/* ─────────────────────────────────────────────────────────────────────────
   NGS Tasks Tracker — Design System
   Dark theme: Claude-inspired warm charcoal, coral accent #E97553
   Light theme: warm white, same coral accent
───────────────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,wght@0,300;0,400;0,500;0,600;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  /* Base palette — warm charcoal (Claude-style) */
  --bg:          #1f1e1d;
  --bg-2:        #252422;
  --surface:     #2a2928;
  --surface-2:   #302f2d;
  --border:      rgba(255 255 255 / 0.08);
  --border-h:    rgba(255 255 255 / 0.15);

  /* Accent — coral signal (matches light theme) */
  --amber:       #E97553;
  --amber-h:     #f08262;
  --amber-dim:   rgba(233 117 83 / 0.15);
  --amber-glow:  rgba(233 117 83 / 0.28);

  /* Secondary — teal */
  --teal:        #14b8a6;
  --teal-dim:    rgba(20 184 166 / 0.12);

  /* Status */
  --green:       #22c55e;
  --green-dim:   rgba(34 197 94 / 0.12);
  --red:         #ef4444;
  --red-dim:     rgba(239 68 68 / 0.12);
  --yellow:      #eab308;
  --yellow-dim:  rgba(234 179 8 / 0.12);

  /* Typography — warm off-white */
  --text:        #e8e5e1;
  --text-2:      #a39e99;
  --text-3:      #6b6560;

  /* Geometry */
  --radius-xs:   4px;
  --radius-sm:   8px;
  --radius:      12px;
  --radius-lg:   18px;
  --radius-xl:   24px;

  /* Motion */
  --ease:        cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --t-fast:      120ms;
  --t:           200ms;
  --t-slow:      350ms;

  --sidebar-w:        256px;
  --sidebar-w-collapsed: 60px;
}

/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; color-scheme: dark light; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--amber); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--amber-h); }
a:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: var(--radius-xs); }

code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.85em;
}

/* ── Utilities ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.page   { min-height: 100dvh; }

.glass {
  background: rgba(30 29 27 / 0.78);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid var(--border);
}

.glass-sm {
  background: rgba(255 255 255 / 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255 255 255 / 0.1); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255 255 255 / 0.18); }

/* ── Focus visible ──────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

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

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background var(--t), color var(--t), box-shadow var(--t), transform var(--t-fast);
  white-space: nowrap;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--amber);
  color: #1a0e08;
  font-weight: 600;
  box-shadow: 0 0 0 0 var(--amber-glow);
}
a.btn-primary, a.btn-primary:visited, a.btn-primary:hover { color: #1a0e08; }
.btn-primary:hover:not(:disabled) {
  background: var(--amber-h);
  box-shadow: 0 0 24px var(--amber-glow);
}

.btn-ghost {
  background: rgba(255 255 255 / 0.05);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(255 255 255 / 0.09);
  color: var(--text);
  border-color: var(--border-h);
}

.btn-danger {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(239 68 68 / 0.25);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239 68 68 / 0.2);
}

.btn-full { width: 100%; justify-content: center; padding: 0.7rem; font-size: 0.95rem; }
.btn-sm   { padding: 0.3rem 0.65rem; font-size: 0.8rem; gap: 0.3em; }

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.input {
  width: 100%;
  background: rgba(255 255 255 / 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  padding: 0.6rem 0.875rem;
  transition: border-color var(--t), box-shadow var(--t), background var(--t);
  outline: none;
}
.input:hover { border-color: var(--border-h); }
.input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(233 117 83 / 0.12);
  background: rgba(255 255 255 / 0.06);
}
.input::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 88px; line-height: 1.5; }

/* iOS zooms into any focused field whose font-size is < 16px. Force 16px on
   touch-width screens so focusing inputs (folder modal, etc.) never zooms. */
@media (max-width: 960px) {
  .input,
  .textarea,
  select,
  textarea,
  input[type="text"],
  input[type="search"],
  input[type="email"],
  input[type="url"],
  input[type="number"],
  input[type="password"] {
    font-size: 16px;
  }
}
.select { cursor: pointer; }
.select option { background: #2a2928; color: var(--text); }

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scale-in {
  from { opacity: 0; transform: scale(0.95) translateY(12px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse-ring {
  0%   { box-shadow: 0 0 0 0 var(--amber-glow); }
  70%  { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes modal-premium-enter {
  0%   { opacity: 0; transform: scale(0.92) translateY(30px); filter: blur(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); filter: blur(0); }
}
@keyframes toast-premium-enter {
  0%   { opacity: 0; transform: translateX(100%) scale(0.9); }
  70%  { opacity: 1; transform: translateX(-10px) scale(1.02); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── LOGIN PAGE ─────────────────────────────────────────────────────────── */
#page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
  animation: fade-in 0.4s var(--ease);
}

/* ── Landing Page ────────────────────────────────────────────────────────── */

#page-landing {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Nav */
.landing-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(31 30 29 / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
[data-theme="light"] .landing-nav {
  background: rgba(248 246 243 / 0.88);
}
.landing-nav-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.landing-logo { text-decoration: none; }
.landing-nav-actions { display: flex; align-items: center; gap: 0.75rem; }
.landing-download-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

/* Hero */
.landing-hero {
  flex: 1;
  max-width: 1120px;
  margin: 0 auto;
  padding: 5rem 1.5rem 4rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}
.landing-hero-inner { display: flex; flex-direction: column; gap: 1.5rem; }

.landing-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid var(--amber-glow);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  width: fit-content;
}

.landing-h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
}
.landing-accent { color: var(--amber); }

.landing-sub {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 520px;
}

.landing-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.landing-cta-main {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}
.landing-cta-dl {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
}
.landing-hint {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: -0.5rem;
}

/* Mock card */
.landing-hero-visual {
  display: flex;
  justify-content: center;
}
.landing-card-mock {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0 0 0 / 0.35);
}
[data-theme="light"] .landing-card-mock {
  box-shadow: 0 24px 80px rgba(0 0 0 / 0.1);
}
.lm-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.lm-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.lm-dot.red    { background: #ff5f57; }
.lm-dot.yellow { background: #febc2e; }
.lm-dot.green  { background: #28c840; }
.lm-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  margin-left: 0.5rem;
}
.lm-task {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
}
.lm-task:last-of-type { border-bottom: none; }
.lm-prio {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lm-task.high   .lm-prio { background: var(--red); }
.lm-task.medium .lm-prio { background: var(--yellow); }
.lm-task.low    .lm-prio { background: var(--teal); }
.lm-task span:nth-child(2) { flex: 1; }
.lm-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  flex-shrink: 0;
}
.lm-badge.done   { background: var(--green-dim); color: var(--green); border: 1px solid rgba(34 197 94 / 0.2); }
.lm-badge.active { background: var(--amber-dim); color: var(--amber); border: 1px solid var(--amber-glow); }
.lm-footer {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  color: var(--text-3);
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

/* Features */
.landing-features {
  background: var(--bg-2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 5rem 1.5rem;
}
.landing-section-inner {
  max-width: 1120px;
  margin: 0 auto;
}
.landing-h2 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}
.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
.landing-feature-card {
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  border: 1px solid var(--border);
  transition: border-color var(--t), box-shadow var(--t);
}
.landing-feature-card:hover {
  border-color: var(--border-h);
  box-shadow: 0 8px 32px rgba(0 0 0 / 0.15);
}
[data-theme="light"] .landing-feature-card:hover {
  box-shadow: 0 8px 32px rgba(0 0 0 / 0.06);
}
.lf-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  background: var(--amber-dim);
  border: 1px solid var(--amber-glow);
  display: flex; align-items: center; justify-content: center;
  color: var(--amber);
  flex-shrink: 0;
}
.landing-feature-card h3 {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.landing-feature-card p {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.6;
}

/* Bottom CTA */
.landing-bottom-cta {
  padding: 6rem 1.5rem;
}

/* Footer */
.landing-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0;
}

/* ── Mobile ──────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .landing-hero {
    grid-template-columns: 1fr;
    padding: 3rem 1.25rem 2.5rem;
    gap: 2.5rem;
  }
  .landing-hero-visual { order: -1; }
  .landing-card-mock { max-width: 100%; }
  .landing-features-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .landing-features { padding: 3rem 1.25rem; }
  .landing-features-grid { grid-template-columns: 1fr; }
  .landing-bottom-cta { padding: 3.5rem 1.25rem; }
  .landing-nav-actions .landing-download-btn { display: none; }
  .landing-cta-row { flex-direction: column; align-items: flex-start; }
  .landing-cta-main, .landing-cta-dl { width: 100%; justify-content: center; }
}

/* Geometric mesh background */
.login-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.login-bg::before {
  content: '';
  position: absolute;
  width: 700px; height: 700px;
  top: -200px; left: -200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(233 117 83 / 0.07) 0%, transparent 70%);
}
.login-bg::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  bottom: -150px; right: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20 184 166 / 0.05) 0%, transparent 70%);
}

/* Decorative grid lines */
.login-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255 255 255 / 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255 255 255 / 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black, transparent);
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  border-radius: var(--radius-xl);
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-shadow: 0 40px 100px rgba(0 0 0 / 0.6), 0 0 0 1px rgba(255 255 255 / 0.05);
  margin: 1rem;
  animation: scale-in 0.45s var(--ease);
}

/* Amber corner accent */
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle at top left, rgba(233 117 83 / 0.12), transparent 70%);
  border-radius: var(--radius-xl) 0 0 0;
  pointer-events: none;
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(233 117 83 / 0.2);
  padding: 0.25rem 0.65rem;
  border-radius: 99px;
  width: fit-content;
}

.login-logo {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.logo-mark {
  font-family: 'Syne', sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.04em;
  line-height: 1;
}
.logo-mark span { color: var(--amber); }

.login-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.login-sub {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.5;
  margin-top: -0.3rem;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-3);
  font-size: 0.75rem;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.login-steps {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.login-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  background: rgba(255 255 255 / 0.025);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.4;
  transition: border-color var(--t);
}
.login-step:hover { border-color: var(--border-h); }
.step-num {
  min-width: 22px; height: 22px;
  background: var(--amber);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; font-weight: 700; color: #1a0e08;
  flex-shrink: 0;
}
.step-text code {
  background: rgba(233 117 83 / 0.1);
  color: var(--amber);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.8rem;
}
.bot-link {
  color: var(--amber);
  font-weight: 500;
  font-size: 0.85rem;
  margin-left: 0.15rem;
}

.input-group { display: flex; flex-direction: column; gap: 0.5rem; }
.login-error {
  color: var(--red);
  font-size: 0.8rem;
  text-align: center;
  background: var(--red-dim);
  border: 1px solid rgba(239 68 68 / 0.2);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}

/* ── 2FA step in login card ─────────────────────────────────────────────── */
.twofa-step { display: flex; flex-direction: column; align-items: center; text-align: center; }
.twofa-step-divider { width: 100%; height: 1px; background: var(--border); margin: 1.25rem 0; }
.twofa-icon {
  margin-bottom: 0.75rem;
  color: var(--amber);
  background: rgba(245,158,11,0.12);
  border-radius: 50%;
  width: 72px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.twofa-title { font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 0 0 0.4rem; }
.twofa-desc { font-size: 0.82rem; color: var(--text-3); line-height: 1.5; margin: 0; }
.twofa-code-input {
  text-align: center;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.35em;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
}

/* ── DASHBOARD LAYOUT ───────────────────────────────────────────────────── */
#page-dashboard {
  display: flex;
  min-height: 100dvh;
  animation: fade-in 0.3s var(--ease);
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.875rem;
  border-right: 1px solid var(--border);
  border-radius: 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(26 25 24 / 0.97);
  backdrop-filter: blur(16px);
  transition: width 280ms var(--ease), padding 280ms var(--ease);
}

/* ── Sidebar collapsed (desktop) ─────────────────────────────────────────── */
.sidebar.collapsed {
  width: var(--sidebar-w-collapsed);
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}
.sidebar.collapsed .sidebar-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .sidebar-logo-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}
.sidebar.collapsed .sidebar-section-label {
  opacity: 0;
  max-height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: none;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
  gap: 0;
}
.sidebar.collapsed .sidebar-user {
  justify-content: center;
  gap: 0;
  padding: 0.5rem;
}
.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}
.sidebar.collapsed .sidebar-logo-text { display: none; }
.sidebar.collapsed .sidebar-logo-img { opacity: 1 !important; width: 32px !important; height: 32px !important; }
.sidebar.collapsed .sidebar-collapse-btn { justify-content: center; }

/* Collapse toggle button (inside sidebar) */
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  margin-bottom: 0.25rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--t), color var(--t), justify-content 280ms var(--ease);
  width: 100%;
  font-size: 0;
}
.sidebar-collapse-btn:hover { background: rgba(255 255 255 / 0.05); color: var(--text-2); }
.sidebar-collapse-btn svg { flex-shrink: 0; transition: transform 280ms var(--ease); }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: scaleX(-1); }

/* Logo area */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.625rem;
  margin-bottom: 1.25rem;
  transition: justify-content 280ms var(--ease), padding 280ms var(--ease);
}
.sidebar-logo .logo-mark { font-size: 1.2rem; }

.sidebar-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  border-radius: 6px;
  opacity: 0;
  width: 0;
  overflow: hidden;
  flex-shrink: 0;
  transition: opacity 280ms var(--ease), width 280ms var(--ease);
}

