/* CHIHEB PRO — professional + responsive */

:root {
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --primary-soft: rgba(29, 78, 216, 0.1);
    --secondary: #7c3aed;
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
    --dark: #0f172a;
    --text: #1e293b;
    --muted: #64748b;
    --bg: #eef2f6;
    --bg-pattern: radial-gradient(ellipse 120% 80% at 100% -20%, rgba(29, 78, 216, 0.08), transparent 50%),
        radial-gradient(ellipse 100% 60% at 0% 100%, rgba(124, 58, 237, 0.06), transparent 45%);
    --surface: #ffffff;
    --surface-elevated: #f8fafc;
    --border: #e2e8f0;
    --radius: 14px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
    --font: 'Cairo', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --topbar-h: 56px;
    --sidebar-w: 288px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    font-family: var(--font);
    color: var(--text);
    background-color: var(--bg);
    background-image: var(--bg-pattern);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Allow selection in fields; keep chrome clean elsewhere */
input,
textarea,
select {
    font-family: inherit;
    user-select: text;
    -webkit-user-select: text;
}

/* ----- Login ----- */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.login-panel {
    width: 100%;
    max-width: 420px;
    text-align: center;
    padding: clamp(1.75rem, 5vw, 2.5rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    position: relative;
    overflow: hidden;
}

.login-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.login-icon {
    font-size: clamp(2.5rem, 8vw, 3.25rem);
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.login-panel h2 {
    margin: 0 0 0.25rem;
    font-size: clamp(1.35rem, 4vw, 1.6rem);
    font-weight: 800;
    color: var(--dark);
}

.login-panel .login-tag {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0 0 1.75rem;
}

/* ----- App shell ----- */
.app-shell {
    display: flex;
    flex-direction: row;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
}

.app-shell.hidden {
    display: none !important;
}

.nav-backdrop {
    display: none;
}

.main-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--topbar-h);
    padding: 0.5rem 1rem;
    padding-top: calc(0.5rem + env(safe-area-inset-top, 0px));
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 200;
}

.menu-toggle {
    flex-shrink: 0;
}

.topbar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.topbar-brand strong {
    font-size: 1rem;
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.topbar-brand small {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
}

/* ----- Sidebar ----- */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 1.35rem 1.1rem;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-inline-start: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 1.75rem;
    letter-spacing: -0.03em;
}

.logo i {
    color: var(--primary);
    font-size: 1.5rem;
}

.nav-item {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
    transition: background 0.15s, color 0.15s, transform 0.15s;
    border: 1px solid transparent;
    min-height: 48px;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.nav-item i {
    width: 1.25rem;
    text-align: center;
    color: var(--primary);
    opacity: 0.85;
}

.nav-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 6px 20px rgba(29, 78, 216, 0.35);
}

.nav-item.active i {
    color: #fff;
    opacity: 1;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
}

.user-pill {
    padding: 0.85rem;
    margin-bottom: 0.65rem;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
}

.user-pill .label {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.user-pill .name {
    color: var(--primary);
    font-weight: 800;
    font-size: 1rem;
    margin-top: 0.2rem;
}

/* ----- Main ----- */
.main {
    flex: 1;
    min-height: 0;
    padding: clamp(1rem, 3vw, 1.75rem);
    padding-bottom: calc(clamp(1rem, 3vw, 1.75rem) + var(--safe-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.header-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: clamp(1rem, 3vw, 1.5rem);
}

.page-heading h2 {
    margin: 0;
    font-size: clamp(1.35rem, 4vw, 1.85rem);
    font-weight: 800;
    color: var(--dark);
    letter-spacing: -0.02em;
}

.page-heading .sub {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0.2rem;
}

.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.65rem;
}

.wallet-card {
    margin: 0;
    padding: 0.65rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    border: 1px solid rgba(29, 78, 216, 0.2);
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
}

.wallet-card i {
    color: var(--primary);
    font-size: 1.35rem;
}

.wallet-card .lbl {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 700;
}

.wallet-card .amt {
    font-weight: 900;
    font-size: clamp(1.1rem, 3vw, 1.35rem);
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

/* ----- Cards & grids ----- */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: clamp(1rem, 2.5vw, 1.35rem);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-accent {
    border-top: 4px solid var(--accent, var(--primary));
}

.card-title {
    font-weight: 800;
    margin: 0 0 1rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: var(--dark);
    font-size: 1.05rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.pill-warn {
    font-size: 0.75rem;
    color: var(--warning);
    background: #fffbeb;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-weight: 700;
    border: 1px solid #fde68a;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 1rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1rem;
}

.span-2 {
    grid-column: 1 / -1;
}

.ps-summary-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 520px) {
    .ps-summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .ps-summary-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    .ps-summary-grid .summary-wide {
        grid-column: span 2;
    }
}

.grid-services-top {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

@media (min-width: 960px) {
    .grid-services-top {
        grid-template-columns: 2fr 1fr;
    }
}

.grid-charts-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    min-height: 0;
}

@media (min-width: 900px) {
    .grid-charts-row.split {
        grid-template-columns: 1fr 2fr;
    }
    .grid-charts-row.split-rev {
        grid-template-columns: 2fr 1fr;
    }
}

.chart-card {
    min-height: 260px;
    height: clamp(260px, 38vh, 360px);
    display: flex;
    flex-direction: column;
}

.chart-card canvas {
    flex: 1;
    min-height: 200px;
    max-height: 100%;
}

/* ----- Stats strip ----- */
.stats-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #0f172a, #1e293b) !important;
    color: #f1f5f9 !important;
    border: none !important;
    box-shadow: var(--shadow-md);
}

.stats-toolbar .toolbar-label {
    font-weight: 800;
    margin-inline-end: 0.35rem;
}

.stats-toolbar .btn-ghost-light {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.stats-toolbar .btn-ghost-light:hover {
    background: rgba(255, 255, 255, 0.18);
}

.stats-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    background: rgba(0, 0, 0, 0.25);
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    width: 100%;
    text-align: center;
}

@media (min-width: 768px) {
    .stats-hint {
        width: auto;
        margin-inline-start: auto;
    }
}

.stat-box {
    padding: 1.15rem;
    border-radius: var(--radius);
    color: #fff;
    min-height: 118px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.stat-box i {
    position: absolute;
    font-size: 4.5rem;
    opacity: 0.12;
    inset-inline-start: -0.5rem;
    bottom: -0.5rem;
}

.stat-box .stat-val {
    font-size: clamp(1.35rem, 4vw, 1.85rem);
    font-weight: 800;
    margin-top: 0.35rem;
    font-variant-numeric: tabular-nums;
    position: relative;
    z-index: 1;
}

.stat-box .stat-sub {
    font-size: 0.78rem;
    opacity: 0.92;
    margin-top: 0.35rem;
    position: relative;
    z-index: 1;
}

.card-muted {
    border: 2px dashed var(--border);
    background: var(--surface-elevated);
    text-align: center;
    justify-content: center;
}

/* ----- Buttons ----- */
.btn {
    border: none;
    padding: 0.65rem 1.1rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: transform 0.12s, filter 0.12s, box-shadow 0.12s;
    font-size: 0.9rem;
    font-family: inherit;
    min-height: 44px;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #2563eb);
    box-shadow: 0 4px 14px rgba(29, 78, 216, 0.35);
}
.btn-primary:hover {
    filter: brightness(1.05);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
}

.btn-warning {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
}

.btn-purple {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3);
}

.btn-dark {
    background: var(--dark);
}

.btn-neutral {
    background: #e2e8f0;
    color: #475569;
    box-shadow: none;
}

.btn-icon {
    width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-sm {
    min-height: 40px;
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
}

/* ----- Forms ----- */
label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-bottom: 0.35rem;
    display: block;
    font-weight: 700;
    text-align: start;
}

.form-control {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-elevated);
    text-align: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.15);
}

.form-grid-inv {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 640px) {
    .form-grid-inv {
        grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
        align-items: end;
    }
}

.form-grid-exp {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.65rem;
}

@media (min-width: 480px) {
    .form-grid-exp {
        grid-template-columns: 1fr 1fr;
    }
}

.form-grid-exp .full-row {
    grid-column: 1 / -1;
}

.panel-inset {
    background: var(--surface-elevated);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
    margin-bottom: 1rem;
}

.alert-info {
    font-size: 0.78rem;
    color: var(--muted);
    background: #fff1f2;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid #fecdd3;
    margin-bottom: 1rem;
}

/* ----- PlayStation ----- */
.ps-timer {
    font-size: clamp(1.65rem, 5vw, 2.1rem);
    font-family: ui-monospace, 'Cascadia Code', monospace;
    margin: 0.85rem 0;
    color: var(--text);
    font-weight: 800;
    letter-spacing: 0.06em;
    font-variant-numeric: tabular-nums;
}

.ps-card {
    text-align: center;
    position: relative;
}

.ps-card .ps-badge-limit {
    position: absolute;
    top: 0.65rem;
    inset-inline-start: 0.65rem;
    background: var(--warning);
    color: #fff;
    font-size: 0.68rem;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    font-weight: 800;
}

.ps-card .ps-row-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
    gap: 0.5rem;
}

