:root {
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e2e8f0;
    --paper: #f8fafc;
    --white: #ffffff;
    --brand: #e62e2d;
    --brand-2: #c62828;
    --accent: #f59e0b;
    --danger: #dc2626;
    --success: #16a34a;
    --deleted-row: #fef2f2;
    --deleted-text: #991b1b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --radius: 6px;
}

.deleted-row {
    background: var(--deleted-row) !important;
    border-left: 5px solid var(--deleted-text);
}

.deleted-badge {
    background: var(--deleted-text);
    color: #663d00;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.count-badge {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--muted);
    margin-left: 8px;
    vertical-align: middle;
}

.invoice-status-card {
    display: grid;
    gap: 4px;
    min-width: 220px;
    padding: 11px 12px;
    border-radius: 14px;
    border: 1px solid #d7e4f1;
    background: linear-gradient(180deg, #ffffff 0%, #f5faff 100%);
    text-align: left;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.invoice-status-card strong {
    color: #123c63;
    font-size: 0.88rem;
    line-height: 1.35;
}

.invoice-status-card span:last-child {
    color: #557089;
    font-size: 0.8rem;
    line-height: 1.4;
}

.invoice-status-card.is-deleted {
    border-color: #efcf82;
    background: linear-gradient(135deg, #fffdf5 0%, #fff2d5 100%);
    box-shadow: 0 10px 24px rgba(184, 134, 11, 0.08);
}

.invoice-status-card.is-deleted strong,
.invoice-status-card.is-deleted span:last-child {
    color: #7a5700;
}

.invoice-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid #cddff1;
    background: #edf5ff;
    color: #0f5f9a;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.invoice-status-card.is-deleted .invoice-status-badge {
    border-color: #edc96e;
    background: #fff5d9;
    color: #8a5d00;
}

.invoice-action-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
    align-items: center;
}

.restore-btn {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.list-table th.status-cell,
.list-table td.status-cell,
.list-table th.actions-cell,
.list-table td.actions-cell {
    text-align: left;
}

.list-table tbody tr.deleted-row:hover {
    background: #fff4d8 !important;
}

.dashboard-toast-host {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 10020;
    display: grid;
    gap: 10px;
    max-width: min(380px, calc(100vw - 24px));
}

.dashboard-toast {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #efcf82;
    border-left: 6px solid #c98708;
    background: linear-gradient(145deg, #fffdf7 0%, #fff0cb 100%);
    color: #704e00;
    box-shadow: 0 18px 35px rgba(18, 60, 99, 0.15);
    opacity: 0;
    transform: translateY(-10px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.dashboard-toast.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.dashboard-toast.is-leaving {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
}

.dashboard-toast.error {
    border-color: #f5c5cc;
    border-left-color: var(--danger);
    background: linear-gradient(145deg, #fff8f9 0%, #fdebed 100%);
    color: #8b2434;
}

.dashboard-toast-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.dashboard-toast-title {
    font-size: 0.98rem;
    line-height: 1.35;
}

.dashboard-toast-body {
    margin: 0;
    font-size: 0.84rem;
    line-height: 1.45;
}

.dashboard-toast-close {
    justify-self: start;
    min-height: 30px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: rgba(255, 255, 255, 0.72);
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.deleted-invoice-notice {
    display: grid;
    gap: 5px;
    max-width: 560px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #efcf82;
    background: linear-gradient(145deg, #fffdf6 0%, #fff0ca 100%);
    color: #6d4d00;
    box-shadow: 0 16px 32px rgba(18, 60, 99, 0.1);
}

.deleted-invoice-notice-kicker {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.deleted-invoice-notice strong {
    font-size: 1rem;
    line-height: 1.35;
    color: #5b3f00;
}

.deleted-invoice-notice span {
    font-size: 0.86rem;
    line-height: 1.5;
}

* {
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    overflow-x: hidden;
}

img,
svg,
video {
    max-width: 100%;
    height: auto;
}

body {
    margin: 0;
    color: var(--ink);
    font: 14px/1.5 "Inter", "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;
    background: #f1f5f9;
}

#fluid {
    display: none;
}

.container,
.global-logout-fallback {
    position: relative;
    z-index: 1;
}

a {
    color: #0f5f9a;
}

a:hover {
    color: #0a4c7c;
}

:focus-visible {
    outline: 2px solid #0f7cc4;
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    top: -48px;
    left: 12px;
    z-index: 10000;
    background: #0f5f9a;
    color: #fff;
    border-radius: 8px;
    padding: 8px 12px;
    text-decoration: none;
    font-weight: 700;
    box-shadow: 0 8px 16px rgba(15, 45, 79, 0.2);
    transition: top 0.2s ease;
}

.skip-link:focus-visible {
    top: 12px;
}

.back-to-top {
    position: fixed;
    right: 14px;
    bottom: 64px;
    z-index: 9997;
    border: 1px solid #bfd2e6;
    border-radius: 999px;
    background: #ffffff;
    color: #1e4a72;
    padding: 8px 12px;
    min-height: 38px;
    min-width: 58px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(15, 45, 79, 0.16);
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

body.app-loading {
    overflow: hidden;
}

.page-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background:
        radial-gradient(900px 500px at 10% 0%, rgba(0, 136, 210, 0.16), transparent 62%),
        radial-gradient(700px 420px at 90% 8%, rgba(0, 168, 154, 0.14), transparent 58%),
        linear-gradient(180deg, #f7fbff 0%, #edf4fb 100%);
    opacity: 1;
    visibility: visible;
    transition: opacity 0.32s ease, visibility 0.32s ease;
}

.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.page-loader-box {
    min-width: 160px;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid #cfe0f2;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 12px 26px rgba(15, 45, 79, 0.12);
    display: grid;
    justify-items: center;
    gap: 10px;
}

.page-loader-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(0, 136, 210, 0.22);
    border-top-color: #0088d2;
    border-right-color: #0e8b55;
    animation: page-loader-spin 0.78s linear infinite;
}

.page-loader-text {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #18466f;
}

@keyframes page-loader-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .page-loader {
        transition: none;
    }

    .page-loader-spinner {
        animation-duration: 1.4s;
    }

    .skip-link,
    .back-to-top,
    .btn,
    .row-btn,
    button,
    a.btn {
        transition: none !important;
    }
}

@media print {
    .page-loader {
        display: none !important;
    }

    .top-live-status-bar,
    .global-ist-clock,
    .global-logout-fallback,
    .nav-logout-slot,
    .nav-toggle,
    .back-to-top,
    .skip-link,
    a[href*="logout.php"] {
        display: none !important;
    }
}

.container {
    width: min(1320px, 96vw);
    margin: 14px auto 30px;
}

.top-live-status-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin: 0 0 12px;
    padding: 8px 12px;
    border: 1px solid #d4e3f4;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(240, 247, 255, 0.96));
    box-shadow: 0 10px 20px rgba(15, 45, 79, 0.05);
}

.global-ist-clock {
    margin-left: auto;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.95rem;
    padding: 5px 0;
    text-align: right;
    white-space: nowrap;
}

.fy-selector-bar .global-ist-clock {
    padding: 5px;
}

.hero {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    margin-bottom: 16px;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    align-items: center;
}

@media (max-width: 720px) {
    .top-live-status-bar,
    .fy-selector-bar {
        gap: 10px;
    }

    .global-ist-clock {
        width: 100%;
        text-align: left;
        font-size: 0.94rem;
    }
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.25rem, 2.4vw, 1.9rem);
    line-height: 1.15;
    color: #083a64;
    letter-spacing: 0.01em;
}

.hero p {
    margin: 6px 0 0;
    color: var(--muted);
}

.hero-card {
    background: linear-gradient(130deg, #0e6b88, #1f9d74);
    color: #fff;
    border-radius: 12px;
    padding: 12px 14px;
    min-width: 0;
    display: grid;
    gap: 2px;
    font-size: 0.9rem;
}

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.panel h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    color: var(--ink);
    letter-spacing: 0;
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.section-note {
    margin: -8px 0 16px;
    color: var(--muted);
    font-size: 0.9rem;
}

.form-container {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.form-container h2 {
    margin: 0 0 16px;
    font-size: 1.15rem;
    color: var(--ink);
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
}

.form-row {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-bottom: 12px;
}

.form-group {
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
}

.form-group small {
    color: #5a7390;
}

.form-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.grid {
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
}

.grid-5 {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
    display: grid;
    gap: 6px;
    font-size: 0.84rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--muted);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius);
    background: #ffffff;
    color: var(--ink);
    padding: 10px 12px;
    font: inherit;
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.1);
}

input[readonly] {
    background: #f8fafc;
    color: var(--muted);
}

.table-wrap {
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #d5e2f0;
    border-radius: 14px;
    background: #fff;
    max-height: 500px;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #d5e2f0;
    border-radius: 14px;
    background: #fff;
}

.hotel-list-scroll {
    max-height: 300px !important;
    min-height: 300px !important;
    overflow-y: scroll !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.hotel-list-scroll table {
    width: 100% !important;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.invoice-table th,
.invoice-table td,
.list-table th,
.list-table td,
.data-table th,
.data-table td {
    border-bottom: 1px solid #e6edf6;
    padding: 10px 11px;
    font-size: 0.86rem;
    white-space: nowrap;
}

.invoice-table th,
.list-table th,
.data-table th {
    text-align: left;
    background: #f1f5f9;
    color: var(--muted);
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 2px solid var(--line);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.list-table th,
.list-table td,
.data-table th,
.data-table td {
    text-align: center;
    vertical-align: middle;
}

.list-table th.num,
.list-table td.num,
.data-table th.num,
.data-table td.num {
    text-align: right;
}

.proforma-list-table th,
.proforma-list-table td {
    text-align: left;
}

.proforma-list-table th.num,
.proforma-list-table td.num {
    text-align: right;
}

.invoice-table {
    min-width: 980px;
}

.list-table {
    min-width: 700px;
}

.data-table {
    min-width: 980px;
    border-collapse: separate;
    border-spacing: 0;
}

.list-table td {
    white-space: normal;
    word-break: break-word;
}

.list-table tbody tr:nth-child(even),
.data-table tbody tr:nth-child(even) {
    background: #fbfdff;
}

.list-table tbody tr:hover,
.data-table tbody tr:hover {
    background: #f2f8ff;
}

.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.line-no {
    text-align: center;
    font-weight: 600;
}

.btn,
.row-btn,
button,
a.btn {
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: 8px 14px;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 38px;
    transition: all 0.2s ease;
}

.btn:hover,
.row-btn:hover,
button:hover,
a.btn:hover {
    filter: brightness(0.95);
}

.btn.primary {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand-2);
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.2);
}

.btn.danger {
    background: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    font-weight: 600;
}

.btn.secondary,
.row-btn {
    background: #ffffff;
    color: var(--ink);
    border: 1px solid #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn.secondary:hover,
.row-btn:hover {
    background: #f8fafc;
    border-color: #94a3b8;
}

.btn.sm {
    min-height: 30px;
    padding: 4px 10px;
    font-size: 0.8rem;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.search-form {
    align-items: end;
}

.search-actions {
    display: flex;
    gap: 8px;
    align-items: end;
    justify-content: flex-start;
}

.search-actions-wide {
    grid-column: 1 / -1;
    margin-top: 0;
}

.btn.ghost {
    background: #ffffff;
    border: 1px solid #cfdeee;
    color: #355577;
}

.table-empty-state {
    padding: 20px 12px !important;
    text-align: center;
    color: #5a7390;
    font-style: italic;
}

.sticky-actions {
    position: sticky;
    bottom: 10px;
    z-index: 6;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #ffffff;
    box-shadow: var(--shadow);
}

.hero .actions {
    margin-top: 0;
    justify-content: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
    flex-wrap: wrap;
    overflow-x: visible;
    overflow-y: visible;
    max-width: 100%;
    width: 100%;
    scrollbar-width: thin;
    position: relative;
    z-index: 3;
}

.hero .actions .btn.secondary {
    border-radius: var(--radius);
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    color: var(--muted);
    white-space: normal;
}

.hero .actions .btn.primary {
    border-radius: 10px;
    padding-inline: 16px;
    white-space: nowrap;
}

.hero .actions .btn.nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-tab-icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    background: linear-gradient(180deg, #e9f3ff 0%, #dcebff 100%);
    color: #0d4f80;
    border: 1px solid #c8ddf6;
    flex: 0 0 22px;
}

.hero .actions .btn.nav-active {
    background: #0f5f9a;
    color: #fff;
    border-color: #0f5f9a;
    box-shadow: 0 6px 14px rgba(15, 95, 154, 0.18);
}

.hero .actions .btn.nav-active .nav-tab-icon {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.36);
    color: #ffffff;
}

.hero .nav-toggle {
    display: none;
}

.hero .actions.nav-grouped {
    display: grid;
    grid-template-columns: repeat(4, minmax(170px, 1fr));
    gap: 10px;
    align-items: start;
    overflow: visible;
}

.hero .actions .nav-group {
    position: relative;
    min-width: 0;
}

.hero .actions .nav-group-toggle {
    list-style: none;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.2;
    background: #ffffff;
    border: 1px solid #d4dde8;
    color: #27496d;
    cursor: pointer;
    user-select: none;
    display: block;
    width: 100%;
    position: relative;
    padding-right: 28px;
}

.hero .actions .nav-group-toggle::-webkit-details-marker {
    display: none;
}

.hero .actions .nav-group-toggle::after {
    content: "";
    position: absolute;
    right: 10px;
    top: 50%;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-62%) rotate(45deg);
    opacity: 0.85;
}

.hero .actions .nav-group[open] .nav-group-toggle::after {
    transform: translateY(-32%) rotate(-135deg);
}

.hero .actions .nav-group[open] .nav-group-toggle {
    background: #0f5f9a;
    color: #fff;
    border-color: #0f5f9a;
    box-shadow: 0 6px 14px rgba(15, 95, 154, 0.18);
}

.hero .actions .nav-group.has-active .nav-group-toggle {
    background: #eaf2fb;
    border-color: #bfd2e6;
}

.hero .actions .nav-group-menu {
    position: static;
    z-index: 1;
    min-width: 0;
    max-width: none;
    max-height: none;
    overflow: visible;
    margin-top: 6px;
    padding: 5px;
    border: 1px solid #d9e3ee;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 5px 12px rgba(15, 45, 79, 0.08);
    display: grid;
    gap: 5px;
}

.hero .actions .nav-group:not([open]) .nav-group-menu {
    display: none;
}

.hero .actions .nav-group-menu .btn {
    width: 100%;
    justify-content: flex-start;
    min-height: 32px;
    box-shadow: none;
}

.hero .nav-logout-slot {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.hero .nav-logout-slot .nav-logout-btn {
    min-width: 120px;
}

.global-logout-fallback {
    position: fixed;
    right: 14px;
    bottom: 14px;
    z-index: 9998;
    min-width: 112px;
    border-radius: 10px;
    box-shadow: 0 8px 16px rgba(15, 45, 79, 0.18);
}

.row-limit-note {
    margin: 8px 0 0;
}

.btn[disabled],
button[disabled] {
    opacity: 0.58;
    cursor: not-allowed;
}

.totals {
    margin-top: 12px;
}

.amount-words {
    margin: 8px 0 0;
    color: #12314f;
    font-weight: 700;
}

.notes {
    margin-top: 12px;
}

.hidden-row {
    display: none;
}

.warning-text {
    margin: 8px 0 0;
    color: #b11d2d;
    font-weight: 700;
}

.alert {
    border-radius: 12px;
    padding: 9px 12px;
    margin-bottom: 12px;
    display: inline-flex;
    align-items: center;
}

.alert.error {
    background: #fdecee;
    color: var(--danger);
    border: 1px solid #f8c7ce;
}

.alert.success {
    background: #ecf9f1;
    color: var(--success);
    border: 1px solid #bde8cf;
}

.alert.info {
    background: #edf5ff;
    color: #1f4e78;
    border: 1px solid #c9def3;
}

.formula-notes {
    margin-top: 10px;
    border: 1px dashed #bfd2e7;
    border-radius: 10px;
    padding: 9px 10px;
    background: #f7fbff;
}

.formula-notes summary {
    cursor: pointer;
    font-weight: 700;
    color: #21476b;
}

.formula-notes ul {
    margin: 8px 0 0;
    padding-left: 18px;
    color: #375572;
}

@media (max-width: 1180px) {
    .grid-5 {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1366px) {
    .container {
        width: 95.8vw;
        margin-top: 12px;
    }

    .hero { padding: 12px; }

    .grid-4,
    .grid-5,
    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .actions {
        justify-content: flex-start;
    }

    .hero .actions.nav-grouped {
        grid-template-columns: repeat(3, minmax(170px, 1fr));
    }

    .hero .actions .btn.primary {
        margin-left: 0;
    }

    .hero.nav-mobile .nav-dropdown-actions {
        display: none;
        width: 100%;
    }

    .hero.nav-mobile .nav-dropdown-actions.nav-open {
        display: grid;
        grid-template-columns: 1fr;
        gap: 8px;
        max-height: 70vh;
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 2px;
    }

    .hero.nav-mobile .nav-dropdown-actions .btn {
        width: 100%;
    }

    .hero.nav-mobile .actions.nav-grouped {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .hero.nav-mobile .actions .nav-group {
        width: 100%;
    }

    .hero.nav-mobile .actions .nav-group-toggle {
        width: 100%;
    }

    .hero.nav-mobile .actions .nav-group-menu {
        position: static;
        max-width: none;
        max-height: none;
        margin-top: 6px;
        box-shadow: none;
    }

    .hero .nav-logout-slot {
        justify-content: stretch;
    }

    .hero .nav-logout-slot .nav-logout-btn {
        width: 100%;
    }

    .hero:not(.nav-mobile) .actions { border-radius: 14px; }
}

@media (max-width: 960px) {
    .hero {
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .hero.nav-mobile .nav-toggle {
        display: inline-flex;
        width: 100%;
        justify-content: center;
        font-weight: 700;
        position: relative;
        z-index: 4;
    }

    .hero .actions.nav-grouped {
        grid-template-columns: repeat(2, minmax(150px, 1fr));
    }
}

@media (max-width: 720px) {
    .hero .actions:not(.nav-grouped) {
        display: flex;
        flex-wrap: wrap;
    }

    .hero .actions:not(.nav-grouped) .btn {
        width: auto;
        flex: 1 1 calc(50% - 8px);
    }

    .hero .actions.nav-grouped {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: 95vw;
    }

    .panel {
        padding: 12px;
        border-radius: 12px;
    }

    .grid-4,
    .grid-5,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
        align-items: stretch;
    }

    .btn,
    .row-btn,
    .actions .btn {
        width: 100%;
    }

    .hero .actions:not(.nav-grouped) {
        display: flex;
        flex-wrap: wrap;
        flex-direction: row;
        gap: 8px;
    }

    .hero .actions:not(.nav-grouped) .btn {
        width: auto;
        flex: 1 1 100%;
    }

    .search-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .sticky-actions {
        bottom: 6px;
        padding: 8px;
    }

    .invoice-table th,
    .invoice-table td,
    .list-table th,
    .list-table td,
    .data-table th,
    .data-table td {
        font-size: 0.81rem;
        padding: 7px 8px;
    }

    .data-table {
        min-width: 860px;
    }
}

@media (max-width: 480px) {
    .container {
        width: 96vw;
    }

    .hero {
        padding: 10px;
    }

    .panel {
        padding: 10px;
    }

    .btn,
    .row-btn,
    button,
    a.btn {
        min-height: 36px;
        padding: 8px 10px;
    }

    .back-to-top {
        right: 10px;
        bottom: 58px;
    }

    .global-logout-fallback {
        right: 10px;
        bottom: 10px;
    }
}

[data-theme="dark"] {
    --ink: #e6edf5;
    --muted: #9FB3C8;
    --line: #304057;
    --paper: #1A202C;
    --white: #111827;
    --brand: #38bdf8;
    --brand-2: #2dd4bf;
    --accent: #f59f00;
    --danger: #f87171;
    --success: #4ade80;
    --shadow: 0 14px 28px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
}

[data-theme="dark"] body {
    background:
        radial-gradient(1100px 640px at 0% 0%, rgba(56, 189, 248, 0.12), transparent 58%),
        radial-gradient(860px 560px at 100% 0%, rgba(45, 212, 191, 0.08), transparent 52%),
        linear-gradient(180deg, #060b13 0%, #0b1220 48%, #111827 100%);
}

[data-theme="dark"] .hero {
    background: #1c2431;
    border-color: #304057;
}

[data-theme="dark"] .hero h1 {
    color: #e6edf5;
}

[data-theme="dark"] .panel,
[data-theme="dark"] .form-container {
    background: #1c2431;
    border-color: #304057;
}

[data-theme="dark"] .panel h2,
[data-theme="dark"] .form-container h2 {
    color: #e6edf5;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #111827;
    color: #e6edf5;
    border-color: #304057;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

[data-theme="dark"] .table-wrap,
[data-theme="dark"] .table-responsive {
    background: #1c2431;
    border-color: #304057;
}

[data-theme="dark"] .invoice-table th,
[data-theme="dark"] .list-table th,
[data-theme="dark"] .data-table th {
    background: #111827;
    color: #e6edf5;
    border-bottom: 2px solid #304057;
}

[data-theme="dark"] .invoice-table td,
[data-theme="dark"] .list-table td,
[data-theme="dark"] .data-table td {
    border-bottom: 1px solid #304057;
}

[data-theme="dark"] .list-table tbody tr:nth-child(even),
[data-theme="dark"] .data-table tbody tr:nth-child(even) {
    background: #111827;
}

[data-theme="dark"] .list-table tbody tr:hover,
[data-theme="dark"] .data-table tbody tr:hover {
    background: #1c2b3a;
}

[data-theme="dark"] a {
    color: #60a5fa;
}

[data-theme="dark"] a:hover {
    color: #93c5fd;
}

[data-theme="dark"] .btn.secondary,
[data-theme="dark"] .row-btn {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

[data-theme="dark"] .btn.danger {
    background: #4a1d1d;
    color: #f87171;
    border-color: #7f1d1d;
}

[data-theme="dark"] .top-live-status-bar {
    background: #1c2431;
    border-color: #304057;
}

[data-theme="dark"] .global-ist-clock {
    color: #60a5fa;
}

[data-theme="dark"] .hero .actions {
    background: #111827;
    border-color: #304057;
}

[data-theme="dark"] .hero .actions .btn.secondary {
    background: #1c2431;
    border-color: #304057;
    color: #e6edf5;
}

[data-theme="dark"] .hero .actions .btn.nav-active {
    background: #38bdf8;
    color: #111827;
    border-color: #38bdf8;
}

[data-theme="dark"] .hero .actions .nav-group-toggle {
    background: #1c2431;
    border-color: #304057;
    color: #e6edf5;
}

[data-theme="dark"] .hero .actions .nav-group[open] .nav-group-toggle {
    background: #38bdf8;
    color: #111827;
    border-color: #38bdf8;
}

[data-theme="dark"] .hero .actions .nav-group-menu {
    background: #111827;
    border-color: #304057;
}

[data-theme="dark"] .alert.error {
    background: #4a1d1d;
    color: #f87171;
    border-color: #7f1d1d;
}

[data-theme="dark"] .alert.success {
    background: #164e32;
    color: #4ade80;
    border-color: #15803d;
}

[data-theme="dark"] .alert.info {
    background: #1e3a5a;
    color: #93c5fd;
    border-color: #2563eb;
}

[data-theme="dark"] .invoice-status-card {
    background: linear-gradient(180deg, #1b2431 0%, #121a24 100%);
    border-color: #314152;
}

[data-theme="dark"] .invoice-status-card strong {
    color: #d9e9f7;
}

[data-theme="dark"] .invoice-status-card span:last-child {
    color: #9fb3c6;
}

[data-theme="dark"] .invoice-status-badge {
    background: #13293f;
    border-color: #2e4d68;
    color: #8fcbff;
}

[data-theme="dark"] .invoice-status-card.is-deleted {
    background: linear-gradient(180deg, #3a2d10 0%, #2a2110 100%);
    border-color: #7f6422;
}

[data-theme="dark"] .invoice-status-card.is-deleted strong,
[data-theme="dark"] .invoice-status-card.is-deleted span:last-child,
[data-theme="dark"] .invoice-status-card.is-deleted .invoice-status-badge {
    color: #ffe4a0;
}

[data-theme="dark"] .invoice-status-card.is-deleted .invoice-status-badge {
    background: rgba(255, 228, 160, 0.08);
    border-color: rgba(255, 228, 160, 0.28);
}

[data-theme="dark"] .dashboard-toast {
    background: linear-gradient(145deg, #3c2f14 0%, #2a2112 100%);
    border-color: #7f6422;
    color: #ffe4a0;
}

[data-theme="dark"] .dashboard-toast.error {
    background: linear-gradient(145deg, #4a1d1d 0%, #321415 100%);
    border-color: #7f1d1d;
    color: #fda4af;
}

[data-theme="dark"] .dashboard-toast-close {
    background: rgba(17, 24, 39, 0.55);
}

[data-theme="dark"] .deleted-invoice-notice {
    background: linear-gradient(145deg, #3b2e12 0%, #2a2110 100%);
    border-color: #7f6422;
    color: #ffe4a0;
}

[data-theme="dark"] .deleted-invoice-notice strong {
    color: #fff2c6;
}

[data-theme="dark"] .page-loader {
    background: #0d1117;
}

[data-theme="dark"] .page-loader-box {
    background: #1c2431;
    border-color: #304057;
}

[data-theme="dark"] .page-loader-text {
    color: #e6edf5;
}

[data-theme="dark"] input[readonly] {
    background: #111827;
}

[data-theme="dark"] label,
[data-theme="dark"] .section-note,
[data-theme="dark"] .form-group small,
[data-theme="dark"] .table-empty-state,
[data-theme="dark"] .hero p,
[data-theme="dark"] .mini {
    color: #9fb3c8;
}

[data-theme="dark"] ::placeholder {
    color: #7f93aa;
}

[data-theme="dark"] .skip-link,
[data-theme="dark"] .back-to-top {
    background: #111827;
    color: #e6edf5;
    border-color: #304057;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .btn.ghost {
    background: #111827;
    border-color: #304057;
    color: #d4dee9;
}

[data-theme="dark"] .sticky-actions,
[data-theme="dark"] .formula-notes {
    background: rgba(17, 24, 39, 0.92);
    border-color: #304057;
}

[data-theme="dark"] .formula-notes summary,
[data-theme="dark"] .formula-notes ul {
    color: #d4dee9;
}

[data-theme="dark"] .hero-card {
    background: linear-gradient(135deg, #0f2f46 0%, #134e4a 100%);
    color: #eff7ff;
}

[data-theme="dark"] .nav-tab-icon {
    background: linear-gradient(180deg, #0f2235 0%, #142f49 100%);
    color: #9bd7ff;
    border-color: #2b4861;
}

[data-theme="dark"] .deleted-row {
    background: rgba(127, 100, 34, 0.14) !important;
    border-left-color: #d2a23e;
}

[data-theme="dark"] .deleted-row:hover {
    background: rgba(127, 100, 34, 0.22) !important;
}

[data-theme="dark"] .deleted-badge {
    background: #d2a23e;
    color: #231700;
}
