@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

/* ============================================================
   Invoice System — Design System
   ============================================================ */

:root {
    color-scheme: dark;
    --page: #0a0f1f;
    --surface: #101627;
    --surface-2: #161e33;
    --surface-3: #1c2640;
    --input-bg: #0c1224;
    --border: #1e2a47;
    --border-soft: #182238;
    --ink: #eef1f9;
    --muted: #8b96b5;
    --faint: #566184;
    --accent: #3b82f6;
    --accent-hover: #2f74e8;
    --accent-soft: rgba(59, 130, 246, 0.13);
    --ok: #10b981;
    --ok-ink: #34d399;
    --ok-soft: rgba(16, 185, 129, 0.12);
    --warn: #f59e0b;
    --warn-ink: #fbbf24;
    --warn-soft: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-ink: #f87171;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --sky: #38bdf8;
    --sky-soft: rgba(56, 189, 248, 0.12);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    --radius: 14px;
    --radius-sm: 10px;
}

html[data-theme="light"] {
    color-scheme: light;
    --page: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f1f4fa;
    --surface-3: #e8edf7;
    --input-bg: #ffffff;
    --border: #dde4f0;
    --border-soft: #e7ecf5;
    --ink: #101828;
    --muted: #5f6c84;
    --faint: #8494ad;
    --accent: #2563eb;
    --accent-hover: #1d4fd7;
    --accent-soft: rgba(37, 99, 235, 0.1);
    --ok: #059669;
    --ok-ink: #047857;
    --ok-soft: rgba(5, 150, 105, 0.1);
    --warn: #d97706;
    --warn-ink: #b45309;
    --warn-soft: rgba(217, 119, 6, 0.1);
    --danger: #dc2626;
    --danger-ink: #b91c1c;
    --danger-soft: rgba(220, 38, 38, 0.08);
    --sky: #0284c7;
    --sky-soft: rgba(2, 132, 199, 0.1);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background-color: var(--page);
    color: var(--ink);
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, Tahoma, sans-serif;
    font-size: 13.5px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
}

button {
    font-family: inherit;
}

img {
    max-width: 100%;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 28%, transparent);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--muted) 48%, transparent);
}

::selection {
    background: var(--accent-soft);
    color: var(--ink);
}

[x-cloak] {
    display: none !important;
}

/* ============================================================
   Layout
   ============================================================ */

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(900px 420px at 85% -8%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 60%),
        var(--page);
}

.main {
    flex: 1;
    padding: 24px 16px 48px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

@media (max-width: 767px) {
    .main {
        padding: 16px 12px 40px;
    }
}

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--page) 86%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    height: 62px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    flex-shrink: 0;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: var(--shadow);
}

.brand-mark i {
    width: 19px;
    height: 19px;
}

.brand-name {
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
    max-width: 200px;
}

@media (max-width: 767px) {
    .brand-name {
        max-width: 150px;
    }
}

.brand-sub {
    display: block;
    font-size: 10.5px;
    color: var(--muted);
    font-weight: 500;
    margin-top: 1px;
}

.brand-inline {
    min-width: 0;
    overflow: hidden;
}

@media (max-width: 640px) {
    .brand-sub {
        display: none;
    }
}

.topnav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 12px;
    border-radius: 9px;
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 600;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    border: 1px solid transparent;
}

.nav-link i {
    width: 15px;
    height: 15px;
}

.nav-link:hover {
    color: var(--ink);
    background: var(--surface-2);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-soft);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 1100px) {
    .topnav {
        display: none;
    }
    .menu-btn {
        display: inline-grid !important;
    }
}

/* User chip */
.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 6px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
}

.user-avatar {
    width: 31px;
    height: 31px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.user-chip b {
    display: block;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--ink);
}

.user-chip small {
    display: block;
    font-size: 10.5px;
    color: var(--muted);
    line-height: 1.35;
}

@media (max-width: 560px) {
    .user-meta {
        display: none;
    }
}

/* Mobile nav panel */
.mobile-nav {
    border-top: 1px solid var(--border);
    background: var(--surface);
    max-height: calc(100vh - 62px);
    overflow-y: auto;
}

@media (min-width: 1101px) {
    .mobile-nav {
        display: none !important;
    }
}

.mobile-nav-inner {
    padding: 12px 14px 16px;
    display: grid;
    gap: 6px;
}

.mobile-nav .nav-link {
    width: 100%;
    justify-content: flex-start;
    padding: 11px 12px;
    font-size: 13px;
}

.mobile-nav-divider {
    height: 1px;
    background: var(--border-soft);
    margin: 8px 0;
}

.mobile-nav .btn {
    justify-content: flex-start;
    padding: 11px 12px;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
    background: none;
    color: inherit;
}

