/*!****************************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[13].oneOf[10].use[3]!./src/components/vault/vault.css ***!
  \****************************************************************************************************************************************************************************************************************************************************************************/
/* ═══════════════════════════════════════════════════════════════════════════
   PRZMA Files Desktop — Design System v2 "Aurora Vault"
   Glassmorphic · Dark-first · Calm · WCAG AA verified
   ───────────────────────────────────────────────────────────────────────────
   Every text/background pair below was computed against WCAG 2.1 and passes
   AA (>=4.5:1) on BOTH themes. Do not hand-tweak a colour without re-checking
   its ratio — three tokens in the previous system silently failed:
     --text-muted   2.47:1 dark / 2.19:1 light  (unreadable)
     --accent       2.97:1 on light             (unreadable links/labels)
     --text-dim     4.38:1 on light             (marginal)
   The fix that matters most: the accent now has SEPARATE lightness per theme.
   A single accent lightness mathematically cannot pass on both a near-black
   and a near-white canvas, which is why the old one failed in light mode.
   ═══════════════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ─── Primitives (theme-independent) ───────────────────────────────────────── */
:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'SF Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;

  /* Type scale — 1.200 (minor third), rem-based so OS font-size settings are
     respected. Users who scale their system font must not break the layout. */
  --fs-2xs: 0.6875rem;  /* 11px */
  --fs-xs:  0.75rem;    /* 12px */
  --fs-sm:  0.8125rem;  /* 13px */
  --fs-md:  0.875rem;   /* 14px */
  --fs-base:0.9375rem;  /* 15px */
  --fs-lg:  1.0625rem;  /* 17px */
  --fs-xl:  1.25rem;    /* 20px */
  --fs-2xl: 1.5rem;     /* 24px */
  --fs-3xl: 1.875rem;   /* 30px */

  --lh-tight: 1.25;
  --lh-snug:  1.4;
  --lh-normal:1.6;   /* body copy — generous, reduces reading fatigue */

  /* Spacing — 4px base, consistent rhythm everywhere */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;  --sp-12: 48px;

  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;
  --radius-lg: 20px;
  --radius-full: 999px;

  /* Motion — every duration flows through these so the reduced-motion block
     at the end of this file can neutralise ALL of them in one place. */
  --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --spring: 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* Hues — one source of truth. Semantic hues are deliberately harmonised
     with the iris primary (teal-leaning green, rose-leaning red) rather than
     stock framework colours, which clash against an indigo canvas. */
  --accent-h: 252;  --accent-s: 95%;
  --info-h:   192;
  --green-h:  158;
  --red-h:    352;
  --amber-h:   38;

  /* Comfort */
  --tap-min: 44px;             /* minimum interactive target */
  --focus-width: 3px;
  --content-max: 1440px;
}

/* ─── Dark Theme (default) ─────────────────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0c0e18;
  --bg-gradient:
    radial-gradient(1200px 700px at 12% -10%, hsla(252, 80%, 42%, 0.16), transparent 60%),
    radial-gradient(1000px 600px at 105% 8%,  hsla(192, 80%, 40%, 0.10), transparent 55%),
    linear-gradient(160deg, #0c0e18 0%, #10121f 55%, #141728 100%);
  --surface: rgba(21, 23, 35, 0.72);
  --surface-solid: #151723;
  --surface-2: rgba(30, 33, 47, 0.62);
  --surface-3: rgba(42, 46, 64, 0.42);
  --bg-0: #0e1019;

  --line: rgba(255, 255, 255, 0.11);
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.16);

  --text: #f2f2f8;        /* 17.25:1 */
  --text-dim: #acadc3;    /*  8.72:1 */
  --text-muted: #8688a2;  /*  5.55:1 — was 2.47:1 */

  --accent-l: 76%;
  --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));   /* 6.78:1 */
  --accent-soft: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.14);
  --accent-glow: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.28);
  --accent-bright: hsl(var(--accent-h), 100%, 84%);
  --accent-contrast: #0c0e18;   /* text ON an accent-filled surface */

  --info:  hsl(var(--info-h), 88%, 62%);
  --info-soft: hsla(var(--info-h), 88%, 62%, 0.14);
  --green: hsl(var(--green-h), 68%, 52%);
  --green-soft: hsla(var(--green-h), 68%, 52%, 0.14);
  --red:   hsl(var(--red-h), 88%, 70%);
  --red-soft: hsla(var(--red-h), 88%, 70%, 0.14);
  --amber: hsl(var(--amber-h), 94%, 62%);
  --amber-soft: hsla(var(--amber-h), 94%, 62%, 0.14);

  --topbar-bg: rgba(13, 15, 25, 0.78);
  --sidebar-bg: rgba(15, 17, 28, 0.82);

  /* Compatibility aliases — the Messages UI (and a few other blocks) was
     written against --fg/--bg-1/--bg-2/--bg-3, which were NEVER defined
     anywhere in this stylesheet. ~20 declarations were silently dead, so
     those panes rendered with no background at all. Mapped onto the real
     scale here rather than rewriting every call site. Solid, not
     translucent: they are used as opaque backgrounds. */
  --fg: var(--text);
  --bg-1: #0e1019;
  --bg-2: #151723;
  --bg-3: #1e212f;

  /* Layered elevation — two-part shadows (contact + ambient) read as real
     depth; a single large blur reads as a smudge. */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.34), 0 1px 3px rgba(0,0,0,0.22);
  --shadow: 0 2px 6px rgba(0,0,0,0.36), 0 12px 34px rgba(0,0,0,0.30);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.40), 0 28px 64px rgba(0,0,0,0.42);
  --drop-glow: 0 0 70px hsla(var(--accent-h), 85%, 60%, 0.17);
  --card-hover-glow: 0 0 0 1px var(--accent-glow), 0 10px 34px rgba(0,0,0,0.38);
}