/* Text elements that hide on collapse */
.sidebar-text {
  transition: opacity 200ms var(--ease), width 200ms var(--ease);
  overflow: hidden;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
}
.user-info {
  transition: opacity 200ms var(--ease), width 200ms var(--ease);
  overflow: hidden;
  white-space: nowrap;
  min-width: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.875rem;
  background: rgba(255 255 255 / 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 1rem;
  transition: border-color var(--t);
}
.sidebar-user:hover { border-color: var(--border-h); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber) 0%, #f97316 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: #1a0e08;
  overflow: hidden; flex-shrink: 0;
  font-family: 'Syne', sans-serif;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { font-size: 0.85rem; font-weight: 600; line-height: 1.2; }
.user-tag  { font-size: 0.72rem; color: var(--text-3); margin-top: 0.1rem; }

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0 0.625rem;
  margin: 1.75rem 0 0.5rem;
  transition: opacity 200ms var(--ease), max-height 280ms var(--ease), margin 280ms var(--ease);
  max-height: 2rem;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-nav { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }

/* Lucide icon sizing resets */
.nav-icon,
[data-lucide] {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.icon-sm { width: 14px; height: 14px; }
.icon-xs { width: 12px; height: 12px; }
.btn [data-lucide],
.btn .nav-icon { width: 15px; height: 15px; stroke-width: 2; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-3);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--t), color var(--t), border-color var(--t);
  width: 100%;
}
a.nav-item { text-decoration: none; font-weight: 400; }
.nav-item:hover { background: rgba(255 255 255 / 0.05); color: var(--text-2); }
.nav-item.active {
  background: var(--amber-dim);
  color: var(--amber);
  border-color: rgba(233 117 83 / 0.18);
}
.nav-item.active .nav-icon { filter: none; }
.nav-icon { font-size: 0.95rem; flex-shrink: 0; }

.sidebar-footer { margin-top: auto; padding-top: 0.5rem; border-top: 1px solid var(--border); }
.logout-btn { color: var(--text-3); margin-top: 0.25rem; }
.logout-btn:hover { background: var(--red-dim); color: var(--red); }

/* ── Main Content ───────────────────────────────────────────────────────── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2.25rem 1.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(31 30 29 / 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 0.875rem; }
.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.sidebar-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: var(--t);
  line-height: 1;
}
.sidebar-toggle:hover { background: rgba(255 255 255 / 0.06); color: var(--text); }

/* ── Stats Bar ──────────────────────────────────────────────────────────── */
.tasks-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  padding: 1.25rem 1.75rem 0.5rem;
}

.stat-card {
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t);
}
.stat-card:hover { border-color: var(--border-h); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--amber), transparent);
  opacity: 0;
  transition: opacity var(--t);
}
.stat-card:hover::before { opacity: 1; }

.stat-icon {
  width: 18px; height: 18px;
  margin-bottom: 0.5rem;
  color: var(--text-3);
  display: block;
  flex-shrink: 0;
}
.stat-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}
.stat-label { font-size: 0.7rem; color: var(--text-3); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.07em; font-weight: 500; }
.stat-num.danger  { color: var(--red); }
.stat-num.success { color: var(--green); }

/* ── Tasks List ─────────────────────────────────────────────────────────── */
.tasks-list {
  padding: 0.875rem 1.75rem 3rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.75rem;
  align-content: start;
  overflow-y: auto;
  flex: 1;
}

.tasks-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 4rem 2rem;
  color: var(--text-3);
  text-align: center;
  animation: fade-up 0.4s var(--ease);
  grid-column: 1 / -1;
}
.empty-icon {
  font-size: 2.5rem;
  filter: grayscale(0.4);
  opacity: 0.6;
}
.empty-text { font-family: 'Syne', sans-serif; font-size: 1rem; font-weight: 700; color: var(--text-2); }
.empty-sub  { font-size: 0.8rem; }

/* ── Task Card ──────────────────────────────────────────────────────────── */
.task-card {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 1rem 1rem 0.85rem;
  border-radius: var(--radius);
  background: rgba(255 255 255 / 0.026);
  border: 1px solid var(--border);
  transition: border-color var(--t), background var(--t), box-shadow var(--t-fast);
  position: relative;
  overflow: hidden;
  animation: fade-up 0.3s var(--ease) both;
  cursor: default;
}
.task-card:hover {
  border-color: var(--border-h);
  background: rgba(255 255 255 / 0.04);
  transform: translateY(-1px);
  box-shadow: 0 8px 32px rgba(0 0 0 / 0.25);
}

/* Priority stripe — top bar */
.task-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  transition: opacity var(--t);
}
.task-card.priority-high::before   { background: linear-gradient(90deg, var(--red), transparent); }
.task-card.priority-medium::before { background: linear-gradient(90deg, var(--yellow), transparent); }
.task-card.priority-low::before    { background: linear-gradient(90deg, var(--teal), transparent); }

.task-card.status-done { opacity: 0.45; }
.task-card.status-done .task-title { text-decoration: line-through; color: var(--text-3); }

/* Staggered entrance */
.task-card:nth-child(1)  { animation-delay: 0.03s; }
.task-card:nth-child(2)  { animation-delay: 0.06s; }
.task-card:nth-child(3)  { animation-delay: 0.09s; }
.task-card:nth-child(4)  { animation-delay: 0.12s; }
.task-card:nth-child(5)  { animation-delay: 0.15s; }
.task-card:nth-child(n+6) { animation-delay: 0.18s; }

/* Card top row: checkbox + action buttons */
.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* Checkbox */
.task-check {
  width: 18px; height: 18px;
  border: 1.5px solid var(--border-h);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: border-color var(--t), background var(--t), box-shadow var(--t);
  color: transparent;
  background: none;
}
.task-check:hover {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--green);
}
.task-card.status-done .task-check {
  background: var(--green);
  border-color: var(--green);
  color: #1a0e08;
  box-shadow: 0 0 8px rgba(34 197 94 / 0.3);
}

.task-title {
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.task-desc {
  font-size: 0.775rem;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}
.task-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-top: auto;
}

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.13rem 0.45rem;
  border-radius: 99px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.5;
}
.badge-high    { background: var(--red-dim);    color: #fca5a5; border: 1px solid rgba(239 68 68 / 0.2); }
.badge-medium  { background: var(--yellow-dim); color: #fde68a; border: 1px solid rgba(234 179 8 / 0.2); }
.badge-low     { background: var(--teal-dim);   color: #5eead4; border: 1px solid rgba(20 184 166 / 0.2); }
.badge-pending { background: rgba(233 117 83 / 0.1); color: var(--amber); border: 1px solid rgba(233 117 83 / 0.2); }
.badge-done    { background: var(--green-dim);  color: #86efac; border: 1px solid rgba(34 197 94 / 0.2); }
.badge-api     { background: rgba(20 184 166 / 0.1); color: var(--teal); border: 1px solid rgba(20 184 166 / 0.2); }
.badge-bot     { background: rgba(233 117 83 / 0.1); color: var(--amber); border: 1px solid rgba(233 117 83 / 0.2); }

.deadline-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.7rem;
  color: var(--text-3);
}
.deadline-badge.ok      { color: #5eead4; }
.deadline-badge.soon    { color: var(--yellow); }
.deadline-badge.overdue { color: var(--red); }

/* ── Task card clickable ────────────────────────────────────────────────── */
.task-card { cursor: pointer; }
.task-card:active { transform: translateY(0) scale(0.99); }

/* ── Task Actions ───────────────────────────────────────────────────────── */
.task-actions {
  display: flex;
  gap: 0.2rem;
  align-items: center;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity var(--t);
}
.task-card:hover .task-actions { opacity: 1; }

.task-action-btn {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--t), color var(--t), border-color var(--t);
  flex-shrink: 0;
  padding: 0;
}
.task-action-btn svg { width: 13px; height: 13px; flex-shrink: 0; }
.task-action-btn:hover:not(:disabled) { background: rgba(255 255 255 / 0.07); color: var(--text-2); border-color: var(--border-h); }
.task-action-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.task-action-btn.send-btn:hover:not(:disabled) { color: var(--amber); border-color: rgba(233 117 83 / 0.4); background: var(--amber-dim); }
.task-action-btn.delete-btn:hover:not(:disabled) { color: var(--red); border-color: rgba(239 68 68 / 0.4); background: var(--red-dim); }
.task-action-btn.sent { color: var(--green); border-color: rgba(34 197 94 / 0.3); }
.task-action-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* ── Backlog (Копилка) promote button ───────────────────────────────────── */
.task-action-btn.promote-btn:hover:not(:disabled) {
  color: var(--green);
  border-color: rgba(34 197 94 / 0.4);
  background: var(--green-dim);
}
.task-check.promote-check {
  border-radius: var(--radius-xs);
  width: 20px; height: 20px;
}
.task-check.promote-check:hover {
  border-color: var(--green);
  background: var(--green-dim);
  color: var(--green);
}

/* ── Backlog hint banner ─────────────────────────────────────────────────── */
.backlog-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 1.75rem 0;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(234 179 8 / 0.07);
  border: 1px solid rgba(234 179 8 / 0.15);
  color: var(--text-3);
  font-size: 0.775rem;
  line-height: 1.4;
}
.backlog-hint [data-lucide] { width: 13px; height: 13px; flex-shrink: 0; color: var(--amber); opacity: 0.8; }

/* Backlog single stat grid */
#backlog-stats { grid-template-columns: 1fr; max-width: 220px; }

/* ── Toggle Switch ──────────────────────────────────────────────────────── */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  cursor: pointer;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255 255 255 / 0.1);
  border: 1px solid var(--border-h);
  border-radius: 24px;
  transition: background var(--t), border-color var(--t);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--text-3);
  border-radius: 50%;
  transition: transform var(--t), background var(--t);
}
.toggle-switch input:checked + .toggle-slider {
  background: rgba(233 117 83 / 0.28);
  border-color: rgba(233 117 83 / 0.5);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translate(20px, -50%);
  background: var(--amber);
}

/* ── Settings row ───────────────────────────────────────────────────────── */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
}
.setting-info { flex: 1; }
.setting-label { font-size: 0.9rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.setting-desc  { font-size: 0.78rem; color: var(--text-3); line-height: 1.4; }

.settings-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding-bottom: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.1rem;
}

/* Theme cycle button */
.theme-cycle-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.theme-cycle-btn:hover { background: var(--surface-3, var(--surface-2)); border-color: var(--amber); }
.theme-cycle-icon { display: flex; align-items: center; color: var(--amber); }
.theme-cycle-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }

/* 2FA row */
.setting-row--2fa { opacity: 0.55; }
.toggle-switch--disabled { cursor: not-allowed; pointer-events: none; }

.badge-soon {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(245,158,11,0.15);
  color: var(--amber, #f59e0b);
  border-radius: 5px;
  padding: 0.1rem 0.4rem;
  vertical-align: middle;
}

/* ── Modal footer info ──────────────────────────────────────────────────── */
.modal-footer-info {
  font-size: 0.78rem;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.modal-footer-info svg { flex-shrink: 0; opacity: 0.7; }
.modal-footer-info.active { color: var(--amber); }

/* ── Task Detail ────────────────────────────────────────────────────────── */
#page-task-detail { animation: fade-in 0.3s var(--ease); }
.task-detail-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.back-btn { align-self: flex-start; }
.task-detail-card {
  border-radius: var(--radius-xl);
  padding: 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  animation: scale-in 0.35s var(--ease);
}
.detail-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.detail-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.detail-desc { color: var(--text-2); line-height: 1.65; font-size: 0.9rem; }

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}
.detail-meta-item {
  padding: 0.75rem;
  background: rgba(255 255 255 / 0.025);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--t);
}
.detail-meta-item:hover { border-color: var(--border-h); }
.detail-meta-label {
  font-size: 0.65rem;
  color: var(--text-3);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.detail-meta-label svg { width: 10px; height: 10px; flex-shrink: 0; opacity: 0.7; }
.detail-meta-value { font-size: 0.875rem; font-weight: 500; }
.detail-meta-value.muted { color: var(--text-3); font-style: italic; font-weight: 400; }
.detail-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.detail-owner { display: flex; align-items: center; gap: 0.5rem; }
.detail-owner-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), #f97316);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #1a0e08;
  font-family: 'Syne', sans-serif;
}

/* ── Archived task card ─────────────────────────────────────────────────── */
.task-card.archived {
  opacity: 0.6;
}
.task-card.archived .task-title {
  text-decoration: line-through;
  color: var(--text-3);
}

/* ── Modal ──────────────────────────────────────────────────────────────── */
/* ── Stats Share Modal ───────────────────────────────────────────────────── */
#stats-share-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
#stats-share-modal.hidden { display: none !important; }
#stats-share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0 0 0 / 0.75);
  backdrop-filter: blur(8px);
  z-index: 0;
}
.stats-share-modal-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: 0 40px 120px rgba(0 0 0 / 0.6);
  overflow: hidden;
  animation: modal-premium-enter 0.4s var(--ease) both;
  display: flex;
  flex-direction: column;
}
.stats-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}
.stats-share-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.stats-share-preview {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  padding: 1rem;
}
.stats-share-preview img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}
.stats-share-actions {
  display: flex;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.stats-share-actions .btn { flex: 1; justify-content: center; transition: all 0.2s var(--ease); }
#stats-share-bot {
  background: var(--amber-dim);
  border-color: rgba(233 117 83 / 0.2);
  color: var(--amber);
}
#stats-share-bot:hover {
  background: rgba(233 117 83 / 0.2);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(233 117 83 / 0.15);
}
#stats-share-bot:active { transform: translateY(0); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0 0 0 / 0.75);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 1rem;
  backdrop-filter: blur(6px);
  animation: fade-in 0.15s var(--ease);
}
.modal {
  width: 100%;
  max-width: 500px;
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  max-height: 90dvh;
  overflow: hidden;
  box-shadow: 0 40px 120px rgba(0 0 0 / 0.7), 0 0 0 1px rgba(255 255 255 / 0.07);
  animation: scale-in 0.22s var(--ease);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 0;
}
.modal-header h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.modal-close {
  background: rgba(255 255 255 / 0.06);
  border: 1px solid var(--border);
  color: var(--text-2);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-sm);
  transition: var(--t);
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  flex-shrink: 0;
}
.modal-close svg, .modal-close [data-lucide] { width: 14px; height: 14px; }
.modal-close:hover { background: rgba(255 255 255 / 0.1); color: var(--text); }
.modal-close:focus-visible { outline: 2px solid var(--amber); }

.modal-body {
  padding: 1.25rem 1.5rem;
  display: flex; flex-direction: column; gap: 1rem;
  overflow-y: auto;
}
.modal-footer {
  padding: 0.875rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap;
  background: rgba(255 255 255 / 0.02);
}
.modal-actions { display: flex; gap: 0.5rem; }

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }

