/* ═══════════════════════════════════════════════════════════════
   Fortress Cloud — design system & component styles
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #050816;
  --bg-2: #0a0e19;
  --bg-3: #0d1224;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --surface-3: rgba(255, 255, 255, 0.1);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8ecf4;
  --text-2: #a8b0c2;
  --text-3: #626b80;
  --accent-1: #3b82f6;
  --accent-2: #36cafb;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --gradient: linear-gradient(135deg, #2563eb 0%, #36cafb 100%);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.42);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --sidebar-w: 264px;
  --topbar-h: 66px;
}

[data-theme="light"] {
  --bg: #f8f9fc;
  --bg-2: #f0f2f7;
  --bg-3: #e8ebf2;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-2: rgba(0, 0, 0, 0.04);
  --surface-3: rgba(0, 0, 0, 0.07);
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.14);
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --accent-1: #2563eb;
  --accent-2: #0284c7;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --gradient: linear-gradient(135deg, #2563eb 0%, #0284c7 100%);
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.06);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.12);
}

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

html { scroll-behavior: smooth; }

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

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

::selection { background: rgba(59, 130, 246, 0.4); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); background-clip: content-box; }

/* ── Background orbs ─────────────────────────────────────────── */
.bg-orbs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.5; }
.orb-1 { width: 520px; height: 520px; background: radial-gradient(circle, rgba(59, 130, 246, 0.45), transparent 70%); top: -180px; left: -120px; }
.orb-2 { width: 460px; height: 460px; background: radial-gradient(circle, rgba(54, 202, 251, 0.32), transparent 70%); bottom: -160px; right: -100px; }
.orb-3 { width: 380px; height: 380px; background: radial-gradient(circle, rgba(244, 114, 182, 0.18), transparent 70%); top: 40%; left: 55%; }

/* ── Logo ────────────────────────────────────────────────────── */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.logo-mark { width: 30px; height: 30px; flex: none; border-radius: 50%; object-fit: cover; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 18px; border-radius: 11px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; color: var(--text);
  background: var(--surface-2); transition: transform 0.12s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap; user-select: none;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--gradient); color: #fff;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { background: var(--gradient); box-shadow: 0 8px 26px rgba(59, 130, 246, 0.5); filter: brightness(1.08); }
.btn-primary:disabled { box-shadow: none; filter: none; }

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.btn-danger { background: rgba(248, 113, 113, 0.14); color: var(--danger); border-color: rgba(248, 113, 113, 0.35); }
.btn-danger:hover { background: rgba(248, 113, 113, 0.24); color: #fff; }

.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }

.btn-google { display: flex; }
.btn-google svg { width: 18px; height: 18px; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0 20px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after {
  content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35); border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px; border: none; cursor: pointer;
  color: var(--text-2); background: transparent; transition: background 0.18s ease, color 0.18s ease;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ── Inputs ──────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label, .field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--text-2);
  margin-bottom: 7px;
}
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 44px; }
.input-wrap .input-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 8px;
}
.input-wrap .input-toggle:hover { color: var(--text); background: var(--surface-2); }
.input-wrap .input-toggle svg { width: 18px; height: 18px; }

.input, select.input {
  width: 100%; padding: 11px 14px; border-radius: 11px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font-size: 14px; outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input::placeholder { color: var(--text-3); }
.input:focus { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.22); background: var(--surface-2); }
.field-invalid, .input.field-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.2); }

.form-error {
  background: rgba(248, 113, 113, 0.12); border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger); font-size: 13px; padding: 9px 12px; border-radius: 10px; margin: 4px 0 14px;
}

.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap > svg { position: absolute; right: 10px; width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }
.select {
  appearance: none; padding: 9px 34px 9px 13px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2);
  font-size: 13px; font-weight: 600; cursor: pointer; outline: none;
  transition: border-color 0.18s ease, color 0.18s ease;
}
.select:hover { color: var(--text); }
.select:focus { border-color: var(--accent-1); }
.select option { background: var(--bg-3); color: var(--text); }

/* ── Segmented control ───────────────────────────────────────── */
.segmented { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; }
.segmented button {
  width: 34px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-3); cursor: pointer; border-radius: 8px; transition: all 0.18s ease;
}
.segmented button svg { width: 16px; height: 16px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Pills ───────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.pill-ok { background: rgba(52, 211, 153, 0.14); color: var(--success); }
.pill-warn { background: rgba(251, 191, 36, 0.14); color: var(--warning); }
.pill-crit { background: rgba(248, 113, 113, 0.16); color: var(--danger); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── LANDING ─────────────────────────────────────────────────── */
.landing-body { overflow-x: hidden; }

.landing-nav {
  display: flex; align-items: center; gap: 28px; max-width: 1160px; margin: 0 auto;
  padding: 20px 24px; position: relative; z-index: 5;
}
.landing-nav-links { display: flex; gap: 26px; margin-left: auto; }
.landing-nav-links a { font-size: 14px; font-weight: 500; color: var(--text-2); transition: color 0.18s ease; }
.landing-nav-links a:hover { color: var(--text); }
.landing-nav-cta { display: flex; gap: 10px; }

.hero { max-width: 1160px; margin: 0 auto; padding: 70px 24px 90px; text-align: center; position: relative; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text-2);
  padding: 7px 15px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); margin-bottom: 26px;
}
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); }
.hero-title { font-size: clamp(38px, 6vw, 64px); line-height: 1.08; letter-spacing: -0.03em; font-weight: 800; }
.gradient-text {
  background: var(--gradient); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub { max-width: 620px; margin: 20px auto 34px; font-size: 18px; color: var(--text-2); }
.hero-cta { display: flex; gap: 14px; justify-content: center; margin-bottom: 60px; }

.hero-card {
  max-width: 560px; margin: 0 auto; padding: 22px; border-radius: 20px; text-align: left;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--border-strong); backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg); transform: rotate(-1deg);
  animation: float 7s ease-in-out infinite;
}
.hero-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.hero-card-title { font-weight: 700; font-size: 15px; }
.hc-row { margin-bottom: 10px; }
.file-chip {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); font-size: 14px;
}
.file-chip svg { width: 18px; height: 18px; color: var(--accent-2); flex: none; }
.file-chip b { margin-left: auto; font-weight: 600; color: var(--text-2); font-size: 13px; }
.hc-storage { margin-top: 16px; padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border); }
.hc-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.hc-bar span { display: block; height: 100%; border-radius: 99px; background: var(--gradient); }
.hc-storage-text { display: block; margin-top: 8px; font-size: 12px; color: var(--text-3); font-weight: 600; }

.section { max-width: 1160px; margin: 0 auto; padding: 80px 24px; }
.section-alt { max-width: none; }
.section-title { font-size: clamp(28px, 4vw, 40px); letter-spacing: -0.025em; font-weight: 800; line-height: 1.15; }
.section-sub { color: var(--text-2); font-size: 16px; margin-top: 12px; max-width: 560px; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-top: 44px; }
.feature-card {
  padding: 26px 24px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.feature-card:hover { transform: translateY(-5px); border-color: var(--border-strong); background: var(--surface-2); }
.feature-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 18px; }
.gradient-violet { background: rgba(59, 130, 246, 0.18); }
.gradient-blue { background: rgba(54, 202, 251, 0.16); }
.gradient-green { background: rgba(52, 211, 153, 0.16); }
.gradient-orange { background: rgba(251, 146, 60, 0.16); }
.feature-card h3 { font-size: 17px; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-2); }

.section-alt { background: linear-gradient(180deg, rgba(59, 130, 246, 0.05), transparent); border-block: 1px solid var(--border); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; max-width: 1160px; margin: 0 auto; padding: 60px 24px; }
.check-list { list-style: none; margin-top: 26px; display: grid; gap: 13px; }
.check-list li { display: flex; gap: 12px; align-items: flex-start; color: var(--text-2); font-size: 15px; }
.check-list li::before {
  content: "✓"; flex: none; width: 20px; height: 20px; border-radius: 7px; margin-top: 2px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800;
  background: var(--gradient); color: #fff;
}

.shield-card {
  padding: 34px; border-radius: 22px; background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-strong); backdrop-filter: blur(16px); text-align: center; box-shadow: var(--shadow-lg);
}
.shield-icon { width: 64px; height: 64px; margin-bottom: 16px; }
.shield-card h3 { font-size: 19px; margin-bottom: 10px; }
.shield-card p { color: var(--text-2); font-size: 14px; }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 22px; margin-top: 44px; }
.step { padding: 26px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); position: relative; }
.step-num {
  width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: var(--gradient); color: #fff; font-weight: 800; font-size: 16px; margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
}
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--text-2); }

.storage-demo {
  padding: 30px; border-radius: 20px; background: linear-gradient(160deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
}
.storage-demo-head { display: flex; align-items: center; justify-content: space-between; font-weight: 700; margin-bottom: 18px; }
.storage-demo-bar { height: 14px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.storage-demo-bar span { display: block; height: 100%; border-radius: 99px; background: var(--gradient); }
.storage-demo-labels { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; color: var(--text-2); font-weight: 600; }
.storage-demo-note { margin-top: 18px; font-size: 13px; color: var(--text-3); padding-top: 16px; border-top: 1px solid var(--border); }

.cta { max-width: 760px; margin: 40px auto 90px; padding: 60px 30px; text-align: center; border-radius: 28px;
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.16), rgba(54, 202, 251, 0.08));
  border: 1px solid var(--border-strong); position: relative; overflow: hidden;
}
.cta h2 { font-size: clamp(26px, 4vw, 38px); letter-spacing: -0.03em; font-weight: 800; }
.cta p { color: var(--text-2); margin: 14px auto 28px; font-size: 16px; max-width: 480px; }

.footer { border-top: 1px solid var(--border); background: var(--bg-2); }
.footer-inner { max-width: 1160px; margin: 0 auto; padding: 44px 24px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.footer-tag { color: var(--text-3); font-size: 14px; }
.footer-links { display: flex; gap: 22px; }
.footer-links a { color: var(--text-2); font-size: 14px; font-weight: 500; }
.footer-links a:hover { color: var(--text); }
.footer-copy { color: var(--text-3); font-size: 13px; margin-top: 8px; }

/* ── AUTH pages ──────────────────────────────────────────────── */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 30px 20px; }
.auth-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; }
.auth-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; margin-bottom: 26px; }
.auth-card {
  width: 100%; padding: 34px 32px; border-radius: 22px;
  background: linear-gradient(170deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border-strong); backdrop-filter: blur(20px); box-shadow: var(--shadow-lg);
  animation: rise 0.5s ease both;
}
.auth-title { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.auth-sub { color: var(--text-2); margin: 6px 0 24px; font-size: 15px; }
.auth-alt { text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-2); }
.auth-alt a, .auth-foot a { color: var(--accent-2); font-weight: 600; }
.auth-alt a:hover, .auth-foot a:hover { text-decoration: underline; }
.auth-foot { margin-top: 22px; font-size: 13px; color: var(--text-3); text-align: center; }

.strength-meter { display: flex; gap: 5px; margin-top: 9px; }
/* Vault setup: keep the strength meter visually separate from "Create vault". */
.vault-gate-card .strength-wrap { margin: 14px 0 20px; }
.sm-bar { flex: 1; height: 4px; border-radius: 99px; background: rgba(255, 255, 255, 0.1); transition: background 0.25s ease; }
.sm-bar.lvl-1 { background: var(--danger); }
.sm-bar.lvl-2 { background: var(--warning); }
.sm-bar.lvl-3 { background: var(--warning); }
.sm-bar.lvl-4 { background: var(--success); }
.sm-bar.lvl-5 { background: var(--success); }
.strength-label { font-size: 12px; color: var(--text-3); margin-top: 6px; }