/* ─── Light Theme ──────────────────────────────────────────────────────────── */
:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f5f5fa;
  --bg-gradient:
    radial-gradient(1200px 700px at 10% -12%, hsla(252, 90%, 62%, 0.10), transparent 60%),
    radial-gradient(1000px 600px at 104% 6%,  hsla(192, 85%, 52%, 0.08), transparent 55%),
    linear-gradient(160deg, #f5f5fa 0%, #eff0f7 55%, #f7f7fb 100%);
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-2: rgba(236, 236, 243, 0.76);
  --surface-3: rgba(226, 227, 238, 0.56);
  --bg-0: #ffffff;

  --line: rgba(16, 18, 34, 0.12);
  --border: rgba(16, 18, 34, 0.08);
  --border-hover: rgba(16, 18, 34, 0.18);

  --text: #151728;        /* 16.31:1 */
  --text-dim: #515670;    /*  6.63:1 — was 4.38:1 */
  --text-muted: #676b83;  /*  4.82:1 — was 2.19:1 */

  /* Darker accent: the single most important fix in this file. */
  --accent-s: 72%;
  --accent-l: 52%;
  --accent: hsl(var(--accent-h), var(--accent-s), var(--accent-l));   /* 7.04:1 */
  --accent-soft: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.10);
  --accent-glow: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.22);
  --accent-bright: hsl(var(--accent-h), 76%, 42%);
  --accent-contrast: #ffffff;

  --info:  hsl(var(--info-h), 88%, 28%);   /* 5.45:1 */
  --info-soft: hsla(var(--info-h), 88%, 28%, 0.10);
  --green: hsl(var(--green-h), 84%, 26%);  /* 4.93:1 */
  --green-soft: hsla(var(--green-h), 84%, 26%, 0.10);
  --red:   hsl(var(--red-h), 74%, 44%);    /* 5.45:1 */
  --red-soft: hsla(var(--red-h), 74%, 44%, 0.10);
  --amber: hsl(30, 88%, 34%);              /* 4.92:1 */
  --amber-soft: hsla(30, 88%, 34%, 0.10);

  --topbar-bg: rgba(255, 255, 255, 0.86);
  --sidebar-bg: rgba(249, 249, 253, 0.90);

  /* See the dark-theme block for why these aliases exist. */
  --fg: var(--text);
  --bg-1: #ffffff;
  --bg-2: #f5f5fa;
  --bg-3: #ececf3;

  --shadow-sm: 0 1px 2px rgba(16,18,34,0.06), 0 1px 3px rgba(16,18,34,0.04);
  --shadow: 0 2px 6px rgba(16,18,34,0.07), 0 12px 34px rgba(16,18,34,0.06);
  --shadow-lg: 0 4px 12px rgba(16,18,34,0.09), 0 28px 64px rgba(16,18,34,0.10);
  --drop-glow: 0 0 70px hsla(var(--accent-h), 85%, 55%, 0.10);
  --card-hover-glow: 0 0 0 1px var(--accent-glow), 0 10px 34px rgba(16,18,34,0.10);
}

/* ─── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  /* NOT a px value: hard-coding 16px overrides the browser/OS font-size the
     user deliberately chose. 100% inherits it, so every rem below scales with
     their accessibility settings instead of ignoring them. */
  font-size: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;   /* dvh: avoids the mobile URL-bar jump */
  overflow: hidden;
  /* Stops iOS/Safari from auto-inflating text in flex columns */
  text-rendering: optimizeLegibility;
}

/* Headings inherit the tighter leading — long headings shouldn't sprawl */
h1, h2, h3, h4, h5, h6 {
  line-height: var(--lh-tight);
  letter-spacing: -0.018em;
  font-weight: 700;
}

button {
  font-family: var(--font);
  font-size: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  /* Kills the 300ms tap delay and the grey flash on touch devices */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.55;
}

input, select, textarea {
  font-family: var(--font);
  font-size: inherit;
  color: var(--text);
}

/* Placeholder must stay legible — it is real information, not decoration */
::placeholder { color: var(--text-muted); opacity: 1; }

/* Selection in brand colour rather than the OS default blue */
::selection {
  background: var(--accent-glow);
  color: var(--text);
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

/* Long DIDs / hashes / filenames must never force horizontal page scroll */
p, span, div, td, li, h1, h2, h3, h4 {
  overflow-wrap: break-word;
}

/* ─── App Shell ────────────────────────────────────────────────────────────── */
.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── Top Bar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: 54px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 50;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.3px;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent) 0%, hsl(280, 70%, 55%) 100%);
  border-radius: 8px;
  font-size: 14px;
  color: white;
  font-weight: 800;
  box-shadow: 0 2px 12px hsla(var(--accent-h), 80%, 50%, 0.3);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.did-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-2);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-dim);
  max-width: 260px;
  transition: var(--transition);
}
.did-chip:hover {
  border-color: var(--border-hover);
}

.did-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
  flex-shrink: 0;
}

.did-select {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}
.did-select option {
  background: var(--surface-solid);
  color: var(--text);
}

.did-label {
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  -webkit-user-select: text;
     -moz-user-select: text;
          user-select: text;
}

.icon-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-2);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  border-radius: var(--radius-sm);
  font-size: 15px;
  transition: var(--transition);
}
.icon-btn:hover {
  background: var(--surface-3);
  border-color: var(--border-hover);
  transform: scale(1.05);
}
.icon-btn:active {
  transform: scale(0.95);
}

/* ─── Body Layout ──────────────────────────────────────────────────────────── */
.body {
  flex: 1 1;
  display: flex;
  overflow: hidden;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 228px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-right: 1px solid var(--border);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-section {
  padding: 0 6px;
  margin-bottom: 6px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
  padding: 12px 10px 6px;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  position: relative;
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  width: 100%;
  text-align: left;
}

.nav-item:hover:not(.disabled) {
  background: var(--surface-2);
}

.nav-item.active {
  background: var(--accent-soft);
}
.nav-item.active .nav-icon {
  color: var(--accent);
}
.nav-item.active .nav-title {
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-item.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-item.disabled .nav-title {
  color: var(--text-muted);
}

.nav-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.nav-label {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
  min-width: 0;
  flex: 1 1;
}

.nav-title {
  font-weight: 500;
  font-size: 13.5px;
}

.nav-sub {
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.nav-badge {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--red-soft);
  color: var(--red);
  margin-left: auto;
}

.nav-lock {
  font-size: 11px;
  margin-left: auto;
  opacity: 0.5;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-top: 1px solid var(--border);
}

/* Modern pill status badge */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  transition: var(--transition);
}
.status-pill.online {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.2);
}
.status-pill.offline {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.status-pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-pill.online .status-pip {
  background: #22c55e;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3);
  animation: pip-pulse 2.4s ease-in-out infinite;
}
.status-pill.offline .status-pip {
  background: #f87171;
}

@keyframes pip-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.3); }
  50%       { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.08); }
}

/* ─── Content Area ─────────────────────────────────────────────────────────── */
.content {
  flex: 1 1;
  overflow: hidden;
  padding: 28px 36px 0;
  display: flex;
  flex-direction: column;
}

.content::-webkit-scrollbar {
  width: 6px;
}
.content::-webkit-scrollbar-track {
  background: transparent;
}
.content::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

.content-head {
  margin-bottom: 24px;
}

.content-head h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
}

.content-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

