/* ==========================================================================
   My Locker — single stylesheet, no preprocessor.
   Theme switches on html[data-theme]; accent on html[data-accent].
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */

:root {
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --r-xl: 26px;

  --sp: 20px;
  --sidebar-w: 252px;
  --topbar-h: 66px;

  --ease: cubic-bezier(.32, .72, 0, 1);
  --fast: 140ms var(--ease);
  --slow: 320ms var(--ease);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Inter, Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;
}

/* Dark is the default surface. */
html[data-theme="dark"] {
  --bg:          #080b14;
  --bg-2:        #0c1120;
  --surface:     #111827;
  --surface-2:   #161f33;
  --surface-3:   #1d2740;
  --border:      #222d47;
  --border-soft: #1a2337;
  --text:        #e9edf8;
  --text-2:      #aab6d0;
  --muted:       #78849f;
  --shadow:      0 1px 2px rgb(0 0 0 / .4), 0 8px 30px -8px rgb(0 0 0 / .55);
  --shadow-lg:   0 24px 60px -18px rgb(0 0 0 / .7);
  --glow:        .5;
  --grid-line:   #ffffff08;
}

html[data-theme="light"] {
  --bg:          #f2f5fb;
  --bg-2:        #e9edf7;
  --surface:     #ffffff;
  --surface-2:   #f5f7fc;
  --surface-3:   #eaeff8;
  --border:      #dbe2f0;
  --border-soft: #e7ecf6;
  --text:        #0f172a;
  --text-2:      #46536e;
  --muted:       #6b7897;
  --shadow:      0 1px 2px rgb(16 26 51 / .05), 0 8px 24px -10px rgb(16 26 51 / .16);
  --shadow-lg:   0 24px 60px -18px rgb(16 26 51 / .22);
  --glow:        .16;
  --grid-line:   #0f172a08;
}

/* Accents — cool-leaning by default, warm options available. */
html[data-accent="indigo"]  { --accent: #6366f1; --accent-2: #22d3ee; --on-accent: #fff; }
html[data-accent="violet"]  { --accent: #8b5cf6; --accent-2: #ec4899; --on-accent: #fff; }
html[data-accent="cyan"]    { --accent: #06b6d4; --accent-2: #3b82f6; --on-accent: #04212a; }
html[data-accent="emerald"] { --accent: #10b981; --accent-2: #34d399; --on-accent: #03251a; }
html[data-accent="rose"]    { --accent: #f43f5e; --accent-2: #fb923c; --on-accent: #fff; }
html[data-accent="amber"]   { --accent: #f59e0b; --accent-2: #f43f5e; --on-accent: #2b1602; }

:root {
  --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 38%, transparent);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --ok:   #22c55e;
  --warn: #f59e0b;
  --bad:  #ef4444;
}

/* --- Reset -------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip {
  position: fixed; top: -60px; left: 12px; z-index: 200;
  padding: 10px 16px; border-radius: var(--r);
  background: var(--accent); color: var(--on-accent);
  transition: top var(--fast);
}
.skip:focus { top: 12px; }

.ico { width: 20px; height: 20px; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* --- Shell -------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 60;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  background: var(--bg-2);
  border-right: 1px solid var(--border-soft);
}
/* Soft accent bloom behind the nav — reads as depth, not decoration. */
.sidebar::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 240px at 0% 0%, var(--accent-soft), transparent 70%);
  opacity: calc(var(--glow) + .3);
}
.sidebar > * { position: relative; z-index: 1; }

.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 22px;
}
.brand-mark {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--grad);
  color: var(--on-accent);
  box-shadow: 0 6px 18px -6px var(--accent);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font-size: 16px; letter-spacing: -.02em; color: var(--text-2); }
.brand-name strong { color: var(--text); font-weight: 700; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border-soft); }