.input-with-mic { position: relative; }
.input-with-mic .input { padding-right: 2.5rem; }
.mic-btn {
  position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border-radius: var(--radius-xs);
  transition: opacity var(--t), background var(--t), color var(--t);
  color: var(--text-3);
  opacity: 0.6;
}
.mic-btn svg { width: 14px; height: 14px; }
.mic-btn-top { top: 0.7rem; transform: none; }
.mic-btn:hover { opacity: 1; background: rgba(255 255 255 / 0.08); color: var(--text-2); }
.mic-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.mic-btn.recording { opacity: 1; color: var(--red); animation: blink 1s ease-in-out infinite; }

.voice-status {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8rem; color: var(--red); font-weight: 500;
}
.voice-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--red);
  animation: blink 1s ease-in-out infinite;
}

.checkbox-label {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; cursor: pointer; color: var(--text-2);
  transition: color var(--t);
}
.checkbox-label:hover { color: var(--text); }
.checkbox-label input {
  width: 14px; height: 14px;
  accent-color: var(--amber);
  cursor: pointer;
}

/* ── API Key Modal ──────────────────────────────────────────────────────── */
.api-key-display {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(255 255 255 / 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.api-key-display code {
  flex: 1;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--amber);
  line-height: 1.4;
}
.api-key-info { margin-top: 0.5rem; }
.api-key-info p { font-size: 0.78rem; color: var(--text-3); margin-bottom: 0.5rem; font-weight: 600; }
.api-key-info pre {
  font-size: 0.7rem;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.6;
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 2rem; right: 2rem;
  background: rgba(31 30 28 / 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-h);
  color: var(--text);
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 10000;
  max-width: 340px;
  box-shadow: 0 20px 50px rgba(0 0 0 / 0.4);
  animation: toast-premium-enter 0.5s cubic-bezier(0.19, 1, 0.22, 1) both;
  display: flex; align-items: center; gap: 0.75rem;
}
.toast.toast-success { border-color: rgba(34 197 94 / 0.3); color: #86efac; }
.toast.toast-error   { border-color: rgba(239 68 68 / 0.3); color: #fca5a5; }

/* ── Loading ────────────────────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 3rem; color: var(--text-3); gap: 0.5rem;
}
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border-h);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .tasks-stats { grid-template-columns: repeat(2, 1fr); }
  :root { --sidebar-w: 0px; }

  /* Force sidebar off-screen regardless of .collapsed class specificity.
     Use transform so the panel is fully hidden no matter its width. */
  .sidebar, .sidebar.collapsed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 86vw !important;
    max-width: 340px !important;
    padding: 1.1rem 0.9rem calc(1.1rem + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 60;
    transform: translateX(-102%);
    transition: transform 0.28s var(--ease), box-shadow 0.28s var(--ease);
    box-shadow: none;
    height: 100dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .sidebar.open, .sidebar.collapsed.open {
    transform: translateX(0);
    box-shadow: 6px 0 50px rgba(0 0 0 / 0.65);
  }

  /* ── Fully neutralise the desktop "collapsed" (icon-only) state on mobile ──
     so a sidebar collapsed on desktop still renders as a normal full menu. */
  .sidebar.collapsed .sidebar-text,
  .sidebar.collapsed .user-info,
  .sidebar.collapsed .sidebar-logo-text {
    opacity: 1 !important;
    width: auto !important;
    max-width: none !important;
    overflow: visible !important;
    pointer-events: auto !important;
  }
  .sidebar.collapsed .sidebar-section-label {
    display: block !important;
    opacity: 1 !important;
    max-height: 2rem !important;
    margin: 1.4rem 0 0.4rem !important;
  }
  .sidebar.collapsed .nav-item,
  .sidebar .nav-item {
    justify-content: flex-start !important;
    gap: 0.85rem !important;
    padding: 0.8rem 0.85rem !important;
  }
  .sidebar.collapsed .sidebar-user {
    justify-content: flex-start !important;
    gap: 0.75rem !important;
    padding: 0.7rem 0.875rem !important;
  }
  .sidebar.collapsed .sidebar-logo {
    justify-content: flex-start !important;
    gap: 0.6rem !important;
    padding: 0.25rem 0.5rem !important;
  }
  .sidebar.collapsed .sidebar-logo-img {
    opacity: 1 !important;
    width: 30px !important;
    height: 30px !important;
  }
  .sidebar .sidebar-collapse-btn { display: none !important; }

  /* Bigger, comfortable touch targets + clearer icons */
  .sidebar .nav-item {
    font-size: 0.95rem;
    min-height: 46px;
    border-radius: var(--radius);
  }
  .sidebar .nav-item [data-lucide],
  .sidebar .nav-item .nav-icon,
  .sidebar .nav-item svg {
    width: 19px !important;
    height: 19px !important;
  }
  .sidebar .nav-item:active { background: rgba(255 255 255 / 0.08); }
  .sidebar-nav { gap: 0.2rem; }

  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.15rem;
  }

  #page-dashboard { overflow-x: hidden; }
  .main-content   { width: 100%; max-width: 100%; overflow-x: hidden; }
  .tasks-list     { padding: 0.75rem 1rem 2rem; grid-template-columns: 1fr; }
  .tasks-stats    { padding: 0.75rem 1rem 0; }
  .main-header    { padding: 0.8rem 1rem; }
  .form-row       { grid-template-columns: 1fr; }
  .task-actions   { opacity: 1; }
  .tasks-empty    { grid-column: 1 / -1; }
  .filters-row      { padding: 0.5rem 1rem 1rem; gap: 0.5rem; }
  .desktop-filters  { display: none !important; }
  .mobile-filter-select { display: block; }
  .folders-bar      { padding: 0 1rem 0.5rem; }
}
@media (max-width: 480px) {
  .tasks-stats { grid-template-columns: repeat(2, 1fr); }
  .modal       { border-radius: var(--radius-lg); max-height: 95dvh; }
  .login-card  { padding: 1.75rem 1.25rem; }
  .detail-meta-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   WIZARD — Create Task (multi-step)
═══════════════════════════════════════════════════════════════════════════ */

/* ── Overlay ────────────────────────────────────────────────────────────── */
.wiz-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(31 30 29 / 0.92);
  backdrop-filter: blur(14px) saturate(120%);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  overflow-y: auto;
}


.wiz-x {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: rgba(255 255 255 / 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-3);
  cursor: pointer;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t), color var(--t);
}
.wiz-x:hover { background: rgba(255 255 255 / 0.1); color: var(--text-2); }

/* ── Step dots ──────────────────────────────────────────────────────────── */
.wiz-dots {
  display: flex;
  gap: 6px;
  margin-bottom: 2.5rem;
}
.wiz-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255 255 255 / 0.15);
  transition: background var(--t), width var(--t);
}
.wiz-dot.active {
  background: var(--amber);
  width: 20px;
  border-radius: 3px;
}

/* ── Step container ─────────────────────────────────────────────────────── */
.wiz-step {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: wiz-in 0.28s var(--ease);
}
@keyframes wiz-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wiz-prompt {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.wiz-hint {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: -0.25rem;
}

.wiz-back {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color var(--t);
  align-self: flex-start;
  margin-bottom: -0.5rem;
}
.wiz-back:hover { color: var(--text-2); }

.wiz-skip {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.82rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  transition: color var(--t);
  margin-top: -0.25rem;
}
.wiz-skip:hover { color: var(--text-2); }

/* ── Input field ────────────────────────────────────────────────────────── */
.wiz-field-wrap {
  position: relative;
  width: 100%;
}

.wiz-glow {
  position: absolute;
  inset: -24px;
  border-radius: 40px;
  background: radial-gradient(ellipse, rgba(233 117 83 / 0.08) 0%, transparent 70%);
  pointer-events: none;
  filter: blur(16px);
  transition: opacity var(--t);
  opacity: 0;
}
.wiz-field-wrap:focus-within .wiz-glow { opacity: 1; }

.wiz-input {
  width: 100%;
  background: rgba(255 255 255 / 0.055);
  border: 1.5px solid rgba(255 255 255 / 0.1);
  border-radius: 18px;
  padding: 1rem 3.5rem 1rem 3.25rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 1.05rem;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  position: relative;
  z-index: 1;
}
.wiz-input::placeholder { color: rgba(255 255 255 / 0.25); }
.wiz-input:focus {
  border-color: rgba(233 117 83 / 0.45);
  box-shadow: 0 0 0 4px rgba(233 117 83 / 0.08), 0 16px 48px rgba(0 0 0 / 0.3);
  background: rgba(255 255 255 / 0.075);
}

.wiz-textarea {
  resize: none;
  padding-top: 1rem;
  padding-bottom: 1rem;
  line-height: 1.55;
  border-radius: 18px;
}

.wiz-mic {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: none;
  border: none;
  color: rgba(255 255 255 / 0.3);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: var(--radius-xs);
  transition: color var(--t), background var(--t);
  display: flex; align-items: center;
}
.wiz-mic--ta { top: 1rem; transform: none; }
.wiz-mic:hover, .wiz-mic.recording { color: var(--amber); background: var(--amber-dim); }

.wiz-send {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: var(--amber);
  border: none;
  border-radius: 12px;
  color: #1a0e08;
  cursor: pointer;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t), box-shadow var(--t), transform 0.1s;
  flex-shrink: 0;
}
.wiz-send--ta { top: auto; bottom: 0.6rem; transform: none; }
.wiz-send:hover  { background: var(--amber-h); box-shadow: 0 0 16px var(--amber-glow); }
.wiz-send:active { transform: translateY(-50%) scale(0.93); }
.wiz-send--ta:active { transform: scale(0.93); }

/* ── Voice status ───────────────────────────────────────────────────────── */
.wiz-voice-status {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--amber);
  font-weight: 500;
  background: rgba(233 117 83 / 0.1);
  border: 1px solid rgba(233 117 83 / 0.3);
  border-radius: 99px;
  padding: 0.4rem 1rem;
  white-space: nowrap;
}

/* ── Calendar ───────────────────────────────────────────────────────────── */
/* Mobile picker: shown on small screens instead of calendar */
.wcal-mobile-picker {
  display: none;
  width: 100%;
  max-width: 400px;
  flex-direction: column;
  gap: 0.875rem;
}
.wcal-native-input {
  width: 100%;
  background: rgba(255 255 255 / 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  font-family: 'DM Sans', sans-serif;
  padding: 0.75rem 1rem;
  outline: none;
  box-sizing: border-box;
  cursor: pointer;
}
.wcal-native-input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(233 117 83 / 0.15); }
.wcal-native-prio { display: flex; flex-direction: column; gap: 0.5rem; }

/* Desktop calendar: shown on large screens */
.wiz-cal-desktop { display: flex; }

@media (max-width: 960px) {
  .wcal-mobile-picker { display: flex; }
  .wiz-cal-desktop    { display: none; }
}

.wiz-cal {
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius-lg);
  padding: 1rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.wcal-presets {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.wcal-preset {
  padding: 0.3rem 0.7rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: rgba(255 255 255 / 0.04);
  color: var(--text-2);
  font-size: 0.78rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.wcal-preset:hover  { background: rgba(255 255 255 / 0.08); color: var(--text); border-color: var(--border-h); }
.wcal-preset.active { background: var(--amber-dim); border-color: rgba(233 117 83 / 0.4); color: var(--amber); }

.wcal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wcal-month-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
}
.wcal-nav-btn {
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-xs);
  transition: color var(--t), background var(--t);
}
.wcal-nav-btn:hover { color: var(--text); background: rgba(255 255 255 / 0.07); }

.wcal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  width: 100%;
}
.wcal-weekdays span {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.04em;
  padding-bottom: 0.3rem;
}
.wcal-weekdays .weekend { color: rgba(233 117 83 / 0.5); }

.wcal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 36px);
  gap: 2px;
  width: 100%;
}
.wcal-day {
  width: 100%;
  height: 36px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  border: none;
  background: none;
  color: var(--text-2);
  transition: background var(--t), color var(--t);
  position: relative;
}
.wcal-day:hover:not(.past):not(.empty) { background: rgba(255 255 255 / 0.08); color: var(--text); }
.wcal-day.today {
  color: var(--amber);
  font-weight: 600;
}
.wcal-day.today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--amber);
}
.wcal-day.selected {
  background: var(--amber);
  color: #1a0e08;
  font-weight: 700;
}
.wcal-day.selected.today::after { background: #1a0e08; }
.wcal-day.past   { opacity: 0.25; cursor: not-allowed; }
.wcal-day.empty  { cursor: default; }
.wcal-day.weekend:not(.selected) { color: rgba(245 158 11 / 0.6); }

/* ── Time picker ────────────────────────────────────────────────────────── */
.wcal-lbl {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  display: block;
  margin-bottom: 0.35rem;
}

.wcal-time {
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}
.wcal-time-ctrl {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
}
.wct-btn {
  background: rgba(255 255 255 / 0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-2);
  cursor: pointer;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
  transition: background var(--t), color var(--t);
  flex-shrink: 0;
}
.wct-btn:hover { background: rgba(255 255 255 / 0.12); color: var(--text); }
.wct-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
  min-width: 2ch;
  text-align: center;
}
.wct-sep {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  color: var(--text-3);
  margin: 0 0.25rem;
}

/* ── Priority ───────────────────────────────────────────────────────────── */
.wcal-prio {
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}
.wcal-prio-btns {
  display: flex;
  gap: 0.4rem;
}
.wcal-prio-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255 255 255 / 0.03);
  color: var(--text-2);
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
  transition: background var(--t), border-color var(--t), color var(--t);
}
.wcal-prio-btn:hover { background: rgba(255 255 255 / 0.07); color: var(--text); border-color: var(--border-h); }
.wcal-prio-btn.active[data-prio="low"]    { background: var(--teal-dim);   border-color: rgba(20 184 166 / 0.4); color: var(--teal); }
.wcal-prio-btn.active[data-prio="medium"] { background: var(--amber-dim);  border-color: rgba(233 117 83 / 0.4); color: var(--amber); }
.wcal-prio-btn.active[data-prio="high"]   { background: var(--red-dim);    border-color: rgba(239 68 68 / 0.4);  color: var(--red); }

