:root {
    --bg: #f3f6fb;
    --panel: #ffffff;
    --primary: #2f5af7;
    --primary-dark: #1d4ee5;
    --text: #101828;
    --muted: #667085;
    --border: rgba(16, 24, 40, 0.08);
    --surface: #ffffff;
    --surface-alt: #f6f8ff;
    --surface-soft: #edf3ff;
    --shadow: 0 18px 40px rgba(20, 33, 47, 0.08);
    --hero-bg: linear-gradient(135deg, #2f5af7 0%, #3e7af7 40%, #3368ff 100%);
    --hero-soft: rgba(255, 255, 255, 0.14);
    --input-bg: #f8fafc;
    --input-border: rgba(16, 24, 40, 0.08);
    --page-bg: linear-gradient(135deg, #eef4ff 0%, #f7f9fc 35%, #edf7f4 100%);
}

body[data-theme="dark"] {
    --bg: #0b1020;
    --panel: #121a2a;
    --primary: #73a2ff;
    --primary-dark: #5b8cff;
    --text: #edf3ff;
    --muted: #a6b0c4;
    --border: rgba(148, 163, 184, 0.14);
    --surface: #111827;
    --surface-alt: #1a2334;
    --surface-soft: rgba(114, 149, 255, 0.12);
    --shadow: 0 20px 48px rgba(2, 6, 23, 0.45);
    --hero-bg: linear-gradient(135deg, #10203d 0%, #183e95 100%);
    --hero-soft: rgba(255, 255, 255, 0.05);
    --input-bg: #0f172a;
    --input-border: rgba(148, 163, 184, 0.18);
    --page-bg: linear-gradient(135deg, #0a1120 0%, #101b2d 50%, #0d1729 100%);
}

@font-face {
    font-family: 'IRANSansWeb';
    src: url('../font/IRANSansWeb.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

* {
    box-sizing: border-box;
}

html {
    font-family: 'IRANSansWeb', 'Segoe UI', Tahoma, sans-serif;
}

body {
    margin: 0;
    font-family: 'IRANSansWeb', 'Segoe UI', Tahoma, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    background: var(--page-bg);
    color: var(--text);
    transition: background 0.2s ease, color 0.2s ease;
    direction: rtl;
}

body, button, input, textarea, select, a, span, div, h1, h2, h3, h4, h5, h6, p, label {
    font-family: 'IRANSansWeb', 'Segoe UI', Tahoma, sans-serif;
    font-weight: 500;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

html {
    scroll-behavior: smooth;
}

a {
    color: inherit;
    text-decoration: none;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
}

.topbar {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

body[data-theme="dark"] .topbar {
    background: rgba(15, 23, 42, 0.88);
    border-bottom-color: var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    min-height: 72px;
}

.brand-group {
    display: contents;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.12rem;
    padding: 0 2px;
    margin-inline-start: 14px;
}

.nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
    color: var(--muted);
}

@media (min-width: 841px) {
    .topbar-inner {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 18px;
        direction: rtl;
    }

    .nav {
        order: 1;
        margin-left: auto;
        margin-right: 0;
        justify-content: flex-end;
        flex: 0 1 auto;
    }

    .topbar-actions {
        order: 2;
        margin-left: 0;
        margin-right: 0;
    }

    .brand-group {
        order: 3;
    }
}

.nav a {
    padding: 8px 12px;
    border-radius: 10px;
    transition: 0.2s ease;
    white-space: nowrap;
    font-size: 0.88rem;
    font-weight: 500;
}

.nav a:hover,
.nav a.active {
    background: rgba(47, 111, 237, 0.08);
    color: var(--primary);
}

body[data-theme="dark"] .nav a:hover,
body[data-theme="dark"] .nav a.active {
    background: rgba(115, 162, 255, 0.12);
    color: var(--primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-inline-start: 0;
}

.theme-switcher {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 1.1rem;
    cursor: pointer;
}

.profile-menu-wrap {
    position: relative;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: linear-gradient(135deg, #2f5af7, #6ea1ff);
    color: #fff;
    font-weight: 800;
    font-size: 0.78rem;
    display: grid;
    place-items: center;
    cursor: pointer;
}

.profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    left: auto;
    min-width: 170px;
    width: 170px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow);
    display: none;
    z-index: 15;
    text-align: center !important;
    direction: rtl !important;
}

.profile-menu.open {
    display: block;
}

.profile-menu a,
.profile-menu .logout-form {
    display: block;
    width: 100%;
}

.profile-menu a {
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    text-align: center !important;
    direction: rtl !important;
}

.profile-menu a:hover {
    background: rgba(47, 111, 237, 0.08);
}

.logout-form {
    display: flex;
    align-items: center;
    margin-top: 8px;
    width: 100%;
}

.profile-menu .logout-form .button.small {
    text-align: center !important;
    justify-content: center !important;
    direction: rtl !important;
}

.inline-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
}

.order-action-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: nowrap;
}

.order-note-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    min-width: 18px;
    height: 18px;
    border: 1px solid rgba(47, 111, 237, 0.28);
    border-radius: 50%;
    background: rgba(47, 111, 237, 0.08);
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: all 0.2s ease;
}

.order-note-trigger:hover,
.order-note-trigger:focus-visible {
    background: rgba(47, 111, 237, 0.16);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.08);
    outline: none;
}

.inline-form {
    display: inline-flex;
    align-items: center;
    margin: 0;
}

.inline-actions .button,
.inline-form .button {
    min-height: 30px;
    height: 30px;
    padding: 0 12px;
    border-radius: 8px;
    font-size: 0.68rem;
    line-height: 1;
    white-space: nowrap;
    margin: 0;
    min-width: 60px;
    font-weight: 600;
}

.inline-actions .button.secondary,
.inline-form .button.danger {
    width: auto;
    min-width: 58px;
}

.logout-form .button.small {
    width: 100%;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 0.92rem;
    text-align: center !important;
    justify-content: center !important;
    direction: rtl !important;
}

.profile-panel {
    display: grid;
    gap: 22px;
}

.profile-summary-card {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.38);
}

.profile-badge {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #7aa8ff);
    color: #fff;
    font-weight: 800;
}

.profile-summary-card h2 {
    margin: 0 0 6px;
    font-size: 1.5rem;
}

.profile-summary-card p,
.profile-summary-card small {
    margin: 0;
    color: var(--muted);
}

.profile-form {
    display: grid;
    gap: 22px;
    padding: 12px 0 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.field {
    display: grid;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.field span {
    font-size: 0.82rem;
    font-weight: 500;
}

.settlement-page-shell {
    padding-top: 10px;
}

.settlement-card {
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 24px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 18px;
}

.settlement-card h2 {
    margin: 0;
    font-size: 1.35rem;
}

.settlement-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.summary-box {
    display: grid;
    gap: 8px;
    background: rgba(240, 244, 248, 0.7);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px 18px;
}

.summary-box span {
    font-size: 0.75rem;
    color: var(--muted);
}

.summary-box strong {
    font-size: 1rem;
}

.summary-box.accent {
    background: linear-gradient(135deg, rgba(255, 153, 0, 0.12), rgba(255, 255, 255, 0.9));
    border-color: rgba(255, 153, 0, 0.3);
}

.settlement-form {
    display: grid;
    gap: 16px;
}

.settlement-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: end;
}

.settlement-form-grid .settlement-receipt-field {
    grid-column: 1 / -1;
}

.field-label-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.info-pop-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(47, 111, 237, 0.08);
    color: var(--primary);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: all 0.2s ease;
}

.info-pop-trigger:hover,
.info-pop-trigger:focus-visible {
    background: rgba(47, 111, 237, 0.16);
    box-shadow: 0 0 0 4px rgba(47, 111, 237, 0.08);
    outline: none;
}

.info-pop-trigger::after {
    content: attr(title);
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: max-content;
    max-width: 240px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.92);
    color: #fff;
    font-size: 0.7rem;
    line-height: 1.7;
    white-space: normal;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    pointer-events: none;
    z-index: 20;
}

.info-pop-trigger:hover::after,
.info-pop-trigger:focus-visible::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.field input,
.field select,
.field textarea {
    min-height: 46px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    padding: 0 14px;
    font-size: 0.92rem;
    font-family: inherit;
}

.field textarea {
    min-height: 110px;
    padding: 12px 14px;
    resize: vertical;
}

.field.full-width {
    grid-column: 1 / -1;
}

.single-column {
    grid-template-columns: 1fr;
}

.field-has-error input,
.field-has-error select,
.field-has-error textarea {
    border-color: #d64545;
    background: rgba(214, 69, 69, 0.03);
    box-shadow: 0 0 0 4px rgba(214, 69, 69, 0.08);
}

.field-error-message {
    color: #c0392b;
    font-size: 0.74rem;
    line-height: 1.5;
    margin-top: 2px;
    font-weight: 600;
}

.product-search-wrap {
    margin-bottom: 18px;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.product-search-form {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    margin-inline-start: auto;
    padding: 6px 6px 6px 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.58);
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
}

.product-search-form input {
    flex: 1 1 auto;
    min-height: 40px;
    width: 100%;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    padding: 0 12px;
    font-size: 0.9rem;
    font-family: inherit;
    box-shadow: none;
}

.product-search-form input:focus {
    outline: none;
}

.product-search-form .button {
    flex: 0 0 auto;
    min-height: 34px;
    width: auto;
    padding: 0 14px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.78rem;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .product-search-form {
        width: 100%;
        max-width: none;
        min-height: 46px;
    }

    .product-search-form input {
        font-size: 0.95rem;
        min-height: 38px;
    }

    .product-search-form .button {
        min-height: 32px;
        padding: 0 12px;
        font-size: 0.72rem;
    }
}

.variant-block {
    display: grid;
    gap: 14px;
    margin-top: 18px;
    padding-top: 10px;
}

.variant-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.variant-header h4 {
    margin: 0;
    font-size: 1.02rem;
}

.variant-list {
    display: grid;
    gap: 12px;
}

.variant-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.1fr) minmax(0, 0.8fr) minmax(0, 0.9fr) minmax(0, 0.8fr) auto;
    gap: 10px;
    align-items: end;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.18);
}

