:root {
    color-scheme: light;
    --brand-orange: #f07d00;
    --brand-orange-strong: #d96b00;
    --brand-orange-soft: #fff3e6;
    --brand-blue: #123873;
    --brand-blue-soft: #eaf0f9;
    --bg: #f5f7fa;
    --surface: #ffffff;
    --surface-subtle: #f8fafc;
    --text: #172033;
    --text-muted: #667085;
    --border: #e5e9f0;
    --success: #16825d;
    --danger: #c93b3b;
    --shadow-sm: 0 1px 2px rgba(18, 56, 115, .04), 0 1px 5px rgba(18, 56, 115, .05);
    --shadow-md: 0 14px 35px rgba(18, 56, 115, .09);
    --sidebar-width: 264px;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 22px;
}

[data-theme="dark"] {
    color-scheme: dark;
    --bg: #101722;
    --surface: #182130;
    --surface-subtle: #1d2838;
    --text: #f5f7fb;
    --text-muted: #aeb8c8;
    --border: #2b384b;
    --brand-orange-soft: #382718;
    --brand-blue-soft: #1b2d4b;
    --shadow-sm: 0 1px 4px rgba(0, 0, 0, .2);
    --shadow-md: 0 18px 40px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; transition: background .2s, color .2s; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
svg { display: block; }

.skip-link { position: fixed; z-index: 1000; top: 10px; left: 10px; padding: 10px 14px; background: var(--brand-blue); color: #fff; border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.app-shell { display: flex; min-height: 100vh; }
.app-column { width: calc(100% - var(--sidebar-width)); margin-left: var(--sidebar-width); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 3vw, 46px); background: color-mix(in srgb, var(--surface) 92%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.topbar-context { display: flex; flex-direction: column; gap: 2px; }
.topbar-context span { font-size: 11px; font-weight: 700; color: var(--brand-orange); letter-spacing: .08em; text-transform: uppercase; }
.topbar-context strong { font-size: 14px; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 18px; }
.theme-button { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text-muted); cursor: pointer; }
.theme-button:hover { background: var(--surface-subtle); color: var(--text); }
.theme-button svg, .icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.user-chip { display: flex; align-items: center; gap: 10px; padding-left: 18px; border-left: 1px solid var(--border); }
.user-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: var(--brand-blue); color: #fff; font-size: 14px; font-weight: 700; }
.user-details { display: flex; flex-direction: column; line-height: 1.3; }
.user-details strong { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.user-details small { color: var(--text-muted); font-size: 11px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; background: transparent; cursor: pointer; }
.icon-button:hover { background: var(--surface-subtle); }
.menu-button { display: none; }
main { width: 100%; max-width: 1600px; margin: 0 auto; padding: clamp(24px, 3vw, 44px); }
.sidebar-backdrop { display: none; }

*:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-orange) 45%, transparent); outline-offset: 2px; }

@media (max-width: 900px) {
    .app-column { width: 100%; margin-left: 0; }
    .menu-button { display: grid; }
    .topbar { height: 68px; padding: 0 18px; }
    .topbar-context { flex: 1; }
    .theme-label, .user-details { display: none; }
    .topbar-actions { gap: 4px; }
    .user-chip { padding-left: 10px; }
    main { padding: 24px 18px 36px; }
    .sidebar-backdrop { position: fixed; z-index: 80; inset: 0; display: block; background: rgba(8, 18, 34, .55); opacity: 0; pointer-events: none; transition: opacity .2s; }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
}

@media (max-width: 520px) {
    .topbar-context span { display: none; }
    .topbar-context strong { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