.ps-card .ps-station-name {
    font-size: 1.15rem;
    font-weight: 800;
}

.ps-inner {
    background: var(--surface-elevated);
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.65rem;
    border: 1px solid var(--border);
}

.ps-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.ps-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.ps-actions .btn {
    flex: 1;
    min-width: 120px;
}

.stock-badge {
    font-size: 0.72rem;
    background: var(--primary-soft);
    color: var(--primary);
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    font-weight: 800;
}

/* ----- POS ----- */
.stock-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
    gap: 0.75rem;
    max-height: min(420px, 55vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.15rem;
}

.pos-product-card {
    background: var(--surface);
    padding: 0.85rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.15s;
}

.pos-product-card:hover {
    border-color: rgba(29, 78, 216, 0.25);
}

.pos-product-card .row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.pos-product-card .title {
    font-weight: 800;
    font-size: 0.95rem;
}

.pos-product-card .meta {
    font-size: 0.88rem;
    color: var(--muted);
    font-weight: 600;
}

.pos-product-card .row-actions {
    display: flex;
    gap: 0.45rem;
    margin-top: auto;
    align-items: stretch;
}

.pos-qty {
    width: 4rem;
    min-width: 3.5rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-weight: 800;
    padding: 0.35rem;
}

.quick-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: min(420px, 55vh);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.quick-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    gap: 0.5rem;
    transition: background 0.12s;
    border-radius: var(--radius-sm);
    margin: 0 -0.35rem;
    padding-inline: 0.35rem;
}