.variant-row .compact-field {
    min-width: 0;
}

.variant-row .compact-field input,
.variant-row .compact-field select {
    width: 100%;
    max-width: 150px;
    min-width: 0;
}

.variant-header .button,
.remove-variant {
    width: auto !important;
    min-width: 0 !important;
    max-width: fit-content;
    min-height: 28px !important;
    height: 28px !important;
    padding: 0 10px !important;
    font-size: 0.68rem !important;
    border-radius: 8px !important;
    white-space: nowrap;
    align-self: end;
}

.product-variant-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.product-variant-line {
    font-size: 0.72rem;
    line-height: 1.5;
    white-space: nowrap;
}

.data-table td,
.data-table th {
    font-size: 0.74rem;
}

.profile-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 4px;
}

.profile-meta div {
    display: grid;
    gap: 6px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.22);
}

.profile-meta span {
    color: var(--muted);
    font-size: 0.88rem;
}

.profile-meta strong {
    font-size: 0.98rem;
}

@media (max-width: 720px) {
    .profile-meta span {
        font-size: 0.8rem;
    }

    .profile-meta strong {
        font-size: 0.88rem;
    }

    .profile-summary-card h2 {
        font-size: 1.2rem;
    }

    .field span {
        font-size: 0.82rem;
    }

    .settlement-summary-grid,
    .settlement-form-grid {
        grid-template-columns: 1fr;
    }

    .page-header {
        gap: 12px;
    }

    .data-table th,
    .data-table td {
        font-size: 0.74rem;
        padding: 10px 8px;
    }
}