.pdot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.pdot.low    { background: var(--teal); }
.pdot.medium { background: var(--amber); }
.pdot.high   { background: var(--red); }

/* ── Create button ──────────────────────────────────────────────────────── */
.wiz-create-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.75rem 2rem;
  background: var(--amber);
  border: none;
  border-radius: var(--radius-sm);
  color: #1a0e08;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t), transform 0.1s;
  margin-top: 0.25rem;
  width: 100%;
  max-width: 400px;
  justify-content: center;
}
.wiz-create-btn:hover  { background: var(--amber-h); box-shadow: 0 0 24px var(--amber-glow); }
.wiz-create-btn:active { transform: scale(0.98); }
.wiz-create-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Shake on empty title */
@keyframes wiz-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-6px); }
  40%      { transform: translateX(6px); }
  60%      { transform: translateX(-4px); }
  80%      { transform: translateX(4px); }
}
.wiz-shake { animation: wiz-shake 0.38s ease; border-color: #ef4444 !important; box-shadow: 0 0 0 3px rgba(239,68,68,.25) !important; }

/* Recording state for wizard mic */
#wizard .wiz-mic.recording { color: var(--amber); }

/* Amber dot for wizard voice status */
.wiz-voice-status .voice-dot { background: var(--amber); animation: pulse-ring 1s ease-in-out infinite; }

@media (max-width: 480px) {
  .wiz-prompt { font-size: 1.15rem; }
  .wiz-input  { font-size: 0.95rem; padding: 0.875rem 3.25rem 0.875rem 3rem; }
  .wiz-cal    { padding: 0.75rem; }
  .wcal-grid  { grid-template-rows: repeat(6, 32px); }
  .wcal-day   { font-size: 0.75rem; height: 32px; }
}

/* ── Admin Panel ─────────────────────────────────────────────────────────── */
.admin-stats-row {
  display: flex; gap: 0.75rem; margin-bottom: 1.25rem;
}
.admin-stat {
  flex: 1; background: rgba(255 255 255 / 0.04); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.75rem; text-align: center;
  font-size: 0.72rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em;
}
.admin-stat span { display: block; font-size: 1.5rem; font-weight: 700; color: var(--amber); margin-bottom: 0.2rem; }

.admin-users-list { display: flex; flex-direction: column; gap: 0.75rem; }

.admin-user-card {
  background: rgba(255 255 255 / 0.03); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; display: flex; flex-direction: column; gap: 0.75rem;
}
.admin-user-header { display: flex; align-items: center; gap: 0.75rem; }
.admin-user-avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--amber-dim);
  color: var(--amber); font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden;
}
.admin-user-info { flex: 1; min-width: 0; }
.admin-user-name { font-weight: 600; font-size: 0.92rem; }
.admin-user-meta { font-size: 0.75rem; color: var(--text-3); margin-top: 0.15rem; }
.admin-user-meta code { color: var(--text-2); background: rgba(255 255 255 / 0.06); padding: 0.05rem 0.3rem; border-radius: 3px; }

.admin-key-row {
  display: flex; align-items: center; gap: 0.5rem;
  background: rgba(255 255 255 / 0.03); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem; flex-wrap: wrap;
}
.admin-key-label { font-size: 0.7rem; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; flex-shrink: 0; }
.admin-key-val { font-size: 0.72rem; color: var(--amber); flex: 1; word-break: break-all; }
.admin-copy-btn {
  background: none; border: none; color: var(--text-3); cursor: pointer; padding: 0.2rem;
  border-radius: 4px; transition: color var(--t); flex-shrink: 0;
}
.admin-copy-btn:hover { color: var(--amber); }

.admin-sessions { display: flex; flex-direction: column; gap: 0.4rem; }
.admin-sessions-label {
  font-size: 0.7rem; color: var(--text-3); text-transform: uppercase;
  letter-spacing: 0.05em; display: flex; align-items: center; gap: 0.3rem; margin-bottom: 0.1rem;
}
.admin-session {
  background: rgba(255 255 255 / 0.02); border: 1px solid rgba(255 255 255 / 0.06);
  border-radius: var(--radius-sm); padding: 0.5rem 0.75rem;
  display: flex; flex-direction: column; gap: 0.25rem;
}
.admin-session-row {
  font-size: 0.78rem; color: var(--text-2); display: flex; align-items: center; gap: 0.4rem;
}
.admin-session-row code { color: var(--text); background: rgba(255 255 255 / 0.06); padding: 0.05rem 0.3rem; border-radius: 3px; font-size: 0.75rem; }
.admin-session-row svg { color: var(--text-3); flex-shrink: 0; }

.admin-username-link {
  color: var(--amber); text-decoration: none; font-weight: 500;
  transition: opacity var(--t);
}
.admin-username-link:hover { opacity: 0.75; text-decoration: underline; }

/* Admin responsive */
@media (max-width: 600px) {
  #modal-admin .modal { max-width: 100% !important; width: 100% !important; margin: 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0; align-self: flex-end; }
  #modal-admin { align-items: flex-end; }
  #modal-admin .modal-body { max-height: 80vh !important; }

  .admin-stats-row { gap: 0.4rem; }
  .admin-stat { padding: 0.5rem 0.4rem; font-size: 0.65rem; }
  .admin-stat span { font-size: 1.2rem; }

  .admin-user-card { padding: 0.75rem; }
  .admin-key-row { flex-wrap: wrap; }
  .admin-key-val { font-size: 0.65rem; width: 100%; }

  .admin-session { padding: 0.4rem 0.6rem; }
  .admin-session-row { font-size: 0.72rem; flex-wrap: wrap; }
  .admin-session-row code { word-break: break-all; }
}

/* ── Admin: Tabs ─────────────────────────────────────────────────────────── */
.admin-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  background: rgba(255 255 255 / 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem;
}
.admin-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  padding: 0.5rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: background var(--t), color var(--t);
  font-family: 'DM Sans', sans-serif;
}
.admin-tab:hover { background: rgba(255 255 255 / 0.05); color: var(--text-2); }
.admin-tab.active { background: var(--amber-dim); color: var(--amber); }

/* ── Sidebar mobile overlay ──────────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0 0 0 / 0.55);
  z-index: 49;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay:not(.hidden) { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION (frost-glass, scrollable, neon active border)
═══════════════════════════════════════════════════════════════════════════ */
.mobile-bottom-nav { display: none; }

/* Frost-glass palette (iOS-style) */
:root {
  --nav-frost-bg:     rgba(28, 24, 22, 0.55);
  --nav-frost-border: rgba(255, 255, 255, 0.10);
  --nav-face-bg:      #211c1a;
}
[data-theme="light"] {
  /* Greyer frost so the active pill's face reads against it, plus a soft warm
     fill for the active face so it's clearly visible (white-on-white was not) */
  --nav-frost-bg:     rgba(238, 234, 229, 0.78);
  --nav-frost-border: rgba(255, 255, 255, 0.85);
  --nav-face-bg:      #fff4ef;
}

@media (max-width: 960px) {
  /* Transparent positioning wrapper — the visible bar is .mbn-scroll */
  .mobile-bottom-nav {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 48; /* below sidebar overlay (49) so the burger menu covers it */
    /* Lift the bar off the very bottom — in the Telegram Mini App the safe-area
       inset is usually 0 and the bar otherwise hugs the bottom edge / TG UI. */
    padding: 0 0 calc(1.45rem + env(safe-area-inset-bottom, 0px));
    pointer-events: none; /* let taps in the side gaps fall through */
  }

  /* The floating frost-glass bar: rounded, inset margins, blurred */
  .mbn-scroll {
    position: relative;
    pointer-events: auto;
    display: flex;
    gap: 0.15rem;
    margin: 0 0.7rem;
    padding: 0.4rem 0.45rem;
    border-radius: 28px;
    background: var(--nav-frost-bg);
    backdrop-filter: blur(22px) saturate(140%);
    -webkit-backdrop-filter: blur(22px) saturate(140%);
    border: 1px solid var(--nav-frost-border);
    box-shadow: 0 8px 32px rgba(0 0 0 / 0.42), inset 0 1px 0 rgba(255 255 255 / 0.06);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    /* Native horizontal swipe scrolls the bar; taps switch tabs. */
    touch-action: pan-x;
  }
  .mbn-scroll::-webkit-scrollbar { display: none; }

  /* ── Liquid sliding indicator ─────────────────────────────────────────────
     Outer element carries the JS-driven position (transform/width). The inner
     ".mbn-indicator-face" draws the running neon ring by animating the conic
     gradient's start angle (registered via @property) — no rotating child and
     no overflow clipping, which WebKit failed to apply until a recomposite
     (the "broken border until app re-expand / alt-tab" bug). */
  .mbn-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(0);
    transition:
      transform 0.46s cubic-bezier(0.34, 1.28, 0.4, 1),
      width     0.46s cubic-bezier(0.34, 1.28, 0.4, 1),
      height    0.2s ease,
      top       0.2s ease,
      opacity   0.2s ease;
  }
  .mbn-indicator.ready { opacity: 1; }
  /* While the finger is down the pill tracks in real time (liquid) */
  .mbn-indicator.dragging {
    transition:
      transform 0.13s cubic-bezier(0.22, 1, 0.36, 1),
      width     0.18s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .mbn-indicator-face {
    position: absolute;
    inset: 0;
    border-radius: 15px;
    display: block;
    background: conic-gradient(
      from var(--mbn-angle, 0deg),
      transparent 0deg,
      transparent 70deg,
      #C75A35 120deg,
      #E97553 165deg,
      #F4A080 190deg,
      #E97553 215deg,
      #C75A35 260deg,
      transparent 300deg
    );
    animation: mbn-ring 2.4s linear infinite;
  }
  .mbn-indicator-face::after {
    content: '';
    position: absolute;
    inset: 1.8px;
    border-radius: 13px;
    background: var(--nav-face-bg);
  }

  .mbn-item {
    position: relative;
    z-index: 1; /* sit above the sliding indicator */
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.24rem;
    min-width: 4.1rem;
    padding: 0.5rem 0.55rem;
    border: none;
    background: transparent;
    color: var(--text-3);
    border-radius: 15px;
    font-family: 'DM Sans', sans-serif;
    font-size: 0.66rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    scroll-snap-align: center;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.25s ease, transform 0.2s ease;
  }
  .mbn-item [data-lucide],
  .mbn-item svg { width: 21px !important; height: 21px !important; }
  .mbn-item span { white-space: nowrap; }
  .mbn-item.active { color: var(--amber); }

  /* Reserve space so content isn't hidden behind the floating bar */
  .tasks-list,
  .universe-grid,
  .projects-grid { padding-bottom: 116px !important; }
  .stats-charts { padding-bottom: 116px; }

  /* .main-content is overflow:hidden — panels whose inner grid has no own
     scroll (stats/universe/projects) must scroll as a whole, or their content
     gets clipped on phones. (tasks/backlog scroll via .tasks-list already.) */
  #main-stats,
  #main-universe,
  #main-projects {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Slimmer hint on phones so it doesn't eat the screen */
  .universe-hint {
    padding: 0.9rem 1rem;
    margin: 1rem 1rem 1.25rem;
    font-size: 0.9rem;
    gap: 0.6rem;
  }
  .projects-grid,
  .universe-grid { padding-left: 1rem; padding-right: 1rem; }

  /* Hide sidebar entries that now live in the bottom bar (or are desktop-only) */
  .hide-mobile { display: none !important; }
}

/* Registered so the conic gradient's start angle can interpolate in keyframes.
   On engines without @property support the ring renders static — still correct,
   just not animated. */
@property --mbn-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
@keyframes mbn-ring {
  from { --mbn-angle: 0deg; }
  to   { --mbn-angle: 360deg; }
}

/* ── Per-tab icon press animations (each svg gets its own personality) ───── */
.mbn-anim-pop     { animation: mbn-ic-pop     0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
.mbn-anim-tick    { animation: mbn-ic-tick    0.7s  ease-in-out; }
.mbn-anim-bounce  { animation: mbn-ic-bounce  0.6s  cubic-bezier(0.34, 1.56, 0.64, 1); }
.mbn-anim-drop    { animation: mbn-ic-drop    0.55s cubic-bezier(0.34, 1.56, 0.64, 1); }
.mbn-anim-wiggle  { animation: mbn-ic-wiggle  0.6s  ease-in-out; }
.mbn-anim-sparkle { animation: mbn-ic-sparkle 0.7s  cubic-bezier(0.34, 1.56, 0.64, 1); }
.mbn-anim-flip    { animation: mbn-ic-flip    0.6s  cubic-bezier(0.34, 1.3, 0.5, 1); }
.mbn-anim-rise    { animation: mbn-ic-rise    0.6s  cubic-bezier(0.34, 1.56, 0.64, 1); }
.mbn-anim-spin    { animation: mbn-ic-spin    0.65s cubic-bezier(0.45, 0, 0.2, 1); }

/* Все — quick pop-in scale */
@keyframes mbn-ic-pop {
  0% { transform: scale(1); } 35% { transform: scale(0.72); } 100% { transform: scale(1); }
}
/* Активные — clock hand tick-tock */
@keyframes mbn-ic-tick {
  0% { transform: rotate(0); } 25% { transform: rotate(-22deg); }
  55% { transform: rotate(16deg); } 80% { transform: rotate(-7deg); } 100% { transform: rotate(0); }
}
/* Готово — happy jump */
@keyframes mbn-ic-bounce {
  0% { transform: translateY(0); } 30% { transform: translateY(-6px) scale(1.12); }
  60% { transform: translateY(1.5px) scale(0.96); } 100% { transform: translateY(0) scale(1); }
}
/* Архив — item drops into the box */
@keyframes mbn-ic-drop {
  0% { transform: translateY(0); } 30% { transform: translateY(-5px); }
  60% { transform: translateY(2px) scaleY(0.85); } 80% { transform: translateY(0) scaleY(1.06); } 100% { transform: none; }
}
/* Копилка — piggy shake (coin in!) */
@keyframes mbn-ic-wiggle {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-13deg); } 40% { transform: rotate(11deg); }
  60% { transform: rotate(-7deg); } 80% { transform: rotate(4deg); }
}
/* Universe — sparkle twirl + grow */
@keyframes mbn-ic-sparkle {
  0% { transform: rotate(0) scale(1); } 50% { transform: rotate(180deg) scale(1.25); }
  100% { transform: rotate(360deg) scale(1); }
}
/* Проекты — folder flips open */
@keyframes mbn-ic-flip {
  0% { transform: perspective(120px) rotateX(0); } 45% { transform: perspective(120px) rotateX(-150deg); }
  100% { transform: perspective(120px) rotateX(-360deg); }
}
/* Статистика — bars surge up */
@keyframes mbn-ic-rise {
  0% { transform: translateY(0) scaleY(1); } 35% { transform: translateY(3px) scaleY(0.55); }
  70% { transform: translateY(-2px) scaleY(1.18); } 100% { transform: translateY(0) scaleY(1); }
}
/* Настройки — gear half-turn */
@keyframes mbn-ic-spin {
  from { transform: rotate(0); } to { transform: rotate(180deg); }
}
@media (prefers-reduced-motion: reduce) {
  /* Keep the running neon border (it's a requested feature). If the user has
     "Reduce Motion" on, the border previously stopped — that was the bug.
     Just calm the pill's slide instead of killing the animation. */
  .mbn-indicator {
    transition: transform 0.25s ease, width 0.25s ease, opacity 0.2s ease;
  }
}