/* ─── Dropzone (full-screen drag overlay only) ─────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, var(--accent-soft) 0%, transparent 70%);
  opacity: 0;
  transition: var(--transition-slow);
}

.dropzone:hover {
  border-color: var(--accent);
  box-shadow: var(--drop-glow);
}
.dropzone:hover::before {
  opacity: 1;
}

.dropzone.drag-over {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
  transform: scale(1.01);
  box-shadow: var(--drop-glow), 0 0 80px hsla(var(--accent-h), 80%, 55%, 0.1);
}
.dropzone.drag-over::before {
  opacity: 1;
}
.dropzone.drag-over .dropzone-icon {
  animation: bounce-drop 0.6s ease infinite;
}

.dropzone.uploading {
  pointer-events: none;
  opacity: 0.7;
}

@keyframes bounce-drop {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.dropzone-icon {
  font-size: 42px;
  margin-bottom: 12px;
  display: block;
  position: relative;
  z-index: 1;
  transition: var(--transition);
}

.dropzone-text {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  position: relative;
  z-index: 1;
}

.dropzone-text strong {
  color: var(--accent);
  font-weight: 600;
}

.dropzone-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
  position: relative;
  z-index: 1;
}

/* Upload progress bar */
.upload-progress {
  margin-top: 20px;
  position: relative;
  z-index: 1;
}

.progress-bar-track {
  height: 4px;
  background: var(--surface-3);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-bright) 100%);
  border-radius: 2px;
  transition: width 300ms ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
  font-weight: 500;
}

/* ─── File Layout (horizontal bar + scroll list) ──────────────────────────── */
.file-layout {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  min-height: 0;
}

/* Horizontal drop bar */
.dropzone-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  cursor: pointer;
  transition: var(--transition-slow);
  position: relative;
  overflow: hidden;
}

.dropzone-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at left center, var(--accent-soft) 0%, transparent 70%);
  opacity: 0;
  transition: var(--transition-slow);
}

.dropzone-bar:hover,
.dropzone-bar.drag-over {
  border-color: var(--accent);
  box-shadow: var(--drop-glow);
}
.dropzone-bar:hover::before,
.dropzone-bar.drag-over::before { opacity: 1; }

.dropzone-bar.drag-over {
  border-color: var(--accent-bright);
  background: var(--accent-soft);
}
.dropzone-bar.drag-over .dz-icon { animation: bounce-drop 0.6s ease infinite; }

.dropzone-bar.uploading { pointer-events: none; opacity: 0.8; }

.dz-icon {
  font-size: 22px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  line-height: 1;
}

.dz-text {
  font-size: 13.5px;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
  flex: 1 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dz-text strong { color: var(--accent); font-weight: 600; }
.dz-hint { color: var(--text-muted); font-size: 12px; }

.dz-progress {
  width: 140px;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* Files scrollable panel */
.files-panel {
  flex: 1 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding-right: 4px;
  padding-bottom: 28px;
}

.files-panel::-webkit-scrollbar { width: 5px; }
.files-panel::-webkit-scrollbar-track { background: transparent; }
.files-panel::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}
.files-panel::-webkit-scrollbar-thumb:hover { background: var(--accent-glow); }

/* ─── Files Section ────────────────────────────────────────────────────────── */
.files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
  flex-shrink: 0;
}

.files-head h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.count-badge {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: var(--radius-full);
}

.ghost-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  transition: var(--transition);
}
.ghost-btn:hover {
  background: var(--surface-2);
  border-color: var(--border-hover);
  color: var(--text);
}

/* ─── File Cards ───────────────────────────────────────────────────────────── */
.file-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  animation: card-enter 0.35s ease backwards;
}

.file-card:hover {
  border-color: var(--accent-glow);
  box-shadow: var(--card-hover-glow);
  transform: translateY(-1px);
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.file-thumb {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  font-size: 20px;
  flex-shrink: 0;
}

.file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1;
}

.file-name {
  font-weight: 600;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-sub {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.file-sub .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-muted);
}

.shared-badge {
  display: block;
  margin-top: 4px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-card-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.action-btn {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: var(--transition);
  line-height: 1;
}
.file-card:hover .action-btn {
  opacity: 0.5;
}
.action-btn:hover {
  opacity: 1 !important;
}

.view-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.share-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.del-btn:hover {
  background: var(--red-soft);
  color: var(--red);
}

/* keep old .del-btn alias working */
.del-btn {
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 14px;
  opacity: 0;
  transition: var(--transition);
}
.file-card:hover .del-btn {
  opacity: 0.5;
}

/* ─── File Preview Modal ───────────────────────────────────────────────────── */
.preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  -webkit-backdrop-filter: blur(6px);
          backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade-in 0.15s ease;
}

.preview-modal {
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 320px;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  gap: 16px;
  flex-shrink: 0;
}

.preview-title {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.preview-body {
  flex: 1 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  min-height: 200px;
}

.preview-img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
}

.preview-unsupported {
  text-align: center;
  color: var(--text-dim);
  padding: 40px;
}
.preview-unsupported p {
  margin-top: 12px;
  font-size: 13px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ─── Empty State ──────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 14px;
  display: block;
  opacity: 0.6;
}

.empty p {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  margin-bottom: 4px;
}

.empty span {
  font-size: 13px;
  color: var(--text-dim);
}

/* ─── Settings ─────────────────────────────────────────────────────────────── */
.settings-section {
  max-width: 520px;
  overflow-y: auto;
  flex: 1 1;
  min-height: 0;
  padding-bottom: 28px;
}

.form-group {
  margin-bottom: 22px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--mono);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  background: linear-gradient(135deg, var(--accent) 0%, hsl(280, 70%, 55%) 100%);
  color: white;
  font-weight: 600;
  font-size: 13.5px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  box-shadow: 0 2px 12px hsla(var(--accent-h), 80%, 50%, 0.25);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px hsla(var(--accent-h), 80%, 50%, 0.35);
}
.btn-primary:active {
  transform: scale(0.97);
}
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── Toast Notifications ──────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 64px;
  right: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
  animation: toast-in 0.4s var(--spring) forwards;
  max-width: 380px;
}

.toast.exiting {
  animation: toast-out 0.3s ease forwards;
}

.toast.clickable {
  cursor: pointer;
}
.toast.clickable:hover {
  border-color: var(--accent);
}

.toast.success {
  border-left: 3px solid var(--green);
}
.toast.success .toast-icon { color: var(--green); }

.toast.error {
  border-left: 3px solid var(--red);
}
.toast.error .toast-icon { color: var(--red); }

.toast.info {
  border-left: 3px solid var(--accent);
}
.toast.info .toast-icon { color: var(--accent); }

.toast-icon {
  font-size: 16px;
  flex-shrink: 0;
}

.toast-msg {
  flex: 1 1;
  line-height: 1.4;
}

.toast-close {
  font-size: 16px;
  opacity: 0.4;
  transition: var(--transition);
  padding: 2px;
}
.toast-close:hover {
  opacity: 1;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

/* ─── Circle DID Input ─────────────────────────────────────────────────────── */
.circle-input-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.circle-input-row input {
  flex: 1 1;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 13px;
  font-family: var(--mono);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}
.circle-input-row input:focus {
  border-color: var(--accent);
}

/* ─── Offline Banner ───────────────────────────────────────────────────────── */
.offline-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 12.5px;
  font-weight: 600;
  border-bottom: 1px solid rgba(245, 158, 11, 0.2);
  animation: slide-down 0.3s ease;
}