/* ── APP SHELL ───────────────────────────────────────────────── */
.app-body { height: 100vh; height: 100dvh; overflow: hidden; }
.shell { display: flex; height: 100vh; height: 100dvh; }

.sidebar {
  width: var(--sidebar-w); flex: none; height: 100vh; height: 100dvh; display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.012));
  border-right: 1px solid var(--border); backdrop-filter: blur(20px); z-index: 40;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 18px 14px; flex: none; }
.sidebar-close { display: none; }

/* Scrollable middle region — keeps the head + foot pinned while nav/storage
   can scroll, so small viewports never cut off the logout/settings buttons. */
.sidebar-scroll { flex: 1 1 auto; overflow-y: auto; min-height: 0; overscroll-behavior: contain; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: var(--text-2); font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
  position: relative;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: #fff; }
.nav-icon { display: inline-flex; }
.nav-icon svg { width: 19px; height: 19px; }
.nav-item.active .nav-icon svg { color: var(--accent-2); }
.nav-dot {
  position: absolute; top: 6px; right: 9px;
  min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px;
  background: #e53935; color: #fff;
  font-size: 10px; font-weight: 800; line-height: 17px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--surface-1);
}
.nav-dot[hidden] { display: none; }

.sidebar-storage { margin: 14px 14px; padding: 14px 15px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.sidebar-storage-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; }
.sidebar-storage-title svg { width: 16px; height: 16px; color: var(--accent-2); }
.storage-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.storage-bar span { display: block; height: 100%; border-radius: 99px; background: var(--gradient); transition: width 0.5s ease; }
.storage-bar span.warn { background: linear-gradient(90deg, var(--warning), #fb7185); }
.sidebar-storage-text { font-size: 12px; color: var(--text-3); font-weight: 600; margin-top: 8px; }

.sidebar-merlin-usage { margin: 0 14px 14px; padding: 10px 15px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.sidebar-merlin-text { font-size: 12px; color: var(--text-3); font-weight: 600; }

.sidebar-foot { margin-top: auto; flex: none; display: flex; align-items: center; gap: 6px; padding: 14px 14px 18px; border-top: 1px solid var(--border); }
.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .icon-btn { flex: none; }

.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--gradient); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: 0.02em;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}
.avatar-lg { width: 58px; height: 58px; font-size: 20px; }
.avatar-btn { border: none; cursor: pointer; }

.sidebar-backdrop { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* The top bar (search field + avatar) is kept ONLY on the "My files" page.
   Every other page removes it; the mobile menu then floats as a small button. */
body.no-topbar .topbar { display: none; }
.hamburger-float { display: none; }

.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; border-bottom: 1px solid var(--border); background: rgba(7, 10, 18, 0.72);
  backdrop-filter: blur(18px); position: relative; z-index: 30;
  transition: height 0.25s ease, padding 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}
.hamburger { display: none; }
.topbar-search {
  flex: 1; max-width: 480px; display: flex; align-items: center; gap: 10px;
  padding: 0 14px; height: 40px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.topbar-search:focus-within { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18); background: var(--surface-3); }
.topbar-search svg { width: 17px; height: 17px; flex: none; }
.topbar-search input { flex: 1; border: none; background: transparent; color: var(--text); font-size: 14px; outline: none; }
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-right { margin-left: auto; }

.content { flex: 1; overflow-y: auto; padding: 28px 34px 60px; max-width: 1220px; width: 100%; margin: 0 auto; }

/* ── Views ───────────────────────────────────────────────────── */
.view-head { margin-bottom: 24px; }
.trash-empty-btn { flex: none; }
.view-head.trash-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.view-head.trash-head .view-sub { width: 100%; }
.view-title { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; display: flex; align-items: center; gap: 10px; }
.view-title svg { width: 22px; height: 22px; color: var(--accent-2); }
.view-sub { color: var(--text-2); font-size: 14px; margin-top: 4px; }
.view-loading { min-height: 300px; }

.files-head { margin-bottom: 6px; }
.breadcrumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 16px; min-height: 28px; }
.crumb {
  border: none; background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600;
  cursor: pointer; padding: 4px 8px; border-radius: 8px; transition: all 0.16s ease;
}
.crumb:hover { background: var(--surface-2); color: var(--text); }
.crumb.current { color: var(--text); pointer-events: none; }
.crumb .ic { width: 15px; height: 15px; vertical-align: -2.5px; }
.crumb-sep { color: var(--text-3); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

/* ── Dashboard cards ─────────────────────────────────────────── */
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 34px; }
.dash-card {
  padding: 24px; border-radius: var(--radius); background: linear-gradient(170deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border); transition: border-color 0.2s ease, transform 0.2s ease;
}
.dash-card:hover { border-color: var(--border-strong); }
.dash-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dash-card-title { display: flex; align-items: center; gap: 9px; font-size: 14px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; }
.dash-card-title svg { width: 17px; height: 17px; color: var(--accent-2); }
.dash-big { font-size: 34px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 14px; }
.dash-big span { font-size: 15px; color: var(--text-3); font-weight: 600; margin-left: 4px; }
.storage-bar.big { height: 11px; }
.storage-bar.big span.warn { background: linear-gradient(90deg, var(--warning), #fb7185); }
.storage-bar.big span.crit { background: linear-gradient(90deg, var(--danger), var(--warning)); }
.storage-bar.big.warn span { background: linear-gradient(90deg, var(--warning), #fb7185); }
.storage-bar.big.crit span { background: linear-gradient(90deg, var(--danger), var(--warning)); }
.dash-storage-stats { display: flex; gap: 18px; margin: 14px 0 20px; font-size: 13px; color: var(--text-2); font-weight: 600; flex-wrap: wrap; }
.storage-card .btn { margin-top: 4px; }

.dash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.dash-action {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--border); cursor: pointer;
  color: var(--text); font-weight: 600; font-size: 14px; transition: all 0.18s ease; text-align: left;
}
.dash-action:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-2px); }
.dash-action-icon { width: 38px; height: 38px; flex: none; border-radius: 11px; display: flex; align-items: center; justify-content: center; }
.dash-action-icon svg { width: 19px; height: 19px; }
.violet { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.blue { background: rgba(54, 202, 251, 0.16); color: #67e8f9; }
.amber { background: rgba(251, 191, 36, 0.16); color: #fcd34d; }
.red { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }

.dash-section { margin-top: 6px; }
.dash-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dash-section-title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }

/* ── File grid ───────────────────────────────────────────────── */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 16px; }

.file-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px; cursor: default; transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  animation: rise 0.35s ease both; outline: none;
}
.file-card:hover { transform: translateY(-3px); border-color: var(--border-strong); background: var(--surface-2); box-shadow: var(--shadow); }
.file-card:focus-visible { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); }
.file-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 10px; }
.file-card-preview { display: flex; align-items: center; justify-content: center; height: 64px; flex: 1; min-width: 0; }
.file-card-preview .file-icon { filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45)); }
.file-card.is-image { cursor: zoom-in; }
.file-card-actions { display: flex; gap: 2px; opacity: 0; transition: opacity 0.16s ease; }
.file-card:hover .file-card-actions, .file-card:focus-visible .file-card-actions { opacity: 1; }
.file-card-actions .icon-btn { width: 30px; height: 30px; }
.file-card-name {
  font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.file-card-meta { font-size: 12px; color: var(--text-3); }

.preview-folder { width: 56px; height: 56px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
  background: rgba(59, 130, 246, 0.16); border: 1px solid rgba(59, 130, 246, 0.3); color: #93c5fd; }
.preview-folder svg { width: 30px; height: 30px; }
.preview-folder.sm { width: 40px; height: 40px; border-radius: 11px; }
.preview-folder.sm svg { width: 22px; height: 22px; }
.preview-folder.lg { width: 64px; height: 64px; border-radius: 16px; }
.preview-folder.lg svg { width: 34px; height: 34px; }

.file-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border-strong); }
.file-row .file-thumb { width: 38px; height: 38px; border-radius: 9px; }

.star-btn.active { color: var(--warning); }
.star-btn.active svg { width: 18px; height: 18px; }

/* ── File list ───────────────────────────────────────────────── */
.file-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.file-row {
  display: grid; grid-template-columns: 32px 46px minmax(160px, 1fr) 130px 90px 150px 88px;
  align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border);
  transition: background 0.14s ease; cursor: default; outline: none;
}
.col-check { display: flex; align-items: center; justify-content: center; }
.col-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent-1); }
.bulk-actions-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--accent-1); color: #fff; border-radius: 0 0 14px 14px;
  font-size: 13px; font-weight: 600;
}
.bulk-actions-bar .btn { color: #fff; border-color: rgba(255,255,255,0.3); }
.bulk-actions-bar .btn:hover { background: rgba(255,255,255,0.15); }
.bulk-actions-bar .btn-danger { border-color: rgba(255,255,255,0.5); }
.bulk-count { margin-right: auto; }
.file-row:first-child { border-top: none; }
.file-row:not(.file-row-head):hover { background: var(--surface-2); }
.file-row-head { background: var(--surface-2); font-size: 12px; color: var(--text-3); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; cursor: default; }
.col-icon { display: flex; align-items: center; }
.col-name { min-width: 0; display: flex; flex-direction: column; }
.row-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-path { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.col-type, .col-size, .col-date { font-size: 13px; color: var(--text-2); }
.col-actions { display: flex; justify-content: flex-end; gap: 2px; opacity: 0; transition: opacity 0.15s ease; }
.file-row:hover .col-actions { opacity: 1; }
[data-kind="folder"][data-action="open-folder"] { cursor: pointer; }

/* ── Empty states & skeletons ────────────────────────────────── */
.empty-state { text-align: center; padding: 70px 20px; animation: rise 0.4s ease both; }
.empty-icon {
  width: 84px; height: 84px; margin: 0 auto 20px; border-radius: 26px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, rgba(59, 130, 246, 0.2), rgba(54, 202, 251, 0.12));
  border: 1px solid var(--border-strong); box-shadow: var(--shadow);
}
.empty-icon svg { width: 40px; height: 40px; color: var(--accent-2); }
.empty-state h3 { font-size: 19px; font-weight: 800; margin-bottom: 8px; }
.empty-state p { color: var(--text-2); font-size: 14px; margin-bottom: 22px; }

.sk-card { padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.sk { background: rgba(255, 255, 255, 0.07); border-radius: 8px; position: relative; overflow: hidden; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  transform: translateX(-100%); animation: shimmer 1.4s infinite;
}
.sk-icon { height: 56px; border-radius: 12px; margin-bottom: 12px; }
.sk-line { height: 12px; margin-bottom: 8px; }
.w70 { width: 70%; }
.w40 { width: 40%; }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 5, 10, 0.68); backdrop-filter: blur(6px); padding: 20px;
  animation: fade 0.2s ease both;
}
.modal {
  width: 100%; max-width: 460px; max-height: 88vh; display: flex; flex-direction: column;
  background: linear-gradient(175deg, #131827, #0c101c); border: 1px solid var(--border-strong);
  border-radius: 20px; box-shadow: var(--shadow-lg); overflow: hidden;
  animation: pop 0.28s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.modal-wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; }
.modal-title { font-size: 17px; font-weight: 800; }
.modal-close { width: 32px; height: 32px; }
.modal-body { padding: 8px 22px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; }
.modal-foot .upload-summary { margin-right: auto; font-size: 13px; color: var(--text-3); font-weight: 600; }
.confirm-msg { color: var(--text-2); font-size: 14px; line-height: 1.6; }

/* Move dialog */
.move-tree { max-height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin-top: 6px; }
.move-option {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 10px;
  cursor: pointer; font-size: 14px; transition: background 0.14s ease; border: 1px solid transparent;
}
.move-option:hover { background: var(--surface-2); }
.move-option.selected { background: var(--accent-soft); border-color: rgba(59, 130, 246, 0.4); }
.move-option svg { width: 17px; height: 17px; color: var(--accent-2); flex: none; }
.move-radio { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--text-3); flex: none; transition: all 0.15s ease; }
.move-option.selected .move-radio { border-color: var(--accent-2); background: radial-gradient(circle, var(--accent-2) 35%, transparent 40%); }
.move-indent { flex: none; }