.quick-row:last-child {
    border-bottom: none;
}

.quick-row:active {
    background: var(--surface-elevated);
}

.quick-row .qt {
    font-weight: 800;
    font-size: 0.95rem;
}

.quick-row .sub {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.quick-row .sub.danger {
    color: var(--danger);
    font-size: 0.74rem;
}

.quick-add {
    background: #f3e8ff;
    color: var(--secondary);
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.bill-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 88px), 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.bill-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.bill-fields > * {
    flex: 1 1 160px;
}

.bill-fields .bill-submit {
    flex: 1 1 100%;
}

@media (min-width: 768px) {
    .bill-fields .bill-submit {
        flex: 1 1 180px;
    }
}

.bill-btn {
    padding: 0.55rem 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-elevated);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 800;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-height: 44px;
}

.bill-btn:hover {
    background: #e2e8f0;
}

.bill-btn.selected {
    background: var(--dark);
    color: #fff;
    border-color: var(--dark);
}

.bill-btn.d17 {
    background: linear-gradient(135deg, #fbbf24, #d97706);
    color: #fff;
    border-color: #b45309;
}

/* ----- Tables ----- */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    max-height: min(440px, 60vh);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    min-width: 520px;
}

th {
    text-align: right;
    color: var(--muted);
    padding: 0.75rem 0.65rem;
    background: var(--surface-elevated);
    border-bottom: 2px solid var(--border);
    font-weight: 800;
    white-space: nowrap;
}

td {
    padding: 0.65rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    vertical-align: middle;
}

.btn-icon-danger {
    color: var(--danger);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    min-height: 44px;
    min-width: 44px;
}

.btn-icon-danger:hover {
    background: #fef2f2;
}

/* ----- Modals ----- */
.modal-card {
    width: 100%;
    max-width: 420px;
    margin: 1rem;
    text-align: center;
    border-top: 4px solid var(--success);
}

.pay-desc {
    color: var(--muted);
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.pay-amount {
    font-size: clamp(2rem, 9vw, 3.25rem);
    font-weight: 800;
    color: var(--dark);
    margin: 0.5rem 0;
    font-variant-numeric: tabular-nums;
}

.pay-currency {
    color: var(--success);
    font-weight: 800;
    margin-bottom: 1.25rem;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 400px) {
    .modal-actions {
        flex-direction: row;
    }
}

.modal-actions .btn {
    flex: 1;
}

.modal-form .btn-ghost {
    width: 100%;
    margin-top: 0.5rem;
    background: transparent;
    color: var(--muted);
    box-shadow: none;
}

/* ----- Save indicator ----- */
#saveIndicator {
    position: fixed;
    bottom: calc(1rem + var(--safe-bottom));
    inset-inline-start: 1rem;
    background: rgba(15, 23, 42, 0.92);
    color: #34d399;
    padding: 0.45rem 1rem;
    border-radius: 999px;
    font-size: 0.78rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.35s;
    pointer-events: none;
    z-index: 400;
    font-weight: 700;
    box-shadow: var(--shadow-md);
}

#saveIndicator.show {
    opacity: 1;
}

.pulse {
    width: 8px;
    height: 8px;
    background: #34d399;
    border-radius: 50%;
    animation: pulse-anim 1.5s infinite;
}

@keyframes pulse-anim {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(52, 211, 153, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
    }
}

@keyframes blink {
    50% {
        opacity: 0.55;
    }
}

.hidden {
    display: none !important;
}

/* ----- Responsive: tablet / mobile nav ----- */
@media (max-width: 1024px) {
    .nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 250;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.25s ease, visibility 0.25s;
    }

    .nav-backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        height: 100%;
        height: 100dvh;
        max-height: 100dvh;
        z-index: 300;
        transform: translateX(100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-top: calc(1rem + env(safe-area-inset-top, 0px));
        border-inline-start: none;
        box-shadow: none;
    }

    .sidebar.is-open {
        transform: translateX(0);
        box-shadow: -12px 0 40px rgba(15, 23, 42, 0.18);
    }

    .topbar {
        display: flex;
    }
}

@media (max-width: 639px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .wallet-card {
        flex: 1;
        min-width: 0;
    }

    .header-actions .btn-icon {
        flex-shrink: 0;
    }
}

/* Settings layout */
.settings-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 960px) {
    .settings-grid {
        grid-template-columns: 2fr 1fr;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}