.admin-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
}

/* ── Admin: Access badges ────────────────────────────────────────────────── */
.access-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 0.35rem;
}
.access-granted      { background: rgba(86 184 110 / 0.15); color: #56b86e; border: 1px solid rgba(86 184 110 / 0.3); }
.access-denied-badge { background: rgba(232 88 88 / 0.12); color: var(--red); border: 1px solid rgba(232 88 88 / 0.25); }
.access-admin        { background: var(--amber-dim); color: var(--amber); border: 1px solid rgba(233 117 83 / 0.3); }
.access-trial        { background: rgba(99 179 237 / 0.12); color: #63b3ed; border: 1px solid rgba(99 179 237 / 0.3); }
.access-trial-expired { background: rgba(200 150 50 / 0.12); color: #c89632; border: 1px solid rgba(200 150 50 / 0.3); }

/* ── Admin: Payment config ───────────────────────────────────────────────── */
.payment-config-wrap { display: flex; flex-direction: column; gap: 1rem; }

.payment-price-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 0.75rem;
}
.payment-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255 255 255 / 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.875rem;
}
.payment-banks-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: -0.25rem;
}
.payment-banks-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.payment-bank-card {
  background: rgba(255 255 255 / 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  transition: border-color var(--t), background var(--t);
}
.payment-bank-card.active {
  border-color: rgba(233 117 83 / 0.4);
  background: rgba(233 117 83 / 0.04);
}
.payment-bank-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.payment-bank-name { font-weight: 600; font-size: 0.9rem; }
.payment-bank-active-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(233 117 83 / 0.3);
  padding: 0.1rem 0.4rem;
  border-radius: 20px;
}
.payment-bank-fields { display: flex; flex-direction: column; gap: 0.5rem; }

@media (max-width: 560px) {
  .payment-banks-grid { grid-template-columns: 1fr; }
  .payment-price-row  { grid-template-columns: 1fr; }
}

/* ── Access Denied Page ──────────────────────────────────────────────────── */
.access-denied-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: var(--bg);
}
.access-denied-wrap {
  max-width: 440px;
  width: 100%;
  padding: 2.5rem 2rem;
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.access-denied-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(233 117 83 / 0.1);
  border: 1px solid rgba(233 117 83 / 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--amber);
}
.access-denied-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.access-denied-sub { font-size: 0.9rem; color: var(--text-2); line-height: 1.6; }
.access-denied-steps {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  text-align: left;
}
.access-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-2);
  background: rgba(255 255 255 / 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
}
.access-step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--amber-dim);
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.access-denied-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; justify-content: center; width: 100%; }

/* ── Sidebar Divider ────────────────────────────────────────────────────── */
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0.625rem;
  opacity: 0.5;
}

/* ── STATISTICS PAGE ────────────────────────────────────────────────────── */
.stats-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.stats-range-picker {
  display: flex;
  padding: 4px;
  gap: 4px;
}
.range-btn {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--t);
}
.range-btn:hover { color: var(--text-2); background: rgba(255,255,255,0.05); }
.range-btn.active {
  background: var(--amber);
  color: #1a0e08;
}

.nd-meta-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.5rem 0;
}

.nd-meta-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
}

.nd-meta-item:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.nd-meta-item i {
  color: var(--text-3);
  width: 14px;
}

.nd-meta-info {
  display: flex;
  flex-direction: column;
}

.nd-meta-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  margin-bottom: 0.15rem;
}

.nd-meta-value {
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 500;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding: 1.25rem 1.75rem;
}

.stat-big-card {
  padding: 1.75rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.stat-big-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  font-weight: 600;
}
.stat-big-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.stat-big-num.success { color: var(--green); }
.stat-trend {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 0.5rem;
}

.stats-charts {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1.25rem;
  padding: 0 1.75rem 3rem;
}

.chart-container {
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.chart-title {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-2);
}

.chart-placeholder {
  height: 240px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-bottom: 25px;
  border-bottom: 1px solid var(--border);
  position: relative;
  margin-top: 10px;
}

/* Custom CSS Bar Chart */
.bar-group {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  position: relative;
}
.bar {
  flex: 1;
  min-width: 4px;
  border-radius: 2px 2px 0 0;
  transition: height 0.6s var(--ease);
  position: relative;
}
.bar.created { background: var(--amber); opacity: 0.4; }
.bar.completed { background: var(--green); }

.bar:hover::after {
  content: attr(data-value);
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  border: 1px solid var(--border-h);
  z-index: 10;
}

.chart-label {
  position: absolute;
  bottom: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-3);
  white-space: nowrap;
}

.priority-stats {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.prio-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.prio-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}
.prio-bar-bg {
  height: 6px;
  background: rgba(255,255,255,0.05);
  border-radius: 3px;
  overflow: hidden;
}
.prio-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s var(--ease);
}
.prio-bar-fill.high { background: var(--red); }
.prio-bar-fill.medium { background: var(--yellow); }
.prio-bar-fill.low { background: var(--teal); }

@media (max-width: 900px) {
  .stats-grid, .stats-charts {
    grid-template-columns: 1fr;
  }
}

/* ── Mobile native selects ──────────────────────────────────────────────── */
.mobile-filter-select {
  display: none;
  flex: 1;
  min-width: 0;
  background: rgba(255 255 255 / 0.06);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'DM Sans', sans-serif;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  padding-right: 2rem;
  transition: border-color 0.15s;
}
.mobile-filter-select:focus { border-color: var(--amber); }
.mobile-filter-select option { background: #1f1e1d; color: var(--text); }

/* ── View Filters ───────────────────────────────────────────────────────── */
.filters-row {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.75rem 1.5rem;
  gap: 0.75rem;
}

.view-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
  min-width: 0;
}
.view-filters::-webkit-scrollbar { display: none; }

.filter-pill {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  color: var(--text-3);
  padding: 0.45rem 1rem;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease);
}
.filter-pill:hover { 
  background: rgba(255,255,255,0.06); 
  color: var(--text-2); 
  border-color: var(--border-h);
}
.filter-pill.active {
  background: var(--amber-dim);
  border-color: rgba(245,158,11,0.3);
  color: var(--amber);
}

/* ── Priority filter ──────────────────────────────────────────────────────── */
.priority-filter-wrap {
  position: relative;
  flex-shrink: 0;
}

.priority-filter-btn {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.priority-chevron {
  width: 12px;
  height: 12px;
  transition: transform 0.2s var(--ease);
}

.priority-filter-btn[aria-expanded="true"] .priority-chevron {
  transform: rotate(180deg);
}

.priority-filter-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  z-index: 100;
  min-width: 160px;
  overflow: hidden;
}

.priority-filter-menu.hidden { display: none; }

.priority-filter-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border: none;
  background: none;
  color: var(--text-2);
  font-size: 0.8rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.priority-filter-item:hover { background: var(--surface-2); }

.priority-filter-item.active { color: var(--amber); }

.priority-filter-item::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
}

.priority-filter-item[data-priority="high"]::before   { background: #E85858; }
.priority-filter-item[data-priority="medium"]::before { background: var(--amber); }
.priority-filter-item[data-priority="low"]::before    { background: #56B86E; }
.priority-filter-item[data-priority="all"]::before    { display: none; }

/* ── Folders menu ──────────────────────────────────────────────────────────── */
.folders-bar {
  padding: 0.75rem 1.75rem;
  position: relative;
}

.folders-menu-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.folders-chevron {
  transition: transform 0.2s var(--ease);
}

.folders-menu-btn[aria-expanded="true"] .folders-chevron {
  transform: rotate(180deg);
}

.folders-menu {
  position: absolute;
  top: calc(100% + 0.5rem);
  left: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  min-width: 200px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.1);
  z-index: 100;
  overflow: hidden;
}

.folders-menu.hidden {
  display: none;
}

.folder-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  color: var(--text-2);
  text-align: left;
  cursor: pointer;
  font-size: 0.875rem;
  transition: all 0.2s var(--ease);
}

.folder-item:hover:not(.add-folder) {
  background: var(--surface-2);
  color: var(--text);
}

.folder-item.active {
  background: var(--amber-dim);
  color: var(--amber);
  font-weight: 600;
}

.folder-item.add-folder {
  border-top: 1px solid var(--border);
  color: var(--text-3);
}

.folder-item.add-folder:hover {
  background: var(--surface-2);
  color: var(--text);
}

.folder-divider {
  height: 1px;
  background: var(--border);
}

#folders-list {
  max-height: 300px;
  overflow-y: auto;
}

/* ── Folder color picker ──────────────────────────────────────────────────── */
.folder-color-picker {
  margin-top: 1rem;
}

.folder-color-picker label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-2);
}