.nav-link {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  color: var(--text-2);
  font-weight: 500;
  transition: background var(--fast), color var(--fast);
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link .ico { transition: transform var(--fast); }
.nav-link:hover .ico { transform: scale(1.08); }

.nav-link.is-active { color: var(--text); background: var(--accent-soft); }
.nav-link.is-active .ico { color: var(--accent); }
.nav-link.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%;
  width: 3px; height: 20px; margin-top: -10px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.drawer-close { display: none; margin-left: auto; font-size: 26px; color: var(--muted); line-height: 1; }
.drawer-veil {
  position: fixed; inset: 0; z-index: 55;
  background: rgb(3 6 14 / .6);
  backdrop-filter: blur(3px);
}

.main-col { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }

/* --- Topbar ------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 var(--sp);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--border-soft);
}
.topbar-title { font-size: 18px; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.burger { display: none; }

.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--text-2);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  transition: color var(--fast), border-color var(--fast), transform var(--fast);
}
.icon-btn:hover { color: var(--text); border-color: var(--border); transform: translateY(-1px); }

.theme-toggle .ico-moon { display: none; }
html[data-theme="light"] .theme-toggle .ico-sun  { display: none; }
html[data-theme="light"] .theme-toggle .ico-moon { display: block; }

.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  transition: border-color var(--fast);
}
.user-chip:hover { border-color: var(--accent-line); }
.user-chip img, .avatar-fallback {
  width: 28px; height: 28px; border-radius: 50%; flex: none; object-fit: cover;
}
.avatar-fallback {
  display: grid; place-items: center;
  background: var(--grad); color: var(--on-accent);
  font-size: 12px; font-weight: 700;
}
.user-chip-name { font-size: 13.5px; font-weight: 550; }

.main { padding: var(--sp); max-width: 1440px; }

/* --- Primitives --------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }

.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 620; }
.card-head .spacer { margin-left: auto; }

.page-head {
  display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head h2 { font-size: 24px; letter-spacing: -.02em; }
.page-head p { color: var(--muted); font-size: 14px; margin-top: 4px; }
.page-head .spacer { margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px; font-weight: 560;
  white-space: nowrap;
  transition: transform var(--fast), background var(--fast), border-color var(--fast), opacity var(--fast);
}
.btn:hover { transform: translateY(-1px); border-color: var(--accent-line); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn .ico { width: 17px; height: 17px; }

.btn-primary {
  background: var(--grad); color: var(--on-accent);
  border-color: transparent;
  box-shadow: 0 6px 20px -8px var(--accent);
}
.btn-primary:hover { box-shadow: 0 10px 28px -8px var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 32%, transparent); background: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--bad) 12%, transparent); border-color: var(--bad); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }

.field { display: block; margin-bottom: 16px; }
.field > span {
  display: block; margin-bottom: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--text-2);
  letter-spacing: .01em;
}
.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; margin-top: 6px; }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2378849f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
}

/* Password show/hide toggle */
.eye-wrap { position: relative; display: block; }
.eye-wrap .input { padding-right: 44px; }
.eye-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 8px;
  color: var(--muted);
  transition: color var(--fast);
}
.eye-btn:hover { color: var(--text); }
.eye-btn svg { width: 18px; height: 18px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
  text-transform: capitalize;
}
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-ok  { background: color-mix(in srgb, var(--ok) 16%, transparent);  color: var(--ok); }
.pill-bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }

.empty {
  padding: 52px 24px; text-align: center; color: var(--muted);
}
.empty h3 { color: var(--text-2); font-size: 15px; margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 46ch; margin: 0 auto; }

.notice {
  display: flex; gap: 12px;
  padding: 13px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13.5px; color: var(--text-2);
  margin-bottom: 18px;
}
.notice strong { color: var(--text); }
.notice-warn {
  border-color: color-mix(in srgb, var(--warn) 40%, transparent);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
}
.notice-bad {
  border-color: color-mix(in srgb, var(--bad) 40%, transparent);
  background: color-mix(in srgb, var(--bad) 10%, transparent);
}

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