@keyframes slide-down {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── Tooltip ──────────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 8px);
  top: 50%;
  transform: translateY(-50%);
  padding: 5px 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
  z-index: 10;
}
[data-tooltip]:hover::after {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAJESTIC LAYER — royal violet + gold, gradient titles, accordion nav
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --gold: hsl(43, 92%, 60%);
  --gold-soft: hsla(43, 92%, 60%, 0.14);
  --grad-royal: linear-gradient(120deg,
    hsl(var(--accent-h), 95%, 72%) 0%,
    hsl(265, 80%, 64%) 45%,
    var(--gold) 115%);
}

/* Layered ambient glows behind everything for depth. */
body {
  background:
    radial-gradient(1100px 600px at -5% -10%, hsla(var(--accent-h), 85%, 55%, 0.12), transparent 60%),
    radial-gradient(900px 520px at 108% 115%, var(--gold-soft), transparent 62%),
    var(--bg-gradient);
  background-attachment: fixed;
}
:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 600px at -5% -10%, hsla(var(--accent-h), 85%, 60%, 0.08), transparent 60%),
    radial-gradient(900px 520px at 108% 115%, hsla(43, 92%, 60%, 0.07), transparent 62%),
    var(--bg-gradient);
  background-attachment: fixed;
}

/* Brand wordmark → gradient text + animated sheen on the mark. */
.brand > span {
  background: var(--grad-royal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}
.brand-mark {
  position: relative;
  overflow: hidden;
  background: var(--grad-royal);
  box-shadow: 0 4px 18px hsla(var(--accent-h), 85%, 55%, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.55) 50%, transparent 70%);
  transform: translateX(-120%);
  animation: brand-sheen 5s ease-in-out infinite;
}
@keyframes brand-sheen {
  0%, 70% { transform: translateX(-120%); }
  85%, 100% { transform: translateX(120%); }
}

/* Page heading → gradient text for a regal feel. */
.content-head h1 {
  background: var(--grad-royal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 800;
}

/* ─── Storage Accordion ────────────────────────────────────────────────────── */
.accordion {
  margin-bottom: 4px;
}

.accordion-header {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  transition: var(--transition);
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}
.accordion-header:hover {
  background: var(--surface-2);
  color: var(--text);
}
.accordion-icon {
  font-size: 14px;
}
.accordion-title {
  flex: 1 1;
  text-align: left;
}
.accordion-chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--spring);
}
.accordion.open .accordion-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.accordion-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-left: 6px;
  transition: max-height var(--transition-slow), opacity var(--transition), padding var(--transition);
}
.accordion.open .accordion-body {
  max-height: 320px;
  opacity: 1;
  padding-top: 4px;
}

/* ─── Sidebar bottom (Settings pinned to the floor) ────────────────────────── */
.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 8px;
}
.sidebar-bottom .sidebar-footer {
  margin-top: 6px;
}

/* Richer active nav state — gilded edge + soft glow. */
.nav-item.active {
  background: linear-gradient(90deg, var(--accent-soft), transparent 85%);
  box-shadow: inset 0 0 0 1px var(--accent-glow);
}
.nav-item.active::before {
  background: var(--grad-royal);
  box-shadow: 0 0 12px var(--accent-glow);
  height: 60%;
}

/* ─── Files actions / Delete-all ───────────────────────────────────────────── */
.files-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ghost-btn.danger {
  color: var(--red);
  border-color: var(--red-soft);
}
.ghost-btn.danger:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}
.ghost-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ─── Utilities ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ════════════════════════════════════════════════════════════════════════════
   MESSAGES UI
   ════════════════════════════════════════════════════════════════════════════ */

.messages-container {
  display: flex;
  flex-direction: column;
  flex: 1 1;
  min-height: 0;
  background: var(--bg-1);
}

.messages-tabs {
  display: flex;
  gap: 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
}

.tab-btn {
  padding: 12px 16px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg);
  opacity: 0.6;
  transition: all 0.3s;
}

.tab-btn.active {
  opacity: 1;
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.tab-btn:hover {
  opacity: 0.8;
}

.tab-content {
  flex: 1 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.messages-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
  overflow: hidden;
}

.messages-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.messages-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.badge {
  background: var(--accent);
  color: white;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.badge.pending {
  background: #ff9800;
}

.refresh-btn {
  padding: 4px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  color: var(--fg);
  transition: all 0.2s;
}

.refresh-btn:hover:not(:disabled) {
  background: var(--bg-3);
}

.refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.did-info {
  font-size: 12px;
  color: var(--fg);
  opacity: 0.7;
  margin-bottom: 12px;
  font-family: monospace;
}

.did-info strong {
  font-weight: 600;
  opacity: 1;
}

.activity-list {
  flex: 1 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.activity-item {
  background: var(--bg-0);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
  transition: all 0.2s;
}

.activity-item:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.activity-item.pending {
  border-left: 3px solid #ff9800;
}

.activity-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
  gap: 12px;
}

.actor-info {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
  flex: 1 1;
  font-size: 13px;
}

.actor {
  font-weight: 600;
  color: var(--accent);
  font-family: monospace;
  font-size: 12px;
}

.action {
  color: var(--fg);
  opacity: 0.6;
  font-size: 12px;
}

.object-name {
  color: var(--fg);
  font-weight: 500;
}

.timestamp {
  color: var(--fg);
  opacity: 0.5;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.activity-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  opacity: 0.8;
}

.meta {
  display: flex;
  gap: 8px;
  align-items: center;
}

.space-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}

.space-tag.public {
  background: rgba(0, 123, 255, 0.15);
  color: var(--accent);
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
}

.name-section {
  display: flex;
  gap: 6px;
  align-items: baseline;
  flex-wrap: wrap;
  flex: 1 1;
}

.actions {
  display: flex;
  gap: 6px;
}

.btn {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--bg-0);
  cursor: pointer;
  font-size: 12px;
  color: var(--fg);
  transition: all 0.2s;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--bg-2);
}

.btn.btn-primary {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.btn.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn.btn-secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn.btn-secondary:hover {
  background: rgba(0, 123, 255, 0.1);
}

.btn.btn-small {
  padding: 4px 8px;
  font-size: 11px;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1;
  color: var(--fg);
  opacity: 0.6;
}

.empty-state p {
  margin: 0 0 8px 0;
  font-size: 14px;
}

.empty-state small {
  font-size: 12px;
  opacity: 0.8;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--bg-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 16px;
  border-radius: 4px;
  background: var(--accent);
  color: white;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: slideIn 0.3s ease-out;
  z-index: 1000;
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ════════════════════════════════════════════════════════════════════════════
   SHARE DIALOG
   ════════════════════════════════════════════════════════════════════════════ */

.share-dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.share-dialog {
  background: var(--bg-0);
  border-radius: 8px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--fg);
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--fg);
  opacity: 0.6;
  transition: opacity 0.2s;
  padding: 0;
}