.color-options {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.color-option {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  opacity: 0.75;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.color-option:hover {
  transform: scale(1.15);
  opacity: 1;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.color-option.active {
  opacity: 1;
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px currentColor, 0 4px 14px rgba(0,0,0,0.18);
}

/* ══════════════════════════════════════════════════════════════════════════
   LIGHT THEME — accent #E97553
   Applied via [data-theme="light"] on <html>. Persisted in localStorage.
══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
  color-scheme: light;

  --bg:        #f8f6f3;
  --bg-2:      #f0ede8;
  --surface:   #ffffff;
  --surface-2: #f5f2ee;
  --border:    rgba(0, 0, 0, 0.08);
  --border-h:  rgba(0, 0, 0, 0.15);

  --amber:      #E97553;
  --amber-h:    #d4623e;
  --amber-dim:  rgba(233, 117, 83, 0.12);
  --amber-glow: rgba(233, 117, 83, 0.25);

  --teal:     #0d9488;
  --teal-dim: rgba(13, 148, 136, 0.12);

  --green:     #16a34a;
  --green-dim: rgba(22, 163, 74, 0.1);
  --red:       #dc2626;
  --red-dim:   rgba(220, 38, 38, 0.1);
  --yellow:    #d97706;
  --yellow-dim: rgba(217, 119, 6, 0.1);

  --text:   #1c1a17;
  --text-2: #57534e;
  --text-3: #a8a29e;
}

/* ── Body & html ────────────────────────────────────────────────────────── */
[data-theme="light"] body {
  background: var(--bg);
  color: var(--text);
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
[data-theme="light"] ::-webkit-scrollbar-thumb       { background: rgba(0,0,0,0.13); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }

/* ── Glass surfaces ─────────────────────────────────────────────────────── */
[data-theme="light"] .glass {
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-color: var(--border);
}
[data-theme="light"] .glass-sm {
  background: rgba(0, 0, 0, 0.025);
  border-color: var(--border);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
[data-theme="light"] .btn-primary { color: #fff; }
[data-theme="light"] .btn-ghost {
  background: rgba(0, 0, 0, 0.04);
  color: var(--text-2);
  border-color: var(--border);
}
[data-theme="light"] .btn-ghost:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.07);
  color: var(--text);
  border-color: var(--border-h);
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */
[data-theme="light"] .input {
  background: rgba(0, 0, 0, 0.035);
  color: var(--text);
  border-color: var(--border);
}
[data-theme="light"] .input:hover { border-color: var(--border-h); }
[data-theme="light"] .input:focus {
  background: rgba(0, 0, 0, 0.05);
  box-shadow: 0 0 0 3px rgba(233, 117, 83, 0.14);
}
[data-theme="light"] .input::placeholder { color: var(--text-3); }
[data-theme="light"] .select option { background: #fff; color: var(--text); }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
[data-theme="light"] .sidebar {
  background: rgba(248, 246, 243, 0.97);
  border-right-color: var(--border);
}
[data-theme="light"] .sidebar-user {
  background: rgba(0, 0, 0, 0.03);
  border-color: var(--border);
}
[data-theme="light"] .sidebar-user:hover { border-color: var(--border-h); }
[data-theme="light"] .sidebar-footer     { border-top-color: var(--border); }
[data-theme="light"] .nav-item:hover     { background: rgba(0, 0, 0, 0.05); color: var(--text-2); }
[data-theme="light"] .sidebar-toggle        { border-color: var(--border); color: var(--text-2); }
[data-theme="light"] .sidebar-toggle:hover  { background: rgba(0,0,0,0.05); color: var(--text); }
[data-theme="light"] .sidebar-collapse-btn:hover { background: rgba(0,0,0,0.05); color: var(--text-2); }

/* ── Main header ────────────────────────────────────────────────────────── */
[data-theme="light"] .main-header {
  background: rgba(248, 246, 243, 0.9);
  border-bottom-color: var(--border);
}

/* ── Stat cards ─────────────────────────────────────────────────────────── */
[data-theme="light"] .stat-card:hover { border-color: var(--border-h); }

/* ── Task cards ─────────────────────────────────────────────────────────── */
[data-theme="light"] .task-card {
  background: rgba(0, 0, 0, 0.025);
  border-color: var(--border);
}
[data-theme="light"] .task-card:hover {
  background: rgba(0, 0, 0, 0.042);
  border-color: var(--border-h);
  box-shadow: 0 8px 32px rgba(0,0,0,0.07);
}
[data-theme="light"] .task-check {
  border-color: rgba(0, 0, 0, 0.2);
}
[data-theme="light"] .task-card.status-done .task-check { color: #fff; }

/* ── Task action buttons ────────────────────────────────────────────────── */
[data-theme="light"] .task-action-btn {
  border-color: var(--border);
  color: var(--text-3);
}
[data-theme="light"] .task-action-btn:hover:not(:disabled) {
  background: rgba(0,0,0,0.06);
  color: var(--text-2);
  border-color: var(--border-h);
}

/* ── Badges (light theme) ───────────────────────────────────────────────── */
[data-theme="light"] .badge-medium { color: var(--yellow); }

/* ── Modal ──────────────────────────────────────────────────────────────── */
[data-theme="light"] .modal-overlay { background: rgba(0,0,0,0.35); }
[data-theme="light"] .modal {
  box-shadow: 0 40px 120px rgba(0,0,0,0.14), 0 0 0 1px rgba(0,0,0,0.07);
}
[data-theme="light"] .modal-footer {
  background: rgba(0,0,0,0.02);
  border-top-color: var(--border);
}
[data-theme="light"] .modal-close {
  background: rgba(0,0,0,0.05);
  border-color: var(--border);
  color: var(--text-2);
}
[data-theme="light"] .modal-close:hover { background: rgba(0,0,0,0.09); color: var(--text); }

/* ── Toggle switch ──────────────────────────────────────────────────────── */
[data-theme="light"] .toggle-slider {
  background: rgba(0,0,0,0.12);
  border-color: rgba(0,0,0,0.15);
}
[data-theme="light"] .toggle-slider::before { background: #fff; }

/* ── Toast ──────────────────────────────────────────────────────────────── */
[data-theme="light"] .toast {
  background: rgba(255,255,255,0.98);
  color: var(--text);
  border-color: var(--border-h);
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
[data-theme="light"] .toast.toast-success { border-color: rgba(22,163,74,0.3); }
[data-theme="light"] .toast.toast-error   { border-color: rgba(220,38,38,0.3); }

/* ── Login page ─────────────────────────────────────────────────────────── */
[data-theme="light"] .login-bg::before {
  background: radial-gradient(circle, rgba(233,117,83,0.08) 0%, transparent 70%);
}
[data-theme="light"] .login-bg::after {
  background: radial-gradient(circle, rgba(13,148,136,0.06) 0%, transparent 70%);
}
[data-theme="light"] .login-grid {
  background-image:
    linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}
[data-theme="light"] .login-card {
  box-shadow: 0 40px 100px rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.06);
}
[data-theme="light"] .login-card::before {
  background: radial-gradient(circle at top left, rgba(233,117,83,0.1), transparent 70%);
}
[data-theme="light"] .login-step {
  background: rgba(0,0,0,0.025);
  border-color: var(--border);
}
[data-theme="light"] .login-step:hover { border-color: var(--border-h); }
[data-theme="light"] .step-text code {
  background: rgba(233,117,83,0.1);
}

/* ── Wizard ─────────────────────────────────────────────────────────────── */
[data-theme="light"] .wiz-overlay {
  background: rgba(248,246,243,0.93);
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
}
[data-theme="light"] .wiz-x {
  background: rgba(0,0,0,0.05);
  border-color: var(--border);
  color: var(--text-3);
}
[data-theme="light"] .wiz-x:hover { background: rgba(0,0,0,0.09); color: var(--text-2); }
[data-theme="light"] .wiz-dot { background: rgba(0,0,0,0.15); }
[data-theme="light"] .wiz-input {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.12);
  color: var(--text);
}
[data-theme="light"] .wiz-input::placeholder { color: var(--text-3); }
[data-theme="light"] .wiz-input:focus {
  background: rgba(0,0,0,0.055);
  border-color: rgba(233,117,83,0.5);
  box-shadow: 0 0 0 4px rgba(233,117,83,0.09), 0 16px 48px rgba(0,0,0,0.06);
}
[data-theme="light"] .wiz-mic { color: rgba(0,0,0,0.3); }
[data-theme="light"] .wiz-glow {
  background: radial-gradient(ellipse, rgba(233,117,83,0.1) 0%, transparent 70%);
}
[data-theme="light"] .wcal-preset {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
  color: var(--text-2);
}
[data-theme="light"] .wcal-preset:hover { background: rgba(0,0,0,0.06); color: var(--text); }
[data-theme="light"] .wcal-nav-btn { color: var(--text-3); }
[data-theme="light"] .wcal-nav-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); }
[data-theme="light"] .wcal-weekdays span { color: var(--text-3); }
[data-theme="light"] .wcal-weekdays .weekend { color: rgba(233,117,83,0.6); }
[data-theme="light"] .wcal-day { color: var(--text-2); }
[data-theme="light"] .wcal-day:hover:not(.past):not(.empty) { background: rgba(0,0,0,0.07); color: var(--text); }
[data-theme="light"] .wcal-day.weekend:not(.selected) { color: rgba(233,117,83,0.7); }
[data-theme="light"] .wcal-time { border-top-color: var(--border); }
[data-theme="light"] .wcal-prio { border-top-color: var(--border); }
[data-theme="light"] .wct-btn {
  background: rgba(0,0,0,0.05);
  border-color: var(--border);
  color: var(--text-2);
}
[data-theme="light"] .wct-btn:hover { background: rgba(0,0,0,0.09); color: var(--text); }
[data-theme="light"] .wcal-prio-btn {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
  color: var(--text-2);
}
[data-theme="light"] .wcal-prio-btn:hover { background: rgba(0,0,0,0.06); color: var(--text); border-color: var(--border-h); }

/* ── API key modal ──────────────────────────────────────────────────────── */
[data-theme="light"] .api-key-display {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
}

/* ── Task detail ────────────────────────────────────────────────────────── */
[data-theme="light"] .detail-meta-item {
  background: rgba(0,0,0,0.025);
  border-color: var(--border);
}
[data-theme="light"] .detail-meta-item:hover { border-color: var(--border-h); }

/* ── Admin panel ────────────────────────────────────────────────────────── */
[data-theme="light"] .admin-stat {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
}
[data-theme="light"] .admin-user-card {
  background: rgba(0,0,0,0.025);
  border-color: var(--border);
}
[data-theme="light"] .admin-key-row {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
}
[data-theme="light"] .admin-session {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.07);
}
[data-theme="light"] .admin-session-row code,
[data-theme="light"] .admin-user-meta code {
  background: rgba(0,0,0,0.06);
  color: var(--text);
}

/* ── Statistics ─────────────────────────────────────────────────────────── */
[data-theme="light"] .prio-bar-bg { background: rgba(0,0,0,0.07); }
[data-theme="light"] .bar:hover::after {
  background: var(--surface);
  border-color: var(--border-h);
  color: var(--text);
}

/* ── Filter pills ───────────────────────────────────────────────────────── */
[data-theme="light"] .filter-pill {
  background: rgba(0,0,0,0.03);
  border-color: var(--border);
  color: var(--text-3);
}
[data-theme="light"] .filter-pill:hover {
  background: rgba(0,0,0,0.06);
  color: var(--text-2);
  border-color: var(--border-h);
}

/* ── Sidebar divider ────────────────────────────────────────────────────── */
[data-theme="light"] .sidebar-divider { background: var(--border); }

/* ══════════════════════════════════════════════════════════════════════════
   TASK DETAIL — full page redesign
══════════════════════════════════════════════════════════════════════════ */

.td-page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  animation: fade-in 0.25s var(--ease);
}

/* ── Top nav bar ─────────────────────────────────────────────────────────── */
.td-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(31 30 29 / 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  gap: 1rem;
}
[data-theme="light"] .td-topbar {
  background: rgba(248 246 243 / 0.92);
}

.td-back-btn { flex-shrink: 0; }
.td-topbar-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }

/* ── Loading ─────────────────────────────────────────────────────────────── */
.td-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-height: 50vh;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */
.td-hero {
  position: relative;
  overflow: hidden;
  padding: 3rem 0 2.5rem;
  border-bottom: 1px solid var(--border);
}
.td-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 100% at 20% 50%, rgba(233 117 83 / 0.07) 0%, transparent 70%);
  pointer-events: none;
}
[data-theme="light"] .td-hero::before {
  background: radial-gradient(ellipse 60% 100% at 20% 50%, rgba(233 117 83 / 0.07) 0%, transparent 70%);
}

.td-hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.td-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.td-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.18;
  color: var(--text);
  text-wrap: balance;
  max-width: 820px;
}

.td-desc {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-2);
  max-width: 700px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── Columns layout ──────────────────────────────────────────────────────── */
#page-universe {
  padding: 2.5rem 3.5rem 5rem;
  max-width: 1600px;
  margin: 0 auto;
}

.td-columns {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.75rem 1.75rem 4rem;
  width: 100%;
  align-items: start;
}

/* ── Left main ───────────────────────────────────────────────────────────── */
.td-main { display: flex; flex-direction: column; gap: 1.25rem; }

.td-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.td-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.td-section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Syne', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.td-section-title [data-lucide] { width: 14px; height: 14px; }

/* ── Subtasks ────────────────────────────────────────────────────────────── */

.subtasks-count-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  padding: 0.1rem 0.45rem;
  border-radius: 20px;
  background: var(--amber-dim);
  color: var(--amber);
  border: 1px solid rgba(233 117 83 / 0.25);
  letter-spacing: 0;
  text-transform: none;
}

.subtasks-progress-wrap {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}
.subtasks-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255 255 255 / 0.08);
  border-radius: 99px;
  overflow: hidden;
}
.subtasks-progress-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 99px;
  transition: width 300ms var(--ease);
}
.subtasks-progress-fill.done { background: #56b86e; }
.subtasks-progress-label {
  font-size: 0.72rem;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.subtasks-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.subtasks-empty {
  font-size: 0.82rem;
  color: var(--text-3);
  padding: 0.25rem 0;
}

.subtask-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255 255 255 / 0.02);
  border: 1px solid var(--border);
  transition: background var(--t), border-color var(--t), opacity 200ms;
  animation: subtask-in 180ms var(--ease) both;
}
@keyframes subtask-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.subtask-removing { opacity: 0; transform: translateX(8px); transition: opacity 200ms, transform 200ms; }
.subtask-item:hover { background: rgba(255 255 255 / 0.04); border-color: var(--border-h); }
.subtask-item.completed { opacity: 0.6; }

.subtask-checkbox-wrap {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
}
.subtask-checkbox-wrap input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.subtask-checkmark {
  width: 17px;
  height: 17px;
  border-radius: 5px;
  border: 1.5px solid var(--border-h);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t), border-color var(--t);
  flex-shrink: 0;
}
.subtask-checkmark svg { opacity: 0; transition: opacity 150ms; color: #fff; }
.subtask-checkbox-wrap input:checked + .subtask-checkmark {
  background: #56b86e;
  border-color: #56b86e;
}
.subtask-checkbox-wrap input:checked + .subtask-checkmark svg { opacity: 1; }
.subtask-checkbox-wrap:hover .subtask-checkmark { border-color: #56b86e; }

.subtask-title {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text);
  line-height: 1.4;
  word-break: break-word;
}
.subtask-item.completed .subtask-title {
  text-decoration: line-through;
  color: var(--text-3);
}

.subtask-inline-input {
  flex: 1;
  font-size: 0.875rem;
  padding: 0.2rem 0.5rem;
  height: auto;
  min-height: unset;
}

.subtask-edit-btn,
.subtask-del-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-3);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  opacity: 0;
  transition: opacity var(--t), color var(--t), background var(--t);
}
.subtask-item:hover .subtask-edit-btn,
.subtask-item:hover .subtask-del-btn { opacity: 1; }
.subtask-edit-btn:hover { color: var(--amber); background: var(--amber-dim); }
.subtask-del-btn:hover  { color: var(--red);   background: var(--red-dim); }

.subtasks-add { padding-top: 0.25rem; }
.subtasks-add-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.subtasks-input {
  flex: 1;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  min-height: unset;
  height: 36px;
}
.subtasks-add-row .btn-sm { height: 36px; flex-shrink: 0; }

/* ── Gallery ─────────────────────────────────────────────────────────────── */
.td-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.625rem;
}

.td-gallery-empty {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-3);
  font-size: 0.82rem;
  padding: 2rem 0;
}
.td-gallery-empty [data-lucide] { width: 16px; height: 16px; opacity: 0.5; }

.td-thumb-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: rgba(255 255 255 / 0.04);
  border: 1px solid var(--border);
  transition: border-color var(--t), transform var(--t-fast), box-shadow var(--t);
  animation: fade-up 0.3s var(--ease) both;
}
[data-theme="light"] .td-thumb-wrap { background: rgba(0 0 0 / 0.04); }

[data-theme="light"] .subtask-item { background: rgba(0 0 0 / 0.02); border-color: var(--border); }
[data-theme="light"] .subtask-item:hover { background: rgba(0 0 0 / 0.04); }
[data-theme="light"] .subtasks-progress-bar { background: rgba(0 0 0 / 0.08); }

.td-thumb-wrap:hover {
  border-color: var(--amber);
  transform: scale(1.03);
  box-shadow: 0 8px 32px rgba(0 0 0 / 0.2);
}

.td-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--t);
}

.td-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0 0 0 / 0.5) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--t);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0.4rem;
}
.td-thumb-wrap:hover .td-thumb-overlay { opacity: 1; }

.td-thumb-delete {
  background: rgba(239 68 68 / 0.85);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  cursor: pointer;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t);
  flex-shrink: 0;
}
.td-thumb-delete:hover { background: var(--red); }
.td-thumb-delete [data-lucide] { width: 11px; height: 11px; }

.td-thumb-zoom {
  background: rgba(0 0 0 / 0.5);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  cursor: pointer;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
}
.td-thumb-zoom [data-lucide] { width: 11px; height: 11px; }

/* upload drag hint */
.td-upload-btn { cursor: pointer; }
.td-upload-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-3);
}