/* Grid and flex children default to min-width:auto, which means they refuse to
   shrink below their content's intrinsic width. One long line of code or a wide
   filename then stretches the whole column and scrolls the page sideways
   instead of scrolling inside its own box. */
.grid > *, .vault-layout > *, .board > *, .ring-wrap > * { min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }

/* --- Mini player ---------------------------------------------------------
   Lives outside #main so it survives the SPA-style page swaps in core.js —
   visible on every page whenever a track is loaded, even if it's paused. */

.mini-player {
  position: fixed; left: 18px; bottom: 18px; z-index: 250;
  display: flex; align-items: center; gap: 11px;
  padding: 7px 16px 7px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  max-width: min(300px, calc(100vw - 36px));
  animation: mp-in 220ms var(--ease);
}
@keyframes mp-in { from { opacity: 0; transform: translateY(10px) scale(.95); } }

.mini-player-play {
  width: 34px; height: 34px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad); color: var(--on-accent);
  transition: transform var(--fast);
}
.mini-player-play:hover { transform: scale(1.06); }
.mini-player-play .ico { width: 15px; height: 15px; }

.mini-player-info { min-width: 0; overflow: hidden; }
.mini-player-info b {
  display: block; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-player-info span {
  display: block; font-size: 11px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --- Toasts ------------------------------------------------------------- */

.toasts {
  position: fixed; right: 18px; bottom: 18px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  min-width: 240px; max-width: 380px;
  padding: 12px 16px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  border-left: 3px solid var(--accent);
  animation: toast-in 260ms var(--ease);
  pointer-events: auto;
}
.toast.is-bad { border-left-color: var(--bad); }
.toast.is-ok  { border-left-color: var(--ok); }
.toast.is-out { animation: toast-out 200ms var(--ease) forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(20px); } }

/* --- Auth pages --------------------------------------------------------- */

.auth {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 24px;
  background:
    radial-gradient(700px 400px at 15% 0%,  var(--accent-soft), transparent 65%),
    radial-gradient(600px 400px at 85% 100%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 65%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  padding: 34px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.auth-brand {
  display: flex; align-items: center; gap: 11px; justify-content: center;
  margin-bottom: 8px;
}
.auth h1 { font-size: 22px; text-align: center; margin-top: 18px; }
.auth-sub { text-align: center; color: var(--muted); font-size: 14px; margin: 6px 0 26px; }

/* --- Dashboard ---------------------------------------------------------- */

.hero {
  position: relative; overflow: hidden;
  padding: 30px;
  border-radius: var(--r-xl);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  margin-bottom: 18px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(560px 300px at 100% 0%, var(--accent-soft), transparent 62%),
    linear-gradient(120deg, transparent 62%, color-mix(in srgb, var(--accent-2) 9%, transparent));
}
.hero-grid {
  position: absolute; inset: 0;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, #000, transparent 85%);
}
.hero > .hero-inner { position: relative; }

/* Live clock in the hero's top-right corner */
.hero-clock {
  position: absolute; top: 26px; right: 30px; z-index: 1;
  display: flex; flex-direction: column; align-items: flex-end; gap: 7px;
  text-align: right;
}
.hero-clock b {
  font-size: 30px; font-weight: 700; letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-clock small { color: var(--muted); font-size: 11.5px; }
.day-progress {
  width: 130px; height: 4px; border-radius: 99px;
  background: var(--surface-3); overflow: hidden;
}
.day-progress i {
  display: block; height: 100%; width: 0;
  border-radius: 99px; background: var(--grad);
  transition: width 900ms linear;
}
.hero h2 { font-size: 27px; letter-spacing: -.025em; }
.hero h2 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin-top: 7px; font-size: 14.5px; }
.hero-actions { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }

.stat { padding: 18px 20px; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin-top: 6px; }
.stat-value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.ring-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.ring { position: relative; width: 148px; height: 148px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { stroke: var(--surface-3); }
.ring-mid {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
}
.ring-mid b { font-size: 19px; letter-spacing: -.02em; }
.ring-mid span { font-size: 11.5px; color: var(--muted); display: block; }

.legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-row span:last-child { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }

.mini-list { display: flex; flex-direction: column; }
.mini-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 20px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
.mini-item:last-child { border-bottom: 0; }
.mini-item:hover { background: var(--surface-2); }
.mini-item .grow { flex: 1; min-width: 0; }
.mini-item .grow b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-item .grow small { color: var(--muted); font-size: 12px; }

/* --- Locker ------------------------------------------------------------- */

.dropzone {
  position: relative;
  padding: 34px 24px;
  border-radius: var(--r-lg);
  border: 2px dashed var(--border);
  background: var(--surface);
  text-align: center;
  transition: border-color var(--fast), background var(--fast), transform var(--fast);
  margin-bottom: 18px;
}
.dropzone.is-over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.005);
}
.dropzone h3 { font-size: 15.5px; }
.dropzone p { color: var(--muted); font-size: 13.5px; margin: 5px 0 15px; }
.dropzone-ico {
  width: 46px; height: 46px; margin: 0 auto 12px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
}
.dropzone-ico svg { width: 22px; height: 22px; }

.uploads { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.upload-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 15px;
  border-radius: var(--r);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  font-size: 13px;
}
.upload-row .grow { flex: 1; min-width: 0; }
.upload-row b { display: block; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--grad); transition: width 160ms linear; }
.upload-pct { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; min-width: 38px; text-align: right; }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.search {
  position: relative; flex: 1; min-width: 200px; max-width: 340px;
}
.search .input { padding-left: 36px; }
.search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px; font-weight: 520; color: var(--text-2);
  transition: all var(--fast);
}
.chip:hover { border-color: var(--accent-line); color: var(--text); }
.chip.is-on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.files {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}
.file {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  overflow: hidden;
  transition: transform var(--fast), border-color var(--fast), box-shadow var(--fast);
}
.file:hover { transform: translateY(-3px); border-color: var(--accent-line); box-shadow: var(--shadow); }
.file-thumb {
  height: 116px;
  display: grid; place-items: center;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-soft);
  overflow: hidden;
  position: relative;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb .ico { width: 30px; height: 30px; color: var(--muted); }