.form-actions {
    display: flex;
    justify-content: flex-end;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(25, 135, 84, 0.1);
    border: 1px solid rgba(25, 135, 84, 0.15);
    color: #0f5132;
}

.alert-error {
    background: rgba(220, 53, 69, 0.08);
    border: 1px solid rgba(220, 53, 69, 0.12);
    color: #b42318;
}

.button.small {
    min-height: 40px;
    padding: 0 16px;
    font-size: 0.82rem;
    font-weight: 600;
}

.button.tiny {
    min-height: 28px;
    padding: 0 10px;
    font-size: 0.68rem;
    font-weight: 600;
}

.table-inline-action {
    margin-inline-start: 6px;
}

@media print {
    body {
        background: #fff !important;
        color: #000 !important;
    }

    .topbar,
    .page-header .product-toolbar a,
    .page-header .product-toolbar button,
    .button,
    .mobile-nav-toggle,
    .profile-menu-wrap,
    .theme-switcher,
    .footer,
    .nav,
    .topbar-actions,
    .alert,
    .invoice-card .page-header .product-toolbar {
        display: none !important;
    }

    .page-wrap,
    .container,
    .page-card,
    .invoice-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #fff !important;
        box-shadow: none !important;
        border: none !important;
    }

    .invoice-shell,
    .invoice-header-row,
    .invoice-summary,
    .invoice-section,
    .invoice-receipts {
        page-break-inside: avoid;
    }

    .invoice-card {
        padding: 0 !important;
    }
}

@media (max-width: 720px) {
    .form-grid,
    .profile-meta,
    .variant-row {
        grid-template-columns: 1fr;
    }

    .profile-summary-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .product-search-form {
        flex-direction: column;
        align-items: stretch;
    }
}

.mobile-nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
    cursor: pointer;
}

.mobile-nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 0 auto;
    background: var(--text);
    border-radius: 2px;
}

.hero {
    padding: 72px 0 28px;
}

.hero-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(247, 249, 252, 0.96));
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
    padding: clamp(28px, 5vw, 56px);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 32px;
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(47, 111, 237, 0.1);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

h1 {
    margin: 18px 0 16px;
    font-size: clamp(2.2rem, 5vw, 4rem);
    line-height: 1.08;
    letter-spacing: -0.04em;
}

.lead {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--muted);
    max-width: 680px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 28px;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 12px;
    padding: 0 20px;
    font-weight: 700;
    border: 1px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 12px 20px rgba(47, 111, 237, 0.2);
}

.button.primary:hover {
    background: var(--primary-dark);
}

.button.success {
    background: #19a974;
    border-color: rgba(25, 169, 116, 0.2);
    color: #fff;
    box-shadow: 0 12px 20px rgba(25, 169, 116, 0.18);
}

.button.success:hover {
    background: #148d62;
}

.button.secondary {
    background: #f1f5ff;
    border-color: var(--border);
    color: var(--text);
}

.button.warning {
    background: linear-gradient(135deg, #ffb454, #f59e0b);
    border-color: rgba(245, 158, 11, 0.25);
    color: #fff;
    box-shadow: 0 12px 20px rgba(245, 158, 11, 0.2);
}

.button.warning:hover {
    background: linear-gradient(135deg, #f6a93a, #e08b00);
}

.button.danger {
    background: #dc3545;
    border-color: rgba(220, 53, 69, 0.2);
    color: #fff;
}

body[data-theme="dark"] .button.secondary {
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text);
}

.hero-panel {
    background: #0e1729;
    border-radius: 24px;
    min-height: 280px;
    padding: 26px;
    color: #dfe9ff;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.metric {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 22px;
}

.metric-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 18px 14px;
}

.metric-box strong {
    display: block;
    font-size: 1.4rem;
    margin-bottom: 6px;
}