.btn i {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.btn-sm {
    padding: 7px 11px;
    font-size: 11.5px;
    border-radius: 8px;
}

.btn-sm i {
    width: 13px;
    height: 13px;
}

.btn-lg {
    padding: 12px 22px;
    font-size: 13.5px;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: var(--surface-2);
    color: var(--ink);
    border-color: var(--border);
}

.btn-ghost:hover {
    background: var(--surface-3);
}

.btn-outline {
    border-color: var(--border);
    color: var(--muted);
}

.btn-outline:hover {
    color: var(--ink);
    border-color: var(--muted);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover {
    filter: brightness(1.08);
}

.btn-soft-danger {
    background: var(--danger-soft);
    color: var(--danger-ink);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.btn-soft-danger:hover {
    background: color-mix(in srgb, var(--danger) 22%, transparent);
}

.btn-soft-success {
    background: var(--ok-soft);
    color: var(--ok-ink);
    border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}

.btn-soft-success:hover {
    background: color-mix(in srgb, var(--ok) 20%, transparent);
}

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-icon i {
    width: 15px;
    height: 15px;
}

.btn-icon:hover {
    color: var(--ink);
    border-color: var(--muted);
    background: var(--surface-3);
}

.btn-icon.sm {
    width: 29px;
    height: 29px;
    border-radius: 8px;
}

.btn-icon.sm i {
    width: 13px;
    height: 13px;
}

.menu-btn {
    display: none;
}

/* ============================================================
   Page head
   ============================================================ */

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.page-head h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.page-head p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

.page-head p b {
    color: var(--ink);
}

.page-head .today {
    font-size: 12px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.card-head h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.card-head h2 i {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.card-head .sub {
    font-size: 11.5px;
    color: var(--muted);
    font-weight: 500;
    margin: 0;
}

.card-body {
    padding: 18px;
}

@media (max-width: 560px) {
    .card-body {
        padding: 14px;
    }
}

/* ============================================================
   Stat cards (KPI)
   ============================================================ */

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

@media (max-width: 1080px) {
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 460px) {
    .stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

.stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.stat-info {
    min-width: 0;
}

.stat::after {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--stat-c, var(--accent));
    opacity: 0.85;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-value {
    display: block;
    margin-top: 5px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.stat-value small {
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.stat-ico {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.stat-ico i {
    width: 19px;
    height: 19px;
}

.ico-blue {
    background: var(--accent-soft);
    color: var(--accent);
}

.ico-emerald {
    background: var(--ok-soft);
    color: var(--ok-ink);
}

.ico-amber {
    background: var(--warn-soft);
    color: var(--warn-ink);
}

.ico-sky {
    background: var(--sky-soft);
    color: var(--sky);
}

/* ============================================================
   Forms
   ============================================================ */

.label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 7px;
}

.label .req {
    color: var(--danger);
}

.input,
.select {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9.5px 13px;
    color: var(--ink);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.input::placeholder {
    color: var(--faint);
}

.input:focus,
.select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.select {
    background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
    background-position: 12px center, 17px center;
    background-size: 5px 5px;
    background-repeat: no-repeat;
    padding-inline-start: 13px;
    padding-inline-end: 32px;
    cursor: pointer;
}

.select option {
    background: var(--surface);
    color: var(--ink);
}

.select option {
    background: var(--surface);
    color: var(--ink);
}

textarea.input {
    min-height: 78px;
    resize: vertical;
}

.fgroup {
    margin-bottom: 14px;
}

/* Filter form */
.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
    gap: 12px 14px;
    align-items: end;
}

@media (max-width: 767px) {
    .filter-form {
        display: none;
    }
    .filter-form.show {
        display: grid;
    }
}

.filter-actions {
    display: flex;
    gap: 8px;
    grid-column: 1 / -1;
    justify-content: flex-end;
    padding-top: 2px;
}

/* ============================================================
   Tables
   ============================================================ */

.table-wrap {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table thead th {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--muted);
    text-align: right;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: color-mix(in srgb, var(--surface-2) 55%, transparent);
}

.data-table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr {
    transition: background 0.12s;
}

.data-table tbody tr:hover {
    background: var(--surface-2);
}

.t-cell {
    font-weight: 600;
    color: var(--ink);
}

.t-mono {
    font-family: 'Courier New', Consolas, monospace;
    direction: ltr;
    text-align: right;
    font-size: 12.5px;
    color: var(--muted);
}

.t-num {
    font-family: 'Courier New', Consolas, monospace;
    font-weight: 700;
    color: var(--ok-ink);
}

.t-dim {
    color: var(--muted);
}

.t-accent {
    color: var(--accent);
    font-weight: 700;
}

.t-row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

/* Mobile: table becomes cards */
@media (max-width: 767px) {
    .table-wrap {
        overflow: visible;
    }
    .data-table thead {
        display: none;
    }
    .data-table,
    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
        width: 100%;
    }
    .data-table tbody {
        display: grid;
        gap: 12px;
        padding: 14px;
    }
    .data-table tbody tr {
        background: var(--surface-2);
        border: 1px solid var(--border);
        border-radius: 12px;
        padding: 4px 0;
    }
    .data-table tbody tr:hover {
        background: var(--surface-2);
    }
    .data-table tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 8px 14px;
        border-bottom: 1px solid var(--border-soft);
        overflow-wrap: anywhere;
    }
    .data-table tbody td::before {
        content: attr(data-label);
        font-size: 11.5px;
        font-weight: 600;
        color: var(--muted);
        flex-shrink: 0;
        overflow-wrap: normal;
    }
    .data-table tbody td[data-full] {
        display: block;
        border-bottom: 0;
        padding-top: 10px;
    }
    .data-table tbody td[data-full]::before {
        display: none;
    }
    .data-table .t-row-actions {
        justify-content: flex-start;
    }
    .data-table .t-cell-trunc {
        max-width: 55vw;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* ============================================================
   Badges
   ============================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 3.5px 10px;
    border-radius: 999px;
    border: 1px solid;
    white-space: nowrap;
}

.badge i {
    width: 12px;
    height: 12px;
}

.badge-ok {
    background: var(--ok-soft);
    color: var(--ok-ink);
    border-color: color-mix(in srgb, var(--ok) 32%, transparent);
}

.badge-warn {
    background: var(--warn-soft);
    color: var(--warn-ink);
    border-color: color-mix(in srgb, var(--warn) 32%, transparent);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger-ink);
    border-color: color-mix(in srgb, var(--danger) 32%, transparent);
}

.badge-info {
    background: var(--sky-soft);
    color: var(--sky);
    border-color: color-mix(in srgb, var(--sky) 32%, transparent);
}

.badge-neutral {
    background: var(--surface-3);
    color: var(--muted);
    border-color: var(--border);
}

.badge-purple {
    background: color-mix(in srgb, #a855f7 12%, transparent);
    color: #c084fc;
    border-color: color-mix(in srgb, #a855f7 30%, transparent);
}

html[data-theme="light"] .badge-purple {
    color: #7e22ce;
}

/* ============================================================
   Alerts
   ============================================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    margin-bottom: 16px;
    border: 1px solid;
    line-height: 1.6;
}

.alert i {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger-ink);
    border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}

.alert-success {
    background: var(--ok-soft);
    color: var(--ok-ink);
    border-color: color-mix(in srgb, var(--ok) 30%, transparent);
}

.alert-info {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

/* ============================================================
   Pagination
   ============================================================ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    color: var(--muted);
    font-size: 12.5px;
    flex-wrap: wrap;
}

.pagination-nav {
    display: flex;
    gap: 8px;
}

.pg-btn {
    padding: 8px 14px;
    border-radius: 9px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--ink);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.pg-btn i {
    width: 13px;
    height: 13px;
}

.pg-btn:hover {
    background: var(--surface-3);
}

.pg-btn.disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ============================================================
   Modal
   ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(2, 6, 23, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--border-soft);
}

.modal-head h3 {
    margin: 0;
    font-size: 14.5px;
    font-weight: 700;
}

.modal-body {
    padding: 18px;
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(2, 6, 23, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
}

.lightbox {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 860px;
    max-height: calc(100vh - 28px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.lightbox-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    flex-wrap: wrap;
}

.lightbox-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lightbox-title i {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.lightbox-title .track {
    font-family: 'Courier New', monospace;
    color: var(--accent);
}

.lightbox-actions {
    display: flex;
    gap: 8px;
}

.lightbox-body {
    flex: 1;
    overflow: auto;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    min-height: 240px;
}

.lightbox-body img {
    max-height: 62vh;
    object-fit: contain;
    border-radius: 8px;
}

/* ============================================================
   Login
   ============================================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background:
        radial-gradient(1000px 480px at 82% -12%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 62%),
        var(--page);
}

.login-shell {
    width: 100%;
    max-width: 940px;
    position: relative;
}

.login-theme-btn {
    position: absolute;
    top: 0;
    inset-inline-end: 0;
    z-index: 2;
}

.login-card {
    display: grid;
    grid-template-columns: 0.95fr 1.05fr;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.login-brand-side {
    padding: 40px 34px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    background:
        radial-gradient(420px 300px at 0% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 60%),
        var(--surface-2);
    border-inline-end: 1px solid var(--border-soft);
}

.login-brand-side .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 13px;
}

.login-brand-side .brand-mark i {
    width: 23px;
    height: 23px;
}

.login-features {
    display: grid;
    gap: 14px;
    margin-top: 8px;
}

.login-feature {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 12.5px;
    color: var(--muted);
}

.login-feature i {
    width: 17px;
    height: 17px;
    color: var(--accent);
    flex-shrink: 0;
}

.login-foot-note {
    font-size: 11px;
    color: var(--faint);
    line-height: 1.7;
}

.login-form-side {
    padding: 40px 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-side h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.login-form-side .lead {
    margin: 5px 0 24px;
    font-size: 12.5px;
    color: var(--muted);
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap .input {
    padding-inline-start: 38px;
}

.input-icon-wrap > i {
    position: absolute;
    inset-inline-start: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--faint);
    pointer-events: none;
}

@media (max-width: 740px) {
    .login-card {
        grid-template-columns: 1fr;
        border-radius: 16px;
    }
    .login-brand-side {
        display: none;
    }
    .login-form-side {
        padding: 30px 22px;
    }
}

/* ============================================================
   Invoice form
   ============================================================ */

.form-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--ink);
    margin: 0 0 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-soft);
}

.form-section-title i {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

@media (max-width: 900px) {
    .grid-3,
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .grid-3,
    .grid-4,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 16px;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.active {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.upload-zone .up-ico {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--surface-3);
    color: var(--accent);
    display: grid;
    place-items: center;
    margin: 0 auto 10px;
}

.upload-zone .up-ico i {
    width: 21px;
    height: 21px;
}

.upload-zone .up-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.upload-zone .up-hint {
    font-size: 11.5px;
    color: var(--faint);
    margin-top: 3px;
}

.draft-notice {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11.5px;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px dashed var(--border);
    border-radius: 9px;
    padding: 9px 13px;
    margin: 0 0 20px;
}

.countdown-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 13px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    background: var(--warn-soft);
    color: var(--warn-ink);
    border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
}

.countdown-pill i {
    width: 14px;
    height: 14px;
}

/* ============================================================
   Misc / detail pages
   ============================================================ */

.section-title {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title i {
    width: 16px;
    height: 16px;
    color: var(--accent);
}

.eyebrow {
    font-size: 10.5px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 4px;
}

.hint {
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.65;
}

.metric-card {
    border-top: 3px solid var(--accent);
}

.detail-dl {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 26px;
}

@media (max-width: 640px) {
    .detail-dl {
        grid-template-columns: 1fr;
    }
}

.detail-dl dt {
    font-size: 11.5px;
    color: var(--muted);
}

.detail-dl dd {
    margin: 3px 0 0;
    font-weight: 600;
    font-size: 13px;
    word-break: break-word;
}

.timeline {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 16px;
}

.timeline li {
    position: relative;
    padding-inline-start: 18px;
    border-inline-start: 2px solid var(--accent);
}

.timeline li::before {
    content: '';
    position: absolute;
    inset-inline-start: -5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.leader-list {
    display: grid;
    gap: 12px;
}

.leader-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.leader-rank {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.leader-info {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.leader-info p {
    margin: 0;
    font-weight: 600;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leader-info small {
    color: var(--muted);
    font-size: 11px;
}

.leader-amount {
    color: var(--ok-ink);
    font-weight: 700;
    font-size: 12.5px;
    font-family: 'Courier New', Consolas, monospace;
    text-align: left;
    white-space: nowrap;
    overflow-wrap: anywhere;
    flex-shrink: 0;
}

.blank-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--muted);
    font-size: 13px;
}

.blank-state i {
    width: 34px;
    height: 34px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ============================================================
   Utilities
   ============================================================ */

.m-0 {
    margin: 0;
}

.text-center {
    text-align: center;
}

.hidden {
    display: none;
}

.hide-sm {
    display: inline-flex;
}

.show-sm {
    display: none !important;
}

@media (max-width: 767px) {
    .hide-sm {
        display: none !important;
    }
    .show-sm {
        display: inline-flex !important;
    }
    /* Prevent iOS Safari auto-zoom when focusing inputs (<16px triggers zoom) */
    .input,
    .select,
    textarea.input {
        font-size: 16px;
    }
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
    border-top: 1px solid var(--border);
    padding: 16px;
    text-align: center;
    font-size: 11.5px;
    color: var(--faint);
}

/* SweetAlert */
.swal2-popup {
    background: var(--surface) !important;
    color: var(--ink) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    font-family: 'Vazirmatn', sans-serif !important;
}

.swal2-title,
.swal2-html-container {
    color: var(--ink) !important;
}

.swal2-confirm.swal2-styled,
.swal2-cancel.swal2-styled {
    font-family: inherit !important;
    border-radius: 9px !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *:before,
    *:after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}