.file-body { padding: 11px 13px; }
.file-name {
  font-size: 13px; font-weight: 550;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: flex; gap: 7px; }
.file-acts {
  position: absolute; top: 8px; right: 8px;
  display: flex; gap: 5px;
  opacity: 0; transition: opacity var(--fast);
}
.file:hover .file-acts, .file:focus-within .file-acts { opacity: 1; }
.file-act {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(6px);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.file-act:hover { color: var(--text); border-color: var(--accent-line); }
.file-act.is-on { color: var(--warn); }
.file-act .ico { width: 14px; height: 14px; }

/* Folder breadcrumb above the file grid */
.crumbs {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  margin-bottom: 13px;
  font-size: 13.5px;
}
.crumb {
  color: var(--text-2); font-weight: 550;
  padding: 3px 8px; border-radius: 7px;
  transition: background var(--fast), color var(--fast);
}
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.is-here { color: var(--accent); background: var(--accent-soft); }
.crumb-sep { color: var(--muted); }

.kind-folder { --k: #f59e0b; }
.kind-image  { --k: #38bdf8; }
.kind-video  { --k: #a78bfa; }
.kind-audio  { --k: #f472b6; }
.kind-pdf    { --k: #fb7185; }
.kind-archive{ --k: #fbbf24; }
.kind-code   { --k: #34d399; }
.kind-doc    { --k: #60a5fa; }
.kind-other  { --k: #94a3b8; }
.file-thumb .ico { color: var(--k, var(--muted)); }
.file-thumb { background: color-mix(in srgb, var(--k, var(--muted)) 8%, var(--surface-2)); }

/* --- Media / Music ------------------------------------------------------ */

.player-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
}
.player-frame iframe, .player-frame video { width: 100%; height: 100%; border: 0; }
.player-idle {
  position: absolute; inset: 0;
  display: grid; place-content: center; gap: 10px; text-align: center;
  color: var(--muted);
  background: var(--surface-2);
}

.viz-stage {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--bg-2), var(--surface));
  aspect-ratio: 16 / 7;
  /* No min-height here: paired with aspect-ratio it would drive the *width* up
     (240px tall × 16/7 = 548px wide) and overflow narrow screens. The mobile
     breakpoint sets an explicit height instead. */
}
.viz-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.viz-empty {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center; gap: 8px;
  color: var(--muted); font-size: 13.5px;
}
.viz-now {
  position: absolute; left: 20px; bottom: 18px; right: 20px;
  pointer-events: none;
}
.viz-now b { font-size: 15px; display: block; text-shadow: 0 2px 12px rgb(0 0 0 / .6); }
.viz-now span { font-size: 12px; color: var(--text-2); }

.transport {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  margin-top: 14px;
}
.play-btn {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--grad); color: var(--on-accent);
  box-shadow: 0 8px 22px -8px var(--accent);
  transition: transform var(--fast);
}
.play-btn:hover { transform: scale(1.06); }
.play-btn svg { width: 20px; height: 20px; }
.seek { flex: 1; display: flex; align-items: center; gap: 11px; }
.time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 40px; }

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  border-radius: 99px;
  background: var(--surface-3);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}
input[type="range"]::-moz-range-thumb {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--surface);
}

.tracklist { max-height: 340px; overflow-y: auto; }
.track {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  font-size: 13.5px;
  transition: background var(--fast);
}
.track:hover { background: var(--surface-2); }
.track.is-on { background: var(--accent-soft); }
.track.is-on .track-num { color: var(--accent); }
.track-num { width: 20px; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.track .grow { flex: 1; min-width: 0; }
.track b { display: block; font-weight: 520; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track small { color: var(--muted); font-size: 11.5px; }

/* --- Planner ------------------------------------------------------------ */

.planner-grid { grid-template-columns: 1.5fr 1fr; align-items: start; }

.cal-head {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px;
  margin-bottom: 6px;
}
.cal-head span {
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: .06em;
  padding: 6px 0;
}
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  min-height: 96px;
  padding: 8px;
  border-radius: var(--r);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  text-align: left;
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color var(--fast), transform var(--fast);
}
.day:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.day.is-out { opacity: .4; }
.day.is-today { border-color: var(--accent); }
.day.is-sel { background: var(--accent-soft); border-color: var(--accent); }
.day-n { font-size: 12px; font-weight: 650; color: var(--text-2); }
.day.is-today .day-n { color: var(--accent); }
.day-dots { display: flex; gap: 3px; flex-wrap: wrap; }
.day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.day-tasks { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.day-task {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border-left: 2px solid var(--accent);
}
.day-task.is-done { text-decoration: line-through; opacity: .55; }

.task {
  display: flex; align-items: flex-start; gap: 11px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.task:last-child { border-bottom: 0; }
.task-check {
  width: 18px; height: 18px; flex: none; margin-top: 2px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  display: grid; place-items: center;
  transition: all var(--fast);
}
.task-check:hover { border-color: var(--accent); }
.task-check.is-done { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.task-check svg { width: 11px; height: 11px; opacity: 0; }
.task-check.is-done svg { opacity: 1; }
.task .grow { flex: 1; min-width: 0; }
.task b { font-weight: 550; font-size: 13.5px; display: block; }
.task.is-done b { text-decoration: line-through; color: var(--muted); }
.task p { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: pre-wrap; }
.task-files { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.task-file {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  font-size: 11.5px; color: var(--text-2);
}
.task-file:hover { border-color: var(--accent-line); color: var(--text); }
.task-file svg { width: 11px; height: 11px; }

/* --- Code Vault --------------------------------------------------------- */

.vault-layout { display: grid; grid-template-columns: 268px 1fr; gap: 16px; align-items: start; }

.snips { display: flex; flex-direction: column; max-height: 62vh; overflow-y: auto; }
.snip {
  width: 100%; text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--fast);
}
.snip:hover { background: var(--surface-2); }
.snip.is-on { background: var(--accent-soft); }
.snip b { display: block; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snip small { color: var(--muted); font-size: 11.5px; display: flex; gap: 7px; margin-top: 3px; }

/* Textarea sits transparent on top of the highlighted <pre>; both must use
   identical metrics or the caret drifts away from the glyphs. */
.editor {
  position: relative;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: var(--bg-2);
  overflow: hidden;
  transition: border-color var(--fast);
}
.editor:focus-within { border-color: var(--accent); }
.editor pre, .editor textarea {
  margin: 0;
  padding: 15px 17px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.62;
  tab-size: 2;
  white-space: pre;
  overflow-wrap: normal;
  border: 0;
}
.editor pre {
  min-height: 380px;
  max-height: 62vh;
  overflow: auto;
  pointer-events: none;
  color: var(--text);
}
.editor textarea {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--accent);
  overflow: auto;
  outline: none;
}
.editor textarea::selection { background: color-mix(in srgb, var(--accent) 34%, transparent); }

.tok-key { color: #c084fc; font-weight: 600; }
.tok-str { color: #34d399; }
.tok-num { color: #fbbf24; }
.tok-com { color: var(--muted); font-style: italic; }
.tok-fun { color: #60a5fa; }
.tok-tag { color: #f472b6; }
.tok-att { color: #fbbf24; }
html[data-theme="light"] .tok-key { color: #7c3aed; }
html[data-theme="light"] .tok-str { color: #047857; }
html[data-theme="light"] .tok-num { color: #b45309; }
html[data-theme="light"] .tok-fun { color: #1d4ed8; }
html[data-theme="light"] .tok-tag { color: #be185d; }
html[data-theme="light"] .tok-att { color: #b45309; }

/* --- Queue board -------------------------------------------------------- */

.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.lane {
  border-radius: var(--r-lg);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  transition: border-color var(--fast), background var(--fast);
}
.lane.is-over { border-color: var(--accent); background: var(--accent-soft); }
.lane-head {
  display: flex; align-items: center; gap: 9px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.lane-head b { font-size: 13.5px; }
.lane-head .count {
  margin-left: auto;
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--surface-3);
  padding: 2px 8px; border-radius: 99px;
}
.lane-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 110px; }

.qcard {
  padding: 12px;
  border-radius: var(--r);
  border: 1px solid var(--border-soft);
  background: var(--surface-2);
  cursor: grab;
  transition: transform var(--fast), border-color var(--fast), opacity var(--fast);
}
.qcard:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.qcard.is-drag { opacity: .45; cursor: grabbing; }
.qcard b { font-size: 13px; font-weight: 550; display: block; line-height: 1.4; }
.qcard .host { font-size: 11.5px; color: var(--muted); margin-top: 3px; display: block; }
.qcard-acts { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.qcard-acts .btn { padding: 4px 9px; font-size: 11.5px; border-radius: 7px; }

/* --- Settings ----------------------------------------------------------- */

.set-nav { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.set-panel { display: none; }
.set-panel.is-on { display: block; }

.avatar-edit { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.avatar-big {
  width: 84px; height: 84px; flex: none;
  border-radius: 50%;
  object-fit: cover;
  display: grid; place-items: center;
  background: var(--grad); color: var(--on-accent);
  font-size: 30px; font-weight: 700;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border), 0 10px 30px -10px var(--accent);
}

.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch {
  width: 40px; height: 40px;
  border-radius: 12px;
  border: 2px solid transparent;
  position: relative;
  transition: transform var(--fast);
}
.swatch:hover { transform: scale(1.1); }
.swatch i { position: absolute; inset: 3px; border-radius: 8px; }
.swatch.is-on { border-color: var(--text); }
.swatch[data-accent="indigo"]  i { background: linear-gradient(135deg, #6366f1, #22d3ee); }
.swatch[data-accent="violet"]  i { background: linear-gradient(135deg, #8b5cf6, #ec4899); }
.swatch[data-accent="cyan"]    i { background: linear-gradient(135deg, #06b6d4, #3b82f6); }
.swatch[data-accent="emerald"] i { background: linear-gradient(135deg, #10b981, #34d399); }
.swatch[data-accent="rose"]    i { background: linear-gradient(135deg, #f43f5e, #fb923c); }
.swatch[data-accent="amber"]   i { background: linear-gradient(135deg, #f59e0b, #f43f5e); }

.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border-soft); }
.seg button {
  padding: 7px 15px; border-radius: 8px;
  font-size: 13px; font-weight: 550; color: var(--muted);
  transition: all var(--fast);
}
.seg button.is-on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.device {
  display: flex; align-items: center; gap: 13px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
}
.device:last-child { border-bottom: 0; }
.device .grow { flex: 1; min-width: 0; }
.device b { font-size: 13.5px; font-weight: 550; display: block; }
.device small { color: var(--muted); font-size: 12px; }
.device-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.device.is-current .device-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); }

.keyrow {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.keyrow:last-child { border-bottom: 0; }
.keyrow .grow { flex: 1; min-width: 190px; }
.keyrow b { font-size: 13.5px; display: block; }
.keyrow small { color: var(--muted); font-size: 12px; font-family: var(--mono); }

/* --- Modal -------------------------------------------------------------- */

.modal {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 20px;
  background: rgb(3 6 14 / .65);
  backdrop-filter: blur(4px);
  animation: fade 180ms var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal-card {
  width: 100%; max-width: 520px;
  max-height: 88vh; overflow-y: auto;
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop 240ms var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }
.modal-head {
  display: flex; align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { font-size: 16px; }
.modal-x { margin-left: auto; font-size: 24px; color: var(--muted); line-height: 1; }
.modal-x:hover { color: var(--text); }
.modal-body { padding: 22px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 22px;
  border-top: 1px solid var(--border-soft);
}

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 1120px) {
  .vault-layout { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  /* The calendar needs the full width well before the other grids do. */
  .planner-grid { grid-template-columns: 1fr; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--slow);
    box-shadow: var(--shadow-lg);
  }
  body.drawer-open .sidebar { transform: none; }
  .drawer-close { display: block; }
  .burger { display: grid; }
  .main-col { margin-left: 0; }
  .board { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  :root { --sp: 14px; }
  .main { padding: var(--sp); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .user-chip-name { display: none; }
  .user-chip { padding: 5px; }
  .hero { padding: 22px; }
  .hero h2 { font-size: 21px; }
  /* No corner room on a phone — clock sits above the greeting instead. */
  .hero-clock { position: static; align-items: flex-start; text-align: left; margin-bottom: 14px; }
  .hero-clock b { font-size: 24px; }
  .files { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  /* Swap the aspect ratio for a fixed height so the stage can never be wider
     than the viewport. */
  .viz-stage { aspect-ratio: auto; height: 200px; }
  .transport { flex-wrap: wrap; }
  .day { min-height: 62px; padding: 5px; }
  .day-tasks { display: none; }
  .cal, .cal-head { gap: 4px; }
  .toasts { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; }
  /* Toasts go full-width here, so stack the mini player above them. */
  .mini-player { left: 14px; bottom: 76px; max-width: calc(100vw - 28px); }
  .card-pad { padding: 16px; }
}

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