/* ==========================================================================
   GELEX HUB — macOS Launchpad style
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --text: #f5f7fa;
  --text-dim: rgba(245, 247, 250, 0.72);
  --text-faint: rgba(245, 247, 250, 0.5);
  --icon-size: 84px;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --focus: #fff;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (max-width: 560px) {
  :root { --icon-size: 68px; }
}

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

html, body {
  height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overflow-y: auto;
}

/* ---------- Desktop wallpaper (gradient mesh) ---------- */
body {
  min-height: 100vh;
  background:
    radial-gradient(120% 90% at 12% 8%, #5b21b6 0%, transparent 45%),
    radial-gradient(110% 80% at 92% 6%, #1e3a8a 0%, transparent 50%),
    radial-gradient(120% 100% at 88% 100%, #0f766e 0%, transparent 55%),
    radial-gradient(120% 90% at 4% 100%, #be123c 0%, transparent 50%),
    linear-gradient(160deg, #1e1b4b 0%, #0f172a 55%, #020617 100%);
  background-attachment: fixed;
}

/* ---------- Menu bar ---------- */
.menubar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  font-size: 13px;
  font-weight: 500;
  z-index: 50;
  user-select: none;
}

.mb-left { display: flex; align-items: center; gap: 14px; }

.mb-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
}

.mb-brand {
  font-weight: 700;
  letter-spacing: 0.01em;
}

.mb-right {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.mb-date { opacity: 0.85; }

/* ---------- Launchpad ---------- */
.launchpad {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 70px 24px 130px;
}

/* Search (spotlight) */
.lp-search {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, 78vw);
  height: 30px;
  padding: 0 14px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.18);
  color: var(--text);
  transition: background var(--ease) 180ms, box-shadow var(--ease) 180ms;
}
.lp-search:focus-within {
  background: rgba(255, 255, 255, 0.26);
  box-shadow: 0 6px 26px rgba(0, 0, 0, 0.28);
}
.lp-search svg { color: var(--text-dim); flex: none; }
.lp-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  -webkit-appearance: none;
  appearance: none;
}
.lp-search input::placeholder { color: var(--text-faint); }
.lp-search input[type="search"]::-webkit-search-cancel-button,
.lp-search input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

/* Grid */
.lp-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 14px 50px;
  max-width: 660px;
}

/* App tile */
.app {
  position: relative;
  width: 116px;
  animation: pop-in var(--ease-spring) 360ms backwards;
  animation-delay: calc(min(var(--i, 0), 12) * 45ms);
}