.close-btn:hover {
  opacity: 1;
}

.dialog-body {
  padding: 20px;
  flex: 1 1;
  overflow-y: auto;
}

.file-preview {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-2);
  border-radius: 6px;
  margin-bottom: 20px;
}

.file-icon {
  font-size: 32px;
  flex-shrink: 0;
}

.file-name {
  font-weight: 600;
  color: var(--fg);
  font-size: 14px;
}

.file-size {
  font-size: 12px;
  color: var(--fg);
  opacity: 0.6;
  margin-top: 4px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 8px;
  color: var(--fg);
  text-transform: uppercase;
  opacity: 0.8;
}

.info-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  background: rgba(0, 123, 255, 0.1);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}

.info-box strong {
  color: var(--accent);
  font-size: 14px;
}

.info-box small {
  color: var(--fg);
  opacity: 0.7;
  font-size: 12px;
}

.note {
  display: block;
  color: var(--fg);
  opacity: 0.6;
  font-size: 12px;
  margin-top: 12px;
  font-style: italic;
}

.dialog-footer {
  display: flex;
  gap: 8px;
  padding: 20px;
  border-top: 1px solid var(--line);
  justify-content: flex-end;
}

.btn-secondary {
  padding: 8px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
  transition: all 0.2s;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-3);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  padding: 8px 16px;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: white;
  transition: all 0.2s;
}

.btn-primary:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Messages Accordion Overrides */
.messages-container .accordion {
  border: none;
  background: transparent;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}

.messages-container .accordion-header {
  padding: 12px 16px;
  background: var(--bg-1);
  border: none;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
  color: var(--fg);
}

.messages-container .accordion-body {
  padding: 16px;
  background: var(--bg-0);
}

.messages-container .messages-panel {
  padding: 0;
  background: transparent;
  border: none;
  margin: 0;
}

.messages-container .messages-header {
  display: none;
}

.messages-container .did-info {
  margin: 0 0 12px 0;
  padding: 0;
}

.messages-tabs {
  display: none;
}

/* ─── Global Drag & Drop Overlay ─────────────────────────────────────────── */
.app.global-drag-over::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--surface);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  z-index: 9998;
}

.global-drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.global-drop-overlay .overlay-content {
  background: var(--surface-solid);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  padding: 60px;
  text-align: center;
  box-shadow: var(--shadow), 0 0 40px var(--accent-glow);
  animation: overlayPop 0.3s var(--spring) forwards;
}

.global-drop-overlay .overlay-icon {
  font-size: 64px;
  display: block;
  margin-bottom: 20px;
  animation: bounceSoft 2s infinite ease-in-out;
}

.global-drop-overlay h2 {
  font-size: 28px;
  margin-bottom: 8px;
  color: var(--text);
}

.global-drop-overlay p {
  font-size: 16px;
  color: var(--text-dim);
}

@keyframes overlayPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bounceSoft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.animation-fade {
  animation: fadeIn 0.2s ease-out forwards;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════════════════════════════════════════════════════
   AUTH — login · register · verify · forgot · reset
   ════════════════════════════════════════════════════════════════════════════ */

/* Full-screen overlay rendered at the app root — covers topbar + sidebar */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 32px 16px 48px;
  animation: fadeIn 0.18s ease;
}

.auth-verifying {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-dim);
  font-size: 13px;
}
.auth-verifying .spinner { margin-bottom: 14px; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.auth-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  box-shadow: var(--shadow), 0 0 60px hsla(var(--accent-h), 70%, 50%, 0.08);
  padding: 32px;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Logo */
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.auth-logo-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--grad-royal);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 16px hsla(var(--accent-h), 80%, 50%, 0.35),
              inset 0 1px 0 rgba(255,255,255,0.4);
}

.auth-logo-name {
  background: var(--grad-royal);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

/* Tabs */
.auth-tabs {
  display: flex;
  gap: 0;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1 1;
  padding: 9px 0;
  font-size: 13px;
  font-weight: 600;
  border-radius: 8px;
  color: var(--text-dim);
  transition: var(--transition);
  background: none;
}

.auth-tab.active {
  background: var(--surface-solid);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.auth-tab:not(.active):hover {
  color: var(--text);
}

/* Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

.auth-req {
  color: var(--red);
  margin-left: 2px;
}

.auth-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  color: var(--text);
  outline: none;
  transition: var(--transition);
}

.auth-input:focus {
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-input::placeholder { color: var(--text-muted); }

.auth-input-mono {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.3px;
}

.auth-input-wrap {
  position: relative;
}

.auth-input-wrap .auth-input {
  padding-right: 42px;
}

.eye-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 16px;
  opacity: 0.5;
  transition: opacity var(--transition);
  line-height: 1;
  padding: 4px;
}

.eye-btn:hover { opacity: 1; }

/* Password strength */
.pw-strength-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
}

.pw-strength-bar {
  flex: 1 1;
  display: flex;
  gap: 3px;
}

.pw-seg {
  flex: 1 1;
  height: 3px;
  border-radius: 2px;
  background: var(--border-hover);
  transition: background var(--transition);
}

.pw-label {
  font-size: 11px;
  font-weight: 600;
  min-width: 60px;
  text-align: right;
}

/* Submit button */
.auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--accent) 0%, hsl(280, 70%, 55%) 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 3px 16px hsla(var(--accent-h), 80%, 50%, 0.3);
  margin-top: 2px;
}

.auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px hsla(var(--accent-h), 80%, 50%, 0.4);
}

.auth-submit:active:not(:disabled) { transform: scale(0.98); }

.auth-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Spinner (inline button) */
.btn-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}

/* Link button */
.link-btn {
  font-size: 12.5px;
  color: var(--accent);
  font-weight: 500;
  text-align: center;
  display: block;
  transition: var(--transition);
}

.link-btn:hover { color: var(--accent-bright); }
.link-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }

/* Messages */
.auth-msg {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  line-height: 1.4;
}

.auth-msg.error {
  background: var(--red-soft);
  border: 1px solid rgba(239,68,68,0.2);
  color: var(--red);
}

.auth-msg.ok {
  background: var(--green-soft);
  border: 1px solid rgba(34,197,94,0.2);
  color: var(--green);
}

/* Hint */
.auth-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.auth-hint code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 1px 5px;
  border-radius: 4px;
}

/* Step header (verify, forgot, reset) */
.auth-step-header {
  text-align: center;
  margin-bottom: 24px;
}

.auth-step-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.auth-step-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
}

.auth-step-sub {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 280px;
  margin: 0 auto;
}

/* OTP boxes */
.otp-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 4px 0 8px;
}

.otp-box {
  width: 46px;
  height: 54px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  font-family: var(--mono);
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  caret-color: var(--accent);
  transition: var(--transition);
}

.otp-box:focus {
  border-color: var(--accent);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--accent-soft);
  transform: scale(1.06);
}