/* drop zone highlight */
.td-gallery.dragover {
  outline: 2px dashed var(--amber);
  outline-offset: 4px;
  border-radius: var(--radius);
  background: var(--amber-dim);
}

/* ── Right sidebar cards ─────────────────────────────────────────────────── */
.td-sidebar { display: flex; flex-direction: column; gap: 0.875rem; position: sticky; top: 70px; }

.td-actions-card,
.td-meta-card,
.td-author-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.td-actions-card .btn { width: 100%; justify-content: center; }

.td-meta-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.td-meta-row.td-meta-row-horizontal {
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}
.td-meta-row:last-child { border-bottom: none; padding-bottom: 0; }
.td-meta-row:first-child { padding-top: 0; }

.td-meta-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.td-meta-label [data-lucide] { width: 10px; height: 10px; }
.td-meta-value { font-size: 0.875rem; font-weight: 500; color: var(--text); padding-left: 0.05rem; }
.td-meta-value.muted { color: var(--text-3); font-style: italic; font-weight: 400; }

.td-author-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.td-author-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--amber) 0%, #f97316 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; font-weight: 700;
  color: #fff;
  font-family: 'Syne', sans-serif;
  overflow: hidden; flex-shrink: 0;
}
.td-author-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.td-author-name { font-size: 0.9rem; font-weight: 600; }
.td-author-tag  { font-size: 0.72rem; color: var(--text-3); margin-top: 0.1rem; }

/* ── Participants card ───────────────────────────────────────────────────── */
.td-participants-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.td-participants-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.td-participant-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.td-participant-info { flex: 1; min-width: 0; }
.td-participant-name { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-participant-tag  { font-size: 0.7rem; color: var(--text-3); margin-top: 0.05rem; }
.td-participant-remove {
  width: 26px; height: 26px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.td-participant-remove:hover { background: rgba(239,68,68,0.15); color: var(--red); }
.td-no-participants { font-size: 0.8rem; color: var(--text-3); font-style: italic; }

/* invite link section inside participants card */
.td-invite-link-section { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }
.td-invite-url-row {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}
.td-invite-url-input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  font-size: 0.72rem;
  color: var(--text-2);
  outline: none;
  font-family: inherit;
  cursor: default;
  min-width: 0;
}
.td-invite-hint { font-size: 0.72rem; color: var(--text-3); }

/* ── Invite Accept Page ──────────────────────────────────────────────────── */
.invite-accept-page {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}
.invite-card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2rem 2rem 1.75rem;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0;
}
.invite-card--error { opacity: 0.85; }
.invite-badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber, #f59e0b);
  background: rgba(245,158,11,0.12);
  border-radius: 6px;
  padding: 0.2rem 0.6rem;
  margin-bottom: 1.25rem;
}
.invite-task-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 1.25rem;
  word-break: break-word;
}
.invite-from {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  width: 100%;
  margin-bottom: 0.25rem;
}
.invite-owner-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--amber, #f59e0b);
  color: #000;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.invite-owner-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.invite-owner-info { display: flex; flex-direction: column; align-items: flex-start; gap: 0.1rem; }
.invite-owner-label { font-size: 0.7rem; color: var(--text-3); }
.invite-owner-name { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.invite-owner-tag { font-size: 0.75rem; color: var(--text-3); }
.invite-login-hint { font-size: 0.85rem; color: var(--text-3); margin-top: 1.25rem; }
.invite-back-link {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: var(--text-3);
  text-decoration: none;
}
.invite-back-link:hover { color: var(--text-2); }

/* ── Lightbox ────────────────────────────────────────────────────────────── */
.td-lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0 0 0 / 0.93);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.18s var(--ease);
}

.td-lb-close {
  position: absolute;
  top: 1.25rem; right: 1.25rem;
  background: rgba(255 255 255 / 0.1);
  border: 1px solid rgba(255 255 255 / 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t);
  z-index: 2;
}
.td-lb-close:hover { background: rgba(255 255 255 / 0.2); }
.td-lb-close [data-lucide] { width: 18px; height: 18px; }

.td-lb-arrow {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  background: rgba(255 255 255 / 0.1);
  border: 1px solid rgba(255 255 255 / 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t);
  z-index: 2;
}
.td-lb-arrow:hover { background: rgba(255 255 255 / 0.2); }
.td-lb-arrow [data-lucide] { width: 22px; height: 22px; }
.td-lb-prev { left: 1.25rem; }
.td-lb-next { right: 1.25rem; }

.td-lb-wrap {
  max-width: calc(100vw - 6rem);
  max-height: calc(100dvh - 6rem);
  display: flex;
  align-items: center;
  justify-content: center;
}
.td-lb-img {
  max-width: 100%;
  max-height: calc(100dvh - 6rem);
  border-radius: var(--radius);
  object-fit: contain;
  box-shadow: 0 40px 120px rgba(0 0 0 / 0.6);
  animation: scale-in 0.22s var(--ease);
  user-select: none;
}

.td-lb-counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: rgba(255 255 255 / 0.5);
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .td-columns {
    grid-template-columns: 1fr;
  }
  .td-sidebar {
    position: static;
    order: -1;
  }
  .td-actions-card .btn { width: auto; }
  .td-actions-card { flex-direction: row; flex-wrap: wrap; gap: 0.5rem; padding: 0.875rem; }
}
@media (max-width: 600px) {
  .td-topbar { padding: 0.75rem 1rem; }
  .td-hero { padding: 2rem 0 1.5rem; }
  .td-hero-inner { padding: 0 1rem; }
  .td-columns { padding: 1rem 1rem 3rem; gap: 1rem; }
  .td-gallery { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .td-lb-wrap { max-width: calc(100vw - 2rem); }
  .td-lb-prev { left: 0.5rem; }
  .td-lb-next { right: 0.5rem; }
}

/* ── Confirm dialog ─────────────────────────────────────────────────────── */
.modal-confirm {
  max-width: 360px;
}
.confirm-msg {
  font-size: 0.925rem;
  line-height: 1.55;
  color: var(--text);
}

/* ── Dropzone Modal ─────────────────────────────────────────────────────── */
.dropzone-modal {
  max-width: 500px;
  width: 95%;
}

.dropzone-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  margin-top: 0.5rem;
  border: 2px dashed var(--border-h);
  border-radius: var(--radius-lg);
  background: rgba(255 255 255 / 0.02);
  cursor: pointer;
  transition: all var(--t);
  text-align: center;
}

.dropzone-area:hover,
.dropzone-area.dragover {
  border-color: var(--amber);
  background: var(--amber-dim);
}

.dropzone-icon {
  color: var(--amber);
  margin-bottom: 1rem;
}

.dropzone-icon svg {
  width: 48px;
  height: 48px;
  stroke-width: 1.5;
  transition: transform var(--t);
}

.dropzone-area:hover .dropzone-icon svg,
.dropzone-area.dragover .dropzone-icon svg {
  transform: translateY(-5px);
}

.dropzone-text {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.dropzone-text strong {
  color: var(--amber);
  font-weight: 600;
}

.dropzone-sub {
  font-size: 0.85rem;
  color: var(--text-3);
}

/* ═══════════════════════════════════════════════════════════════════════════
   Rich Text Editor
═══════════════════════════════════════════════════════════════════════════ */

.rte-wrapper {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%;
}
.rte-wrapper:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}
.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 1px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  flex-wrap: wrap;
  user-select: none;
  gap: 2px;
}
.rte-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
  flex-shrink: 0;
}
.rte-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.78rem;
  font-family: inherit;
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
  line-height: 1;
}
.rte-btn:hover { background: var(--surface); color: var(--text); }
.rte-btn.active { background: var(--amber-dim); color: var(--amber); }
.rte-btn svg { pointer-events: none; }

.rte-editor {
  min-height: 140px;
  max-height: 400px;
  overflow-y: auto;
  padding: 14px 16px;
  outline: none;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.7;
  caret-color: var(--amber);
  word-break: break-word;
}
.rte-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--text-3);
  pointer-events: none;
  display: block;
}

/* Shared formatting rules for editor and rich display */
.rte-editor h1, .rich-content h1 { font-size: 1.3rem; font-weight: 700; margin: 0.6rem 0 0.3rem; color: var(--text); font-family: 'Syne', sans-serif; }
.rte-editor h2, .rich-content h2 { font-size: 1.08rem; font-weight: 600; margin: 0.5rem 0 0.25rem; color: var(--text); font-family: 'Syne', sans-serif; }
.rte-editor h3, .rich-content h3 { font-size: 0.85rem; font-weight: 600; margin: 0.4rem 0 0.2rem; color: var(--text); text-transform: uppercase; letter-spacing: 0.05em; }
.rte-editor p, .rich-content p { margin: 0.15rem 0; }
.rte-editor ul, .rich-content ul,
.rte-editor ol, .rich-content ol { margin: 0.3rem 0; padding-left: 1.6rem; }
.rte-editor li, .rich-content li { margin: 0.2rem 0; }
.rte-editor blockquote, .rich-content blockquote {
  border-left: 3px solid var(--amber);
  margin: 0.6rem 0;
  padding: 0.5rem 1rem;
  background: var(--amber-dim);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  color: var(--text-2);
  font-style: italic;
}
.rte-editor code, .rich-content code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.15rem 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em;
  color: var(--amber);
}
.rte-editor pre, .rich-content pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 0.8rem 1rem;
  overflow-x: auto;
  margin: 0.6rem 0;
}
/* В редакторе строки внутри <pre> рендерятся как <div>/<br> — убираем разрывы фона */
.rte-editor pre * { background: transparent !important; border: none !important; }
.rte-editor pre code { display: block; white-space: pre; tab-size: 2; }
.rte-editor pre div, .rte-editor pre p { margin: 0; padding: 0; min-height: 1.5em; }
.rte-editor pre code, .rich-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  white-space: pre;
  tab-size: 2;
  -moz-tab-size: 2;
  display: block;
}
.rte-editor pre, .rich-content pre { white-space: pre; tab-size: 2; }
/* ── Подсвеченный блок кода (после enhanceCodeBlocks) ─────────────────────── */
/* Селекторы прицельно по `.code-block X` чтобы перебить наследуемые .rich-content/.rte-editor правила. */
.code-block {
  display: block;
  margin: 0.8rem 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #0d1117;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  line-height: 1.55;
}
.code-block .code-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 0.45rem 0.85rem;
  background: rgba(255 255 255 / 0.04);
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
}
.code-block .code-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--text-3);
  text-transform: lowercase;
}
.code-block .code-copy {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.2rem 0.55rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-2);
  font-size: 0.72rem;
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.code-block .code-copy:hover { background: rgba(255 255 255 / 0.08); color: var(--text); }
.code-block .code-copy [data-lucide] { width: 13px; height: 13px; }
.code-block pre.code-block-pre {
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow-x: auto;
}
.code-block pre.code-block-pre > code,
.code-block pre.code-block-pre > code.hljs {
  display: block;
  margin: 0;
  padding: 0.85rem 1rem;
  background: transparent;
  border: 0;
  color: #c9d1d9;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
  -moz-tab-size: 2;
}

.rte-editor a, .rich-content a { color: var(--amber); text-decoration: underline; text-underline-offset: 2px; }
.rte-editor hr, .rich-content hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }
.rte-editor b, .rte-editor strong,
.rich-content b, .rich-content strong { color: var(--text); }

/* Wizard step 2 RTE */
.wiz-rte .rte-editor { min-height: 220px; font-size: 0.95rem; }
.wiz-step-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 0.75rem;
}
.wiz-send-inline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--amber);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t), box-shadow var(--t);
}
.wiz-send-inline:hover { background: var(--amber-h); box-shadow: 0 0 16px var(--amber-glow); }
.wiz-send-inline:active { transform: scale(0.97); }

/* Modal RTE */
.modal-rte .rte-editor { min-height: 160px; }

/* Wider edit modal */
.modal-wide { max-width: 680px !important; }

/* Rich content display */
.rich-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-2);
}
.rich-content:empty { display: none; }

/* Light theme overrides */
[data-theme="light"] .rte-wrapper { background: var(--surface); }
[data-theme="light"] .rte-toolbar { background: var(--surface-2); }
[data-theme="light"] .rte-editor blockquote { background: var(--amber-dim); }
[data-theme="light"] .rte-editor code, [data-theme="light"] .rich-content code { background: var(--surface-2); }
[data-theme="light"] .rte-editor pre, [data-theme="light"] .rich-content pre { background: var(--surface-2); }
/* Принудительно сохраняем тёмный фон внутри .code-block для любой темы */
[data-theme="light"] .code-block,
[data-theme="light"] .code-block pre,
[data-theme="light"] .code-block pre code { background: transparent; }
[data-theme="light"] .code-block { background: #0d1117; }
[data-theme="light"] .code-block pre.code-block-pre > code,
[data-theme="light"] .code-block pre.code-block-pre > code.hljs {
  background: transparent;
  color: #c9d1d9;
  border: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Hotkeys Page  /hotkeys
═══════════════════════════════════════════════════════════════════════════ */

/* ── macOS Download Page ─────────────────────────────────────────────────── */
.mac-dl-page {
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.mac-dl-topbar {
  display: flex;
  align-items: center;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: rgba(31 30 29 / 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 10;
}
[data-theme="light"] .mac-dl-topbar { background: rgba(248 246 243 / 0.88); }
.mac-dl-topbar a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-2);
  font-size: 0.875rem;
  transition: color var(--t);
}
.mac-dl-topbar a:hover { color: var(--text); }

.mac-dl-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 4rem 1.5rem 6rem;
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
  width: 100%;
}

/* Hero */
.mac-dl-hero {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: flex-start;
}
.mac-dl-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.mac-dl-sub {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.65;
  max-width: 520px;
}
.mac-dl-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
  margin-top: 0.5rem;
  color: #fff !important;
}
.mac-dl-btn:hover { color: #fff !important; }
.mac-dl-req {
  font-size: 0.75rem;
  color: var(--text-3);
}

/* Screenshot */
.mac-dl-screenshot-wrap {
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: 0 24px 80px rgba(0 0 0 / 0.3);
  background: var(--surface);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
[data-theme="light"] .mac-dl-screenshot-wrap { box-shadow: 0 24px 80px rgba(0 0 0 / 0.08); }
.mac-dl-screenshot {
  width: 100%;
  display: block;
}
.mac-dl-screenshot-placeholder {
  padding: 3rem;
  text-align: center;
  color: var(--text-3);
  font-size: 0.85rem;
}

/* Steps */
.mac-dl-steps-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  color: var(--text);
}
.mac-dl-steps {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.mac-dl-step {
  display: flex;
  gap: 1.25rem;
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.mac-dl-step:last-child { border-bottom: none; }
.mac-dl-step-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--amber-dim);
  border: 1px solid var(--amber-glow);
  color: var(--amber);
  font-family: 'Syne', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.mac-dl-step-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.mac-dl-step-body strong {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.mac-dl-step-body p {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
}
.mac-dl-step-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  background: var(--surface-2);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-xs);
  color: var(--amber);
}

/* Code block with copy */
.mac-dl-code {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-top: 0.4rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82rem;
  color: var(--text);
}
.mac-dl-code code {
  flex: 1;
  background: none;
  padding: 0;
  color: var(--text);
  font-size: 0.82rem;
}
.mac-dl-copy {
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color var(--t), background var(--t);
}
.mac-dl-copy:hover { color: var(--text); background: var(--surface); }

.mac-dl-note {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--amber-glow);
  background: var(--amber-dim);
}
.mac-dl-note-icon {
  color: var(--amber);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.mac-dl-note strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.35rem;
}
.mac-dl-note p {
  font-size: 0.875rem;
  color: var(--text-2);
  line-height: 1.6;
}