@keyframes pop-in {
  from { opacity: 0; transform: scale(0.82) translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.app-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 14px 6px 10px;
  border-radius: 16px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  transition: transform var(--ease-spring) 220ms;
}
.app-tile:hover { transform: translateY(-6px); }
.app-tile:active { transform: translateY(-2px) scale(0.96); transition-duration: 90ms; }
.app-tile:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

/* Squircle icon */
.app-ic {
  width: var(--icon-size);
  height: var(--icon-size);
  border-radius: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: box-shadow var(--ease) 220ms;
}
.app-tile:hover .app-ic {
  box-shadow:
    0 16px 34px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.app-ic svg {
  width: 50%;
  height: 50%;
  color: #fff;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.22));
}

.app-name {
  font-size: 13px;
  line-height: 1.3;
  text-align: center;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.55);
  max-width: 100%;
  word-break: break-word;
}

/* Pin toggle */
.app-pin {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.38);
  color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--ease) 160ms, background var(--ease) 160ms, color var(--ease) 160ms, transform var(--ease) 160ms;
}
.app:hover .app-pin,
.app-pin:focus-visible { opacity: 1; }
.app-pin:hover { background: rgba(0, 0, 0, 0.6); color: #fff; transform: scale(1.08); }
.app-pin:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.app-pin[aria-pressed="true"] { opacity: 1; color: #fbbf24; }
.app-pin svg { width: 13px; height: 13px; }
@media (hover: none) {
  .app-pin { opacity: 1; }
}

/* Empty state */
.lp-empty {
  color: var(--text-dim);
  font-size: 15px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}

/* ---------- Dock ---------- */
.dock {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.34);
  z-index: 40;
  max-width: calc(100vw - 24px);
}
.dock:empty { display: none; }

.dock-item {
  width: 50px;
  height: 50px;
  border-radius: 22%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: transform var(--ease-spring) 200ms;
  transform-origin: bottom center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.dock-item svg { width: 50%; height: 50%; color: #fff; filter: drop-shadow(0 1px 1px rgba(0,0,0,.2)); }
.dock-item:hover { transform: translateY(-12px) scale(1.3); }
.dock-item:active { transform: translateY(-6px) scale(1.2); }
.dock-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

@media (max-width: 560px) {
  .dock-item { width: 42px; height: 42px; }
  .dock-item:hover { transform: translateY(-10px) scale(1.25); }
}

/* ---------- Accessibility helpers ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- Menubar buttons ---------- */
.mb-btn {
  height: 22px;
  padding: 0 9px;
  font: inherit;
  font-size: 12px;
  line-height: 1;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  cursor: pointer;
  transition: background var(--ease) 150ms, color var(--ease) 150ms;
}
.mb-btn:hover { background: rgba(255, 255, 255, 0.22); color: var(--text); }
.mb-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.mb-btn[hidden] { display: none; }
.mb-btn[aria-pressed="true"] { background: rgba(255, 255, 255, 0.3); color: var(--text); }

/* ---------- App: hidden / hide button ---------- */
.app.is-hidden .app-ic { opacity: 0.38; filter: grayscale(0.6); }
.app.is-hidden .app-name { opacity: 0.5; }

.app-hide {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.38);
  color: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--ease) 160ms, background var(--ease) 160ms, color var(--ease) 160ms;
}
.app:hover .app-hide,
.app-hide:focus-visible { opacity: 1; }
.app-hide:hover { background: rgba(0, 0, 0, 0.6); color: #fff; }
.app-hide:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; opacity: 1; }
.app-hide[aria-pressed="true"] { opacity: 1; color: #fbbf24; }
.app-hide svg { width: 14px; height: 14px; }
@media (hover: none) {
  .app-hide { opacity: 1; }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in var(--ease) 160ms;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  position: relative;
  width: min(380px, 100%);
  padding: 22px 22px 20px;
  border-radius: 18px;
  background: rgba(20, 24, 41, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  color: var(--text);
  animation: pop-in var(--ease-spring) 280ms;
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { background: rgba(255, 255, 255, 0.22); }

.modal-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.modal-head strong { font-size: 17px; }
.modal-sub { font-size: 12px; color: var(--text-dim); }

.modal-tabs { display: flex; gap: 6px; margin-bottom: 16px; background: rgba(255, 255, 255, 0.08); padding: 4px; border-radius: 10px; }
.modal-tabs button {
  flex: 1;
  padding: 8px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.modal-tabs button.active { background: rgba(255, 255, 255, 0.18); color: var(--text); }

.modal-form { display: flex; flex-direction: column; gap: 10px; }
.modal-form input,
.modal-form select {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.modal-form input::placeholder { color: var(--text-faint); }
.modal-form input:focus,
.modal-form select:focus { outline: 2px solid rgba(255, 255, 255, 0.5); outline-offset: 0; }
.modal-label { font-size: 12px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.modal-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dim); }
.modal-check input { width: auto; height: auto; }

.modal-preview { display: flex; justify-content: center; margin: 4px 0 2px; }
.modal-preview .app-ic { width: 56px; height: 56px; }

.modal-error { color: #fca5a5; font-size: 13px; min-height: 0; }
.modal-submit {
  margin-top: 4px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  color: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.modal-submit:hover { filter: brightness(1.08); }
.modal-submit:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.modal-actions { display: flex; flex-direction: column; gap: 10px; }
.modal-btn {
  height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.modal-btn:hover { background: rgba(255, 255, 255, 0.2); }
.modal-btn.danger { background: rgba(225, 29, 72, 0.25); border-color: rgba(225, 29, 72, 0.5); }
.modal-btn.danger:hover { background: rgba(225, 29, 72, 0.4); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%) translateY(10px);
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text);
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease) 200ms, transform var(--ease) 200ms;
  z-index: 120;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ==========================================================================
   APP SHELL: sidebar + content (new multi-view layout)
   ========================================================================== */
.shell {
  display: grid;
  grid-template-columns: 84px 1fr;
  min-height: 100vh;
  padding-top: 30px; /* menubar height */
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 30px;
  left: 0;
  bottom: 0;
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 18px 0 90px;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 45;
}

.nav-item {
  position: relative;
  width: 64px;
  padding: 12px 4px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 160ms, color var(--ease) 160ms, border-color var(--ease) 160ms;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.nav-item.active { background: rgba(255, 255, 255, 0.14); color: var(--text); border-color: rgba(255, 255, 255, 0.14); }
.nav-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.nav-ic svg { width: 22px; height: 22px; }
.nav-ic { display: flex; }
.nav-label { letter-spacing: 0.01em; }

.nav-badge {
  position: absolute;
  top: 6px; right: 8px;
  min-width: 17px; height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  line-height: 17px;
  text-align: center;
  font-weight: 700;
}

.content {
  grid-column: 2;
  min-width: 0;
}

/* Hide the floating dock on non-apps views to avoid clutter. */
body[data-view="tasks"] .dock,
body[data-view="today"] .dock { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); }
.dock { transition: opacity var(--ease) 220ms, transform var(--ease) 220ms; }

/* Launchpad view stays centered. */
.view { min-height: calc(100vh - 30px); }

/* On apps view we keep the original centered launchpad. */
.view-apps .launchpad { min-height: calc(100vh - 30px); }

/* ---------- Mobile: sidebar → bottom bar ---------- */
@media (max-width: 720px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    top: auto; bottom: 0; left: 0; right: 0;
    width: 100%; height: 64px;
    flex-direction: row;
    justify-content: space-around;
    padding: 6px 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-right: none;
  }
  .nav-item { width: auto; flex: 1; padding: 6px; }
  .nav-badge { top: 2px; right: 50%; transform: translateX(20px); }
  .content { grid-column: 1; padding-bottom: 80px; }
  /* Move the floating dock up so it doesn't collide with the bottom bar. */
  .dock { bottom: 80px; }
}

/* ==========================================================================
   TASKS VIEW
   ========================================================================== */
.tasks-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 140px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tasks-head { display: flex; align-items: flex-end; justify-content: space-between; }
.tasks-title h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.tasks-sub { font-size: 13px; color: var(--text-dim); margin-top: 2px; display: block; }

/* Quick capture */
.quick-capture {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: var(--text-dim);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}
.quick-capture:focus-within {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(129, 140, 248, 0.55);
  box-shadow: 0 6px 26px rgba(79, 70, 229, 0.32);
}
.quick-capture input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.quick-capture input::placeholder { color: var(--text-faint); }
.qc-hint {
  font-size: 11px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-faint);
  font-family: inherit;
}

/* Filter pills */
.tasks-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.task-search {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text-dim);
  min-width: 200px; flex: 1; max-width: 320px;
}
.task-search:focus-within { border-color: rgba(129, 140, 248, 0.5); }
.task-search input {
  flex: 1; min-width: 0;
  background: transparent; border: none; outline: none;
  color: var(--text); font: inherit; font-size: 13px;
}
.task-search input::placeholder { color: var(--text-faint); }
.task-select {
  height: 34px; padding: 0 10px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  font: inherit; font-size: 13px;
}
.task-select option { background: #1e293b; }
.pill {
  padding: 6px 13px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--ease) 140ms, color var(--ease) 140ms;
}
.pill:hover { background: rgba(255, 255, 255, 0.16); color: var(--text); }
.pill.active { background: linear-gradient(145deg, #818cf8, #4f46e5); color: #fff; border-color: transparent; }

/* Task body: list (detail is now a modal overlay, so list takes full width) */
.tasks-body {
  width: 100%;
}
@media (max-width: 860px) {
  .tasks-body { width: 100%; }
}

.task-list { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.task-group { display: flex; flex-direction: column; gap: 6px; }
.tg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 4px;
}
.tg-dot { width: 8px; height: 8px; border-radius: 50%; }
.tg-count { color: var(--text-faint); font-weight: 500; }

/* Task row */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.09);
  cursor: pointer;
  transition: background var(--ease) 140ms, border-color var(--ease) 140ms, transform var(--ease) 100ms;
}
.task-row:hover { background: rgba(255, 255, 255, 0.12); }
.task-row:active { transform: scale(0.997); }
.task-row.is-selected { border-color: rgba(129, 140, 248, 0.7); background: rgba(99, 102, 241, 0.16); }
.task-row.is-dragging { opacity: 0.5; }
.task-row.is-overdue { border-left: 3px solid #ef4444; }
.task-row.is-done { opacity: 0.55; }
.task-row.is-done .t-title { text-decoration: line-through; }

.t-check {
  flex: none;
  width: 22px; height: 22px;
  margin-top: 1px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: background var(--ease) 140ms, border-color var(--ease) 140ms;
}
.t-check:hover { border-color: rgba(255, 255, 255, 0.6); }
.task-row.is-done .t-check { background: linear-gradient(145deg, #34d399, #059669); border-color: transparent; }
.t-check svg { width: 14px; height: 14px; }

.t-main { flex: 1; min-width: 0; }
.t-title { font-size: 14.5px; line-height: 1.4; word-break: break-word; }
.t-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 5px; font-size: 11.5px; color: var(--text-dim); }
.t-prio { padding: 2px 7px; border-radius: 5px; font-weight: 700; background: color-mix(in srgb, var(--p) 22%, transparent); color: var(--p); }
.t-due.due-over { color: #fca5a5; font-weight: 600; }
.t-assignee { font-size: 13px; opacity: 0.8; }

.t-del {
  flex: none;
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 6px;
  opacity: 0;
  transition: opacity var(--ease) 140ms, background var(--ease) 140ms, color var(--ease) 140ms;
}
.task-row:hover .t-del { opacity: 1; }
.t-del:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }

.tasks-empty {
  text-align: center;
  color: var(--text-dim);
  padding: 50px 20px;
  font-size: 15px;
}

/* ---------- Task detail (full-screen modal overlay) ---------- */
.task-detail-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade-in var(--ease) 160ms;
}
.task-detail-overlay[hidden] { display: none !important; }
.task-detail {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  padding: 26px 28px;
  border-radius: 18px;
  background: rgba(20, 24, 41, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  animation: pop-in var(--ease-spring) 280ms;
}
.detail-close {
  position: absolute; top: 14px; right: 14px;
  width: 30px; height: 30px;
  border: none; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: var(--text); font-size: 20px; cursor: pointer; z-index: 2;
}
.detail-close:hover { background: rgba(255, 255, 255, 0.22); }
.task-detail[hidden] { display: none; }

.d-title-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; padding-right: 24px; }
.d-check {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.d-check[aria-pressed="true"] { background: linear-gradient(145deg, #34d399, #059669); border-color: transparent; }
.d-check svg { width: 16px; height: 16px; }
.d-title {
  flex: 1; min-width: 0;
  background: transparent;
  border: none; outline: none;
  color: var(--text);
  font: inherit; font-size: 17px; font-weight: 600;
  border-bottom: 1px solid transparent;
}
.d-title:focus { border-bottom-color: rgba(129, 140, 248, 0.6); }

/* "Đã lưu" feedback badge */
.d-save-badge {
  flex: none;
  font-size: 11px; font-weight: 600;
  color: #34d399;
  opacity: 0;
  transition: opacity var(--ease) 200ms;
  white-space: nowrap;
}
.d-save-badge.show { opacity: 1; }

.d-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.d-field label { font-size: 11px; color: var(--text-dim); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.d-field input, .d-field select, .d-field textarea {
  width: 100%;
  padding: 8px 11px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: inherit; font-size: 14px;
  resize: vertical;
}
.d-field input:focus, .d-field select:focus, .d-field textarea:focus { outline: 2px solid rgba(129, 140, 248, 0.5); outline-offset: 0; }

/* Detail form: 2-column grid for compact fields on wide screens. */
.d-grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
@media (max-width: 560px) {
  .d-grid2 { grid-template-columns: 1fr; }
}
.d-grid2 .d-field { margin-bottom: 0; }

/* Datetime row: prominent date + time inputs side by side. */
.d-due-row { display: flex; flex-direction: column; gap: 8px; }
.d-dt-inputs { display: flex; gap: 8px; align-items: center; }
.d-dt-inputs input[type="date"],
.d-dt-inputs input[type="time"] {
  flex: 1; height: 40px; padding: 0 12px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text); font: inherit; font-size: 14px;
  color-scheme: dark;
}
.d-dt-inputs input:focus { outline: 2px solid rgba(129, 140, 248, 0.5); }
.d-dt-clear {
  flex: none; width: 38px; height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  border-radius: 9px; cursor: pointer; font-size: 16px;
}
.d-dt-clear:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }
.d-allday { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); text-transform: none; letter-spacing: 0; font-weight: 500; }
.d-allday input { width: auto; height: auto; }

/* ---------- Detail: sections (subtasks, tags) ---------- */
.d-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.d-sec-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.d-sub-prog { font-size: 11px; color: #a5b4fc; font-weight: 600; }
.d-empty { font-size: 12.5px; color: var(--text-faint); padding: 4px 0; }

.d-sub { display: flex; align-items: center; gap: 9px; padding: 7px 4px; border-radius: 7px; }
.d-sub:hover { background: rgba(255, 255, 255, 0.05); }
.d-sub.is-done .d-sub-title { text-decoration: line-through; opacity: 0.5; }
.d-sub-check {
  flex: none; width: 20px; height: 20px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.d-sub.is-done .d-sub-check { background: linear-gradient(145deg, #34d399, #059669); border-color: transparent; }
.d-sub-check svg { width: 12px; height: 12px; }
.d-sub-title { flex: 1; font-size: 13.5px; word-break: break-word; }
.d-sub-del { flex: none; width: 20px; height: 20px; border: none; background: transparent; color: var(--text-faint); font-size: 16px; cursor: pointer; border-radius: 5px; opacity: 0; }
.d-sub:hover .d-sub-del { opacity: 1; }
.d-sub-del:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }

.d-add-sub, .d-add-tag { display: flex; gap: 6px; margin-top: 6px; }
.d-add-sub input, .d-add-tag input {
  flex: 1; height: 32px; padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text); font: inherit; font-size: 13px;
}
.d-add-sub input:focus, .d-add-tag input:focus { outline: 2px solid rgba(129, 140, 248, 0.5); outline-offset: 0; }
.d-add-sub button, .d-add-tag button {
  flex: none; width: 32px; height: 32px;
  border: none; border-radius: 8px;
  background: rgba(99, 102, 241, 0.3);
  color: var(--text); font-size: 18px; cursor: pointer;
}
.d-add-sub button:hover, .d-add-tag button:hover { background: rgba(99, 102, 241, 0.5); }

/* Tag chips */
.d-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.d-tag-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 6px;
  background: color-mix(in srgb, var(--tg) 24%, transparent);
  color: var(--tg);
  font-size: 12px; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--tg) 40%, transparent);
}
.d-tag-chip button { background: transparent; border: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; opacity: 0.7; padding: 0; }
.d-tag-chip button:hover { opacity: 1; }

/* Task row: tag chips + subtask progress */
.t-tag {
  display: inline-block;
  padding: 1px 6px; border-radius: 4px;
  background: color-mix(in srgb, var(--tg) 22%, transparent);
  color: var(--tg);
  font-size: 10.5px; font-weight: 600;
}
.t-sub { font-size: 11px; color: #a5b4fc; }
.t-rec { font-size: 11px; opacity: 0.85; }

/* Recurrence editor in detail */
.d-rec-row { display: flex; flex-direction: column; gap: 8px; }
.d-rec-week { display: flex; gap: 4px; flex-wrap: wrap; }
.d-rec-week[hidden] { display: none; }
.rec-day {
  min-width: 30px; height: 28px; padding: 0 6px;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-dim);
  font: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: background var(--ease) 130ms, color var(--ease) 130ms;
}
.rec-day:hover { background: rgba(255, 255, 255, 0.16); }
.rec-day.active { background: linear-gradient(145deg, #818cf8, #4f46e5); color: #fff; border-color: transparent; }

/* ---------- View toggle (list/calendar) ---------- */
.view-toggle { display: flex; gap: 4px; background: rgba(255, 255, 255, 0.08); padding: 3px; border-radius: 9px; margin-left: auto; }
.vt-btn {
  width: 32px; height: 30px;
  border: none; border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px; cursor: pointer;
  transition: background var(--ease) 130ms, color var(--ease) 130ms;
}
.vt-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }
.vt-btn.active { background: rgba(255, 255, 255, 0.2); color: var(--text); }

/* ---------- Calendar view ---------- */
.tasks-calendar { width: 100%; }
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cal-nav button {
  width: 30px; height: 30px; border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08); color: var(--text);
  border-radius: 8px; font-size: 18px; cursor: pointer;
}
.cal-nav button:hover { background: rgba(255, 255, 255, 0.18); }
.cal-month { font-weight: 700; font-size: 15px; text-transform: capitalize; flex: 1; text-align: center; }
.cal-today-btn { width: auto !important; padding: 0 12px; font-size: 12px !important; font-weight: 600; }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-hd { text-align: center; font-size: 11px; font-weight: 700; color: var(--text-dim); padding: 6px 0; text-transform: uppercase; }
.cal-cell {
  min-height: 86px; padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex; flex-direction: column; gap: 4px;
}
.cal-cell.empty { background: transparent; border-color: transparent; }
.cal-cell.is-today { border-color: rgba(129, 140, 248, 0.7); background: rgba(99, 102, 241, 0.12); }
.cal-date { font-size: 12px; font-weight: 700; color: var(--text-dim); }
.cal-cell.is-today .cal-date { color: #a5b4fc; }
.cal-tasks { display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-task {
  font-size: 11px; padding: 2px 5px; border-radius: 4px;
  background: color-mix(in srgb, var(--p) 24%, transparent);
  color: var(--p); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; border-left: 2px solid var(--p);
}
.cal-task.is-done { opacity: 0.45; text-decoration: line-through; }
.cal-task:hover { background: color-mix(in srgb, var(--p) 38%, transparent); }
.cal-more { font-size: 10px; color: var(--text-faint); padding: 0 5px; }

/* ---------- Cheatsheet modal ---------- */
.cheatsheet { display: flex; flex-direction: column; gap: 9px; }
.cs-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cs-row span { color: var(--text-dim); }
.cs-row kbd, .cs-row code {
  display: inline-block; min-width: 24px; text-align: center;
  padding: 3px 7px; border-radius: 5px;
  background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16);
  font: inherit; font-size: 11.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text); font-weight: 600;
}

.d-actions { display: flex; justify-content: flex-end; margin-top: 6px; }
.d-del {
  padding: 8px 14px; border-radius: 9px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font: inherit; font-size: 13px; cursor: pointer;
}
.d-del:hover { background: rgba(239, 68, 68, 0.35); color: #fff; }

.d-activity { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.1); }
.da-head { font-size: 11px; color: var(--text-dim); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 8px; }
.da-line { font-size: 12.5px; color: var(--text-dim); padding: 4px 0; }
.da-who { font-weight: 600; color: var(--text); }
.da-time { color: var(--text-faint); font-size: 11px; }
.da-empty { font-size: 12.5px; color: var(--text-faint); }

/* ==========================================================================
   TODAY (DASHBOARD) VIEW
   ========================================================================== */
.today-shell {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 24px 140px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.today-hero {
  position: relative;
  padding: 28px 26px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.32), rgba(14, 165, 233, 0.18));
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.th-greet { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.th-sub { color: var(--text-dim); margin-top: 4px; font-size: 14px; }
.th-streak {
  position: absolute; top: 22px; right: 24px;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 13px; line-height: 1.3;
  opacity: 0.7;
}
.th-streak.is-active { opacity: 1; background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(239, 68, 68, 0.25)); }
.th-streak strong { font-size: 22px; }
.th-flame { font-size: 28px; animation: flame-flicker 1.8s ease-in-out infinite; }
@keyframes flame-flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.12) rotate(2deg); } }

.today-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 820px) { .today-grid { grid-template-columns: 1fr; } }