.otp-box:not(:placeholder-shown) {
  border-color: var(--accent-glow);
  color: var(--accent-bright);
}

/* Resend timer */
.resend-timer {
  color: var(--text-muted);
  font-size: 12px;
}

/* Sent / success screen */
.auth-sent {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.auth-sent-icon {
  font-size: 52px;
  margin-bottom: 4px;
}

/* Auth-dot on sidebar item when signed in */
.nav-auth-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green-soft);
  margin-left: 6px;
  vertical-align: middle;
}

/* ════════════════════════════════════════════════════════════════════════════
   ACCOUNT PAGE — profile · stats · sessions
   ════════════════════════════════════════════════════════════════════════════ */

.account-wrap {
  flex: 1 1;
  overflow-y: auto;
  padding: 0 0 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
}

.account-wrap::-webkit-scrollbar { width: 5px; }
.account-wrap::-webkit-scrollbar-track { background: transparent; }
.account-wrap::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: 3px;
}

/* Profile card */
.acct-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  padding: 20px 22px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  animation: slideUp 0.3s ease;
}

.acct-avatar {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  background: var(--grad-royal);
  border-radius: 16px;
  font-size: 24px;
  font-weight: 800;
  color: white;
  box-shadow: 0 4px 16px hsla(var(--accent-h), 80%, 50%, 0.3),
              inset 0 1px 0 rgba(255,255,255,0.3);
}

.acct-meta {
  flex: 1 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.acct-name {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.verified-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.role-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.role-badge.admin {
  background: var(--amber-soft);
  color: var(--amber);
}

.role-badge.mod {
  background: var(--accent-soft);
  color: var(--accent);
}

.acct-email {
  font-size: 12.5px;
  color: var(--text-dim);
}

.acct-did-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.acct-did {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acct-bio {
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 2px;
}

.copy-btn {
  font-size: 13px;
  opacity: 0.5;
  transition: opacity var(--transition);
  flex-shrink: 0;
  padding: 2px;
}

.copy-btn:hover { opacity: 1; }

/* Stats strip */
.acct-stats {
  display: flex;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.acct-stat {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 14px 16px;
  background: var(--surface);
}

.acct-stat-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.acct-stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

/* Error */
.acct-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--red-soft);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--red);
}

.acct-error-close {
  font-size: 14px;
  opacity: 0.6;
  flex-shrink: 0;
  transition: opacity var(--transition);
}
.acct-error-close:hover { opacity: 1; }

/* Section */
.acct-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.acct-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.acct-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.acct-update-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.acct-update-version {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
}
.acct-update-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  color: var(--text-dim);
}

.sessions-loading,
.sessions-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

/* Session list */
.sessions-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: var(--transition);
  animation: card-enter 0.3s ease backwards;
}

.session-item:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.session-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.session-info {
  flex: 1 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.session-device {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.session-meta {
  display: flex;
  gap: 10px;
  align-items: center;
}

.session-ip,
.session-time {
  font-size: 11.5px;
  color: var(--text-dim);
}

.session-ip::after {
  content: '·';
  margin-left: 10px;
  color: var(--text-muted);
}

.session-id-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.session-id {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--text-muted);
}

.revoke-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0;
  transition: var(--transition);
  background: transparent;
}

.session-item:hover .revoke-btn { opacity: 1; }

.revoke-btn:hover {
  background: var(--red-soft);
  color: var(--red);
  opacity: 1;
}

.revoke-btn:disabled { opacity: 0.5; cursor: wait; }

/* Skeleton loader */
.skeleton-text {
  display: inline-block;
  width: 120px;
  height: 16px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s linear infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* Account actions */
.acct-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.acct-logout-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: var(--transition);
}

.acct-logout-btn:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--red);
  color: var(--red);
}

.acct-logout-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  transition: var(--transition);
}

.acct-logout-all-btn:hover:not(:disabled) {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.acct-logout-btn:disabled,
.acct-logout-all-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Account toast */
.acct-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  background: var(--surface-solid);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--green);
  box-shadow: var(--shadow);
  animation: toast-in 0.3s var(--spring);
  z-index: 200;
  white-space: nowrap;
}


/* ═══════════════════════════════════════════════════════════════════════════
   ██  REFINEMENT LAYER — Design System v2
   ═══════════════════════════════════════════════════════════════════════════
   Appended deliberately. Everything here is a considered override of the
   rules above, relying on cascade order rather than editing ~3000 lines of
   existing component CSS in place. Three things this layer adds that the
   original stylesheet had NONE of:
     1. :focus-visible          — keyboard users could not see where they were
     2. prefers-reduced-motion  — animations were unconditional (vestibular risk)
     3. @media breakpoints      — the layout could not respond to window size
   ═══════════════════════════════════════════════════════════════════════════ */


/* ═══════════════════════════════════════════════════════════════════════════
   1 · COMFORT & ACCESSIBILITY
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Focus ────────────────────────────────────────────────────────────────
   :focus-visible (not :focus) so the ring appears for keyboard/AT users but
   never on mouse click — the reason many apps strip focus styling entirely
   and break keyboard navigation in the process. Ring is drawn with
   box-shadow + outline together: outline follows border-radius in modern
   engines, the shadow guarantees a visible halo against any surface. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: var(--focus-width) solid var(--accent);
  outline-offset: 2px;
  box-shadow: 0 0 0 calc(var(--focus-width) + 2px) var(--accent-soft);
  z-index: 3;
  position: relative;
}

/* Never leave a focus ring invisible against an accent-filled control */
.btn-primary:focus-visible,
.auth-submit:focus-visible,
.nav-item.active:focus-visible {
  outline-color: var(--text);
  box-shadow: 0 0 0 calc(var(--focus-width) + 2px) rgba(0, 0, 0, 0.35);
}

/* Skip-link: first tab stop, lets keyboard users jump the whole sidebar */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -100px;
  z-index: 999;
  padding: var(--sp-3) var(--sp-5);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transition: top var(--transition);
}
.skip-link:focus { top: var(--sp-4); }

/* ─── Reduced motion ───────────────────────────────────────────────────────
   Respects the OS-level "reduce motion" setting. Transforms and animations
   are what trigger vestibular discomfort, so those are neutralised; colour
   and opacity fades are kept (brief, and they preserve the sense of state
   change that makes the UI feel responsive rather than broken). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  :root {
    --transition: 0.01ms linear;
    --transition-slow: 0.01ms linear;
    --transition-fast: 0.01ms linear;
    --spring: 0.01ms linear;
  }
  /* Anything that moves stays put, including on hover */
  .file-card:hover,
  .btn:hover:not(:disabled),
  .btn-primary:hover:not(:disabled),
  .action-btn:hover,
  .nav-item:hover:not(.disabled) {
    transform: none !important;
  }
}

/* ─── Forced / high contrast ───────────────────────────────────────────────
   Glassmorphism relies on translucency and soft borders, both of which
   disappear for users who need high contrast. Swap to solid surfaces and
   hard borders so structure stays readable. */