@media (max-width: 580px) {
  .mac-dl-body { padding: 2.5rem 1.25rem 4rem; }
  .mac-dl-topbar { padding: 0.85rem 1.25rem; }
}

.hk-page { min-height: 100vh; background: var(--bg); }
.hk-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky;
  top: 0;
  z-index: 10;
}
.hk-logo {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: 0.01em;
  text-decoration: none;
}
.hk-logo span { color: var(--amber); }
.hk-hero {
  text-align: center;
  padding: 3.5rem 2rem 2.5rem;
}
.hk-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 0.9rem;
}
.hk-hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
}
.hk-hero p {
  color: var(--text-2);
  font-size: 0.975rem;
  max-width: 460px;
  margin: 0 auto;
  line-height: 1.65;
}
.hk-body {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 2rem 4rem;
}
.hk-section { margin-bottom: 2.5rem; }
.hk-section-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 0.75rem;
}
.hk-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.hk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 0.5rem;
}
.hk-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-xs);
  background: var(--surface);
  border: 1px solid var(--border);
  gap: 1rem;
  transition: border-color var(--t-fast);
}
.hk-row:hover { border-color: var(--border-h); }
.hk-desc { font-size: 0.875rem; color: var(--text-2); flex: 1; }
.hk-keys { display: flex; align-items: center; gap: 0.25rem; flex-shrink: 0; }
.hk-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-h);
  font-size: 0.7rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 500;
  color: var(--text);
  box-shadow: 0 1px 0 var(--border-h);
  white-space: nowrap;
}
.hk-or { font-size: 0.68rem; color: var(--text-3); padding: 0 1px; }
.hk-kbd-plus { font-size: 0.65rem; color: var(--text-3); padding: 0 1px; }

@media (max-width: 640px) {
  .hk-topbar { padding: 1rem 1.25rem; }
  .hk-hero { padding: 2.5rem 1.25rem 1.75rem; }
  .hk-body { padding: 0 1.25rem 3rem; }
  .hk-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE — Comprehensive phone layout (≤ 480px)
═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
  /* ── Header ───────────────────────────────────────────────────────────── */
  .main-header {
    padding: 0.6rem 0.875rem;
    gap: 0.5rem;
  }
  .page-title { font-size: 0.95rem; }

  /* ── Stats bar: 2 columns, tighter ───────────────────────────────────── */
  .tasks-stats {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.75rem 0.875rem 0.25rem;
  }
  .stat-card { padding: 0.65rem 0.75rem; }
  .stat-num  { font-size: 1.5rem; }
  .stat-label { font-size: 0.62rem; }
  .stat-icon { width: 14px; height: 14px; margin-bottom: 0.3rem; }

  /* ── Filters row ─────────────────────────────────────────────────────── */
  .filters-row {
    padding: 0.5rem 0.875rem 0.875rem;
    gap: 0.5rem;
    flex-wrap: nowrap;
  }
  .view-filters {
    gap: 0.4rem;
  }
  .filter-pill {
    padding: 0.38rem 0.7rem;
    font-size: 0.7rem;
  }
  .priority-filter-btn {
    font-size: 0.7rem;
    padding: 0.38rem 0.7rem;
  }

  /* ── Task list ───────────────────────────────────────────────────────── */
  .tasks-list {
    padding: 0.5rem 0.875rem 4rem;
    gap: 0.6rem;
  }
  .task-card { padding: 0.85rem 0.85rem 0.7rem; }
  .task-title { font-size: 0.875rem; }
  .task-desc  { font-size: 0.75rem; }
  .task-actions { opacity: 1; }

  /* ── Trial banner ────────────────────────────────────────────────────── */
  #trial-banner {
    margin: 0 0.875rem 0.6rem !important;
    padding: 0.55rem 0.75rem !important;
    font-size: 0.78rem !important;
    flex-wrap: wrap;
    gap: 0.4rem !important;
  }

  /* ── Modals: full-screen bottom sheet ───────────────────────────────── */
  .modal-overlay { align-items: flex-end; }
  .modal {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 93dvh;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0;
  }
  .modal-header { padding: 1rem 1.25rem 0.75rem; }
  .modal-body   { padding: 0 1.25rem 1.5rem; }

  /* ── Task detail modal ───────────────────────────────────────────────── */
  .detail-meta-grid { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .detail-title     { font-size: 1.05rem; }

  /* ── Sidebar width handled in the 960px breakpoint (86vw / max 340px) ─── */

  /* ── Login card ──────────────────────────────────────────────────────── */
  .login-card { padding: 1.5rem 1rem; }

  /* ── Settings modal: form rows single-column ─────────────────────────── */
  .form-row { grid-template-columns: 1fr; }

  /* ── Admin panel on mobile ───────────────────────────────────────────── */
  .admin-user-header { flex-wrap: wrap; }
  .admin-user-actions { flex-wrap: wrap; gap: 0.4rem; }
  .admin-access-btn { width: 100%; justify-content: center; }

  /* ── Wizard ──────────────────────────────────────────────────────────── */
  .wiz-overlay { padding: 1rem 0.75rem; }
  .wiz-card    { padding: 1.5rem 1.25rem; }
  .wiz-prompt  { font-size: 1.1rem; }
  #page-universe { padding: 1rem 1.25rem 5rem !important; }
}

/* ── Narrow landscape / small tablets (481–960px) ─────────────────────── */
@media (min-width: 481px) and (max-width: 960px) {
  .main-header { padding: 0.75rem 1.25rem; }
  .tasks-stats  { padding: 0.875rem 1.25rem 0.25rem; gap: 0.6rem; }
  .filters-row  { padding: 0.6rem 1.25rem 1rem; }
  .tasks-list   { padding: 0.75rem 1.25rem 3rem; }
  #trial-banner { margin: 0 1.25rem 0.75rem !important; }
}

/* ── UNIVERSE (Notes) ───────────────────────────────────────────────────── */

.universe-grid {
  column-count: 3;
  column-gap: 1.25rem;
  padding: 1.5rem 2.5rem;
  width: 100%;
}

@media (max-width: 1200px) { .universe-grid { column-count: 2; } }
@media (max-width: 768px) { .universe-grid { column-count: 1; } }

.universe-card {
  break-inside: avoid;
  margin-bottom: 1.25rem;
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  cursor: pointer;
  transition: all var(--t) var(--ease);
  position: relative;
  overflow: hidden;
  animation: fade-up 0.4s var(--ease) backwards;
  box-shadow: none !important;
}

.universe-card:hover {
  border-color: var(--border-h);
}

.universe-card.pinned {
  border-color: var(--amber);
  background: linear-gradient(135deg, rgba(233, 117, 83, 0.05), rgba(233, 117, 83, 0.02));
}


.uc-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.uc-content {
  font-size: 0.9rem;
  color: var(--text-2);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.uc-content a {
  color: var(--amber);
  pointer-events: none; /* In grid view, click should open detail */
}

.uc-footer {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-3);
}

.universe-hint {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem;
  background: linear-gradient(to right, rgba(233, 117, 83, 0.1), rgba(233, 117, 83, 0.02));
  border: 1px dashed rgba(233, 117, 83, 0.3);
  border-radius: var(--radius-lg);
  color: var(--amber);
  font-size: 1rem;
  margin: 1.5rem 2.5rem 2.5rem;
  font-weight: 500;
  animation: fade-in 0.8s var(--ease);
}

/* Detail Page Customizations for Notes */
#page-note-detail .nd-content {
  font-size: 1.1rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

#page-note-detail .nd-content a {
  color: var(--amber);
  text-decoration: underline;
  text-underline-offset: 4px;
}

#page-note-detail .nd-content blockquote {
  border-left: 3px solid var(--amber);
  padding-left: 1rem;
  margin: 1rem 0;
  color: var(--text-2);
  font-style: italic;
}

.badge-purple {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Glow effects for note cards */
.universe-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(255,255,255,0.03) 0%, transparent 80%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.universe-card:hover::after {
  opacity: 1;
}

/* ── Projects (Folders) ──────────────────────────────────────────────────── */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
  padding: 1.5rem 2.5rem;
  width: 100%;
}
@media (max-width: 768px) {
  /* minmax(0,1fr) stops a wide child (long share URL / buttons) from blowing
     the single column out past the viewport. */
  .projects-grid { grid-template-columns: minmax(0, 1fr); padding: 1rem; }
  .project-card  { min-width: 0; overflow: hidden; padding: 1rem 1.1rem; }
  .pc-name       { font-size: 1.05rem; }

  /* Stack the share row: link on its own line, action buttons below — so the
     edit/delete buttons never run off the right edge. */
  .pc-share-row  { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .pc-link       { flex: none; width: 100%; box-sizing: border-box; }
  .pc-actions    { margin-left: 0; width: 100%; }
  .pc-actions [data-action="share"] { flex: 1; justify-content: center; }
}

.project-card {
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: fade-up 0.4s var(--ease) backwards;
}

.pc-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.pc-dot {
  width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0;
}
.pc-name {
  font-family: 'Syne', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pc-count {
  font-size: 0.78rem;
  color: var(--text-3);
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  flex-shrink: 0;
}

.pc-tasks { display: flex; flex-direction: column; gap: 0.4rem; }
.pc-task {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--t) var(--ease);
  font-size: 0.9rem;
  color: var(--text-2);
}
.pc-task:hover { border-color: var(--border-h); color: var(--text); }
.pc-task .pc-task-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.pc-task .pc-task-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-task.done .pc-task-title { text-decoration: line-through; opacity: 0.6; }
.pc-empty-tasks { font-size: 0.85rem; color: var(--text-3); padding: 0.3rem 0; }

.pc-share-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.pc-link {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  color: var(--amber);
  background: rgba(233,117,83,0.08);
  border: 1px solid rgba(233,117,83,0.25);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.pc-actions { display: flex; gap: 0.4rem; margin-left: auto; }

/* ── Comments ────────────────────────────────────────────────────────────── */
.td-comments-list { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.td-comment { display: flex; gap: 0.75rem; align-items: flex-start; }
.td-comment-avatar { width: 34px !important; height: 34px !important; font-size: 0.8rem !important; flex-shrink: 0; }
.td-comment-main { flex: 1; min-width: 0; }
.td-comment-head { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.2rem; }
.td-comment-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.td-comment-time { font-size: 0.75rem; color: var(--text-3); }
.td-comment-del {
  margin-left: auto; background: transparent; border: none; color: var(--text-3);
  cursor: pointer; padding: 2px; border-radius: 6px; display: inline-flex; opacity: 0; transition: opacity .15s, color .15s;
}
.td-comment:hover .td-comment-del { opacity: 1; }
.td-comment-del:hover { color: var(--red, #ef4444); }
.td-comment-body { font-size: 0.92rem; line-height: 1.55; color: var(--text-2); word-break: break-word; }
.td-comment-form { display: flex; flex-direction: column; gap: 0.6rem; }
.td-comment-input { width: 100%; resize: vertical; min-height: 56px; font-family: inherit; }
.td-comment-form .btn { align-self: flex-end; }

/* ── Command palette (Cmd/Ctrl+K) ────────────────────────────────────────── */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0 0 0 / 0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 12vh 1rem 1rem;
  animation: fade-in 0.15s var(--ease);
}
.cmdk-box {
  width: 100%; max-width: 600px;
  background: var(--surface); border: 1px solid var(--border-h);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 24px 60px rgba(0 0 0 / 0.45);
}
.cmdk-input-row { display: flex; align-items: center; gap: 0.7rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.cmdk-input-row [data-lucide] { width: 18px; height: 18px; color: var(--text-3); flex-shrink: 0; }
.cmdk-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 1rem; font-family: inherit; }
.cmdk-esc { font-size: 0.7rem; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 0.1rem 0.4rem; }
.cmdk-results { max-height: 60vh; overflow-y: auto; padding: 0.5rem; }
.cmdk-group-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-3); padding: 0.6rem 0.75rem 0.3rem; }
.cmdk-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 0.75rem; border-radius: 10px; cursor: pointer; color: var(--text-2); }
.cmdk-item .cmdk-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.cmdk-item [data-lucide] { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.cmdk-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-item.active, .cmdk-item:hover { background: rgba(255 255 255 / 0.06); color: var(--text); }
.cmdk-tag { flex-shrink: 0; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); background: rgba(255 255 255 / 0.06); border: 1px solid var(--border); border-radius: 5px; padding: 0.1rem 0.4rem; }
.cmdk-empty { padding: 1.5rem; text-align: center; color: var(--text-3); font-size: 0.9rem; }

svg.filled { fill: currentColor; }

.td-link {
  color: var(--amber);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity 0.2s;
}
.td-link:hover {
  opacity: 0.8;
}
