/* YRC BOX — mission-control aesthetic: phosphor amber, hairline rules,
   monospace telemetry, sharp corners. Light theme is the default (:root);
   the dark theme lives under [data-theme="dark"]. Surfaces, text, scrims and
   chrome are all tokens so a theme is just a variable swap. */

:root {
  /* --- surfaces & text (LIGHT — default) --- */
  --bg:        #f5f4f1;
  --panel:     #ffffff;
  --panel-2:   #efeee9;
  --raised:    #e7e5df;
  --line:      #d9d7cf;
  --line-soft: #e8e6df;
  --text:      #1b1b1e;
  --text-dim:  #565660;
  --text-mute: #86868f;

  /* accent for TEXT/icons — kept readable on the active surface */
  --accent:      #9a6400;
  --amber-ghost: rgba(255, 176, 0, 0.20);

  /* scrims, chrome, previews — theme-aware */
  --scrim:           rgba(24, 22, 18, 0.5);
  --scrollbar:       #cfcdc4;
  --scrollbar-hover: #b9b7ad;
  --preview-bg:      #f0efeb;
  --grain-opacity:   0;
  --btn-hover-bg:     #e6e4dd;
  --btn-hover-border: #c7c5bb;
  --card-hover-border:#c1bfb4;
  --danger-text:      #b3261e;
  --shadow: 0 20px 50px -14px rgba(60, 55, 45, 0.28), 0 0 0 1px var(--line);

  /* --- accent FILL & signal colours (shared by both themes) --- */
  --amber:     #ffb000;
  --amber-dim: #b87d00;
  --cyan:      #4fd1e0;
  --red:       #ff5f56;
  --green:     #2f9e6f;

  /* --- geometry & type (shared) --- */
  --r: 2px;
  --sidebar-w: 232px;
  --topbar-h: 56px;

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --cond: 'IBM Plex Sans Condensed', var(--sans);

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="dark"] {
  --bg:        #0b0b0c;
  --panel:     #131315;
  --panel-2:   #191a1d;
  --raised:    #1f2024;
  --line:      #292a2f;
  --line-soft: #1e1f23;
  --text:      #e9e7e4;
  --text-dim:  #9a9aa2;
  --text-mute: #63636d;

  --accent:      #ffb000;
  --amber-ghost: rgba(255, 176, 0, 0.12);

  --scrim:           rgba(6, 6, 7, 0.78);
  --scrollbar:       #2c2d33;
  --scrollbar-hover: #3d3e46;
  --preview-bg:      #000;
  --grain-opacity:   0.035;
  --btn-hover-bg:     #26272c;
  --btn-hover-border: #3a3b42;
  --card-hover-border:#3a3b42;
  --danger-text:      #ff9a94;
  --shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.7), 0 0 0 1px var(--line);

  --green: #4ec9a0;
}

/* Smooth the flip between themes without animating every hover transition. */
body, .sidebar, .topbar, .card, .modal, .auth-card, .ctx, .tray, .toast {
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease), color 0.25s var(--ease);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Film grain + a faint vignette so flat panels get some atmosphere. */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }

::selection { background: var(--amber); color: #000; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border: 3px solid var(--bg); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.micro {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
}

/* ------------------------------------------------------------------ auth */

.auth-wrap {
  height: 100%;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(700px 400px at 50% -10%, rgba(255, 176, 0, 0.09), transparent 70%),
    var(--bg);
}

/* Faint engineering graph paper behind the sign-in card. */
.auth-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 40%, #000 0%, transparent 75%);
  opacity: 0.6;
}

.auth-card {
  position: relative;
  width: min(400px, calc(100vw - 48px));
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 36px 32px 32px;
  animation: rise 0.5s var(--ease) both;
}

.auth-card::before {
  content: '';
  position: absolute;
  top: -1px; left: -1px; right: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--amber), var(--amber-dim) 40%, transparent);
}

.brand {
  font-family: var(--cond);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 9px;
}

.brand-mark {
  width: 13px;
  height: 20px;
  background: var(--amber);
  box-shadow: 0 0 18px rgba(255, 176, 0, 0.55);
  animation: blink 3.4s steps(1) infinite;
}

@keyframes blink { 0%, 92% { opacity: 1; } 96% { opacity: 0.25; } }