@media (prefers-contrast: more) {
  :root, :root[data-theme="dark"] {
    --surface: var(--surface-solid);
    --surface-2: #1e212f;
    --border: rgba(255, 255, 255, 0.34);
    --border-hover: rgba(255, 255, 255, 0.60);
    --line: rgba(255, 255, 255, 0.40);
    --text-muted: #b6b8cc;
  }
  :root[data-theme="light"] {
    --surface: #ffffff;
    --surface-2: #ffffff;
    --border: rgba(16, 18, 34, 0.42);
    --border-hover: rgba(16, 18, 34, 0.72);
    --line: rgba(16, 18, 34, 0.48);
    --text-muted: #3f4358;
  }
  .topbar, .sidebar, .card, .file-card, .modal {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
}

/* Windows High Contrast Mode — system colours must win outright */
@media (forced-colors: active) {
  .btn, .btn-primary, .file-card, .nav-item, .card {
    border: 1px solid ButtonBorder;
  }
  :where(a, button, input, select, textarea):focus-visible {
    outline: 3px solid Highlight;
  }
}

/* ─── Interactive target sizing ────────────────────────────────────────────
   Small icon buttons stay visually small but get their hit area padded out
   to 44px via a pseudo-element, so nobody has to aim precisely. */
.action-btn, .icon-btn, .del-btn, .acct-error-close {
  position: relative;
}
.action-btn::after, .icon-btn::after, .del-btn::after, .acct-error-close::after {
  content: '';
  position: absolute;
  inset: 50% auto auto 50%;
  width: max(100%, var(--tap-min));
  height: max(100%, var(--tap-min));
  transform: translate(-50%, -50%);
}

/* ─── Scrollbars ───────────────────────────────────────────────────────────
   Thin, themed, and — critically — always visible rather than fading, so
   users always know a region is scrollable. */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--surface-3) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--surface-3);
  border: 2px solid transparent;
  background-clip: content-box;
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover { background-color: var(--text-muted); background-clip: content-box; }
::-webkit-scrollbar-corner { background: transparent; }


/* ═══════════════════════════════════════════════════════════════════════════
   2 · SURFACE & COMPONENT POLISH
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── App shell ────────────────────────────────────────────────────────────
   dvh keeps the shell correct when browser chrome collapses; the 100vh
   fallback stays first for older engines. */
.app { height: 100vh; height: 100dvh; }

/* ─── Top bar ──────────────────────────────────────────────────────────────
   Slightly taller for breathing room, with a hairline highlight along the
   bottom edge that reads as a light source rather than a flat divider. */
.topbar {
  height: 58px;
  padding-inline: var(--sp-5);
  backdrop-filter: blur(24px) saturate(1.45);
  -webkit-backdrop-filter: blur(24px) saturate(1.45);
  box-shadow: 0 1px 0 var(--border), var(--shadow-sm);
}

.brand { font-size: var(--fs-base); letter-spacing: -0.02em; }

/* Brand mark: two-stop gradient across the harmonised hue range + inner rim
   light. The rim (inset highlight) is what stops a gradient chip from
   looking flat. */
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background:
    linear-gradient(140deg,
      hsl(var(--accent-h), 95%, 66%) 0%,
      hsl(var(--info-h), 88%, 52%) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 3px 14px hsla(var(--accent-h), 88%, 55%, 0.42);
  color: #fff;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
  width: 240px;
  padding: var(--sp-4) var(--sp-3);
  gap: 3px;
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
}

.sidebar-label {
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* Nav items: generous target, quick hover, accent rail on the active item
   instead of a heavy filled block. */
.nav-item {
  min-height: 40px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-item:hover:not(.disabled) {
  background: var(--surface-2);
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item.active .nav-title { color: var(--accent); }

/* ─── Cards ────────────────────────────────────────────────────────────────
   Lift is 2px, not more: a large hover translate across a grid of cards makes
   the whole page appear to shimmer as the pointer crosses it. */
.file-card {
  border-radius: var(--radius);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition),
    border-color var(--transition);
}
.file-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--card-hover-glow);
  border-color: var(--border-hover);
}
.file-card:active { transform: translateY(0); }

/* ─── Buttons ──────────────────────────────────────────────────────────────
   Unified across the three separate .btn definitions that had accumulated in
   this file. Primary gets a top rim-light so it reads as a raised physical
   control rather than a flat rectangle. */
.btn, .btn-primary, .btn-secondary, .auth-submit {
  min-height: 38px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--radius-sm);
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition),
    background var(--transition),
    border-color var(--transition);
}

.btn-primary, .auth-submit {
  background: linear-gradient(180deg,
    hsl(var(--accent-h), var(--accent-s), calc(var(--accent-l) + 5%)) 0%,
    var(--accent) 100%);
  color: var(--accent-contrast);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    0 1px 2px rgba(0, 0, 0, 0.22),
    0 4px 14px var(--accent-glow);
}
.btn-primary:hover:not(:disabled), .auth-submit:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 2px 4px rgba(0, 0, 0, 0.24),
    0 8px 22px var(--accent-glow);
}
.btn-primary:active:not(:disabled), .auth-submit:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.26);
}

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

/* ─── Inputs ─────────────────────────────────────────────────────────────── */
input, select, textarea,
.auth-input, .settings-input {
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.auth-input:focus, .settings-input:focus, input:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

/* ─── Surfaces / modals ────────────────────────────────────────────────────── */
.modal, .card, .acct-card, .auth-card {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Dialog backdrop: blur + dim together reads as depth; dim alone reads flat.
   NOTE: .auth-overlay is deliberately NOT in this list. Despite the name it
   is the full-screen auth PAGE container, not a scrim behind a dialog —
   applying a dim here greys out the entire sign-in screen (and turns the
   light theme muddy). It keeps the page gradient below instead. */
.modal-backdrop, .overlay {
  backdrop-filter: blur(10px) saturate(0.85);
  -webkit-backdrop-filter: blur(10px) saturate(0.85);
  background: rgba(6, 7, 14, 0.62);
}

/* Auth screen: same ambient gradient as the app shell so signing in and
   landing in the app feel like one continuous surface. */
.auth-overlay {
  background: var(--bg-gradient);
  background-attachment: fixed;
}

/* ─── Status colour usage ──────────────────────────────────────────────────
   Colour is never the ONLY signal — pair with an icon/label in markup.
   These are the AA-verified values from the token layer. */
.badge-success, .status-synced { color: var(--green); background: var(--green-soft); }
.badge-error,   .status-failed { color: var(--red);   background: var(--red-soft); }
.badge-warning, .status-pending{ color: var(--amber); background: var(--amber-soft); }
.badge-info { color: var(--info); background: var(--info-soft); }


/* ═══════════════════════════════════════════════════════════════════════════
   3 · RESPONSIVE SYSTEM
   ═══════════════════════════════════════════════════════════════════════════
   The original desktop stylesheet had ZERO breakpoints — resizing the window
   below ~1000px broke the layout. Progressive degradation below:
     <=1180  tighter gutters, narrower sidebar
     <=980   sidebar collapses to an icon rail
     <=720   sidebar hides, content goes single-column
     <=560   compact everything
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1180px) {
  .sidebar { width: 208px; }
  .content, .files-section { padding-inline: var(--sp-4); }
  .file-grid, .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

/* Icon rail — labels drop, icons centre, tooltips carry the meaning */
@media (max-width: 980px) {
  .sidebar {
    width: 68px;
    padding-inline: var(--sp-2);
    align-items: center;
  }
  .sidebar .nav-title,
  .sidebar-label,
  .sidebar .accordion-title,
  .storage-accordion .accordion-body {
    display: none;
  }
  .nav-item {
    justify-content: center;
    width: 48px;
    padding-inline: 0;
  }
  .did-chip { max-width: 168px; }
  .file-grid, .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(172px, 1fr));
  }
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .topbar { height: 54px; padding-inline: var(--sp-3); }
  .content, .files-section { padding-inline: var(--sp-3); }
  .file-grid, .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--sp-3);
  }
  .modal, .card, .auth-card {
    width: calc(100vw - var(--sp-6));
    max-width: none;
  }
  /* Stack any two-column row */
  .acct-update-row, .acct-did-row, .actions, .file-bar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-2);
  }
}