/* Details dialog */
.details-head { display: flex; align-items: center; gap: 16px; margin: 6px 0 18px; }
.details-name { font-size: 17px; font-weight: 800; word-break: break-word; }
.details-sub { font-size: 13px; color: var(--text-3); font-weight: 600; }
.details-rows { display: flex; flex-direction: column; }
.details-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-top: 1px solid var(--border); font-size: 14px; }
.details-row:first-child { border-top: none; }
.details-key { color: var(--text-3); font-weight: 600; flex: none; }
.details-val { color: var(--text); text-align: right; word-break: break-word; }

/* Share dialog */
.share-body { padding: 4px 0 6px; }
.share-note { color: var(--text-2); font-size: 13.5px; line-height: 1.55; margin: 6px 0 14px; }
.share-note.share-error { color: var(--danger); }
.share-url-row { display: flex; gap: 10px; margin-bottom: 12px; }
.share-url { flex: 1; min-width: 0; font-size: 13px; color: var(--text-2); }
.share-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.share-actions .btn { flex: none; }

/* ── Upload panel ────────────────────────────────────────────── */
.dropzone {
  border: 2px dashed var(--border-strong); border-radius: 16px; padding: 34px 20px;
  text-align: center; cursor: pointer; transition: all 0.2s ease; margin-bottom: 14px; background: rgba(0, 0, 0, 0.15);
}
.dropzone:hover, .dropzone.dragging { border-color: var(--accent-1); background: var(--accent-soft); }
.dz-icon { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); }
.dz-icon svg { width: 30px; height: 30px; color: var(--accent-2); }
.dz-title { font-size: 16px; font-weight: 800; }
.dz-sub { font-size: 13px; color: var(--text-2); margin: 4px 0 14px; }
.dz-limit { font-size: 12px; color: var(--text-3); margin-top: 14px; }

.upload-queue { display: flex; flex-direction: column; gap: 10px; max-height: 240px; overflow-y: auto; }
.upload-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.upload-item .file-icon { flex: none; }
.ui-info { flex: 1; min-width: 0; }
.ui-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ui-progress { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); margin: 7px 0; overflow: hidden; }
.ui-progress-fill { height: 100%; border-radius: 99px; background: var(--gradient); transition: width 0.15s ease; }
.ui-meta { font-size: 12px; color: var(--text-3); }
.upload-item.done .ui-progress-fill { background: var(--success); }
.upload-item.done .ui-meta { color: var(--success); }
.upload-item.error .ui-progress-fill { background: var(--danger); }
.upload-item.error .ui-meta { color: var(--danger); }
.upload-item .icon-btn { width: 30px; height: 30px; }

/* ── Toasts ──────────────────────────────────────────────────── */
.toast-root { position: fixed; bottom: 22px; right: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px; min-width: 260px; max-width: 380px;
  padding: 13px 16px; border-radius: 13px; font-size: 14px; font-weight: 600;
  background: linear-gradient(170deg, #161c2c, #10141f); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); transform: translateX(120%); opacity: 0; transition: all 0.32s cubic-bezier(0.34, 1.3, 0.64, 1);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast-icon { width: 28px; height: 28px; flex: none; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.toast-icon svg { width: 16px; height: 16px; color: #fff; }
.toast-success .toast-icon { background: rgba(52, 211, 153, 0.9); }
.toast-error .toast-icon { background: rgba(248, 113, 113, 0.9); }
.toast-info .toast-icon { background: rgba(96, 165, 250, 0.9); }

/* ── Context menu ────────────────────────────────────────────── */
.context-menu {
  position: fixed; z-index: 150; min-width: 200px; padding: 6px; border-radius: 13px;
  background: linear-gradient(175deg, #171d2d, #101420); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg); opacity: 0; transform: scale(0.96) translateY(-4px);
  transition: all 0.15s ease; transform-origin: top right;
}
.context-menu.show { opacity: 1; transform: scale(1) translateY(0); }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px;
  background: transparent; border: none; border-radius: 9px; color: var(--text);
  font-size: 14px; font-weight: 600; cursor: pointer; text-align: left; transition: background 0.13s ease;
}
.menu-item:hover { background: var(--surface-3); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: rgba(248, 113, 113, 0.14); }
.menu-item.disabled { opacity: 0.4; cursor: not-allowed; }
.menu-item-icon { display: inline-flex; }
.menu-item-icon svg { width: 17px; height: 17px; }

/* ── Settings ────────────────────────────────────────────────── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.settings-col { display: flex; flex-direction: column; gap: 20px; }
.settings-account { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.settings-account-meta { display: flex; flex-direction: column; }
.settings-name { font-size: 17px; font-weight: 800; }
.settings-email { font-size: 13px; color: var(--text-3); }
.settings-note { font-size: 13px; color: var(--text-2); margin: 4px 0 14px; }
.danger-card { border-color: rgba(248, 113, 113, 0.25); }
.danger-card .dash-card-title { color: var(--danger); }

.api-docs-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--accent-2); }
.api-docs-link svg { width: 14px; height: 14px; }
.api-docs-link:hover { text-decoration: underline; }
.api-key-box {
  display: flex; align-items: center; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 11px 14px; margin-bottom: 14px;
}
.api-key-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px; letter-spacing: 0.02em; color: var(--text);
  word-break: break-all; line-height: 1.4;
}
.api-key-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.92) translateY(8px); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes float { 0%, 100% { transform: rotate(-1deg) translateY(0); } 50% { transform: rotate(-1deg) translateY(-12px); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes pulse-soft { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }

/* ── ANALYTICS CONSOLE ───────────────────────────────────────── */
.admin-page .topbar-search { display: none; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.admin-grid .dash-card { min-width: 0; }
.admin-grid .card-wide { grid-column: 1 / -1; }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px;
}
.kpi-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 8px; }
.kpi-value { font-size: 26px; font-weight: 800; color: var(--text); line-height: 1.1; }
.kpi-sub { font-size: 12px; color: var(--text-3); margin-top: 6px; }

.chart-empty { padding: 28px; text-align: center; color: var(--text-3); font-size: 14px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-val { fill: var(--text-3); font-size: 10px; font-family: inherit; }
.chart-day { fill: var(--text-3); font-size: 10px; font-family: inherit; }
.chart-total { margin-top: 8px; font-size: 13px; color: var(--text-2); font-weight: 600; }

.detail-row {
  display: flex; justify-content: space-between; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-2);
}
.detail-row:last-child { border-bottom: none; }
.detail-row b { color: var(--text); font-weight: 600; text-align: right; }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 540px; }
.admin-table th {
  text-align: left; padding: 9px 12px; color: var(--text-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border-strong);
}
.admin-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); color: var(--text); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: var(--surface); }
.admin-table .sub { font-size: 12px; color: var(--text-3); }

/* Admin plan picker */
.plan-opt { text-align: left; min-width: 110px; padding: 10px 14px !important; line-height: 1.35; }
.plan-opt:hover { border-color: var(--accent-1); }
.pill-accent { background: var(--accent-soft); color: var(--accent-1); border: 1px solid rgba(59,130,246,.25); border-radius: 20px; padding: 3px 10px; font-size: 12px; font-weight: 600; display: inline-block; }