.section {
    padding: 24px 0 64px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

.card {
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 12px 24px rgba(25, 35, 51, 0.04);
}

body[data-theme="dark"] .card,
body[data-theme="dark"] .hero-card {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.96), rgba(15, 23, 42, 0.96));
    border-color: var(--border);
    box-shadow: 0 18px 42px rgba(2, 6, 23, 0.38);
}

body[data-theme="dark"] .card p,
body[data-theme="dark"] .card li,
body[data-theme="dark"] .lead,
body[data-theme="dark"] .footer,
body[data-theme="dark"] .visual-frame p {
    color: var(--muted);
}

.dashboard-shell {
    display: grid;
    gap: 22px;
}

.dashboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dashboard-view-toggle {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.04);
}

.dashboard-mode-btn {
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--muted);
    padding: 8px 14px;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dashboard-mode-btn.active {
    background: linear-gradient(135deg, #2f5af7, #5d8bff);
    color: #fff;
    box-shadow: 0 8px 20px rgba(47, 111, 237, 0.2);
}

.dashboard-panel {
    display: none;
}

.dashboard-panel.active {
    display: block;
}

.dashboard-metric-grid,
.dashboard-secondary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.dashboard-secondary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
}

.metric-card {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.86), rgba(243, 247, 255, 0.9));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
    display: grid;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: "";
    position: absolute;
    inset: 0 auto auto 0;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(47, 111, 237, 0.12), transparent 72%);
    pointer-events: none;
}

.metric-card.accent {
    background: linear-gradient(135deg, rgba(47, 111, 237, 0.12), rgba(255, 255, 255, 0.96));
    border-color: rgba(47, 111, 237, 0.18);
}

.metric-card.muted-card {
    background: linear-gradient(140deg, rgba(248, 250, 255, 0.96), rgba(240, 245, 255, 0.9));
}

.metric-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.metric-topline span {
    color: var(--muted);
    font-size: 0.82rem;
}

.metric-topline strong {
    font-size: 1.06rem;
    line-height: 1.4;
}

.metric-card small {
    color: var(--muted);
    font-size: 0.78rem;
    position: relative;
    z-index: 1;
}

.metric-inline-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    background: rgba(47, 111, 237, 0.05);
    color: var(--text);
    font-size: 0.74rem;
    position: relative;
    z-index: 1;
}

.metric-inline-stat span {
    color: var(--muted);
}

.metric-inline-stat strong {
    font-size: 0.78rem;
    color: var(--text);
}

.chart-card,
.dashboard-lowstock-card,
.dashboard-aging-card {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.85), rgba(244, 247, 255, 0.9));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
}

.chart-header {
    margin-bottom: 12px;
}

.chart-header h3,
.lowstock-header h3 {
    margin: 0;
    font-size: 1.08rem;
}

.sales-chart {
    width: 100%;
    height: 200px;
    display: block;
}

.dashboard-status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.dashboard-lowstock-card,
.dashboard-aging-card {
    display: grid;
    gap: 14px;
    width: 100%;
}

.lowstock-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.lowstock-header span {
    font-size: 0.76rem;
    background: rgba(255, 153, 0, 0.1);
    border: 1px solid rgba(255, 153, 0, 0.16);
    color: #b87500;
    padding: 5px 10px;
    border-radius: 999px;
}

.lowstock-list,
.aging-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.lowstock-list li,
.aging-list li {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 153, 0, 0.14);
    background: rgba(255, 153, 0, 0.03);
    border-radius: 14px;
}

.aging-list li {
    border-color: rgba(47, 111, 237, 0.14);
    background: rgba(47, 111, 237, 0.03);
}

.lowstock-name,
.aging-meta {
    display: grid;
    gap: 4px;
}

.lowstock-name strong,
.aging-meta strong {
    font-size: 0.9rem;
}

.lowstock-name span,
.aging-meta small {
    color: var(--muted);
    font-size: 0.76rem;
}

.lowstock-stock,
.aging-amount {
    display: grid;
    justify-items: end;
    gap: 2px;
}

.lowstock-stock span,
.aging-amount span {
    font-weight: 700;
    color: #c86d00;
}

.aging-amount span {
    color: var(--primary);
}

.lowstock-stock small,
.aging-amount small {
    color: var(--muted);
    font-size: 0.7rem;
}

.dashboard-empty-state {
    margin: 0;
}

body[data-theme="dark"] .dashboard-view-toggle,
body[data-theme="dark"] .metric-card,
body[data-theme="dark"] .chart-card,
body[data-theme="dark"] .dashboard-lowstock-card,
body[data-theme="dark"] .dashboard-aging-card {
    background: linear-gradient(145deg, rgba(17, 24, 39, 0.94), rgba(15, 23, 42, 0.98));
    border-color: var(--border);
    box-shadow: 0 18px 38px rgba(2, 6, 23, 0.4);
}

body[data-theme="dark"] .metric-card::before {
    background: radial-gradient(circle, rgba(115, 162, 255, 0.18), transparent 72%);
}

body[data-theme="dark"] .metric-inline-stat {
    background: rgba(115, 162, 255, 0.08);
}

body[data-theme="dark"] .lowstock-list li,
body[data-theme="dark"] .aging-list li {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(148, 163, 184, 0.16);
}

