.app-top-navigation { position: sticky; top: 0; z-index: 30; box-shadow: 0 2px 8px #0f172a0d; }
.app-navigation-actions { min-width: 0; }
.app-top-navigation.is-compact { position: fixed; inset: 0 0 auto; width: 100%; }
.app-top-navigation.is-compact > div:first-child { padding: 4px 12px; display: block; }
.app-top-navigation.is-compact > div:first-child > a,
.app-top-navigation.is-compact > div:not(:first-child),
.app-top-navigation.is-compact .app-navigation-actions > div,
.app-top-navigation.is-compact nav a > span { display: none !important; }
.app-top-navigation.is-compact .app-navigation-actions { display: block; width: 100%; }
.app-top-navigation.is-compact nav { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 2px; scrollbar-width: thin; }
.app-top-navigation.is-compact nav a { flex: 0 0 auto; white-space: nowrap; padding: 7px 9px; font-size: 13px; line-height: 20px; }
@media screen and (max-width: 767px) {
    .app-top-navigation > div:first-child { padding-top: 8px; padding-bottom: 8px; gap: 8px; }
    .app-navigation-actions { width: 100%; flex-wrap: nowrap; gap: 8px; }
    .app-navigation-actions nav { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; }
    .app-navigation-actions nav a { white-space: nowrap; }
    .app-navigation-actions > div { gap: 4px; padding-left: 4px; }
}
@media print { .app-top-navigation { display: none !important; position: static; } }

:root {
    --theme-page: #f4f7f5;
    --theme-surface: #ffffff;
    --theme-surface-soft: #f8fafc;
    --theme-surface-muted: #f1f5f9;
    --theme-border: #e2e8f0;
    --theme-text: #0f172a;
    --theme-muted: #64748b;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --theme-page: #0b1120;
    --theme-surface: #111827;
    --theme-surface-soft: #172033;
    --theme-surface-muted: #1e293b;
    --theme-border: #334155;
    --theme-text: #e5edf6;
    --theme-muted: #9aa9bc;
    background: var(--theme-page);
}

html[data-theme="dark"] body {
    background: var(--theme-page) !important;
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .bg-white,
html[data-theme="dark"] [class~="bg-white"] {
    background-color: var(--theme-surface) !important;
}

html[data-theme="dark"] .bg-slate-50,
html[data-theme="dark"] [class~="bg-slate-50/70"],
html[data-theme="dark"] [class~="bg-slate-50/60"] {
    background-color: var(--theme-surface-soft) !important;
}

html[data-theme="dark"] .bg-slate-100,
html[data-theme="dark"] .bg-slate-200 {
    background-color: var(--theme-surface-muted) !important;
}

html[data-theme="dark"] .text-slate-950,
html[data-theme="dark"] .text-slate-900,
html[data-theme="dark"] .text-slate-800 {
    color: var(--theme-text) !important;
}

html[data-theme="dark"] .text-slate-700,
html[data-theme="dark"] .text-slate-600 {
    color: #c5d0df !important;
}

html[data-theme="dark"] .text-slate-500,
html[data-theme="dark"] .text-slate-400 {
    color: var(--theme-muted) !important;
}

html[data-theme="dark"] .border,
html[data-theme="dark"] .border-t,
html[data-theme="dark"] .border-b,
html[data-theme="dark"] .border-l,
html[data-theme="dark"] .border-r,
html[data-theme="dark"] .border-2,
html[data-theme="dark"] .border-t-2,
html[data-theme="dark"] .border-t-4,
html[data-theme="dark"] .divide-y > :not([hidden]) ~ :not([hidden]),
html[data-theme="dark"] .divide-x > :not([hidden]) ~ :not([hidden]) {
    border-color: var(--theme-border) !important;
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea {
    background-color: #0f172a !important;
    border-color: #475569 !important;
    color: #f1f5f9 !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #718096 !important;
    opacity: 1;
}

html[data-theme="dark"] input:disabled,
html[data-theme="dark"] input[readonly],
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled {
    background-color: #1e293b !important;
    color: #94a3b8 !important;
}

html[data-theme="dark"] input[type="checkbox"],
html[data-theme="dark"] input[type="radio"] {
    accent-color: #22c55e;
}

html[data-theme="dark"] option {
    background: #0f172a;
    color: #f1f5f9;
}

html[data-theme="dark"] table tbody tr {
    border-color: var(--theme-border) !important;
}

html[data-theme="dark"] .shadow,
html[data-theme="dark"] .shadow-sm,
html[data-theme="dark"] .shadow-md,
html[data-theme="dark"] .shadow-lg,
html[data-theme="dark"] .shadow-xl,
html[data-theme="dark"] .shadow-2xl {
    --tw-shadow-color: rgba(0, 0, 0, .5) !important;
}

html[data-theme="dark"] .hover\:bg-slate-50:hover,
html[data-theme="dark"] .hover\:bg-slate-100:hover {
    background-color: #243247 !important;
}

html[data-theme="dark"] .hover\:bg-green-50:hover {
    background-color: #123524 !important;
}

html[data-theme="dark"] .bg-green-50,
html[data-theme="dark"] .bg-green-100,
html[data-theme="dark"] [class~="bg-emerald-50/60"] {
    background-color: #123524 !important;
}

html[data-theme="dark"] .bg-amber-50,
html[data-theme="dark"] .bg-amber-100,
html[data-theme="dark"] [class~="bg-amber-50/60"],
html[data-theme="dark"] .bg-yellow-50,
html[data-theme="dark"] .bg-yellow-100 {
    background-color: #3a2b10 !important;
}

html[data-theme="dark"] .bg-red-50,
html[data-theme="dark"] .bg-red-100 {
    background-color: #3b171d !important;
}

html[data-theme="dark"] .bg-blue-50,
html[data-theme="dark"] .bg-blue-100 {
    background-color: #142b4a !important;
}

html[data-theme="dark"] .bg-violet-50,
html[data-theme="dark"] .bg-violet-100,
html[data-theme="dark"] .bg-purple-50,
html[data-theme="dark"] .bg-purple-100 {
    background-color: #2d2147 !important;
}

html[data-theme="dark"] .bg-orange-50,
html[data-theme="dark"] .bg-orange-100 {
    background-color: #402414 !important;
}

html[data-theme="dark"] .text-green-900,
html[data-theme="dark"] .text-green-800,
html[data-theme="dark"] .text-green-700,
html[data-theme="dark"] .text-emerald-900,
html[data-theme="dark"] .text-emerald-800,
html[data-theme="dark"] .text-emerald-700 {
    color: #86efac !important;
}

html[data-theme="dark"] .text-amber-900,
html[data-theme="dark"] .text-amber-800,
html[data-theme="dark"] .text-amber-700,
html[data-theme="dark"] .text-amber-600,
html[data-theme="dark"] .text-yellow-900,
html[data-theme="dark"] .text-yellow-800 {
    color: #fcd34d !important;
}

html[data-theme="dark"] .text-red-900,
html[data-theme="dark"] .text-red-800,
html[data-theme="dark"] .text-red-700 {
    color: #fca5a5 !important;
}

html[data-theme="dark"] .text-blue-900,
html[data-theme="dark"] .text-blue-800,
html[data-theme="dark"] .text-blue-700 {
    color: #93c5fd !important;
}

html[data-theme="dark"] .text-violet-900,
html[data-theme="dark"] .text-violet-800,
html[data-theme="dark"] .text-violet-700,
html[data-theme="dark"] .text-purple-900,
html[data-theme="dark"] .text-purple-800 {
    color: #c4b5fd !important;
}

html[data-theme="dark"] .border-green-200,
html[data-theme="dark"] .border-green-300 { border-color: #27744a !important; }
html[data-theme="dark"] .border-amber-200,
html[data-theme="dark"] .border-amber-300,
html[data-theme="dark"] .border-yellow-200 { border-color: #8a651e !important; }
html[data-theme="dark"] .border-red-200,
html[data-theme="dark"] .border-red-300 { border-color: #8f3540 !important; }
html[data-theme="dark"] .border-blue-200,
html[data-theme="dark"] .border-blue-300 { border-color: #315f91 !important; }
html[data-theme="dark"] .border-violet-200,
html[data-theme="dark"] .border-violet-300 { border-color: #67489a !important; }

html[data-theme="dark"] .planned-payment-summary > .bg-blue-50,
html[data-theme="dark"] .planned-payment-summary > .bg-blue-50 *,
html[data-theme="dark"] .planned-payment-summary > .bg-amber-50,
html[data-theme="dark"] .planned-payment-summary > .bg-amber-50 *,
html[data-theme="dark"] .planned-payment-summary > .bg-violet-50,
html[data-theme="dark"] .planned-payment-summary > .bg-violet-50 * {
    color: #ffffff !important;
}


html[data-theme="dark"] .delivery-card {
    background-color: #172033 !important;
}

html[data-theme="dark"] .ring-white {
    --tw-ring-color: #111827 !important;
}

html[data-theme="dark"] ::-webkit-scrollbar { width: 12px; height: 12px; }
html[data-theme="dark"] ::-webkit-scrollbar-track { background: #0b1120; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #475569; border-radius: 999px; border: 3px solid #0b1120; }

.theme-toggle {
    min-height: 38px;
}

@media print {
    html[data-theme="dark"] {
        color-scheme: light;
        background: #fff !important;
    }
    html[data-theme="dark"] body,
    html[data-theme="dark"] .bg-white,
    html[data-theme="dark"] .bg-slate-50,
    html[data-theme="dark"] .bg-slate-100 {
        background: #fff !important;
        color: #000 !important;
    }
    html[data-theme="dark"] input,
    html[data-theme="dark"] select,
    html[data-theme="dark"] textarea {
        background: #fff !important;
        color: #000 !important;
        border-color: #94a3b8 !important;
    }
    html[data-theme="dark"] .planned-payment-summary > .bg-blue-50,
    html[data-theme="dark"] .planned-payment-summary > .bg-blue-50 *,
    html[data-theme="dark"] .planned-payment-summary > .bg-amber-50,
    html[data-theme="dark"] .planned-payment-summary > .bg-amber-50 *,
    html[data-theme="dark"] .planned-payment-summary > .bg-violet-50,
    html[data-theme="dark"] .planned-payment-summary > .bg-violet-50 * {
        color: #000 !important;
    }

}