.today-card {
  padding: 22px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.today-card.mini { padding: 16px 18px; }
.tc-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.tc-head h2 { font-size: 18px; font-weight: 700; }
.tc-count { font-size: 12px; color: var(--text-dim); }
.tc-overdue {
  font-size: 12.5px;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.18);
  padding: 6px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.dt-task {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 6px;
  cursor: pointer;
  transition: background var(--ease) 130ms;
}
.dt-task:hover { background: rgba(255, 255, 255, 0.1); }
.dt-task.is-done .dt-title { text-decoration: line-through; opacity: 0.55; }
.dt-check {
  width: 22px; height: 22px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.dt-task.is-done .dt-check { background: linear-gradient(145deg, #34d399, #059669); border-color: transparent; }
.dt-check svg { width: 14px; height: 14px; }
.dt-title { flex: 1; font-size: 14px; }
.dt-due { font-size: 12px; color: var(--text-dim); }
.tc-empty { color: var(--text-dim); padding: 14px 0; font-size: 14px; }

.today-side { display: flex; flex-direction: column; gap: 18px; }
.stat { display: flex; flex-direction: column; padding: 8px 0; }
.stat + .stat { border-top: 1px solid rgba(255, 255, 255, 0.08); padding-top: 14px; }
.stat-num { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.stat-lbl { font-size: 12.5px; color: var(--text-dim); }

.mini-apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mini-app {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; color: var(--text);
}
.mini-app .app-ic { width: 44px; height: 44px; border-radius: 22%; }
.mini-app .app-ic svg { width: 50%; height: 50%; color: #fff; }
.mini-name { font-size: 11px; text-align: center; color: var(--text-dim); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Streak chip in menubar ---------- */
.mb-streak {
  font-weight: 700;
  font-size: 12px;
  color: #fbbf24;
}

/* ---------- Microsoft login button ---------- */
.modal-sep {
  display: flex; align-items: center;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  margin: 14px 0;
}
.modal-sep::before, .modal-sep::after {
  content: ""; flex: 1; height: 1px;
  background: rgba(255, 255, 255, 0.12);
}
.modal-sep::before { margin-right: 12px; }
.modal-sep::after { margin-left: 12px; }
.ms-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ease) 150ms;
}
.ms-btn:hover { background: rgba(255, 255, 255, 0.22); color: var(--text); }

/* ==========================================================================
   LOGIN SCREEN (full-screen, shown when not authenticated)
   ========================================================================== */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in var(--ease) 220ms;
}

.login-card {
  width: min(380px, 100%);
  padding: 34px 30px 26px;
  border-radius: 22px;
  background: rgba(20, 24, 41, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  animation: pop-in var(--ease-spring) 320ms;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--text);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.login-brand svg { opacity: 0.95; }

.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-form input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.login-form input::placeholder { color: var(--text-faint); }
.login-form input:focus { outline: 2px solid rgba(129, 140, 248, 0.55); outline-offset: 0; }

.login-error {
  color: #fca5a5;
  font-size: 13px;
  background: rgba(239, 68, 68, 0.14);
  padding: 8px 12px;
  border-radius: 8px;
}

.login-submit {
  margin-top: 4px;
  height: 44px;
  border: none;
  border-radius: 11px;
  background: linear-gradient(145deg, #60a5fa, #2563eb);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: filter var(--ease) 150ms;
}
.login-submit:hover { filter: brightness(1.1); }
.login-submit:active { transform: scale(0.98); }

.login-sep {
  display: flex; align-items: center;
  text-align: center;
  color: var(--text-faint);
  font-size: 12px;
  margin: 16px 0 12px;
}
.login-sep::before, .login-sep::after {
  content: ""; flex: 1; height: 1px;
  background: rgba(255, 255, 255, 0.12);
}
.login-sep::before { margin-right: 12px; }
.login-sep::after { margin-left: 12px; }

.login-card .ms-btn { width: 100%; }

.login-foot {
  text-align: center;
  margin-top: 18px;
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ---------- User management table ---------- */
.users-table-wrap {
  max-height: 50vh;
  overflow: auto;
  margin: 12px 0;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.users-table th {
  position: sticky; top: 0;
  background: rgba(20, 24, 41, 0.95);
  text-align: left;
  padding: 9px 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.users-table td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}
.users-table tr:last-child td { border-bottom: none; }
.users-table tr:hover td { background: rgba(255, 255, 255, 0.04); }
.users-table .you { color: var(--text-faint); font-size: 11px; }
.users-table .muted { color: var(--text-faint); }
.urole {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}
.urole.admin { background: rgba(245, 158, 11, 0.22); color: #fbbf24; }
.urole.user { background: rgba(99, 102, 241, 0.22); color: #a5b4fc; }
.udel {
  width: 24px; height: 24px;
  border: none;
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-radius: 6px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.udel:hover { background: rgba(239, 68, 68, 0.4); color: #fff; }

/* ==========================================================================
   TASK REDESIGN (v2) — overrides + new components
   ========================================================================== */

/* ---------- Task row: chấm priority + mini progress bar ---------- */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: background var(--ease) 140ms, border-color var(--ease) 140ms, transform var(--ease) 100ms, box-shadow var(--ease) 140ms;
}
.task-row:hover { background: rgba(255, 255, 255, 0.11); border-color: rgba(255, 255, 255, 0.16); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.task-row:active { transform: scale(0.997); }
.task-row.is-selected { border-color: rgba(129, 140, 248, 0.7); background: rgba(99, 102, 241, 0.18); box-shadow: 0 4px 18px rgba(99, 102, 241, 0.25); }
.task-row.is-dragging { opacity: 0.5; }
.task-row.is-overdue { border-left: 3px solid #ef4444; }
.task-row.is-done { opacity: 0.5; }
.task-row.is-done .t-title { text-decoration: line-through; }

.t-check {
  flex: none;
  width: 22px; height: 22px;
  margin-top: 1px;
  border-radius: 7px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  transition: background var(--ease) 140ms, border-color var(--ease) 140ms;
}
.t-check:hover { border-color: rgba(255, 255, 255, 0.65); }
.task-row.is-done .t-check { background: linear-gradient(145deg, #34d399, #059669); border-color: transparent; }
.t-check svg { width: 14px; height: 14px; }

/* Priority dot (replaces text badge) */
.t-dot {
  flex: none;
  width: 10px; height: 10px;
  margin-top: 8px;
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 12%, transparent);
}

.t-main { flex: 1; min-width: 0; }
.t-title { font-size: 14.5px; line-height: 1.4; word-break: break-word; font-weight: 500; }
.t-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 5px; font-size: 11.5px; color: var(--text-dim); }
.t-due.due-over { color: #fca5a5; font-weight: 600; }

/* Mini subtask progress in row */
.t-sub-mini { display: inline-flex; align-items: center; gap: 5px; }
.t-sub-track { display: inline-block; width: 36px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); overflow: hidden; }
.t-sub-fill { display: block; height: 100%; background: linear-gradient(90deg, #818cf8, #4f46e5); border-radius: 3px; transition: width var(--ease) 200ms; }
.t-sub-num { font-size: 10.5px; color: #a5b4fc; font-variant-numeric: tabular-nums; }

.t-tag {
  display: inline-block;
  padding: 1px 7px; border-radius: 5px;
  background: color-mix(in srgb, var(--tg) 22%, transparent);
  color: var(--tg);
  font-size: 10.5px; font-weight: 600;
}
.t-rec { font-size: 12px; opacity: 0.85; }

.t-del {
  flex: none;
  width: 24px; height: 24px;
  margin-top: 2px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 7px;
  opacity: 0;
  transition: opacity var(--ease) 140ms, background var(--ease) 140ms, color var(--ease) 140ms;
}
.task-row:hover .t-del { opacity: 1; }
.t-del:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }
@media (hover: none) { .t-del { opacity: 0.8; } }

/* ---------- Lists management button + modal ---------- */
.lists-btn { font-size: 12px; }

/* ---------- Detail: 2-pane layout ---------- */
.d-panes {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  margin: 18px 0;
}
@media (max-width: 680px) {
  .d-panes { grid-template-columns: 1fr; gap: 16px; }
}
.d-pane { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Footer actions: prominent */
.d-actions {
  display: flex; gap: 10px; justify-content: space-between;
  padding-top: 16px; margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.d-done-btn {
  flex: 1; height: 42px;
  border: none; border-radius: 10px;
  background: linear-gradient(145deg, #34d399, #059669);
  color: #fff; font: inherit; font-size: 14px; font-weight: 700;
  cursor: pointer;
  transition: filter var(--ease) 130ms;
}
.d-done-btn:hover { filter: brightness(1.1); }
.d-del {
  flex: none; padding: 0 18px; height: 42px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
}
.d-del:hover { background: rgba(239, 68, 68, 0.3); color: #fff; }

/* Subtask progress bar in detail */
.d-sub-progress {
  height: 6px; border-radius: 3px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden; margin-bottom: 10px;
}
.d-sub-bar {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #10b981);
  border-radius: 3px;
  transition: width var(--ease) 300ms;
  width: 0%;
}
.d-sub-progress[hidden] { display: none; }

/* Add-list mini button next to label */
.d-add-list {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  margin-left: 6px;
  border: none; border-radius: 50%;
  background: rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 13px; line-height: 1; cursor: pointer;
  vertical-align: middle;
}
.d-add-list:hover { background: rgba(99, 102, 241, 0.5); color: #fff; }

/* ---------- Lists management modal ---------- */
.lists-mgmt { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.lrow {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.lrow:hover { background: rgba(255, 255, 255, 0.1); }
.lcolor { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.lname { flex: 1; font-size: 14px; font-weight: 500; }
.lcount { font-size: 11px; color: var(--text-faint); }
.ldel {
  width: 22px; height: 22px;
  border: none; background: transparent;
  color: var(--text-faint); font-size: 16px; cursor: pointer; border-radius: 5px;
}
.ldel:hover { background: rgba(239, 68, 68, 0.25); color: #fff; }

/* ---------- Color picker ---------- */
.color-picker { display: flex; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.cp-swatch {
  width: 28px; height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--ease) 130ms, border-color var(--ease) 130ms;
}
.cp-swatch:hover { transform: scale(1.12); }
.cp-swatch.active { border-color: #fff; transform: scale(1.12); }

/* ---------- Sticky tasks toolbar ---------- */
.tasks-shell { position: relative; }
.tasks-toolbar {
  position: sticky;
  top: 0;
  z-index: 5;
  padding: 10px 0;
  margin-bottom: 4px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.92) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