body[data-theme="dark"] .lowstock-stock span,
body[data-theme="dark"] .aging-amount span {
    color: #9ec5ff;
}

body[data-theme="dark"] .lowstock-header span {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.18);
    color: #f7d97a;
}

@media (max-width: 720px) {
    .dashboard-metric-grid,
    .dashboard-secondary-grid,
    .dashboard-status-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .metric-topline {
        flex-direction: column;
        align-items: flex-start;
    }

    .lowstock-list li,
    .aging-list li {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }

    .lowstock-stock,
    .aging-amount {
        justify-items: start;
    }
}

.card h3 {
    margin-top: 0;
    margin-bottom: 12px;
    font-size: 1.2rem;
}

.card p,
.card li {
    color: var(--muted);
    line-height: 1.7;
}

.card ul {
    margin: 0;
    padding-left: 18px;
}

.data-table-wrap {
    width: 100%;
    overflow-x: auto;
    margin-top: 18px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.28);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
    font-size: 0.74rem;
    line-height: 1.7;
}

.data-table th {
    background: rgba(47, 111, 237, 0.04);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 700;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.table-link {
    color: var(--primary);
    font-weight: 700;
}

.muted-text {
    color: var(--muted);
}

.table-inline-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    height: 26px;
    min-width: 52px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 0.56rem;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    margin: 0;
}

.pagination-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.pagination-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    min-height: 32px;
    padding: 0 10px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.4);
    color: var(--text);
    font-size: 0.76rem;
    font-weight: 700;
    text-decoration: none;
}

.pagination-button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.return-modal,
.receipt-modal,
.return-detail-modal,
.order-note-modal,
.settlement-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.return-modal.open,
.receipt-modal.open,
.return-detail-modal.open,
.order-note-modal.open,
.settlement-modal.open {
    display: flex !important;
}

.return-modal-backdrop,
.receipt-modal-backdrop,
.return-detail-backdrop,
.order-note-backdrop,
.settlement-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.return-modal-dialog,
.receipt-modal-dialog,
.return-detail-dialog,
.order-note-dialog,
.settlement-modal-dialog {
    position: relative;
    width: min(480px, calc(100% - 24px));
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    box-shadow: var(--shadow);
    padding: 18px;
    z-index: 1;
}

.receipt-modal-dialog {
    width: min(680px, calc(100% - 24px));
}

.order-note-dialog,
.settlement-modal-dialog {
    width: min(560px, calc(100% - 24px));
}

.return-detail-content,
.order-note-content {
    min-height: 80px;
    padding: 18px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.3);
    color: var(--text);
    line-height: 1.9;
    white-space: pre-wrap;
    font-size: 0.82rem;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
}

.return-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.return-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.modal-close {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
}

.return-form {
    display: grid;
    gap: 14px;
}

.return-form textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    padding: 12px 14px;
}

.receipt-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 8px;
    align-items: center;
    justify-items: center;
}

.receipt-preview-item {
    display: block;
    width: min(100%, 420px);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.3);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.receipt-preview-item img {
    display: block;
    width: 100%;
    max-height: 420px;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    background: #f8fafc;
}

.empty-state {
    text-align: center;
    padding: 26px 16px;
    color: var(--muted);
}

.page-card {
    background: rgba(255, 255, 255, 0.52);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.04);
}

.page-wrap {
    padding: 28px 0;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.product-header {
    flex-wrap: wrap;
}

.product-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.order-form-shell {
    display: grid;
    gap: 18px;
    margin-top: 10px;
}

.order-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: end;
}

.selected-product-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(47, 111, 237, 0.04);
}

.selected-product-summary span {
    color: var(--muted);
    font-size: 0.8rem;
}

.selected-product-summary strong {
    font-size: 1rem;
}

.order-variant-list-wrap {
    overflow-x: auto;
    margin-bottom: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.28);
}

.order-variant-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.order-variant-table th,
.order-variant-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    vertical-align: middle;
    font-size: 0.78rem;
}

.order-variant-table th {
    background: rgba(47, 111, 237, 0.04);
    font-weight: 700;
}

.order-variant-table tbody tr:last-child td {
    border-bottom: none;
}

.order-variant-name {
    font-weight: 700;
    color: var(--text);
}

.order-qty {
    width: 86px;
    min-height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--input-bg);
    color: var(--text);
    padding: 0 10px;
    text-align: center;
}

.order-unit-price,
.order-subtotal {
    font-weight: 700;
    color: var(--text);
}

.order-summary-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin: 8px 0 18px;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(25, 135, 84, 0.08);
    border: 1px solid rgba(25, 135, 84, 0.12);
    color: #0f5132;
    font-weight: 700;
}

.quantity-stepper {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    padding: 4px 8px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03);
}

.qty-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #2f5af7, #4d7cff);
    color: #fff;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    font-weight: 700;
    display: grid;
    place-items: center;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.qty-btn:hover {
    transform: translateY(-1px);
}

.order-qty {
    width: 70px;
    min-height: 34px;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 700;
    appearance: textfield;
}

.order-qty.invalid {
    border: 1px solid rgba(217, 48, 37, 0.7);
    border-radius: 8px;
    background: rgba(217, 48, 37, 0.04);
}