/* ── MERLIN AI ASSISTANT ──────────────────────────────────── */
body.merlin-page .content {
  overflow: hidden; padding: 0; max-width: none; margin: 0;
  display: flex; flex-direction: column;
}
.merlin-app { display: flex; flex: 1; min-height: 0; }
.merlin-sidebar {
  width: 340px; flex: none; background: var(--bg-2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden;
}
.merlin-sidebar .btn-primary.btn-block { width: auto; display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 12px 6px; }
.merlin-conv-list { flex: 1; overflow-y: auto; padding: 8px; }
.merlin-conv-section { }
.merlin-conv-divider { height: 1px; background: var(--border); margin: 6px 12px; }
.merlin-conv-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 10px; border-radius: 10px; cursor: pointer;
  color: var(--text-2); font-size: 14px; margin-bottom: 3px; gap: 6px;
}
.merlin-conv-item:hover { background: var(--surface); color: var(--text); }
.merlin-conv-item.active { background: var(--accent-soft); color: var(--accent-1); }
.merlin-conv-pin-icon { font-size: 14px; margin-right: 5px; flex-shrink: 0; }
.merlin-conv-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; font-size: 14.5px; }
.merlin-conv-pin, .merlin-conv-del {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  padding: 7px 8px; border-radius: 8px; opacity: 0; transition: opacity .15s, color .15s, background .15s; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.merlin-conv-item:hover .merlin-conv-pin, .merlin-conv-item:hover .merlin-conv-del { opacity: 1; }
.merlin-conv-pin:hover { color: var(--accent-1); background: var(--accent-soft); }
.merlin-conv-del:hover { color: var(--danger); background: rgba(239,68,68,.1); }
.merlin-usage { padding: 12px 14px; border-top: 1px solid var(--border); flex-shrink: 0; }
.merlin-usage-text { font-size: 12px; color: var(--text-3); text-align: center; }
.merlin-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.merlin-messages {
  flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; min-height: 0;
}
.merlin-welcome {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; text-align: center; color: var(--text-2); padding: 40px 20px;
}
.merlin-welcome-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.merlin-welcome h2 { font-size: 24px; color: var(--text); margin-bottom: 8px; }
.merlin-welcome p { max-width: 400px; margin-bottom: 24px; }
.merlin-examples { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 500px; }
.merlin-example {
  background: var(--surface); border: 1px solid var(--border); border-radius: 20px;
  padding: 8px 16px; font-size: 13px; color: var(--text-2); cursor: pointer;
  transition: all .15s;
}
.merlin-example:hover { border-color: var(--accent-1); color: var(--accent-1); background: var(--accent-soft); }
.merlin-msg { display: flex; max-width: 720px; width: 100%; margin: 0 auto; }
.merlin-msg-user { justify-content: flex-end; }
.merlin-msg-assistant { justify-content: flex-start; }
.merlin-msg-content {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px;
  line-height: 1.6; max-width: 80%; word-wrap: break-word;
}
.merlin-msg-user .merlin-msg-content { background: var(--accent-1); color: #fff; border-radius: var(--radius-sm) var(--radius-sm) 4px var(--radius-sm); }
.merlin-msg-assistant .merlin-msg-content { background: var(--surface-2); color: var(--text); border-radius: var(--radius-sm) var(--radius-sm) var(--radius-sm) 4px; }
.merlin-attach-ref {
  display: inline-block; font-size: 12.5px; font-weight: 700;
  color: var(--accent-1); background: var(--accent-soft);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 3px 10px; margin-bottom: 8px;
}
.merlin-msg-content code { background: rgba(0,0,0,.15); padding: 1px 5px; border-radius: 4px; font-size: 13px; }
.merlin-typing .merlin-msg-content { color: var(--text-3); }
.merlin-dots span { animation: merlin-blink 1.2s infinite; }
.merlin-dots span:nth-child(2) { animation-delay: 0.2s; }
.merlin-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Thinking state — Merlin avatar (round, spinning) + 150% text */
.merlin-typing { display: flex; align-items: center; gap: 14px; }
.merlin-thinking-avatar {
  width: 64px; height: 64px; flex: none; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 3px var(--accent-soft), 0 0 18px rgba(0, 0, 0, .25);
  animation: merlin-spin 1.6s linear infinite;
}
.merlin-thinking-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes merlin-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.merlin-thinking-text {
  font-size: 150%;
  color: var(--text-2); font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  .merlin-thinking-avatar { animation: none; }
}
@keyframes merlin-blink { 0%,60%,100% { opacity: 0.2; } 30% { opacity: 1; } }

/* Tool status — a clear "working on it" card with an animated progress bar */
.merlin-tool-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 14px; padding: 11px 14px; min-width: 220px;
}
.merlin-tool-spinner {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  border: 2.5px solid var(--border-strong); border-top-color: var(--accent-1);
  animation: merlin-spin 0.7s linear infinite;
}
.merlin-tool-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.merlin-tool-label { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.merlin-progress { height: 5px; border-radius: 99px; background: rgba(120, 130, 155, 0.22); overflow: hidden; }
.merlin-progress-bar {
  height: 100%; width: 45%; border-radius: 99px; background: var(--gradient);
  animation: merlin-progress-slide 1.1s ease-in-out infinite;
}
@keyframes merlin-progress-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}
@media (prefers-reduced-motion: reduce) {
  .merlin-tool-spinner, .merlin-progress-bar { animation: none; }
  .merlin-progress-bar { width: 100%; }
}
.merlin-composer { padding: 16px 24px; border-top: 1px solid var(--border); flex-shrink: 0; }
.merlin-input-wrap {
  display: flex; align-items: flex-end; gap: 8px; max-width: 720px; margin: 0 auto;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px;
}
.merlin-input-wrap:focus-within { border-color: var(--accent-1); }
.merlin-input {
  flex: 1; background: none; border: none; color: var(--text); font-size: 14px;
  font-family: var(--font); resize: none; outline: none; min-height: 24px; max-height: 150px;
}
.merlin-attach-btn, .merlin-voice-btn {
  background: none; border: none; color: var(--accent-2); cursor: pointer;
  padding: 4px; border-radius: 6px; display: flex; align-items: center; gap: 4px;
  transition: color .15s, background .15s; flex-shrink: 0;
}
.merlin-attach-btn:hover, .merlin-voice-btn:hover { color: var(--accent-1); background: var(--accent-soft); }
.merlin-voice-label { font-size: 12px; font-weight: 700; color: var(--accent-2); }
/* Voice states */
.merlin-voice-btn.voice-requesting { color: var(--text-3); cursor: wait; }
.merlin-voice-btn.voice-recording { color: #e53935; animation: merlin-pulse 1s infinite; }
.merlin-voice-btn.voice-recording .merlin-voice-label { color: #e53935; }
.merlin-voice-btn.voice-processing { color: var(--warning); cursor: wait; }
.merlin-voice-btn.voice-processing svg { animation: merlin-spin 1s linear infinite; }
.merlin-voice-btn.voice-error { color: var(--danger); }
@keyframes merlin-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes merlin-spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.merlin-send {
  background: var(--accent-1); border: none; color: #fff; border-radius: 8px;
  width: 36px; height: 36px; cursor: pointer; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; transition: opacity .15s;
}
.merlin-send:hover { opacity: 0.85; }
.merlin-send:disabled { opacity: 0.4; cursor: not-allowed; }
.merlin-attach-preview {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px; max-width: 720px; margin: 6px auto 0;
  padding: 6px 12px; border-radius: 8px; background: var(--surface-3);
  font-size: 12px; color: var(--text-2);
}
.merlin-attach-chip {
  display: inline-flex; align-items: center; gap: 4px; max-width: 220px;
  padding: 3px 6px 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text);
}
.merlin-attach-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.merlin-upload-progress { max-width: 720px; margin: 8px auto 0; font-size: 12px; color: var(--text-2); }
.merlin-upload-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.merlin-upload-fill { height: 100%; width: 0%; border-radius: 999px; background: var(--gradient); transition: width .15s ease; }
.merlin-attach-remove {
  background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 16px; padding: 0 4px;
}
.merlin-attach-remove:hover { color: var(--danger); }
.merlin-msg-content strong { font-weight: 700; }
.merlin-msg-content em { font-style: italic; }
.merlin-msg-content a { color: var(--accent-2); text-decoration: underline; word-break: break-all; }
.merlin-msg-content a:hover { color: var(--accent-1); }
.merlin-md-h2 { font-size: 17px; font-weight: 800; margin: 14px 0 8px; line-height: 1.35; letter-spacing: -0.01em; }
.merlin-md-h3 { font-size: 15.5px; font-weight: 700; margin: 12px 0 6px; line-height: 1.4; }
.merlin-md-h4 { font-size: 14px; font-weight: 700; margin: 10px 0 6px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.merlin-md-hr { border: none; border-top: 1px solid var(--border); margin: 12px 0; }
.merlin-md-quote { border-left: 3px solid var(--accent-1); padding: 6px 12px; margin: 8px 0; color: var(--text-2); background: var(--surface); border-radius: 0 8px 8px 0; }
.merlin-md-ul, .merlin-md-ol { margin: 8px 0 8px 18px; padding: 0; }
.merlin-md-ul li, .merlin-md-ol li { margin: 4px 0; line-height: 1.5; }
.merlin-md-ul { list-style: disc; }
.merlin-md-ol { list-style: decimal; }
.merlin-code-block { margin: 10px 0; padding: 12px 14px; border-radius: 10px; background: rgba(0,0,0,.28); border: 1px solid var(--border); overflow-x: auto; }
.merlin-code-block code { background: none; padding: 0; font-size: 12.5px; line-height: 1.55; white-space: pre; }
[data-theme="light"] .merlin-code-block { background: #f0f2f7; }
[data-theme="light"] .merlin-md-quote { background: var(--bg-2); }

/* ── MERLIN SETTINGS (usage + memory) ──────────────────────── */
.merlin-dash-card { display: flex; flex-direction: column; }
.merlin-prompt-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.merlin-prompt-chip {
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 600;
  cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.merlin-prompt-chip:hover { border-color: var(--accent-1); color: var(--accent-1); background: var(--accent-soft); }
.merlin-memory-form { display: flex; gap: .5rem; margin-top: .75rem; flex-wrap: wrap; }
.merlin-memory-form input {
  flex: 1; min-width: 140px; padding: 8px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 13px;
}
.merlin-memory-form input:focus { outline: none; border-color: var(--accent-1); }
.merlin-memory-val { display: inline-flex; align-items: center; gap: .5rem; min-width: 0; }
.merlin-memory-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.merlin-memory-edit {
  width: 100%; min-width: 220px; min-height: 60px; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--accent-1); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 13px; resize: vertical;
}

/* ── IN-BROWSER OFFICE EDITOR ───────────────────────────────── */
.editor-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.editor-title-wrap { flex: 1; min-width: 0; }
.editor-title {
  font-size: 19px; font-weight: 800; color: var(--text); letter-spacing: -0.01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.editor-sub { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.save-status.saved { color: var(--success); }
.save-status.error { color: var(--danger); }
.save-status.saving { color: var(--accent-2); }
.editor-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.editor-hint { margin-top: 10px; font-size: 12px; color: var(--text-3); }

/* Spreadsheet grid */
.sheet-tabs { display: flex; align-items: flex-end; gap: 2px; margin-bottom: 10px; overflow-x: auto; }
.sheet-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px;
  background: var(--surface); border: 1px solid var(--border); border-bottom: none;
  border-radius: 10px 10px 0 0; color: var(--text-2); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.sheet-tab.active { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); box-shadow: inset 0 2px 0 var(--accent-1); }
.sheet-tab-close { font-size: 14px; line-height: 1; color: var(--text-3); padding: 0 2px; border-radius: 4px; }
.sheet-tab-close:hover { color: var(--danger); background: var(--surface-3); }
.sheet-tab-add {
  display: inline-flex; align-items: center; justify-content: center; padding: 8px 10px;
  background: transparent; border: 1px dashed var(--border-strong); border-radius: 10px;
  color: var(--text-3); cursor: pointer;
}
.sheet-tab-add:hover { color: var(--accent-2); border-color: var(--accent-1); }
.sheet-tab-add svg { width: 16px; height: 16px; }
.sheet-host { overflow: auto; max-height: calc(100vh - 360px); border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.sheet-grid { border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 100%; }
.sheet-grid th, .sheet-grid td { border: 1px solid var(--border); }
.sheet-grid th.corner, .sheet-grid th.row-head, .sheet-grid th.col-head {
  background: var(--surface-2); color: var(--text-3); font-weight: 600; padding: 6px 8px;
  position: sticky; z-index: 1; font-size: 12px; text-align: center;
}
.sheet-grid th.col-head { top: 0; min-width: 88px; }
.sheet-grid th.row-head { left: 0; min-width: 42px; }
.sheet-grid td { padding: 0; }
.sheet-cell {
  min-width: 88px; height: 30px; padding: 5px 8px; color: var(--text);
  cursor: cell; white-space: nowrap; overflow: hidden;
}
.sheet-cell:hover { background: var(--surface-2); }
.sheet-cell.editing {
  outline: 2px solid var(--accent-1); outline-offset: -1px; background: var(--bg-3);
  white-space: pre; overflow: visible; cursor: text;
}

/* Word document editor */
.doc-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 14px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
}
.doc-toolbar .icon-btn { font-size: 14px; min-width: 34px; }
.doc-sep { width: 1px; height: 22px; background: var(--border-strong); margin: 0 8px; }
.doc-canvas { display: flex; justify-content: center; }
.doc-page {
  width: 100%; max-width: 820px; min-height: 60vh; padding: 48px 64px;
  background: #fff; color: #1b2430; border-radius: 8px; box-shadow: var(--shadow-lg);
  line-height: 1.6; font-size: 15px; outline: none;
}
.doc-page:focus { box-shadow: var(--shadow-lg), 0 0 0 2px var(--accent-1); }
.doc-page h1 { font-size: 26px; margin: 18px 0 10px; }
.doc-page h2 { font-size: 21px; margin: 16px 0 8px; }
.doc-page h3 { font-size: 17px; margin: 14px 0 6px; }
.doc-page p { margin: 0 0 12px; }
.doc-page ul, .doc-page ol { margin: 0 0 12px 24px; padding: 0; }
.doc-page li { margin-bottom: 4px; }
.doc-page a { color: #2563eb; text-decoration: underline; }

/* Plain text / code editor */
.text-editor {
  width: 100%; min-height: calc(100vh - 240px); resize: vertical;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px; line-height: 1.6; outline: none;
}
.text-editor:focus { border-color: var(--accent-1); }

/* ── EDITOR INSTRUMENT PANEL (fixed on top, opaque) ──────────── */
.editor { display: flex; flex-direction: column; }
.editor-instrument {
  position: sticky; top: 0; z-index: 30;
  background: var(--bg); padding-top: 4px;
  border-bottom: 1px solid var(--border);
}

/* Color pickers inside the toolbars */
.doc-colorbtn { position: relative; overflow: hidden; cursor: pointer; }
.doc-colorbtn input[type="color"] {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: 0; cursor: pointer; border: 0; padding: 0;
}
.doc-color-dot { display: block; width: 20px; height: 4px; border-radius: 99px; margin-top: 2px; }

/* Spreadsheet formula bar + formatting toolbar */
.sheet-formula { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.sheet-ref {
  flex: none; min-width: 48px; padding: 6px 8px; text-align: center;
  font-size: 12px; font-weight: 700; color: var(--text-3);
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
}
.sheet-formula-input {
  flex: 1; height: 34px; padding: 0 10px;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; font-size: 13px; outline: none; font-variant-numeric: tabular-nums;
}
.sheet-formula-input:focus { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.sheet-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 6px 8px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.sheet-toolbar .icon-btn { min-width: 30px; font-size: 13px; }
.sheet-toolbar .tool-label { min-width: auto; padding: 0 10px; }
.sheet-toolbar .tool-label:hover { border-color: var(--accent-1); }
.sheet-toolbar .doc-sep { height: 20px; }
.sheet-cell.active { outline: 2px solid var(--accent-1); outline-offset: -2px; }

/* PDF editor */
.pdf-toolbar {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 8px 10px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.pdf-toolbar .icon-btn { font-size: 14px; min-width: 34px; }
.pdf-toolbar .icon-btn.active { background: var(--accent-soft); color: #fff; }
.pdf-size-select {
  height: 30px; padding: 0 6px; font-size: 12px;
  background: var(--bg-3); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
}
.pdf-scroll {
  overflow: auto; max-height: calc(100vh - 300px);
  border: 1px solid var(--border); border-radius: 12px;
  background: #2c2f3a; padding: 18px;
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.pdf-page { position: relative; box-shadow: var(--shadow-lg); line-height: 0; background: #fff; }
.pdf-page canvas { display: block; }
.pdf-page .pdf-overlay { position: absolute; inset: 0; cursor: crosshair; }
.pdf-page.tool-pointer .pdf-overlay { cursor: default; }
.pdf-page.tool-sign .pdf-overlay { cursor: copy; }
.pdf-page.tool-draw .pdf-overlay, .pdf-page.tool-sign .pdf-overlay { touch-action: none; }
.sig-wrap { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.sig-canvas { display: block; touch-action: none; }

/* Clickable (editable) file cards & rows */
.file-card.can-edit, .file-row.can-edit { cursor: pointer; }
.file-card.can-edit:hover, .file-row.can-edit:hover { border-color: var(--accent-1); }
.file-card.can-edit:hover .file-card-name, .file-row.can-edit:hover .row-name { color: var(--accent-2); }
.file-card:hover .file-card-name { color: var(--accent-1); }

/* ═══════════════════════════════════════════════════════════════
   Calendar (Google-Calendar-style events app)
   ═══════════════════════════════════════════════════════════════ */
.cal-app { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.cal-topbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.cal-nav { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cal-nav .cal-title { font-size: 22px; font-weight: 700; margin: 0 8px 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-view-switch { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.cal-view-btn { border: 0; background: transparent; color: var(--text-2); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.cal-view-btn:hover { color: var(--text); }
.cal-view-btn.active { background: var(--accent-1); color: #fff; }
.cal-body { min-height: 0; }

/* ── Month view ── */
.cal-month { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.cal-month-head { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); }
.cal-month-dow { text-align: center; padding: 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); border-bottom: 1px solid var(--border); }
.cal-month-row { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-month-cell { min-height: 116px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px 7px; cursor: pointer; transition: background .15s; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-month-cell:nth-child(7n) { border-right: 0; }
.cal-month-row:last-child .cal-month-cell { border-bottom: 0; }
.cal-month-cell:hover { background: var(--surface-2); }
.cal-month-cell.outside { opacity: .55; }
.cal-cell-date { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; border-radius: 50%; flex-shrink: 0; }
.cal-month-cell.today .cal-cell-date { background: var(--accent-1); color: #fff; }
.cal-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }

/* ── Event pill ── */
.cal-event { display: flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 6px; font-size: 12px; color: #fff; line-height: 1.35; border-left: 3px solid rgba(255, 255, 255, .55); cursor: pointer; overflow: hidden; white-space: nowrap; min-width: 0; }
.cal-event:hover { filter: brightness(1.12); }
.cal-event-time { opacity: .95; font-weight: 600; flex-shrink: 0; }
.cal-event-title { overflow: hidden; text-overflow: ellipsis; }
.cal-cell-more { font-size: 12px; color: var(--text-2); cursor: pointer; padding: 1px 4px; }
.cal-cell-more:hover { color: var(--accent-2); }

/* ── Week / day view ── */
.cal-week { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.cal-week-head { display: grid; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-dow-head { padding: 8px 4px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.cal-dow-name { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.cal-dow-num { font-size: 15px; font-weight: 700; }
.cal-dow-head.today .cal-dow-num { background: var(--accent-1); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; }
.cal-gutter { min-width: 0; }
.cal-all-day { display: grid; border-bottom: 1px solid var(--border); min-height: 32px; }
.cal-all-day-label { font-size: 11px; color: var(--text-2); padding: 9px 8px; }
.cal-day-col { position: relative; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; padding: 2px; min-width: 0; }
.cal-all-day-col { min-height: 28px; }
.cal-timegrid { display: grid; }
.cal-timegutters { position: relative; }
.cal-timegutter-row { position: relative; height: 52px; border-bottom: 1px solid var(--border); }
.cal-timegutter-row span { position: absolute; top: -7px; right: 8px; font-size: 11px; color: var(--text-3); background: var(--surface); padding: 0 3px; }
.cal-day-body { position: relative; height: 1248px; }
.cal-slots { position: absolute; inset: 0; }
.cal-slot { height: 52px; border-bottom: 1px solid var(--border); cursor: pointer; }
.cal-slot:hover { background: var(--accent-soft); }
.cal-day-blocks { position: absolute; inset: 0; pointer-events: none; }
.cal-day-blocks .cal-event { pointer-events: auto; position: absolute; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 1px; padding: 3px 6px; overflow: hidden; border-radius: 8px; box-shadow: var(--shadow-sm); }
.cal-day-blocks .cal-event .cal-event-time { font-size: 11px; }
.cal-day-blocks .cal-event .cal-event-title { white-space: normal; }

/* ── Agenda view ── */
.cal-agenda { display: flex; flex-direction: column; gap: 16px; }
.cal-agenda-day { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); overflow: hidden; }
.cal-agenda-date { padding: 10px 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent-2); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-agenda-item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; cursor: pointer; border-bottom: 1px solid var(--border); }
.cal-agenda-item:last-child { border-bottom: 0; }
.cal-agenda-item:hover { background: var(--surface-2); }
.cal-agenda-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cal-agenda-time { font-size: 13px; color: var(--text-2); min-width: 148px; }
.cal-agenda-title { font-size: 14px; font-weight: 600; }
.cal-agenda-loc { font-size: 12px; color: var(--text-3); margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-agenda-empty { text-align: center; padding: 70px 20px; color: var(--text-3); }
.cal-agenda-empty svg { width: 44px; height: 44px; margin-bottom: 12px; opacity: .5; }

/* ── Event form modal ── */
.cal-form { display: flex; flex-direction: column; gap: 2px; }
.cal-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cal-form label { display: block; }
.cal-form .checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; padding-top: 4px; }
.cal-desc-toolbar { display: flex; gap: 2px; margin-bottom: 4px; }
.cal-desc-toolbar .icon-btn { padding: 2px 8px; font-size: 13px; line-height: 1.2; }
.cal-desc-editor { min-height: 80px; max-height: 200px; overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; }
.cal-colors { display: flex; flex-wrap: wrap; gap: 9px; }
.cal-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; transition: transform .12s, box-shadow .12s; }
.cal-color:hover { transform: scale(1.15); }
.cal-color.active { border-color: #fff; box-shadow: 0 0 0 2px var(--bg-2), 0 0 0 4px var(--border-strong); }

/* ── Password vault ── */
.vault-gate { display: flex; align-items: center; justify-content: center; padding: 60px 20px; min-height: 70vh; }
.vault-gate-card { width: 100%; max-width: 460px; padding: 34px 32px; border-radius: 22px; background: linear-gradient(170deg, rgba(255,255,255,.06), rgba(255,255,255,.02)); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); }
.vault-gate-card.shake { animation: shake .5s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 20%{transform:translateX(-9px)} 40%{transform:translateX(9px)} 60%{transform:translateX(-6px)} 80%{transform:translateX(6px)} }
.vault-gate-icon { width: 58px; height: 58px; border-radius: 16px; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; background: rgba(52, 211, 153, 0.16); color: var(--success); }
.vault-gate-icon svg { width: 28px; height: 28px; }
.vault-gate-card h2 { font-size: 23px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.vault-gate-sub { color: var(--text-2); font-size: 14px; line-height: 1.55; margin-bottom: 20px; }
.vault-gate-card .input { margin-bottom: 12px; }
.vault-gate-alt { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border-strong); }
.vault-gate-alt .btn { margin-top: 8px; }
.vault-gate-note { color: var(--text-3); font-size: 12px; line-height: 1.5; margin-top: 10px; }
.vault-warn { color: var(--warning); }

.vault-app { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.vault-toolbar { flex-wrap: wrap; }
.vault-search { position: relative; display: inline-flex; align-items: center; }
.vault-search > svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.vault-search input { padding: 9px 12px 9px 34px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font-size: 13px; width: 190px; outline: none; }
.vault-search input:focus { border-color: var(--accent-1); box-shadow: 0 0 0 3px rgba(59,130,246,.22); }

.vault-list { display: flex; flex-direction: column; gap: 9px; }
.vault-item { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-radius: 13px; background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: border-color .18s ease, background .18s ease; }
.vault-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.vault-item-ico { width: 40px; height: 40px; flex: none; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: rgba(251, 191, 36, .15); color: var(--warning); }
.vault-item-ico svg { width: 20px; height: 20px; }
.vault-favicon { width: 24px; height: 24px; border-radius: 4px; object-fit: contain; }
.vault-favicon-fallback { display: flex; align-items: center; justify-content: center; }
.vault-editor-favicon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none; }
.vault-editor-favicon .vault-favicon { width: 24px; height: 24px; }
.vault-item-main { min-width: 0; flex: 1; }
.vault-item-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.vault-group { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.vault-item-user { font-size: 13px; color: var(--text-2); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vault-item-pass { display: flex; align-items: center; gap: 2px; margin-top: 5px; }
.vault-pass-mask { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--text-2); letter-spacing: .06em; }
.vault-pass-mask .muted { font-family: inherit; letter-spacing: normal; color: var(--text-3); }
.vault-item-actions { display: flex; gap: 2px; flex: none; }

.vault-form { display: flex; flex-direction: column; gap: 2px; }
.vault-form textarea.input { resize: vertical; }
.field-row { display: flex; gap: 8px; align-items: center; }
.field-row .input { flex: 1; min-width: 0; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); cursor: pointer; margin-top: 10px; }

.vault-import-note { color: var(--text-2); font-size: 13px; line-height: 1.55; margin: 0 0 14px; }
.vault-import-preview { font-size: 13px; color: var(--danger); font-weight: 600; margin-right: auto; }
.vault-import-preview.ok { color: var(--success); }
.vault-format-opts { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.vault-format-opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; background: var(--surface); }
.vault-format-opt:hover { border-color: var(--border-strong); }
.vault-format-opt input { accent-color: var(--accent-1); }
.vault-format-opt span { font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 8px; }
.vault-format-opt span svg { width: 17px; height: 17px; color: var(--accent-2); }
.vault-format-opt small { margin-left: auto; font-size: 12px; color: var(--text-3); text-align: right; max-width: 240px; }


/* ── Messages ──────────────────────────────────────────────── */
/* ── Messages ───────────────────────────────────────────────── */
/* The chat fills the viewport: the conversation list (left) and the composer
   (bottom) stay fixed, and ONLY the message thread scrolls. */
body.msg-page .content {
  overflow: hidden;
  padding: 0;
  max-width: none;
  margin: 0;
  display: flex;
  flex-direction: column;
}
body.msg-page .msg-app { flex: 1; min-height: 0; }
body.msg-page .msg-side .msg-conv-list,
body.msg-page .msg-messages { min-height: 0; }
.msg-app { display: flex; flex: 1; min-height: 0; }
.msg-side { width: 310px; flex: none; border-right: 1px solid var(--border); display: flex; flex-direction: column; background: var(--bg-2); }
.msg-side-head { padding: 14px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--border); }
.msg-conv-list { flex: 1; overflow-y: auto; padding: 8px; }
.msg-conv { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; border: none; background: transparent; color: var(--text); cursor: pointer; }
.msg-conv:hover { background: var(--surface-2); }
.msg-conv.active { background: var(--accent-soft); }
.msg-conv-body { flex: 1; min-width: 0; }
.msg-conv-top { display: flex; justify-content: space-between; gap: 8px; }
.msg-conv-name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-conv-flag { font-size: 11px; opacity: .75; margin-left: 3px; flex: none; }

/* ── My Files list: sortable column headers ─────────────── */
.col-sort { border: none; background: none; cursor: pointer; font: inherit; font-weight: 600; color: var(--text-2); padding: 2px 4px; border-radius: 6px; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-sort:hover { color: var(--text); background: var(--surface-2); }
.col-sort-active { color: var(--accent-2); }

/* ── Inline video player in file rows/cards ─────────────── */
.video-player { max-width: 220px; max-height: 140px; width: 100%; border-radius: 10px; display: block; background: #000; }
.msg-conv-time { font-size: 11px; color: var(--text-3); flex: none; }
.msg-conv-preview { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.msg-conv-preview svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; flex: none; }
.msg-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-1); color: #fff; font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.msg-conv-none { color: var(--text-3); font-size: 13px; text-align: center; padding: 24px; }

.msg-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; object-fit: cover; display: inline-flex; align-items: center; justify-content: center; background: var(--gradient); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .02em; }
.msg-avatar-init { text-transform: none; }

.msg-thread { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.msg-thread-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.msg-thread-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.msg-thread-title .msg-avatar { width: 38px; height: 38px; }
.msg-thread-name { font-weight: 800; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-thread-sub { font-size: 12px; color: var(--text-3); }

.msg-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.msg-row { display: flex; gap: 10px; align-items: flex-end; }
.msg-row.mine { justify-content: flex-end; }
.msg-row .msg-avatar { width: 32px; height: 32px; }
.msg-bubble-wrap { max-width: 74%; display: flex; flex-direction: column; }
.msg-row.mine .msg-bubble-wrap { align-items: flex-end; }
.msg-bubble { padding: 9px 13px; border-radius: 15px; background: var(--surface-2); border: 1px solid var(--border); }
.msg-row.mine .msg-bubble { background: var(--accent-1); border-color: transparent; color: #fff; }
.msg-sender { font-size: 11.5px; font-weight: 700; color: var(--accent-2); margin-bottom: 2px; }
.msg-text { font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.msg-text a { color: inherit; text-decoration: underline; }
.msg-meta { font-size: 10.5px; color: var(--text-3); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.msg-sys { align-self: center; font-size: 12px; color: var(--text-3); background: var(--surface); padding: 4px 12px; border-radius: 999px; }
.msg-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-3); text-align: center; padding: 30px; }
.msg-empty h3 { color: var(--text); margin: 8px 0 0; }
.msg-empty p { max-width: 360px; line-height: 1.55; }
.msg-empty-icon { width: 60px; height: 60px; border-radius: 18px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent-2); }
.msg-empty-icon svg { width: 28px; height: 28px; }

.msg-attach-link { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: inherit; padding: 7px 10px; border-radius: 9px; background: rgba(0, 0, 0, .18); margin-top: 6px; text-decoration: none; }
.msg-attach-link svg { width: 15px; height: 15px; flex: none; }
.msg-attach-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-attach-size { margin-left: auto; font-size: 11px; opacity: .7; flex: none; }
.msg-img { max-width: 260px; max-height: 220px; border-radius: 10px; margin-top: 6px; display: block; }

/* ── Reply / forward / edit / delete-augmented bubbles ──── */
.msg-reply-quote { font-size: 12px; line-height: 1.4; color: var(--text-2); background: rgba(0,0,0,.18); border-left: 3px solid var(--accent-1); border-radius: 6px; padding: 4px 8px; margin: 0 0 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.msg-row.mine .msg-reply-quote { background: rgba(255,255,255,.16); color: #fff; }
.msg-reply-quote-who { display: block; font-weight: 700; font-size: 11px; color: var(--accent-2); }
.msg-row.mine .msg-reply-quote-who { color: #cfe3ff; }
.msg-fwd-tag { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; opacity: .65; margin-bottom: 2px; }
.msg-flags { display: block; font-size: 10.5px; color: var(--text-3); margin-top: 2px; }

.msg-deleted .msg-bubble { color: var(--text-3); font-style: italic; }
.msg-deleted-label { font-size: 12.5px; }

.msg-edit-box { margin-top: 2px; }
.msg-edit-input { width: 100%; box-sizing: border-box; resize: none; background: var(--surface); border: 1px solid var(--accent-1); border-radius: 9px; color: var(--text); font: inherit; font-size: 14px; line-height: 1.45; padding: 8px 10px; outline: none; }
.msg-edit-btns { display: flex; gap: 8px; margin-top: 6px; justify-content: flex-end; }
.msg-edit-btns .btn { min-height: 0; padding: 4px 12px; font-size: 12.5px; }

.msg-draft-bar { flex-basis: 100%; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--accent-1); border-radius: 12px; padding: 7px 11px; }
.msg-draft-label { font-size: 11.5px; color: var(--accent-2); font-weight: 700; white-space: nowrap; }
.msg-draft-text { font-size: 12.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.msg-draft-cancel { border: none; background: none; cursor: pointer; color: var(--text-3); padding: 2px; line-height: 1; }
.msg-draft-cancel:hover { color: var(--danger, #ef4444); }
.msg-draft-cancel svg { width: 16px; height: 16px; }

/* ── Emoji reactions ─────────────────────────────────────── */
.msg-react-trigger { border: none; background: none; cursor: pointer; font-size: 13px; opacity: 0; transition: opacity .15s; padding: 0 0 0 6px; line-height: 1; vertical-align: middle; }
.msg-row:hover .msg-react-trigger { opacity: .6; }
.msg-react-trigger:hover { opacity: 1 !important; }
.msg-react-bar { display: flex; gap: 2px; flex-wrap: wrap; margin-top: 4px; padding: 4px 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.msg-emoji-pick { border: none; background: none; cursor: pointer; font-size: 18px; padding: 3px 5px; border-radius: 6px; line-height: 1; }
.msg-emoji-pick:hover { background: var(--surface-2); }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.msg-reaction-pill { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; line-height: 1.3; }
.msg-reaction-pill:hover { border-color: var(--border-strong); }
.msg-reaction-pill.mine { border-color: var(--accent-1); background: var(--accent-soft); }
.msg-reaction-count { font-size: 11px; color: var(--text-3); }

/* ── Members button ──────────────────────────────────────── */
.msg-members-btn { display: inline-flex; align-items: center; justify-content: center; }
.msg-members-btn svg { width: 18px; height: 18px; }
.menu-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; font-size: 10px; }

.msg-composer { border-top: 1px solid var(--border); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--bg-2); }
.msg-composer textarea { flex: 1; resize: none; background: var(--surface); border: 1px solid var(--border); border-radius: 13px; color: var(--text); padding: 10px 13px; font: inherit; font-size: 14px; line-height: 1.45; max-height: 160px; outline: none; }
.msg-composer textarea:focus { border-color: var(--accent-1); }
.msg-composer-btns { display: flex; gap: 8px; align-items: center; flex: none; }
.msg-send-btn svg { width: 17px; height: 17px; }
.msg-voice-btn { position: relative; }
.msg-voice-btn.recording { color: var(--danger, #ef4444); animation: msg-voice-pulse 1s ease-in-out infinite; }
.msg-voice-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--danger, #ef4444); animation: msg-voice-pulse 1s ease-in-out infinite; }
.msg-voice-status { font-size: 11px; white-space: nowrap; color: var(--text-3); }
.msg-voice-btn.transcribing { pointer-events: none; opacity: .7; }
@keyframes msg-voice-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

.msg-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; background: var(--surface); }
.msg-search svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.msg-search input { flex: 1; min-width: 0; background: transparent; border: none; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.msg-user-results { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; max-height: 240px; overflow-y: auto; }
.msg-user { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); }
.msg-user:hover { border-color: var(--border-strong); background: var(--surface-2); }
.msg-user:disabled { opacity: .5; cursor: default; }
.msg-user-info { display: flex; flex-direction: column; min-width: 0; }
.msg-user-name { font-weight: 700; font-size: 14px; }
.msg-user-email { font-size: 12px; color: var(--text-3); }
.msg-user-none { color: var(--text-3); font-size: 13px; padding: 12px; text-align: center; }
.msg-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--text); }
.msg-chip button { border: none; background: none; color: var(--text-2); cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.msg-check svg { width: 14px; height: 14px; color: var(--success); }

.msg-send-convs { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; max-height: 220px; overflow-y: auto; }
.msg-send-conv { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; color: var(--text); }
.msg-send-conv:hover { border-color: var(--border-strong); background: var(--surface-2); }
.msg-send-conv:disabled { opacity: .5; cursor: default; }
.msg-send-name { font-weight: 700; font-size: 14px; }
.msg-send-group { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; margin-left: 6px; vertical-align: middle; }

/* ── E2E gate screens (setup / unlock) ─────────────────────── */
.msg-gate { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; }
.msg-gate-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 32px 28px; text-align: center; }
.msg-gate-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: rgba(99, 102, 241, .15); color: #818cf8; margin-bottom: 16px; }
.msg-gate-icon svg { width: 26px; height: 26px; }
.msg-gate-title { font-size: 20px; font-weight: 800; margin: 0 0 8px; }
.msg-gate-sub { font-size: 13.5px; line-height: 1.55; color: var(--text-2); margin: 0 0 20px; }
.msg-gate-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.msg-gate-warn { font-size: 12px; color: var(--warn); margin: 12px 0 0; line-height: 1.4; }

/* ── E2E lock badges ───────────────────────────────────────── */
.msg-conv-lock { font-size: 11px; margin-left: 4px; opacity: .6; flex: none; }
.msg-lock-badge { font-size: 11px; opacity: .55; margin-left: 3px; vertical-align: baseline; }

.avatar-img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* ── Settings avatar picker ────────────────────────────────── */
.avatar-picker { display: flex; flex-direction: column; gap: 18px; }
.avatar-picker-current { display: flex; align-items: center; gap: 14px; }
.avatar-picker-actions { display: flex; flex-direction: column; gap: 6px; }
.avatar-presets { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.avatar-preset { width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--border); padding: 0; overflow: hidden; cursor: pointer; background: none; transition: transform .15s ease, border-color .15s ease; }
.avatar-preset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-preset:hover { transform: scale(1.08); border-color: var(--border-strong); }
.avatar-preset.active { border-color: var(--accent-1); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 560px) { .avatar-presets { grid-template-columns: repeat(3, 1fr); } }

/* ── Light theme overrides ──────────────────────────────────── */
[data-theme="light"] ::selection { background: rgba(37, 99, 235, 0.25); }

[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); border: 2px solid transparent; background-clip: content-box; }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.22); background-clip: content-box; }

[data-theme="light"] .bg-orbs .orb-1 { background: radial-gradient(circle, rgba(37, 99, 235, 0.15), transparent 70%); }
[data-theme="light"] .bg-orbs .orb-2 { background: radial-gradient(circle, rgba(2, 132, 199, 0.12), transparent 70%); }
[data-theme="light"] .bg-orbs .orb-3 { background: radial-gradient(circle, rgba(244, 114, 182, 0.08), transparent 70%); }

[data-theme="light"] .sidebar { background: #fff; border-right: 1px solid var(--border); }
[data-theme="light"] .sidebar-storage { background: var(--bg-2); }
[data-theme="light"] .nav-item.active { background: var(--accent-soft); color: var(--accent-1); }
[data-theme="light"] .nav-item.active .nav-icon svg { color: var(--accent-1); }

[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.85); }
[data-theme="light"] .topbar-search { background: var(--bg-2); border-color: var(--border); }
[data-theme="light"] .topbar-search:focus-within { background: #fff; }

[data-theme="light"] .input, [data-theme="light"] select.input { background: #fff; border-color: var(--border-strong); }
[data-theme="light"] .input:focus { background: #fff; }
[data-theme="light"] .select { background: #fff; }
[data-theme="light"] .select option { background: #fff; color: var(--text); }

[data-theme="light"] .modal { background: #fff; border-color: var(--border-strong); }
[data-theme="light"] .modal-backdrop { background: rgba(0, 0, 0, 0.35); }

[data-theme="light"] .toast { background: #fff; border-color: var(--border-strong); }

[data-theme="light"] .context-menu { background: #fff; border-color: var(--border-strong); }

[data-theme="light"] .auth-card { background: #fff; }
[data-theme="light"] .hero-card { background: rgba(255, 255, 255, 0.85); }
[data-theme="light"] .shield-card { background: rgba(255, 255, 255, 0.85); }

[data-theme="light"] .msg-side { background: var(--bg-2); }
[data-theme="light"] .msg-composer { background: var(--bg-2); }
[data-theme="light"] .msg-attach-link { background: rgba(0, 0, 0, 0.06); }
[data-theme="light"] .msg-row.mine .msg-bubble { color: #fff; }
[data-theme="light"] .msg-sys { background: var(--bg-3); }

[data-theme="light"] .doc-page { box-shadow: var(--shadow); }

[data-theme="light"] .pdf-scroll { background: #e5e7eb; }

[data-theme="light"] .dropzone { background: var(--bg-2); }

[data-theme="light"] .file-card-preview .file-icon { filter: none; }

[data-theme="light"] .msg-gate-card { background: #fff; }

[data-theme="light"] .vault-gate-card { background: #fff; }
[data-theme="light"] .vault-format-opt { background: #fff; }

[data-theme="light"] .cal-month { background: #fff; }
[data-theme="light"] .cal-week { background: #fff; }
[data-theme="light"] .cal-agenda-day { background: #fff; }
[data-theme="light"] .cal-month-head { background: var(--bg-2); }
[data-theme="light"] .cal-week-head { background: var(--bg-2); }
[data-theme="light"] .cal-timegutter-row span { background: var(--bg-2); }
[data-theme="light"] .cal-slot:hover { background: var(--accent-soft); }

[data-theme="light"] .storage-demo { background: #fff; }
[data-theme="light"] .file-chip { background: var(--bg-2); }
[data-theme="light"] .hc-storage { background: var(--bg-2); }

[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .btn-primary:hover { color: #fff; }

[data-theme="light"] .sk { background: rgba(0, 0, 0, 0.06); }
[data-theme="light"] .sk::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent); }

/* ── Theme picker ──────────────────────────────────────────── */
.theme-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; }
.theme-option {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 20px 16px;
  border-radius: 14px; border: 2px solid var(--border); background: var(--surface);
  cursor: pointer; transition: all 0.2s ease; color: var(--text-2);
}
.theme-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.theme-option.active { border-color: var(--accent-1); background: var(--accent-soft); color: var(--text); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15); }
.theme-option svg { width: 22px; height: 22px; }
.theme-option-label { font-size: 14px; font-weight: 700; }

.theme-option-preview {
  width: 64px; height: 44px; border-radius: 10px; display: flex; flex-direction: column;
  gap: 4px; padding: 8px; border: 1px solid var(--border); overflow: hidden;
}
.theme-dark-preview { background: #0d1224; }
.theme-dark-preview .theme-dot:nth-child(1) { background: rgba(255,255,255,0.12); height: 4px; border-radius: 4px; width: 80%; }
.theme-dark-preview .theme-dot:nth-child(2) { background: rgba(255,255,255,0.06); height: 4px; border-radius: 4px; width: 60%; }
.theme-dark-preview .theme-dot:nth-child(3) { background: var(--accent-1); height: 4px; border-radius: 4px; width: 40%; }
.theme-light-preview { background: #f0f2f7; }
.theme-light-preview .theme-dot:nth-child(1) { background: rgba(0,0,0,0.1); height: 4px; border-radius: 4px; width: 80%; }
.theme-light-preview .theme-dot:nth-child(2) { background: rgba(0,0,0,0.06); height: 4px; border-radius: 4px; width: 60%; }
.theme-light-preview .theme-dot:nth-child(3) { background: var(--accent-1); height: 4px; border-radius: 4px; width: 40%; }

/* ── Referrals + Two-factor authentication ─────────────────── */
.optional-tag { font-weight: 400; color: var(--text-3); font-size: 12px; }
.field-hint { margin: 6px 2px 0; font-size: 12.5px; color: var(--text-3); }
.field-hint.ref-ok { color: var(--success); }
.field-hint.ref-bad { color: var(--danger); }

.tfa-block { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.tfa-title { font-size: 15px; font-weight: 700; color: var(--text); }

.qr-box {
  display: flex; justify-content: center; align-items: center;
  background: #fff; border-radius: 14px; padding: 14px;
  width: fit-content; margin: 10px auto;
}
.qr-box svg { width: 200px; height: 200px; display: block; }

.tfa-secret {
  text-align: center; font-size: 12.5px; color: var(--text-2);
  word-break: break-all; margin-bottom: 12px;
}
.tfa-secret code {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px 8px; font-size: 12px;
}

input.tfa-input, .text-input.tfa-input {
  letter-spacing: 0.45em; text-align: center; font-size: 20px; font-weight: 700;
}
.tfa-back-btn { margin-top: 8px; }
.tfa-note { font-size: 13.5px; color: var(--text-2); margin-bottom: 4px; }

.modal .text-input, .modal .field-label { display: block; width: 100%; }
.modal .field-label { margin-top: 10px; }

/* ── Office page ─────────────────────────────────────────── */
.office-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 16px; margin-top: 20px;
}
.office-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; text-decoration: none; color: var(--text);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.office-card:hover {
  transform: translateY(-2px); border-color: var(--accent-1); box-shadow: var(--shadow);
}
.office-thumb {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 10px; position: relative;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.office-badge { font-weight: 800; font-size: 30px; letter-spacing: .04em; }
/* Real content previews replace the colored badge once loaded. */
.office-preview-body { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; }
.office-thumb.has-preview .office-badge { display: none; }
.office-thumb.has-preview .office-preview-body { display: flex; }
.office-thumb.has-preview { background: var(--surface-2); }
.office-preview-body canvas { width: 100%; height: 100%; object-fit: contain; }
.office-text-preview {
  width: 100%; height: 100%; padding: 12px; font-size: 11px; line-height: 1.5; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 8; -webkit-box-orient: vertical;
}
.office-sheet-preview { border-collapse: collapse; width: 100%; font-size: 9.5px; margin: 8px; }
.office-sheet-preview td {
  border: 1px solid var(--border); padding: 3px 5px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0;
}
.t-pdf  { background: rgba(248,113,113,.15); }  .t-pdf  .office-badge { color: #f87171; }
.t-word { background: rgba(96,165,250,.15); }   .t-word .office-badge { color: #60a5fa; }
.t-sheet{ background: rgba(52,211,153,.15); }   .t-sheet .office-badge { color: #34d399; }
.t-text { background: rgba(148,163,184,.15); }  .t-text .office-badge { color: #94a3b8; }
.t-image { background: rgba(192,132,252,.15); } .t-image .office-badge { color: #c084fc; }
[data-theme="light"] .t-pdf  { background: rgba(220,38,38,.10); }
[data-theme="light"] .t-word { background: rgba(37,99,235,.10); }
[data-theme="light"] .t-sheet{ background: rgba(5,150,105,.10); }
[data-theme="light"] .t-text { background: rgba(100,116,139,.12); }
[data-theme="light"] .t-image { background: rgba(147,51,234,.10); }
.office-name {
  max-width: 100%; font-size: 13.5px; font-weight: 600; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.office-meta { font-size: 12px; color: var(--text-3); margin-top: -4px; }
.office-action { width: 100%; justify-content: center; margin-top: 2px; }

/* Office toolbar */
.office-toolbar { display: flex; gap: 10px; margin-top: 14px; }
.dropdown-wrap { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 100;
  background: #12182b; border: 1px solid var(--border-strong); border-radius: 10px;
  box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px 0; display: flex; flex-direction: column;
}
.dropdown-menu[hidden] { display: none; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; border: none; background: none;
  color: var(--text); font-size: 14px; cursor: pointer; text-align: left; width: 100%;
}
.dropdown-item:hover { background: var(--surface-2); }
.new-file-icon { font-weight: 800; font-size: 13px; width: 32px; text-align: center; }
.spinner-sm { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border); border-top-color: var(--accent-1); border-radius: 50%; animation: spin .6s linear infinite; }

/* Office image thumbnails */
.office-thumb-img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 10px; }

/* Custom audio player (bigger, prettier than the native <audio> controls) */
.audio-player {
  display: flex; align-items: center; gap: 10px; width: 100%; max-width: 100%;
  padding: 6px 10px 6px 6px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.audio-player .audio-el { display: none; }
.audio-player .audio-play {
  flex: none; width: 42px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--gradient); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4); transition: transform .12s ease, box-shadow .15s ease;
}
.audio-player .audio-play:hover { transform: scale(1.08); }
.audio-player .audio-play:active { transform: scale(0.94); }
.audio-player .audio-play svg { width: 20px; height: 20px; }
.audio-player .audio-track {
  flex: 1; min-width: 24px; height: 7px; border-radius: 99px; cursor: pointer; position: relative;
  background: rgba(120, 130, 155, 0.28);
}
.audio-player .audio-track:hover { height: 9px; }
.audio-player .audio-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: var(--gradient); border-radius: 99px; transition: width .1s linear;
}
.audio-player .audio-time {
  flex: none; font-size: 12px; font-weight: 600; color: var(--text-3);
  font-variant-numeric: tabular-nums; min-width: 58px; text-align: right; white-space: nowrap;
}
/* In list view the icon column is narrow — show just the play button. */
.col-icon .audio-player { width: auto; padding: 0; background: none; border: none; gap: 0; }
.col-icon .audio-track, .col-icon .audio-time { display: none; }
.col-icon .audio-player .audio-play { width: 36px; height: 36px; }

/* Lightbox for image preview */
.lightbox-overlay {
  position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,0.94);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .25s ease; pointer-events: none; padding: 14px;
}
.lightbox-overlay.show { opacity: 1; pointer-events: auto; }
.lightbox-overlay .lightbox-img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 8px; box-shadow: var(--shadow-lg); }
.lightbox-close {
  position: absolute; top: 16px; right: 16px; width: 44px; height: 44px;
  background: rgba(255,255,255,0.14); border: none; border-radius: 50%; color: #fff;
  font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s ease;
}
.lightbox-close:hover { background: rgba(255,255,255,0.28); transform: scale(1.06); }
.lightbox-download {
  position: absolute; bottom: 20px; right: 20px; width: 48px; height: 48px;
  background: rgba(255,255,255,0.16); border: none; border-radius: 50%; color: #fff;
  display: flex; align-items: center; justify-content: center; text-decoration: none;
  transition: background .15s, transform .15s ease;
}
.lightbox-download:hover { background: rgba(255,255,255,0.32); transform: scale(1.06); }

[data-theme="light"] .dropdown-menu { background: #fff; border-color: var(--border-strong); }

/* Favorites filter toggle in the My Files toolbar */
.tb-toggle-active {
  color: var(--accent-1);
  border-color: var(--accent-1);
  background: var(--accent-soft);
}

/* ═══════════════════════════════════════════════════════════════
   WebRTC calls (peer-to-peer audio/video)
   ═══════════════════════════════════════════════════════════════ */

body.in-call { overflow: hidden; }

.call-root {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(3, 6, 15, 0.97);
  display: flex; align-items: center; justify-content: center;
}
.call-root[hidden] { display: none; }
[data-theme="light"] .call-root { background: rgba(248, 249, 252, 0.99); }

/* ── Ring / connecting overlay ──────────────────────────────── */
.call-overlay {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 32px; text-align: center; animation: call-fade .25s ease;
}
@keyframes call-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.call-avatar-lg {
  width: 108px; height: 108px; border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--gradient); color: #fff; font-weight: 800; font-size: 40px; letter-spacing: 0.02em;
}
.call-avatar-lg .avatar-img, .call-avatar-lg img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.call-avatar-lg .avatar-init { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.call-name { font-size: 24px; font-weight: 700; color: var(--text); }
.call-sub { font-size: 15px; color: var(--text-2); display: flex; align-items: center; gap: 8px; }

.call-ring-actions { display: flex; gap: 18px; margin-top: 16px; }
.call-btn {
  width: 62px; height: 62px; border-radius: 50%; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: #fff;
  transition: transform .12s ease, filter .15s ease;
}
.call-btn:hover { transform: scale(1.06); filter: brightness(1.1); }
.call-btn:active { transform: scale(0.96); }
.call-accept { background: var(--success); }
.call-reject { background: var(--danger); }

.call-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--text-3); border-top-color: var(--accent-1);
  animation: call-spin .8s linear infinite;
}
@keyframes call-spin { to { transform: rotate(360deg); } }

/* ── Connected view ─────────────────────────────────────────── */
.call-view { position: relative; width: 100%; height: 100%; }

.call-grid {
  position: absolute; inset: 0;
  display: grid; gap: 6px; padding: 6px;
}
.call-grid:not(.audio-only) { grid-template-columns: 1fr 1fr; }
.call-grid.audio-only { grid-template-columns: 1fr; }

.call-tile {
  position: relative; background: #000; border-radius: 12px; overflow: hidden;
  display: flex; align-items: center; justify-content: center; min-height: 0;
}
.call-tile .call-video { width: 100%; height: 100%; object-fit: cover; }
.call-tile-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; color: #fff;
}
.call-local { box-shadow: 0 6px 24px rgba(0,0,0,0.5); }
.call-grid.audio-only .call-local { display: none; }

.call-audio-pulse {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--accent-1); animation: call-pulse 1.4s ease-in-out infinite;
}
@keyframes call-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.25); opacity: 1; }
}

.call-bar {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(17, 24, 39, 0.85); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 999px; padding: 8px 14px;
}
[data-theme="light"] .call-bar { background: rgba(255,255,255,0.9); border-color: var(--border-strong); }

.call-ctrl {
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,0.12); color: #fff;
  display: flex; align-items: center; justify-content: center; transition: background .15s;
}
[data-theme="light"] .call-ctrl { background: var(--surface-3); color: var(--text); }
.call-ctrl:hover { background: rgba(255,255,255,0.25); }
[data-theme="light"] .call-ctrl:hover { background: var(--surface-2); }
.call-ctrl.muted { background: var(--danger); }
.call-ctrl.active { background: var(--accent-1); color: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.call-ctrl-end { background: var(--danger); }
.call-ctrl-end:hover { background: #dc2626; }
.call-clock { color: #fff; font-variant-numeric: tabular-nums; font-size: 14px; min-width: 44px; text-align: center; }
[data-theme="light"] .call-clock { color: var(--text); }

/* ── Chat header call buttons ───────────────────────────────── */
.msg-thread-actions { display: flex; gap: 6px; flex: none; }
.msg-call-btn:hover { color: var(--accent-1); }

/* ── Calendar Guests ────────────────────────────────────────── */
.cal-guests-wrap { position: relative; }
.cal-guest-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  max-height: 200px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.cal-guest-option {
  display: flex; align-items: center; gap: .5rem; padding: 8px 12px; cursor: pointer;
  border: none; background: none; width: 100%; text-align: left; color: var(--text); font-size: 13px;
}
.cal-guest-option:hover { background: var(--surface-2); }
.cal-guest-option.active { background: var(--accent-soft); color: var(--accent-1); }

/* ── Dashboard plan comparison ─────────────────────────────── */
.dash-plan-compare {
  margin-top: .8rem; border: 1px solid var(--border); border-radius: 10px; overflow: hidden;
  font-size: 12.5px;
}
.dash-plan-row {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: 7px 12px; border-bottom: 1px solid var(--border);
}
.dash-plan-row:last-child { border-bottom: none; }
.dash-plan-row span:first-child { font-weight: 700; flex: none; width: 42px; }
.dash-plan-row span:nth-child(2) { opacity: .75; flex: 1; }
.dash-plan-row span:last-child { font-weight: 600; flex: none; }
.dash-plan-row.current { background: var(--accent-soft); color: var(--accent-1); }
.dash-plan-row.current span:nth-child(2), .dash-plan-row.current span:nth-child(3) { opacity: 1; }
.cal-guest-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.cal-guest-chip {
  display: inline-flex; align-items: center; gap: .25rem; padding: 2px 8px;
  background: var(--accent-soft); color: var(--accent-1); border-radius: 999px; font-size: 12px;
}
.cal-guest-remove {
  cursor: pointer; border: none; background: none; color: var(--accent-1); font-size: 14px;
  line-height: 1; padding: 0 2px;
}
.cal-guest-remove:hover { color: var(--danger); }
.cal-event-guests { font-size: 11px; opacity: .7; margin-top: 2px; }

/* ── Notification badge ─────────────────────────────────────── */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: -2px; right: -2px; min-width: 16px; height: 16px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 999px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; pointer-events: none;
}
.notif-badge:empty, .notif-badge[data-count="0"] { display: none; }
.notif-panel { max-height: 400px; overflow-y: auto; }
.notif-item {
  display: flex; gap: .75rem; padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.notif-item:hover { background: var(--surface-2); }
.notif-item.unread { background: var(--accent-soft); }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-item-text { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.notif-item-time { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.notif-empty { padding: 24px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ── Voice message in messenger composer ────────────────────── */
.msg-voice-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--text-2); cursor: pointer;
  transition: all .2s;
}
.msg-voice-btn:hover { background: var(--accent-soft); color: var(--accent-1); }
.msg-voice-btn.recording {
  background: var(--danger); color: #fff;
  animation: pulse-record 1s infinite;
}
@keyframes pulse-record {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}
.msg-voice-btn.transcribing {
  background: var(--accent-soft); color: var(--accent-1);
  animation: spin 1s linear infinite;
}

/* ── Session timeout select ─────────────────────────────────── */
.timeout-select { min-width: 140px; }

/* ── Calendar appointment request ───────────────────────────── */
.cal-appt-user { display: flex; align-items: center; gap: .5rem; margin-bottom: .5rem; }


/* ── Voice message player in chat ───────────────────────────── */
.msg-voice-player {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 18px;
  background: var(--surface-2); min-width: 220px; max-width: 320px;
  border: 1px solid var(--border);
}
.msg-row.mine .msg-voice-player {
  background: rgba(59, 130, 246, 0.12);
  border-color: rgba(59, 130, 246, 0.25);
}
.voice-play-btn {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--accent-1); color: #fff; cursor: pointer; flex-shrink: 0;
  transition: transform .15s, opacity .15s;
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.voice-play-btn:hover { transform: scale(1.08); opacity: .9; }
.voice-play-btn svg { width: 14px; height: 14px; }
.voice-track {
  flex: 1; height: 5px; border-radius: 3px; background: var(--border-strong);
  cursor: pointer; position: relative; min-width: 70px;
}
.voice-fill {
  height: 100%; border-radius: 3px; background: var(--accent-1);
  width: 0%; transition: width .1s linear;
}
.voice-time {
  font-size: 12px; color: var(--text-2); white-space: nowrap; min-width: 56px; text-align: right;
  font-variant-numeric: tabular-nums;
}
[data-theme="light"] .msg-voice-player { background: #f0f4f8; border-color: #d0d7de; }
[data-theme="light"] .msg-row.mine .msg-voice-player { background: #dbeafe; border-color: #93c5fd; }
[data-theme="light"] .voice-track { background: #d0d7de; }
[data-theme="light"] .voice-time { color: #656d76; }

/* ── Notification dismiss ───────────────────────────────────── */
.notif-actions { padding: 8px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: flex-end; }
.notif-dismiss {
  flex-shrink: 0; width: 24px; height: 24px; border-radius: 50%; border: none;
  background: transparent; color: var(--text-3); font-size: 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.notif-dismiss:hover { background: var(--danger); color: #fff; }
.notif-item { display: flex; align-items: flex-start; gap: 8px; }
.notif-body { flex: 1; min-width: 0; }

/* ── Dashboard manual card ──────────────────────────────────── */
.dash-manual-card { cursor: pointer; transition: border-color .15s, box-shadow .15s; display: flex; flex-direction: column; }
.dash-manual-card:hover { border-color: var(--accent-1); box-shadow: 0 0 0 1px var(--accent-1); }
.dash-manual-tip { flex: 1; margin: 8px 0; }
.dash-manual-tip-q { font-weight: 600; font-size: 14px; color: var(--text); margin-bottom: 6px; }
.dash-manual-tip-a { font-size: 13px; color: var(--text-2); line-height: 1.5; }