.auth-tag { margin: 10px 0 26px; color: var(--text-dim); font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 6px; }

input[type='text'], input[type='email'], input[type='password'], input[type='number'], select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 9px 11px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus, select:focus {
  border-color: var(--amber-dim);
  box-shadow: 0 0 0 3px var(--amber-ghost);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--raised);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.08s;
}

.btn:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-border); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #17130a;
  font-weight: 600;
}

.btn-primary:hover { background: #ffc033; border-color: #ffc033; }
.btn-block { width: 100%; padding: 11px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }
.btn-danger:hover { border-color: var(--red); color: var(--red); background: rgba(255, 95, 86, 0.08); }

.auth-switch { margin-top: 18px; text-align: center; color: var(--text-dim); font-size: 13px; }
.auth-switch button { color: var(--accent); font-size: 13px; }
.auth-switch button:hover { text-decoration: underline; }

.auth-theme { margin-top: 16px; text-align: center; }
.auth-theme button { color: var(--text-mute); font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.auth-theme button:hover { color: var(--text); }
.auth-theme svg { width: 13px; height: 13px; }

.form-error {
  background: rgba(255, 95, 86, 0.1);
  border: 1px solid rgba(255, 95, 86, 0.35);
  border-radius: var(--r);
  padding: 9px 11px;
  font-size: 13px;
  color: var(--danger-text);
  margin-bottom: 14px;
}

/* Theme toggle: shows the icon of the theme you'll switch TO (moon while light,
   sun while dark). CSS does the swap off the root attribute — no JS needed. */
.theme-toggle { padding: 6px 8px; color: var(--text-dim); }
.theme-toggle:hover { color: var(--text); background: var(--panel-2); }
.theme-toggle svg { width: 15px; height: 15px; display: block; }
.theme-toggle .icon-sun, .auth-theme .icon-sun { display: none; }
.theme-toggle .icon-moon, .auth-theme .icon-moon { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-sun,
:root[data-theme="dark"] .auth-theme .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon,
:root[data-theme="dark"] .auth-theme .icon-moon { display: none; }

/* ------------------------------------------------------------------ shell */

.shell { display: none; height: 100%; grid-template-columns: var(--sidebar-w) 1fr; }
.shell.active { display: grid; }

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.sidebar-head { padding: 17px 18px; border-bottom: 1px solid var(--line); }
.sidebar-head .brand { font-size: 19px; }
.sidebar-head .brand-mark { width: 10px; height: 15px; }

.nav { padding: 10px 8px; flex: 1; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--r);
  color: var(--text-dim);
  font-size: 13.5px;
  position: relative;
  transition: background 0.12s, color 0.12s;
}

.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--amber-ghost); color: var(--accent); }

/* Active nav gets a phosphor bar, echoing the brand mark. */
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 6px; bottom: 6px;
  width: 2px;
  background: var(--amber);
}

.nav-item svg { width: 15px; height: 15px; flex: none; }
.nav-count { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-mute); }
.nav-sep { height: 1px; background: var(--line-soft); margin: 9px 10px; }

.quota { padding: 14px 18px; border-top: 1px solid var(--line); }
.quota-bar { height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; margin: 8px 0 7px; }

.quota-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--amber-dim), var(--amber));
  transition: width 0.6s var(--ease);
}

.quota-fill.warn { background: linear-gradient(90deg, #c14b3f, var(--red)); }
.quota-text { font-family: var(--mono); font-size: 10.5px; color: var(--text-mute); }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; }

.topbar {
  height: var(--topbar-h);
  flex: none;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  background: var(--panel);
}

.crumbs { display: flex; align-items: center; gap: 5px; min-width: 0; flex: 1; overflow: hidden; }
.crumb { color: var(--text-dim); font-size: 13.5px; padding: 3px 5px; border-radius: var(--r); white-space: nowrap; }
.crumb:hover { color: var(--text); background: var(--panel-2); }
.crumb.current { color: var(--text); font-weight: 500; pointer-events: none; }
.crumb-sep { color: var(--text-mute); font-size: 11px; }

.search-box { position: relative; width: 260px; flex: none; }
.search-box svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--text-mute); }
.search-box input { padding-left: 30px; background: var(--bg); font-size: 13px; }