.order-qty::-webkit-outer-spin-button,
.order-qty::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.stock-warning {
    min-height: 18px;
    margin-top: 6px;
    font-size: 0.7rem;
    line-height: 1.5;
    color: var(--muted);
    text-align: center;
    transition: color 0.15s ease, opacity 0.15s ease;
    opacity: 0;
}

.stock-warning.show {
    opacity: 1;
}

.order-file-field {
    display: none;
    justify-items: center;
    align-items: center;
    text-align: center;
}

.order-file-field input[type="file"] {
    width: 100%;
    max-width: 360px;
    min-height: 48px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: rgba(47, 111, 237, 0.03);
    padding: 12px 14px;
    color: var(--text);
    text-align: center;
    cursor: pointer;
}

.receipt-preview-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
    width: 100%;
}

.receipt-preview-item {
    width: 78px;
    height: 78px;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.28);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.receipt-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.invoice-card {
    max-width: 980px;
}

.invoice-shell {
    display: grid;
    gap: 22px;
    font-size: 0.8rem;
    font-weight: 500;
}

.invoice-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(47, 111, 237, 0.04);
    font-size: 0.8rem;
    font-weight: 500;
}

.invoice-company-signature {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 8px 2px 0 20px;
    margin-top: 8px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #1f2937;
}

.invoice-company-footer {
    display: grid;
    gap: 8px;
    margin-top: -4px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.02);
    font-size: 0.7rem;
    color: var(--muted);
}

.invoice-company-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.invoice-company-line span {
    font-weight: 700;
    color: var(--text);
}

.invoice-company-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.invoice-company-socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(47, 111, 237, 0.04);
    color: var(--primary);
    text-decoration: none;
    font-size: 0.72rem;
    font-weight: 700;
}

.invoice-label {
    font-size: 0.68rem;
    color: var(--muted);
    margin-bottom: 6px;
}

.invoice-divider {
    height: 1px;
    background: var(--border);
}

.invoice-section h3,
.invoice-receipts h3 {
    margin: 0 0 12px;
    font-size: 0.96rem;
    font-weight: 700;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
}

.invoice-table th,
.invoice-table td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
}

.invoice-table th {
    background: rgba(47, 111, 237, 0.04);
    font-weight: 700;
}

.invoice-summary {
    display: grid;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(25, 135, 84, 0.04);
    font-size: 0.72rem;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.summary-note {
    align-items: flex-start;
}

.summary-note strong {
    max-width: 60%;
    text-align: left;
}

.invoice-receipts {
    display: grid;
    gap: 14px;
}

.receipt-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.receipt-preview-item {
    width: 96px;
    height: 96px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.24);
    display: flex;
    align-items: center;
    justify-content: center;
}

.receipt-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.order-full {
    grid-column: 1 / -1;
}

.order-full textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--input-bg);
    color: var(--text);
    padding: 12px 14px;
    resize: vertical;
    min-height: 110px;
    font-size: 0.94rem;
}

.payment-paid-amount {
    display: none;
}

.order-file-field {
    display: none;
    justify-items: center;
    align-items: center;
    text-align: center;
}

.order-file-field input[type="file"] {
    width: 100%;
    max-width: 360px;
    min-height: 48px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: rgba(47, 111, 237, 0.03);
    padding: 12px 14px;
    color: var(--text);
    text-align: center;
    cursor: pointer;
}

.order-form-actions {
    margin-top: 16px;
}

@media print {
    @page {
        margin: 12mm;
    }

    body {
        background: #fff !important;
        color: #111827 !important;
        font-size: 11px !important;
    }

    .topbar,
    .page-toolbar,
    .product-toolbar,
    .button,
    .receipt-modal,
    .return-modal,
    .return-detail-modal,
    .receipt-preview-list,
    .alert {
        display: none !important;
    }

    .page-card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
        background: #fff !important;
    }

    .invoice-card {
        max-width: 100% !important;
    }

    .invoice-shell,
    .invoice-header-row,
    .invoice-company-footer,
    .invoice-summary,
    .invoice-table,
    .invoice-table th,
    .invoice-table td,
    .invoice-company-signature,
    .invoice-label,
    .invoice-section h3,
    .invoice-receipts h3 {
        font-size: 11px !important;
        line-height: 1.5 !important;
    }

    .invoice-shell {
        gap: 12px !important;
    }

    .invoice-header-row,
    .invoice-company-footer,
    .invoice-summary,
    .invoice-table {
        padding: 10px 12px !important;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 7px 6px !important;
    }

    .invoice-company-signature {
        padding: 6px 2px 0 12px !important;
        font-weight: 700 !important;
    }
}