@media (max-width: 560px) {
  :root { --radius: 12px; --radius-lg: 16px; }
  .topbar { padding-inline: var(--sp-2); }
  .did-chip { max-width: 132px; font-size: var(--fs-2xs); }
  .file-grid, .files-grid { grid-template-columns: 1fr 1fr; }
  .btn, .btn-primary, .btn-secondary, .auth-submit {
    width: 100%;
    min-height: var(--tap-min);
  }
  .acct-stats { grid-template-columns: 1fr; }
}

/* Touch devices: hover effects are meaningless and cause sticky states —
   only apply lift/glow where a real pointer exists. */
@media (hover: none) {
  .file-card:hover,
  .btn:hover, .btn-primary:hover, .btn-secondary:hover,
  .nav-item:hover { transform: none; }
  .action-btn, .icon-btn, .del-btn { min-width: var(--tap-min); min-height: var(--tap-min); }
}

/* Coarse pointers get larger controls regardless of viewport width */
@media (pointer: coarse) {
  .btn, .btn-primary, .btn-secondary, .auth-submit, .nav-item {
    min-height: var(--tap-min);
  }
  input, select, textarea, .auth-input {
    min-height: var(--tap-min);
    font-size: 1rem;   /* >=16px: prevents iOS focus-zoom */
  }
}

/* Short viewports (laptop + open devtools): reclaim vertical space */
@media (max-height: 620px) {
  .topbar { height: 48px; }
  .auth-card { padding-block: var(--sp-5); }
  .sidebar { padding-block: var(--sp-2); }
}

/* Print — flatten glass, drop chrome, keep content legible on white */
@media print {
  .sidebar, .topbar, .toast, .modal-backdrop, .file-card-actions { display: none !important; }
  body { background: #fff; color: #000; overflow: visible; }
  .file-card, .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; break-inside: avoid; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ██  FILE CARD KEBAB MENU + SELECTION MODE
   ═══════════════════════════════════════════════════════════════════════════
   Replaces the always-repeating view/share/delete icon trio on every file
   row (noisy once a list has more than a couple of files) with a single
   per-row kebab (⋮), plus a WhatsApp-style select mode: toggle into it,
   tap rows to multi-select, act on all of them at once from one bar instead
   of one row at a time.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Kebab button + menu ──────────────────────────────────────────────────── */
.file-kebab {
  position: relative;
  flex-shrink: 0;
  margin-left: auto;
}

/* .file-card has `backdrop-filter`, which creates its own CSS stacking
   context — the open menu's z-index is scoped INSIDE that context, so it
   loses to the next row's own stacking context regardless of how high the
   value is (this is a containment problem, not a magnitude problem). Lifting
   the whole card that currently owns an open menu above its siblings fixes
   it without a portal. */
.file-card:has(.file-kebab-menu) {
  position: relative;
  z-index: 45;
}

.file-kebab-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-size: 17px;
  line-height: 1;
  /* Visible at rest, at full opacity — a control only discoverable on hover
     is a discomfort trap on touch devices, which have no hover at all.
     --text-dim already carries the "secondary" visual weight and is
     independently AA-verified against every surface it sits on; stacking an
     opacity multiplier on top of it double-dims the glyph below the 3:1
     non-text contrast minimum (measured 2.69:1 on the light theme). */
  color: var(--text-dim);
  transition: var(--transition-fast);
}
.file-card:hover .file-kebab-btn,
.file-kebab-btn:hover,
.file-kebab-btn:focus-visible,
.file-kebab-btn[aria-expanded="true"] {
  background: var(--surface-2);
  color: var(--text);
}

.file-kebab-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 176px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 40;
  animation: kebab-in var(--transition-fast) var(--ease-out) both;
}
@keyframes kebab-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.file-kebab-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius-xs);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--text);
  text-align: left;
  transition: var(--transition-fast);
}
.file-kebab-item:hover,
.file-kebab-item:focus-visible {
  background: var(--surface-2);
}
.file-kebab-item.danger { color: var(--red); }
.file-kebab-item.danger:hover,
.file-kebab-item.danger:focus-visible { background: var(--red-soft); }

.file-kebab-icon {
  width: 18px;
  flex-shrink: 0;
  text-align: center;
  font-size: 14px;
}

/* ─── Selection mode ───────────────────────────────────────────────────────── */
.file-card.selectable { cursor: pointer; }
.file-card.selected {
  border-color: var(--accent);
  background: linear-gradient(0deg, var(--accent-soft), var(--accent-soft)), var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}

.file-select-check {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-hover);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: transparent;
  background: var(--surface-solid);
  transition: var(--transition-fast);
}
.file-card.selected .file-select-check {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}

/* ─── Selection bar (replaces .files-head while active) ──────────────────── */
.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin: 0 0 14px;
  flex-shrink: 0;
  animation: kebab-in var(--transition) var(--ease-out) both;
}

.selection-left {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-width: 0;
}

.selection-close-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-full);
  color: var(--text-dim);
  font-size: 15px;
  flex-shrink: 0;
  transition: var(--transition-fast);
}
.selection-close-btn:hover,
.selection-close-btn:focus-visible {
  background: var(--surface-2);
  color: var(--text);
}

.selection-count {
  font-size: var(--fs-md);
  font-weight: 600;
  white-space: nowrap;
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
}

/* Select-mode toggle in the normal (non-selecting) header — a plain ghost
   button so it doesn't outrank Refresh/Delete-all visually. */
.select-toggle-btn { display: flex; align-items: center; gap: 6px; }