.view-toggle { display: flex; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; flex: none; }
.view-toggle button { padding: 6px 8px; color: var(--text-mute); display: grid; place-items: center; }
.view-toggle button svg { width: 14px; height: 14px; }
.view-toggle button:hover { background: var(--panel-2); color: var(--text); }
.view-toggle button.active { background: var(--amber-ghost); color: var(--accent); }

.content { flex: 1; overflow-y: auto; padding: 18px 16px 90px; position: relative; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line-soft);
}

.section-title { font-family: var(--cond); font-size: 19px; font-weight: 600; letter-spacing: 0.01em; }

/* --------------------------------------------------------------- file grid */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 10px; }

.card {
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 13px;
  cursor: default;
  position: relative;
  transition: border-color 0.14s, background 0.14s, transform 0.14s var(--ease);
  animation: rise 0.32s var(--ease) both;
  user-select: none;
}

.card:hover { border-color: var(--card-hover-border); background: var(--panel-2); transform: translateY(-2px); }
.card.selected { border-color: var(--amber); background: var(--amber-ghost); }
.card.drop-target { border-color: var(--cyan); background: rgba(79, 209, 224, 0.09); }
.card.cut { opacity: 0.45; }

.card-thumb {
  height: 76px;
  display: grid;
  place-items: center;
  margin-bottom: 11px;
  border-radius: var(--r);
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

.card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.card-thumb svg { width: 27px; height: 27px; }
.card-name { font-size: 13px; line-height: 1.35; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { font-family: var(--mono); font-size: 10px; color: var(--text-mute); margin-top: 5px; }

.card-star {
  position: absolute;
  top: 7px; right: 7px;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.15s;
}

.card-star svg { width: 13px; height: 13px; }
.card-star.on, .card:hover .card-star { opacity: 1; }
.card-star.on svg { fill: var(--accent); }

/* --------------------------------------------------------------- file list */

.list { width: 100%; border-collapse: collapse; }

.list th {
  text-align: left;
  padding: 0 10px 8px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}

.list th:hover { color: var(--text); }
.list th .sort-caret { color: var(--accent); margin-left: 3px; }
.list tbody tr { border-bottom: 1px solid var(--line-soft); transition: background 0.1s; animation: fade 0.25s ease both; }
.list tbody tr:hover { background: var(--panel); }
.list tbody tr.selected { background: var(--amber-ghost); box-shadow: inset 2px 0 0 var(--amber); }
.list tbody tr.drop-target { background: rgba(79, 209, 224, 0.1); box-shadow: inset 2px 0 0 var(--cyan); }
.list td { padding: 9px 10px; font-size: 13px; vertical-align: middle; }
.list td.col-name { display: flex; align-items: center; gap: 10px; }
.list td.col-name svg.ftype { width: 16px; height: 16px; flex: none; }
.list .col-meta { font-family: var(--mono); font-size: 11px; color: var(--text-mute); white-space: nowrap; }
.list .col-actions { width: 34px; text-align: right; }

.row-menu { opacity: 0; color: var(--text-mute); padding: 3px; border-radius: var(--r); }
tr:hover .row-menu, .card:hover .row-menu { opacity: 1; }
.row-menu:hover { background: var(--raised); color: var(--text); }
.row-menu svg { width: 14px; height: 14px; display: block; }

.name-cell { min-width: 0; }
.name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-path { font-family: var(--mono); font-size: 10px; color: var(--text-mute); }

/* ------------------------------------------------------------ empty states */

.empty { display: grid; place-items: center; padding: 70px 20px; text-align: center; animation: fade 0.4s ease both; }
.empty-icon { width: 46px; height: 46px; color: var(--text-mute); margin-bottom: 15px; opacity: 0.5; }
.empty h3 { font-family: var(--cond); font-size: 17px; font-weight: 600; margin-bottom: 5px; }
.empty p { color: var(--text-mute); font-size: 13px; max-width: 340px; }

.skeleton { background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 50%, var(--panel) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: var(--r); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* --------------------------------------------------------------- dropzone */

.dropzone {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: var(--scrim);
  backdrop-filter: blur(3px);
}

.dropzone.active { display: grid; animation: fade 0.14s ease both; }

.dropzone-inner {
  border: 2px dashed var(--amber);
  border-radius: var(--r);
  padding: 46px 68px;
  text-align: center;
  background: var(--amber-ghost);
  animation: pulse 1.5s ease-in-out infinite;
}

.dropzone-inner svg { width: 34px; height: 34px; color: var(--accent); margin-bottom: 11px; }
.dropzone-inner h3 { font-family: var(--cond); font-size: 20px; font-weight: 600; }
.dropzone-inner p { color: var(--text-dim); font-size: 12.5px; margin-top: 4px; }

@keyframes pulse { 50% { transform: scale(1.015); } }

/* ------------------------------------------------------------ upload tray */

.tray {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 330px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  z-index: 300;
  display: none;
  animation: rise 0.28s var(--ease) both;
}

.tray.active { display: block; }
.tray-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.tray-head .micro { flex: 1; color: var(--text); }
.tray-body { max-height: 240px; overflow-y: auto; }
.tray-item { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
.tray-item:last-child { border-bottom: none; }
.tray-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.tray-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tray-pct { font-family: var(--mono); font-size: 10.5px; color: var(--text-mute); }
.tray-bar { height: 2px; background: var(--bg); margin-top: 6px; overflow: hidden; }
.tray-fill { height: 100%; width: 0; background: var(--amber); transition: width 0.25s var(--ease); }
.tray-fill.done { background: var(--green); }
.tray-fill.err { background: var(--red); }
.tray-err { color: var(--red); font-size: 11px; margin-top: 3px; }

/* ----------------------------------------------------------- context menu */

.ctx {
  position: fixed;
  z-index: 400;
  min-width: 186px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 4px;
  display: none;
  animation: pop 0.12s var(--ease) both;
}

.ctx.active { display: block; }

.ctx-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border-radius: var(--r);
  font-size: 13px;
  color: var(--text-dim);
  text-align: left;
}

.ctx-item:hover { background: var(--raised); color: var(--text); }
.ctx-item svg { width: 14px; height: 14px; flex: none; }
.ctx-item.danger { color: var(--danger-text); }
.ctx-item.danger:hover { background: rgba(255, 95, 86, 0.12); color: var(--red); }
.ctx-item .shortcut { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--text-mute); }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* --------------------------------------------------------------- modals */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: none;
  place-items: center;
  padding: 24px;
}

.overlay.active { display: grid; animation: fade 0.16s ease both; }

.modal {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  animation: rise 0.24s var(--ease) both;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.modal-head { padding: 15px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-title { font-family: var(--cond); font-size: 16px; font-weight: 600; flex: 1; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { padding: 13px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.modal-close { color: var(--text-mute); padding: 3px; border-radius: var(--r); }
.modal-close:hover { background: var(--raised); color: var(--text); }
.modal-close svg { width: 15px; height: 15px; display: block; }

/* ---------------------------------------------------------------- preview */

.preview-modal { width: min(1000px, 100%); }
.preview-body { padding: 0; background: var(--preview-bg); display: grid; place-items: center; min-height: 260px; max-height: 74vh; overflow: auto; }
.preview-body img, .preview-body video { max-width: 100%; max-height: 74vh; display: block; }
.preview-body iframe { width: 100%; height: 74vh; border: none; background: #fff; }

.preview-body pre {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 20px;
  width: 100%;
  max-height: 74vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  background: var(--bg);
  text-align: left;
}

.preview-none { padding: 56px 20px; text-align: center; color: var(--text-mute); }
.preview-none svg { width: 42px; height: 42px; margin-bottom: 12px; opacity: 0.5; }

/* ----------------------------------------------------------------- shares */

.share-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.share-row:last-child { border-bottom: none; }

.avatar {
  width: 28px; height: 28px;
  flex: none;
  border-radius: var(--r);
  background: var(--raised);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
}

.share-who { flex: 1; min-width: 0; }
.share-name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-email { font-family: var(--mono); font-size: 10.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-add { display: flex; gap: 7px; margin-bottom: 6px; }
.share-add input { flex: 1; }
.share-add select { width: auto; flex: none; }
select { cursor: pointer; }

.link-row { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; margin-bottom: 8px; }
.link-url { display: flex; gap: 6px; align-items: center; }
.link-url input { font-family: var(--mono); font-size: 11px; }
.link-meta { display: flex; gap: 12px; margin-top: 7px; }

.tag {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  color: var(--text-mute);
}

.tag.amber { color: var(--accent); border-color: var(--amber-dim); background: var(--amber-ghost); }

.divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; }
.divider::before, .divider::after { content: ''; height: 1px; background: var(--line-soft); flex: 1; }

/* --------------------------------------------------------------- versions */

.ver-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.ver-row:last-child { border-bottom: none; }

.ver-no {
  font-family: var(--mono);
  font-size: 11px;
  width: 30px; height: 30px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text-dim);
}

.ver-row.current .ver-no { border-color: var(--amber-dim); color: var(--accent); background: var(--amber-ghost); }
.ver-info { flex: 1; min-width: 0; }
.ver-meta { font-family: var(--mono); font-size: 10.5px; color: var(--text-mute); }

/* ---------------------------------------------------------------- toasts */

.toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 7px; align-items: center; }

.toast {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-left: 2px solid var(--amber);
  border-radius: var(--r);
  padding: 9px 14px;
  font-size: 13px;
  box-shadow: var(--shadow);
  animation: drop 0.26s var(--ease) both;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 460px;
}

.toast.err { border-left-color: var(--red); }
.toast.ok { border-left-color: var(--green); }
.toast button { color: var(--accent); font-size: 12px; font-weight: 600; white-space: nowrap; }
.toast.leaving { animation: lift 0.2s ease forwards; }

/* -------------------------------------------------------------- share page */

.share-page { height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(700px 400px at 50% -10%, rgba(255, 176, 0, 0.09), transparent 70%), var(--bg); overflow-y: auto; }
.share-card { width: min(430px, 100%); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative; }
.share-card::before { content: ''; position: absolute; top: -1px; left: -1px; right: -1px; height: 2px; background: linear-gradient(90deg, var(--amber), var(--amber-dim) 40%, transparent); }
.share-card-body { padding: 30px 28px; text-align: center; }
.share-file-icon { width: 52px; height: 52px; color: var(--accent); margin: 6px auto 16px; }
.share-file-name { font-family: var(--cond); font-size: 19px; font-weight: 600; word-break: break-word; margin-bottom: 6px; }
.share-file-meta { font-family: var(--mono); font-size: 11px; color: var(--text-mute); margin-bottom: 22px; }
.share-preview { margin: 0 0 20px; border: 1px solid var(--line); background: var(--preview-bg); max-height: 300px; overflow: hidden; display: grid; place-items: center; }
.share-preview img, .share-preview video { max-width: 100%; max-height: 300px; display: block; }
.share-foot { border-top: 1px solid var(--line); padding: 11px 16px; text-align: center; }

/* ------------------------------------------------------------- animations */

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-9px); } to { opacity: 1; transform: none; } }
@keyframes lift { to { opacity: 0; transform: translateY(-9px); } }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner {
  width: 13px; height: 13px;
  border: 2px solid var(--line);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}

.hidden { display: none !important; }

/* ---------------------------------------------------------- wave 2 additions */

/* Notification bell + badge */
.topbar-icon { position: relative; padding: 6px 8px; color: var(--text-dim); }
.topbar-icon:hover { color: var(--text); background: var(--panel-2); }
.topbar-icon svg { width: 16px; height: 16px; display: block; }
.badge {
  position: absolute; top: 1px; right: 1px;
  min-width: 15px; height: 15px; padding: 0 3px;
  background: var(--red); color: #fff;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  border-radius: 8px; display: grid; place-items: center; line-height: 1;
}

/* Notifications panel (anchored dropdown) */
.notif-panel {
  position: fixed; z-index: 450;
  width: min(360px, calc(100vw - 24px));
  max-height: 70vh; overflow-y: auto;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow);
  animation: pop 0.12s var(--ease) both;
}
.notif-head { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel-2); }
.notif-head .micro { flex: 1; color: var(--text); }
.notif-empty { padding: 32px 20px; text-align: center; color: var(--text-mute); font-size: 13px; }
.notif-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background 0.12s; }
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--panel); }
.notif-item.unread { background: var(--amber-ghost); }
.notif-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); flex: none; margin-top: 5px; opacity: 0; }
.notif-item.unread .notif-dot { opacity: 1; }
.notif-body { flex: 1; min-width: 0; font-size: 13px; line-height: 1.45; }
.notif-body b { font-weight: 600; }
.notif-time { font-family: var(--mono); font-size: 10px; color: var(--text-mute); margin-top: 3px; }