@media (max-width: 720px) {
    .order-grid {
        grid-template-columns: 1fr;
    }

    .page-card {
        padding: 14px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .selected-product-summary {
        flex-direction: column;
        align-items: flex-start;
    }
}

.footer {
    padding: 24px 0 36px;
    border-top: 1px solid var(--border);
    color: var(--muted);
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.empty-state {
    padding: 70px 0;
    text-align: center;
}

.empty-state h1 {
    margin-bottom: 18px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(47, 111, 237, 0.1);
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.empty-state-box {
    min-height: 260px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.38);
    color: var(--muted);
    font-size: 1.1rem;
    padding: 28px;
}

.empty-state-box.compact {
    min-height: 160px;
    padding: 18px;
}

.empty-state-content {
    width: min(100%, 820px);
}

.customer-header {
    align-items: center;
}

.product-header {
    align-items: center;
}

.product-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.product-toolbar .button {
    width: auto;
    max-width: 180px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.85rem;
    border-radius: 10px;
    display: inline-flex;
}

.customer-header .button {
    width: auto;
    max-width: 180px;
    min-height: 34px;
    padding: 0 12px;
    font-size: 0.85rem;
    border-radius: 10px;
    display: inline-flex;
}

.customer-form-shell,
.product-form-shell {
    display: none;
    margin-bottom: 22px;
}

.customer-form-shell.open,
.product-form-shell.open {
    display: block;
}

.customer-form {
    display: grid;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.34);
}

.settings-top-menu {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 18px;
}

.settings-chip {
    min-height: 32px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.42);
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
}

.settings-chip.active {
    background: rgba(47, 111, 237, 0.1);
    border-color: rgba(47, 111, 237, 0.16);
    color: var(--primary);
}

.settings-panel {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.28);
    padding: 18px;
}

.settings-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0 18px;
}

.settings-section-title {
    margin-bottom: 14px;
}

.settings-section-title h3 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.settings-section-title p {
    margin: 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.compact-settings-form {
    gap: 8px;
    padding: 0;
    border: none;
    background: transparent;
}

.settings-form-actions {
    margin-top: 18px;
}

.customer-list-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.22);
    overflow: hidden;
}

.list-header {
    padding: 18px 20px 12px;
    border-bottom: 1px solid var(--border);
}

.list-header h3 {
    margin: 0;
    font-size: 1.15rem;
}

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 16px 18px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    font-size: 0.82rem;
    color: var(--muted);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.08);
}

.data-table tbody tr:hover {
    background: rgba(47, 111, 237, 0.03);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.role-seller {
    background: rgba(47, 111, 237, 0.12);
    color: var(--primary);
}

.role-wholesaler {
    background: rgba(16, 185, 129, 0.12);
    color: #047857;
}

.role-warehouse_manager {
    background: rgba(245, 158, 11, 0.12);
    color: #b45309;
}

.role-admin {
    background: rgba(168, 85, 247, 0.12);
    color: #7c3aed;
}

.empty-state-content p {
    margin: 0;
    font-size: clamp(1rem, 1.4vw, 1.25rem);
    line-height: 2;
}

@media (max-width: 840px) {
    .hero-grid,
    .grid {
        grid-template-columns: 1fr;
    }

    .settings-top-menu {
        gap: 6px;
    }

    .settings-chip {
        font-size: 0.7rem;
        padding: 0 10px;
    }

    .topbar-inner {
        position: relative;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        padding: 12px 0;
    }

    .brand-group {
        display: flex;
        align-items: center;
        gap: 8px;
        order: 1;
        margin-inline-start: 0;
    }

    .brand {
        font-size: 1.05rem;
        order: 1;
        margin-inline-start: 0;
    }

    .topbar-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        order: 2;
        margin-inline-start: auto;
    }

    .mobile-nav-toggle {
        display: flex;
        width: 38px;
        height: 38px;
        order: 2;
        margin-inline-start: 0;
    }

    .nav {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        left: auto;
        display: none;
        order: 3;
        width: min(300px, calc(100vw - 24px));
        flex-direction: column;
        align-items: stretch;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: 18px;
        padding: 10px;
        box-shadow: var(--shadow);
        margin-top: 0;
        z-index: 30;
        overflow: hidden;
    }

    .nav.open {
        display: flex;
    }

    .nav a {
        width: 100%;
        padding: 16px 18px;
        font-size: 1rem;
        text-align: right;
        border-radius: 12px;
    }

    .theme-switcher {
        width: 38px;
        height: 38px;
        font-size: 1rem;
    }

    .profile-avatar {
        width: 38px;
        height: 38px;
        font-size: 0.72rem;
    }

    .profile-menu {
        left: 0;
        right: auto;
        width: min(200px, calc(100vw - 24px));
    }
}

@media (min-width: 841px) {
    .brand-wrap {
        margin-inline-end: auto;
    }

    .topbar-actions {
        margin-inline-start: 0;
    }
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: var(--page-bg);
    padding: 32px 16px;
}

.auth-shell {
    width: min(100%, 1100px);
    min-height: 610px;
    display: grid;
    grid-template-columns: 1.08fr 0.92fr;
    background: rgba(255, 255, 255, 0.38);
    border: 1px solid var(--border);
    border-radius: 32px;
    box-shadow: var(--shadow);
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.auth-visual {
    background: var(--hero-bg);
    color: #fff;
    padding: 30px 26px 28px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-visual::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top left, rgba(255,255,255,0.18), transparent 42%),
                linear-gradient(130deg, rgba(255,255,255,0.06), rgba(255,255,255,0));
}

.visual-frame {
    position: relative;
    z-index: 1;
    width: min(100%, 460px);
    display: grid;
    gap: 18px;
}

.profile-card {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid var(--hero-soft);
    border-radius: 24px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
    padding: 24px 22px 18px;
    backdrop-filter: blur(8px);
}

