/* ────────────────────────────────────────────────────────────────────────────
   "Glazzed" dark-glass theme. Active when <html class="dark">.
   Remaps the light utility palette used across all pages so every section
   inherits the theme; dashboard-specific widgets use the .gz-* classes.
   ──────────────────────────────────────────────────────────────────────────── */

:root {
    --gz-bg: #0a0f1f;
    --gz-panel: rgba(18, 26, 50, 0.62);
    --gz-panel-solid: #131c36;
    --gz-head: rgba(0, 0, 0, 0.22);
    --gz-line: rgba(255, 255, 255, 0.08);
    --gz-line-strong: rgba(255, 255, 255, 0.14);
    --gz-text: #e8edf7;
    --gz-muted: #93a1bd;
    --gz-cyan: #22d3ee;
    --gz-violet: #a78bfa;
    --gz-pink: #f472b6;
    --gz-green: #34d399;
    --gz-amber: #fbbf24;
    --gz-red: #f87171;
}

/* ── Backdrop ─────────────────────────────────────────────────────────────── */
.gz-backdrop { position: fixed; inset: 0; z-index: -10; overflow: hidden; pointer-events: none; }
html.dark .gz-backdrop { background: radial-gradient(1200px 700px at 15% 10%, #1d2a5a 0%, transparent 60%),
                                     radial-gradient(900px 700px at 90% 20%, #3b1d5e 0%, transparent 60%),
                                     radial-gradient(900px 600px at 70% 95%, #0f4c5c 0%, transparent 60%),
                                     radial-gradient(700px 500px at 5% 90%, #4a1840 0%, transparent 60%),
                                     var(--gz-bg); }
html:not(.dark) .gz-backdrop { background: linear-gradient(135deg, #e0e7ff 0%, #ffffff 50%, #ede9fe 100%); }
.gz-blob { position: absolute; border-radius: 9999px; filter: blur(110px); opacity: .55; }
html:not(.dark) .gz-blob { opacity: .35; }

/* ── Base ─────────────────────────────────────────────────────────────────── */
html.dark body { background: var(--gz-bg) !important; color: var(--gz-text) !important; color-scheme: dark; }
html.dark ::selection { background: rgba(34, 211, 238, .35); }
html.dark ::-webkit-scrollbar { width: 8px; height: 8px; }
html.dark ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); border-radius: 8px; }

/* Neutral text */
html.dark .text-slate-900, html.dark .text-slate-800 { color: #f1f5fb !important; }
html.dark .text-slate-700 { color: #d3dbea !important; }
html.dark .text-slate-600 { color: #b3bfd4 !important; }
html.dark .text-slate-500 { color: var(--gz-muted) !important; }
html.dark .text-slate-400 { color: #7f8ca7 !important; }
html.dark .text-slate-300 { color: #56627c !important; }
html.dark .text-slate-200 { color: #3e4963 !important; }
html.dark .hover\:text-slate-900:hover, html.dark .hover\:text-slate-800:hover, html.dark .hover\:text-slate-700:hover { color: #fff !important; }

/* Neutral surfaces */
html.dark .bg-white, html.dark .bg-white\/50, html.dark .bg-white\/60, html.dark .bg-white\/70,
html.dark .bg-slate-50, html.dark .bg-slate-50\/50, html.dark .bg-slate-50\/30 { background-color: rgba(255, 255, 255, .04) !important; }
html.dark .bg-slate-100 { background-color: rgba(255, 255, 255, .08) !important; }
html.dark .bg-slate-200 { background-color: rgba(255, 255, 255, .12) !important; }
html.dark .bg-slate-300 { background-color: rgba(255, 255, 255, .25) !important; }
html.dark .hover\:bg-slate-50:hover, html.dark .hover\:bg-white\/60:hover, html.dark .hover\:bg-slate-100:hover,
html.dark .hover\:bg-slate-50\/50:hover { background-color: rgba(255, 255, 255, .07) !important; }

/* Borders / dividers */
html.dark .border-slate-100, html.dark .border-slate-200, html.dark .border-slate-200\/70, html.dark .border-white\/40,
html.dark .border-white\/50, html.dark .border-white\/60, html.dark .border-slate-50, html.dark .border { border-color: var(--gz-line) !important; }
html.dark .divide-slate-100 > * + *, html.dark .divide-slate-50 > * + * { border-color: var(--gz-line) !important; }
html.dark .border-slate-300 { border-color: var(--gz-line-strong) !important; }
html.dark .ring-indigo-200 { --tw-ring-color: rgba(34, 211, 238, .35) !important; }

/* ── Components ───────────────────────────────────────────────────────────── */
html.dark .card {
    background: var(--gz-panel) !important;
    border: 1px solid var(--gz-line) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .35) !important;
    backdrop-filter: blur(18px) saturate(140%);
}
html.dark .shadow-apple, html.dark .shadow-glass { box-shadow: 0 10px 30px rgba(0, 0, 0, .3) !important; }
html.dark .h1 { font-weight: 300 !important; letter-spacing: -.01em; font-size: 1.75rem; color: #f1f5fb !important; }
html.dark h1.text-3xl { font-weight: 300 !important; }

html.dark .input {
    background: rgba(255, 255, 255, .05) !important; border-color: var(--gz-line-strong) !important; color: var(--gz-text) !important;
}
html.dark .input::placeholder { color: #66738e; }
html.dark .input:focus { --tw-ring-color: rgba(34, 211, 238, .35) !important; border-color: rgba(34, 211, 238, .5) !important; }
html.dark select option, html.dark select optgroup { background: var(--gz-panel-solid); color: var(--gz-text); }
html.dark input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(.8); }
html.dark .label { color: #c8d1e2 !important; }

html.dark .btn-outline { background: rgba(255, 255, 255, .04) !important; border-color: var(--gz-line-strong) !important; color: #d6deec !important; }
html.dark .btn-outline:hover { background: rgba(255, 255, 255, .1) !important; color: #fff !important; }
html.dark .btn-primary { background: linear-gradient(135deg, #06b6d4, #6366f1) !important; box-shadow: 0 6px 18px rgba(6, 182, 212, .25); }
html.dark .btn-primary:hover { filter: brightness(1.1); }
html.dark .btn-gradient { background: linear-gradient(135deg, #06b6d4, #8b5cf6 60%, #ec4899) !important; box-shadow: 0 6px 20px rgba(139, 92, 246, .3); }
html.dark .tab { color: var(--gz-muted) !important; }
html.dark .tab:hover { color: #fff !important; }
html.dark .tab-active { background: rgba(255, 255, 255, .1) !important; color: #fff !important; box-shadow: inset 0 -2px 0 var(--gz-cyan) !important; }

html.dark .modal-panel { background: var(--gz-panel-solid) !important; border: 1px solid var(--gz-line-strong); }
html.dark .bg-slate-900\/50 { background-color: rgba(3, 6, 15, .7) !important; }
html.dark table thead tr { color: var(--gz-muted); }
html.dark .accent-indigo-600 { accent-color: var(--gz-cyan); }

/* Gradient avatars & hero banners */
html.dark .from-indigo-600.to-violet-600, html.dark .from-indigo-500.to-violet-500 { --tw-gradient-from: #06b6d4 var(--tw-gradient-from-position) !important; --tw-gradient-to: #8b5cf6 var(--tw-gradient-to-position) !important; --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to) !important; }

/* ── Glazzed shell ────────────────────────────────────────────────────────── */
.gz-sidebar { backdrop-filter: blur(24px) saturate(140%); }
html.dark .gz-sidebar { background: rgba(10, 15, 32, .72); border-right: 1px solid var(--gz-line); }
html:not(.dark) .gz-sidebar { background: rgba(255, 255, 255, .65); border-right: 1px solid rgba(255, 255, 255, .5); }
.gz-nav-link { display: flex; align-items: center; gap: .75rem; padding: .55rem .9rem; font-size: .85rem; border-left: 3px solid transparent; transition: all .15s; }
html.dark .gz-nav-link { color: #a8b4cc; }
html.dark .gz-nav-link:hover { background: rgba(255, 255, 255, .05); color: #fff; }
html.dark .gz-nav-link.active { background: linear-gradient(90deg, rgba(34, 211, 238, .16), transparent); color: #fff; border-left-color: var(--gz-cyan); }
html:not(.dark) .gz-nav-link { color: #475569; }
html:not(.dark) .gz-nav-link:hover { background: rgba(255, 255, 255, .6); }
html:not(.dark) .gz-nav-link.active { background: rgba(99, 102, 241, .12); color: #4338ca; border-left-color: #6366f1; }

.gz-topbar { backdrop-filter: blur(20px); }
html.dark .gz-topbar { background: rgba(10, 15, 32, .55); border-bottom: 1px solid var(--gz-line); }
html:not(.dark) .gz-topbar { background: rgba(255, 255, 255, .6); border-bottom: 1px solid rgba(255, 255, 255, .5); }

/* Panel with header strip (Glazzed widget) */
.gz-panel { border-radius: 14px; overflow: hidden; backdrop-filter: blur(18px) saturate(140%); }
html.dark .gz-panel { background: var(--gz-panel); border: 1px solid var(--gz-line); box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
html:not(.dark) .gz-panel { background: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .6); box-shadow: 0 8px 24px rgba(15, 23, 42, .06); }
.gz-head { display: flex; align-items: center; gap: .6rem; padding: .7rem 1rem; font-size: .85rem; font-weight: 500; }
html.dark .gz-head { background: var(--gz-head); border-bottom: 1px solid var(--gz-line); color: #e3e9f5; }
html:not(.dark) .gz-head { background: rgba(241, 245, 249, .7); border-bottom: 1px solid #e2e8f0; color: #0f172a; }
.gz-head .gz-tools { margin-left: auto; display: flex; gap: .35rem; align-items: center; }
.gz-head .gz-tool { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 6px; opacity: .65; }
.gz-head .gz-tool:hover { opacity: 1; background: rgba(255, 255, 255, .08); }
.gz-body { padding: 1rem; }

.gz-kpi-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
html.dark .gz-kpi-label { color: var(--gz-muted); }
html:not(.dark) .gz-kpi-label { color: #64748b; }
.gz-big { font-weight: 300; letter-spacing: -.02em; }

.gz-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .55rem; border-radius: 6px; font-size: .72rem; font-weight: 600; }
.gz-up { color: var(--gz-green); }
.gz-down { color: var(--gz-red); }

.gz-list-item { display: flex; gap: .75rem; align-items: flex-start; padding: .75rem 1rem; }
html.dark .gz-list-item + .gz-list-item { border-top: 1px solid var(--gz-line); }
html:not(.dark) .gz-list-item + .gz-list-item { border-top: 1px solid #f1f5f9; }

.gz-icon-tile { width: 2.25rem; height: 2.25rem; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }

.gz-avatar-ring { padding: 3px; border-radius: 9999px; background: conic-gradient(var(--gz-cyan), var(--gz-violet), var(--gz-pink), var(--gz-cyan)); }

/* Hint bubble */
.gz-hint-bubble { background: #0f172a; color: #e2e8f0; border: 1px solid rgba(255, 255, 255, .12); }
html:not(.dark) .gz-hint-bubble { background: #1e293b; color: #f1f5f9; }

/* Inline field errors */
.field-error { border-color: #f87171 !important; box-shadow: 0 0 0 2px rgba(248, 113, 113, .25) !important; }
.field-error-msg { color: #f87171; font-size: .72rem; margin-top: .25rem; }

/* Top progress bar + busy overlay */
#gz-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 200; background: linear-gradient(90deg, #22d3ee, #a78bfa, #f472b6); box-shadow: 0 0 10px #22d3ee; transition: width .3s ease, opacity .3s; opacity: 0; }
#gz-progress.on { opacity: 1; width: 75%; transition: width 8s cubic-bezier(.1, .7, .2, 1); }
.gz-spin { animation: gzspin .8s linear infinite; }
@keyframes gzspin { to { transform: rotate(360deg); } }
.gz-skeleton { background: linear-gradient(90deg, rgba(148, 163, 184, .12) 25%, rgba(148, 163, 184, .25) 37%, rgba(148, 163, 184, .12) 63%); background-size: 400% 100%; animation: gzshimmer 1.4s ease infinite; border-radius: 10px; }
@keyframes gzshimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* Sortable headers / bulk bar */
.sort-link { display: inline-flex; align-items: center; gap: .25rem; }
.sort-link:hover { color: #22d3ee; }
.bulk-bar { position: sticky; bottom: 1rem; z-index: 40; }

/* Light-theme parity for the chart canvases & rings */
html:not(.dark) .gz-big { color: #0f172a; }

@media print {
    html.dark body, html.dark .gz-backdrop { background: #fff !important; }
}

/* Team skill grid: opaque sticky name column in dark mode */
html.dark .gz-sticky-col { background: rgba(22, 27, 48, .96) !important; backdrop-filter: blur(8px); }

/* ── Phase 3 ─────────────────────────────────────────────────────────────── */

/* UI #15 accessibility: skip link, visible keyboard focus, readable muted text in dark mode */
.gz-skip { position: fixed; left: 1rem; top: -4rem; z-index: 200; padding: .6rem 1rem; border-radius: .6rem; background: #0e7490; color: #fff; font-size: .85rem; transition: top .15s; }
.gz-skip:focus { top: 1rem; }
:focus-visible { outline: 2px solid #22d3ee !important; outline-offset: 2px; }
html:not(.dark) :focus-visible { outline-color: #4f46e5 !important; }
html.dark .text-slate-400 { color: #8d9ab3 !important; }
html.dark ::placeholder { color: #8390a8 !important; }
.sr-only:focus { position: static; width: auto; height: auto; clip: auto; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* Chart "View as table" */
.gz-chart-table { margin-top: .4rem; font-size: .75rem; }
.gz-chart-table summary { cursor: pointer; display: inline-flex; color: #64748b; padding: .1rem .3rem; border-radius: .3rem; }
html.dark .gz-chart-table summary { color: #8d9ab3; }
.gz-chart-table summary:hover { text-decoration: underline; }
.gz-chart-table > div { max-height: 240px; overflow: auto; margin-top: .35rem; }
.gz-chart-table table { width: 100%; border-collapse: collapse; }
.gz-chart-table th, .gz-chart-table td { padding: .25rem .5rem; text-align: left; border-bottom: 1px solid rgba(148, 163, 184, .2); white-space: nowrap; }
.gz-chart-table thead th { font-weight: 600; }

/* UI #16 sidebar: full width on desktop, icon rail on tablets or when collapsed, off-canvas on phones */
.rail-only { display: none; }
@media (min-width: 768px) {
    .gz-sidebar { transform: none !important; }
    .app-main { padding-left: 16rem; transition: padding-left .3s; }
}
@media (min-width: 768px) and (max-width: 1023.98px) {
    .gz-sidebar { width: 5rem !important; }
    .app-main { padding-left: 5rem; }
    .gz-sidebar .rail-hide { display: none !important; }
    .gz-sidebar .rail-only { display: block; }
    .gz-sidebar .gz-nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
    .gz-sidebar .rail-center { margin: 0 auto; }
}
@media (min-width: 1024px) {
    html.sb-collapsed .gz-sidebar { width: 5rem !important; }
    html.sb-collapsed .app-main { padding-left: 5rem; }
    html.sb-collapsed .gz-sidebar .rail-hide { display: none !important; }
    html.sb-collapsed .gz-sidebar .rail-only { display: block; }
    html.sb-collapsed .gz-sidebar .gz-nav-link { justify-content: center; padding-left: 0; padding-right: 0; }
    html:not(.sb-collapsed) .gz-sidebar .rail-center { margin-right: 0; }
}
@media (max-width: 639.98px) {
    /* Phones: tighter page gutters, stacked tool rows */
    .page { padding-left: 1rem !important; padding-right: 1rem !important; padding-top: 1.25rem !important; }
    .gz-tools { gap: .15rem; }
}

/* UI #11 customisable dashboard */
.gz-widget-ghost { opacity: .35; }
.gz-widget-drag { cursor: grab; }
[data-widget].gz-editing { outline: 2px dashed rgba(34, 211, 238, .45); outline-offset: 4px; border-radius: 1rem; }

/* UI #10 drag-and-drop plan calendar */
.gz-month.drop-over { outline: 2px dashed #22d3ee; outline-offset: 2px; }
.gz-plan-item { cursor: grab; }
.gz-plan-item.sortable-chosen { cursor: grabbing; }