/* Selection action bar */
.selection-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.selection-bar .sel-count { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-right: 4px; }
.selection-bar .btn { padding: 5px 9px; font-size: 12px; }

/* Grid card menu button (parity with list rows) */
.card-menu {
  position: absolute; top: 7px; left: 7px;
  color: var(--text-mute); background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: var(--r); padding: 2px; opacity: 0; transition: opacity 0.15s, color 0.12s;
}
.card:hover .card-menu { opacity: 1; }
.card-menu:hover { color: var(--text); background: var(--raised); }
.card-menu svg { width: 14px; height: 14px; display: block; }

/* Folder-picker (Move to…) rows */
.pick-row { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--r); cursor: pointer; }
.pick-row:hover { background: var(--panel-2); }
.pick-row svg { width: 17px; height: 17px; flex: none; color: var(--amber); }
.pick-empty { color: var(--text-mute); font-size: 13px; padding: 18px 8px; text-align: center; }

/* Forgot-password link on the auth card */
.auth-forgot { margin-top: 12px; text-align: center; }
.auth-forgot button { color: var(--text-mute); font-size: 12px; }
.auth-forgot button:hover { color: var(--accent); text-decoration: underline; }

/* Comments */
.comment-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; max-height: 46vh; overflow-y: auto; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.comment:last-child { border-bottom: none; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-time { font-family: var(--mono); font-size: 10px; color: var(--text-mute); }
.comment-del { margin-left: auto; color: var(--text-mute); font-size: 12px; padding: 2px 5px; border-radius: var(--r); }
.comment-del:hover { color: var(--red); background: var(--panel-2); }
.comment-body { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.comment-add { display: flex; gap: 8px; align-items: flex-end; }
.comment-add textarea {
  flex: 1; resize: vertical; min-height: 40px; font-family: var(--sans);
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 9px 11px; outline: none;
}
.comment-add textarea:focus { border-color: var(--amber-dim); box-shadow: 0 0 0 3px var(--amber-ghost); }

/* Activity feed */
.activity { display: flex; flex-direction: column; }
.activity-row { display: flex; align-items: baseline; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line-soft); }
.activity-row:hover { background: var(--panel); }
.activity-text { flex: 1; font-size: 13.5px; line-height: 1.5; }
.activity-time { font-family: var(--mono); font-size: 10.5px; color: var(--text-mute); white-space: nowrap; }

/* Command palette (⌘K) */
.palette-wrap {
  position: fixed; inset: 0; z-index: 600;
  background: var(--scrim); backdrop-filter: blur(3px);
  display: grid; place-items: start center; padding-top: 12vh;
  animation: fade 0.12s ease both;
}
.palette {
  width: min(560px, calc(100vw - 32px));
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden;
  animation: rise 0.16s var(--ease) both;
}
.palette-input {
  width: 100%; border: none; border-bottom: 1px solid var(--line) !important;
  background: var(--panel) !important; padding: 15px 18px !important; font-size: 15px; border-radius: 0;
}
.palette-input:focus { box-shadow: none !important; }
.palette-list { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-group { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-mute); padding: 9px 10px 5px; }
.palette-item { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--r); cursor: pointer; color: var(--text-dim); }
.palette-item.active { background: var(--amber-ghost); color: var(--text); }
.palette-item svg { flex: none; color: var(--text-mute); }
.palette-item.active svg { color: var(--accent); }
.palette-text { min-width: 0; }
.palette-text > div:first-child { font-size: 13.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-sub { font-family: var(--mono); font-size: 10px; color: var(--text-mute); }

/* On touch devices there is no hover: reveal the row/card actions permanently. */
@media (hover: none) {
  .row-menu, .card-menu, .card-star { opacity: 1 !important; }
}

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

@media (max-width: 860px) {
  :root { --sidebar-w: 62px; }
  .sidebar-head .brand span, .nav-item span, .quota { display: none; }
  .nav-item { justify-content: center; }
  .search-box { width: 150px; }
  .list .col-meta.hide-sm { display: none; }
}