.profile-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.user-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd7a8, #ffb86b 55%, #f77d5d);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    box-shadow: 0 16px 26px rgba(28, 35, 56, 0.3);
}

.balance-box {
    margin-right: auto;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    font-weight: 700;
    min-width: 80px;
    text-align: center;
    border-radius: 12px;
    padding: 10px 12px;
}

.mini-tag {
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.12);
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
    font-weight: 700;
}

.profile-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 16px;
}

.bill-amount {
    font-size: 1.1rem;
    font-weight: 700;
}

.profile-name {
    font-weight: 600;
    opacity: 0.9;
}

.chart-bars {
    height: 84px;
    display: flex;
    align-items: end;
    gap: 8px;
    margin-bottom: 16px;
    padding: 0 2px;
}

.chart-bars span {
    flex: 1;
    border-radius: 12px 12px 4px 4px;
    background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(255,255,255,0.3));
    min-height: 16px;
}

.quick-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 42px;
    border: none;
    border-radius: 12px;
    background: rgba(255,255,255,0.9);
    color: #1d4ed8;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.visual-frame h2 {
    margin: 0;
    font-size: clamp(2.2rem, 4vw, 3.2rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
}

.visual-frame p {
    margin: 0;
    max-width: 430px;
    color: rgba(255,255,255,0.8);
    line-height: 1.7;
    font-size: 1rem;
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0;
    padding: 28px 38px 30px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
}

.theme-switcher-wrap {
    position: absolute;
    top: 24px;
    left: 28px;
}

.theme-switcher {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-alt);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.theme-switcher:hover {
    transform: translateY(-1px);
}

.auth-header {
    text-align: right;
    margin-bottom: 20px;
}

.auth-header h1 {
    margin: 0 0 8px;
    font-size: clamp(2rem, 3vw, 2.7rem);
    line-height: 1.1;
    letter-spacing: -0.05em;
}

.auth-header p {
    margin: 0;
    color: var(--muted);
    font-size: 1rem;
}

.auth-form {
    display: grid;
    gap: 18px;
}

.input-group {
    display: grid;
    gap: 10px;
}

.input-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.input-shell {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

.input-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: var(--muted);
    font-size: 1rem;
}

.auth-form input {
    flex: 1;
    width: 100%;
    min-height: 44px;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.auth-form input::placeholder {
    color: var(--muted);
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button.primary {
    background: linear-gradient(135deg, #2f5af7, #496eff);
    color: #fff;
    box-shadow: 0 16px 25px rgba(47, 90, 247, 0.22);
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.alert-error {
    background: rgba(220, 53, 69, 0.08);
    border-color: rgba(220, 53, 69, 0.14);
    color: #b42318;
}

.auth-meta {
    margin-top: 18px;
    text-align: center;
    display: grid;
    gap: 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.link-plain {
    text-decoration: none;
    color: var(--primary);
    font-weight: 700;
}

.demo-account {
    display: grid;
    gap: 4px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 0.82rem;
}

.demo-account strong {
    color: var(--text);
    font-size: 0.9rem;
}

.dashboard-wrap,
.page-wrap {
    padding: 48px 0;
}

.dashboard-card,
.page-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    padding: 13px;
}

body[data-theme="dark"] .dashboard-card,
body[data-theme="dark"] .page-card {
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.97), rgba(15, 23, 42, 0.97));
    border-color: var(--border);
    box-shadow: 0 22px 44px rgba(2, 6, 23, 0.42);
}

body[data-theme="dark"] .dashboard-topbar h1,
body[data-theme="dark"] .dashboard-card h2,
body[data-theme="dark"] .dashboard-card h3,
body[data-theme="dark"] .dashboard-card .stat-label,
body[data-theme="dark"] .dashboard-card .stat-value,
body[data-theme="dark"] .dashboard-card .info-label,
body[data-theme="dark"] .dashboard-card .info-value,
body[data-theme="dark"] .dashboard-card .table-title,
body[data-theme="dark"] .page-card h1,
body[data-theme="dark"] .page-card h2,
body[data-theme="dark"] .page-card h3 {
    color: var(--text);
}

body[data-theme="dark"] .dashboard-card p,
body[data-theme="dark"] .dashboard-card li,
body[data-theme="dark"] .dashboard-card .muted,
body[data-theme="dark"] .dashboard-card .meta,
body[data-theme="dark"] .page-card p,
body[data-theme="dark"] .page-card li {
    color: var(--muted);
}

body[data-theme="dark"] .dashboard-card .stat,
body[data-theme="dark"] .dashboard-card .info-row,
body[data-theme="dark"] .dashboard-card .chart-box,
body[data-theme="dark"] .dashboard-card .table-wrap,
body[data-theme="dark"] .empty-state-box {
    background: rgba(15, 23, 42, 0.72);
    border-color: var(--border);
}

.dashboard-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.dashboard-topbar h1 {
    margin: 12px 0 0;
    font-size: clamp(1.8rem, 2.5vw, 2.6rem);
}

@media (max-width: 920px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-visual {
        min-height: 360px;
    }
}

@media (max-width: 560px) {
    .auth-card {
        padding: 22px 18px 20px;
    }

    .theme-switcher-wrap {
        left: 16px;
        top: 16px;
    }

    .visual-frame h2 {
        font-size: 2rem;
    }
}
