/* ==========================================================================
   ClearDo — calm, offline-first task management
   ========================================================================== */

:root {
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #eef1f7;
  --surface-hover: #f1f3f9;
  --border: #e6e9f0;
  --border-strong: #d4d9e4;
  --text: #181c24;
  --text-soft: #3b4250;
  --muted: #6b7280;
  --muted-2: #969dab;

  --accent: #5b6cff;
  --accent-strong: #4554e8;
  --accent-soft: rgba(91, 108, 255, 0.1);
  --accent-softer: rgba(91, 108, 255, 0.06);
  --accent-contrast: #ffffff;
  --danger: #e5484d;
  --danger-soft: rgba(229, 72, 77, 0.1);
  --success: #14a05a;
  --success-soft: rgba(20, 160, 90, 0.12);
  --warning: #d97706;
  --star: #f5a623;

  --c-blue: #4f7cf7;
  --c-purple: #8b5cf6;
  --c-pink: #ec4899;
  --c-red: #ef4444;
  --c-orange: #f97316;
  --c-amber: #f59e0b;
  --c-green: #10b981;
  --c-teal: #14b8a6;

  --shadow-sm: 0 1px 2px rgba(18, 22, 34, 0.05);
  --shadow-md: 0 8px 24px rgba(18, 22, 34, 0.08);
  --shadow-lg: 0 24px 70px rgba(12, 16, 28, 0.22);
  --ring: 0 0 0 3px rgba(91, 108, 255, 0.2);

  --radius-s: 7px;
  --radius-m: 10px;
  --radius-l: 14px;
  --radius-xl: 20px;

  --sidebar-w: 292px;
  --rail-w: 84px;
  --rail-expanded-w: min(380px, calc(100vw - 24px));
  --topbar-h: 64px;
  --detail-w: 424px;

  --toast-bg: #1b2130;
  --toast-text: #f5f7ff;
}

html[data-theme="dark"] {
  --bg: #0c0f16;
  --surface: #141821;
  --surface-2: #191e29;
  --surface-3: #202633;
  --surface-hover: #1d2330;
  --border: #262d3b;
  --border-strong: #343d4f;
  --text: #eef1f8;
  --text-soft: #c5ccda;
  --muted: #8d97a9;
  --muted-2: #697486;

  --accent: #7c8cff;
  --accent-strong: #97a4ff;
  --accent-soft: rgba(124, 140, 255, 0.14);
  --accent-softer: rgba(124, 140, 255, 0.08);
  --accent-contrast: #0d1020;
  --danger: #ff6b70;
  --danger-soft: rgba(255, 107, 112, 0.13);
  --success: #4ade80;
  --success-soft: rgba(74, 222, 128, 0.13);
  --warning: #fbbf24;
  --star: #fbbf24;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.38);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(124, 140, 255, 0.26);

  --toast-bg: #242c3d;
  --toast-text: #f6f8ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  font-size: 17px;
}

body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

h1,
h2,
h3,
h4,
p,
dl,
dd {
  margin: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

::selection {
  background: var(--accent-soft);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.icon {
  width: 22px;
  height: 22px;
  flex: none;
}

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

.skip-link {
  position: fixed;
  left: 12px;
  top: -100px;
  z-index: 300;
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
}

.tiny {
  font-size: 0.7rem;
}

.spacer {
  flex: 1;
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  height: 100dvh;
  overflow: hidden;
}

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100dvh;
  overflow: hidden;
}

.mobile-only {
  display: none !important;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(8, 10, 16, 0.48);
  backdrop-filter: blur(2px);
  animation: fadeIn 0.18s ease;
}

/* --------------------------------------------------------------------------
   Sidebar
   -------------------------------------------------------------------------- */

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  width: min(360px, 88vw);
  height: 100dvh;
  padding: 20px 16px 14px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  transform: translateX(-104%);
  transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1), width 0.22s ease, box-shadow 0.22s ease;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-overlay {
  z-index: 75;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 6px 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  padding: 2px;
  transition: opacity 0.15s ease;
}

.brand:hover {
  opacity: 0.85;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  filter: drop-shadow(0 4px 10px rgba(91, 108, 255, 0.28));
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-name {
  font-size: 1.32rem;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.sidebar-close {
  display: grid !important;
}

.smart-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  padding: 11px 12px;
  border-radius: var(--radius-m);
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 540;
  text-align: left;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item:active {
  transform: translateX(2px) scale(0.99);
}

.nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 640;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: none;
  transition: transform 0.18s ease;
}

.nav-item:hover .nav-icon {
  transform: scale(1.08);
}

.nav-icon .icon {
  width: 22px;
  height: 22px;
}

.icon-myday {
  color: var(--accent);
}

.icon-important {
  color: var(--star);
}

.icon-planned {
  color: #9a6bff;
}

.icon-all {
  color: #0ea5e9;
}

.icon-completed {
  color: var(--success);
}

.nav-count {
  margin-left: auto;
  min-width: 23px;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 650;
  text-align: center;
}

.nav-item[aria-current="page"] .nav-count {
  background: var(--surface);
  color: var(--accent-strong);
}

.lists-block {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-top: 18px;
}

.lists-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 6px;
  color: var(--muted-2);
  font-size: 0.67rem;
  font-weight: 720;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.custom-lists {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  overflow-y: auto;
  padding: 1px 2px 8px;
  scrollbar-gutter: stable;
}

.list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text-soft);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
  user-select: none;
}

.list-item:hover {
  background: var(--surface-hover);
}

.list-item.active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
}

.list-item.dragging {
  opacity: 0.4;
}

.list-item.drop-above {
  box-shadow: 0 -2px 0 0 var(--accent);
}

.list-item.drop-below {
  box-shadow: 0 2px 0 0 var(--accent);
}

.list-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}

.list-emoji {
  width: 24px;
  font-size: 1.12rem;
  line-height: 1;
  text-align: center;
  flex: none;
}

.list-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.95rem;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.list-count {
  color: var(--muted-2);
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
}

.list-more {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 7px;
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease;
}

.list-more .icon {
  width: 17px;
  height: 17px;
}

.list-item:hover .list-more,
.list-item:focus-within .list-more {
  opacity: 1;
}

.list-more:hover {
  background: var(--surface-3);
  color: var(--text);
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.side-action {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-soft);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.side-action:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.side-action-icon {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.side-action-icon .icon {
  width: 19px;
  height: 19px;
}

.side-action-label {
  flex: 1;
  min-width: 0;
}

.side-action-badge {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.58rem;
  font-weight: 760;
  letter-spacing: 0.04em;
}

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 10px 2px;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.sidebar-note .icon {
  width: 13px;
  height: 13px;
}

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: none;
  height: var(--topbar-h);
  padding: 0 30px;
}

.search-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(360px, 100%);
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.9rem;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.search-trigger:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.search-trigger:active {
  transform: scale(0.99);
}

.search-trigger .icon {
  width: 18px;
  height: 18px;
}

.search-trigger-label {
  flex: 1;
  text-align: left;
}

.search-trigger kbd {
  margin-left: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  overflow: hidden;
  border-radius: 11px;
  color: var(--text-soft);
  transition: background-color 0.18s ease, color 0.18s ease, opacity 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.icon-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft), transparent 68%);
  opacity: 0;
  transform: scale(0.55);
  transition: opacity 0.2s ease, transform 0.24s ease;
  pointer-events: none;
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-btn:hover::after {
  opacity: 1;
  transform: scale(1);
}

.icon-btn .icon {
  position: relative;
  z-index: 1;
  transition: transform 0.18s ease;
}

.icon-btn:hover .icon {
  transform: scale(1.08);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn:disabled {
  opacity: 0.32;
  cursor: default;
  background: transparent;
  transform: none;
}

.icon-btn.small {
  width: 32px;
  height: 32px;
  border-radius: 9px;
}

.icon-btn.small .icon {
  width: 18px;
  height: 18px;
}

.lang-switch {
  display: flex;
  gap: 2px;
  margin: 0 3px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}

.lang-btn {
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 720;
  letter-spacing: 0.04em;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Main
   -------------------------------------------------------------------------- */

.main {
  flex: 1;
  min-height: 0;
  padding: 4px 32px 120px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.main:focus {
  outline: none;
}

.demo-banner,
.view-header,
.composer-slot,
.view-content {
  width: 100%;
  max-width: 880px;
  margin-right: auto;
  margin-left: auto;
}

.demo-banner {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 12px;
  margin-bottom: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(91, 108, 255, 0.24);
  border-radius: var(--radius-l);
  background: linear-gradient(120deg, var(--accent-soft), var(--accent-softer) 60%, transparent);
  color: var(--text-soft);
  font-size: 0.8rem;
  animation: slideDown 0.3s ease;
}

html[data-theme="dark"] .demo-banner {
  border-color: rgba(124, 140, 255, 0.28);
}

.demo-banner-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.demo-banner-icon .icon {
  width: 17px;
  height: 17px;
}

.demo-banner p {
  flex: 1;
  line-height: 1.45;
}

.demo-banner-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* View header */

.view-header {
  padding: 20px 0 14px;
}

.view-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.view-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 300px;
  min-width: 0;
}

.view-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.view-icon .icon {
  width: 22px;
  height: 22px;
}

.view-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-size: clamp(1.5rem, 2.3vw, 1.95rem);
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.15;
  word-break: break-word;
}

.view-title .view-emoji {
  font-size: 1.55rem;
  line-height: 1;
}

.view-subtitle {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.filter-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.filter-wrap > .icon {
  position: absolute;
  right: 9px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}

.filter-select {
  height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 550;
  outline: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, box-shadow 0.18s ease;
}

.filter-select:hover {
  border-color: var(--border-strong);
}

.filter-select:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 0.74rem;
}

.progress-track {
  flex: 1;
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-3);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #8e5bff);
  transition: width 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.progress-label {
  flex: none;
  font-variant-numeric: tabular-nums;
}

.view-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.active-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 27px;
  padding: 0 5px 0 9px;
  border: 1px solid var(--accent-soft);
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 600;
}

.active-filter button {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: inherit;
}

.active-filter button:hover {
  background: rgba(91, 108, 255, 0.16);
}

.active-filter .icon {
  width: 12px;
  height: 12px;
}

/* --------------------------------------------------------------------------
   Buttons & form controls
   -------------------------------------------------------------------------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 17px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  font-size: 0.9rem;
  font-weight: 620;
  line-height: 1;
  white-space: nowrap;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 25%, rgba(255, 255, 255, 0.28) 48%, transparent 72%);
  transform: translateX(-130%);
  transition: transform 0.55s ease;
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:hover::before {
  transform: translateX(130%);
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn:disabled {
  transform: none;
  box-shadow: none;
}

.btn .icon {
  width: 18px;
  height: 18px;
  transition: transform 0.18s ease;
}

.btn:hover .icon {
  transform: scale(1.06);
}

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 2px rgba(40, 52, 150, 0.18);
}

html[data-theme="dark"] .btn.primary {
  color: #0e1222;
}

.btn.primary:hover {
  background: var(--accent-strong);
  box-shadow: 0 8px 22px rgba(91, 108, 255, 0.28);
}

.btn.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn.ghost {
  border-color: var(--border);
  background: transparent;
  color: var(--text-soft);
}

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

.btn.small {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 0.8rem;
}

.btn.danger-solid {
  background: var(--danger);
  color: #fff;
}

html[data-theme="dark"] .btn.danger-solid {
  color: #1a0d0e;
}

.btn.danger-solid:hover {
  filter: brightness(1.06);
}

.danger-text {
  color: var(--danger);
}

.btn.ghost.danger-text:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-family: inherit;
  font-size: 0.64rem;
  font-weight: 620;
  line-height: 1;
}

/* --------------------------------------------------------------------------
   Composer
   -------------------------------------------------------------------------- */

.composer-slot {
  margin-bottom: 18px;
}

.composer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 7px 7px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.composer:focus-within {
  border-color: var(--accent);
  box-shadow: var(--ring);
  transform: translateY(-1px);
}

.composer > .icon {
  width: 19px;
  height: 19px;
  color: var(--accent);
}

.composer-input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.95rem;
}

.composer-input::placeholder {
  color: var(--muted-2);
}

.composer-list {
  max-width: 170px;
  height: 36px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.8rem;
  outline: none;
  text-overflow: ellipsis;
  cursor: pointer;
}

.composer-add {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  overflow: hidden;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  transition: background-color 0.18s ease, opacity 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

html[data-theme="dark"] .composer-add {
  color: #0e1222;
}

.composer-add:hover {
  background: var(--accent-strong);
  transform: translateY(-1px) scale(1.03);
  box-shadow: 0 8px 20px rgba(91, 108, 255, 0.3);
}

.composer-add:active {
  transform: scale(0.94);
}

.composer-add .icon {
  width: 20px;
  height: 20px;
  transition: transform 0.22s ease;
}

.composer-add:hover .icon {
  transform: rotate(90deg) scale(1.08);
}

.composer-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-l);
  color: var(--muted);
  font-size: 0.82rem;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Tasks
   -------------------------------------------------------------------------- */

.view-content {
  padding-bottom: 24px;
}

.group {
  margin-bottom: 24px;
}

.group-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 3px 3px 8px;
  color: var(--text-soft);
  font-size: 0.83rem;
  font-weight: 660;
}

.group-head .group-emoji {
  font-size: 1.05rem;
  line-height: 1;
}

.group-head .group-count {
  padding: 0 6px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
  line-height: 19px;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 6px;
}

.task {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 11px 12px 13px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  transition: background-color 0.18s ease, border-color 0.18s ease, opacity 0.2s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.task:hover {
  border-color: var(--border);
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.task:focus-visible {
  outline-offset: -1px;
}

.task.completed {
  opacity: 0.68;
}

.task.dragging {
  opacity: 0.4;
}

.task.drop-before::before,
.task.drop-after::after {
  content: "";
  position: absolute;
  right: 8px;
  left: 8px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  z-index: 2;
}

.task.drop-before::before {
  top: -2px;
}

.task.drop-after::after {
  bottom: -2px;
}

.task-check {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-top: 0;
  flex: none;
  border: 1.7px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.14s ease, box-shadow 0.18s ease;
}

.task-check .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.6;
}

.task-check:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.08);
  box-shadow: 0 0 0 4px var(--accent-softer);
}

.task.completed .task-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  animation: checkPop 0.25s ease;
}

html[data-theme="dark"] .task.completed .task-check {
  color: #0e1222;
}

.task-body {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.task-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.task-title {
  display: inline;
  max-width: 100%;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 58%;
  background-size: 0% 1.5px;
  color: var(--text);
  font-size: 0.96rem;
  font-weight: 520;
  line-height: 1.45;
  overflow-wrap: anywhere;
  transition: background-size 0.28s ease, color 0.2s ease;
}

.task.completed .task-title {
  background-size: 100% 1.5px;
  color: var(--muted);
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  row-gap: 4px;
  font-size: 0.74rem;
  color: var(--muted);
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
}

.meta-chip .icon {
  width: 13px;
  height: 13px;
}

.meta-chip.due.overdue {
  background: var(--danger-soft);
  color: var(--danger);
}

.meta-chip.due.today {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.meta-chip.repeat {
  background: transparent;
  padding: 0;
}

.meta-chip.repeat .icon {
  color: var(--muted-2);
}

.task-list-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-2);
  font-size: 0.68rem;
  white-space: nowrap;
}

.task-list-label .list-dot {
  width: 6px;
  height: 6px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--accent-softer);
  color: var(--accent-strong);
  font-size: 0.66rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

button.tag-chip {
  cursor: pointer;
}

button.tag-chip:hover {
  background: var(--accent-soft);
}

.task-star {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: -3px -3px 0 0;
  flex: none;
  border-radius: 9px;
  color: var(--muted-2);
  transition: color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.task-star .icon {
  width: 18px;
  height: 18px;
  transition: transform 0.22s ease;
}

.task-star:hover {
  background: var(--surface-3);
  color: var(--star);
  transform: scale(1.08);
}

.task-star:hover .icon {
  transform: rotate(-12deg) scale(1.1);
}

.task-star.starred {
  color: var(--star);
}

.task-star.starred .icon {
  fill: currentColor;
}

/* Empty states */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
  text-align: center;
  animation: fadeIn 0.3s ease;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 15px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}

.empty-icon .icon {
  width: 26px;
  height: 26px;
}

.empty-title {
  font-size: 1.02rem;
  font-weight: 660;
  letter-spacing: -0.01em;
}

.empty-body {
  max-width: 380px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.83rem;
  line-height: 1.55;
}

.empty-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Focus timer
   -------------------------------------------------------------------------- */

.focus-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(18px, 2.6vw, 34px);
  margin-bottom: 22px;
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(120% 150% at 0% 0%, var(--accent-soft), transparent 55%),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.focus-ring {
  --p: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(180px, 20vw, 260px);
  height: clamp(180px, 20vw, 260px);
  flex: none;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-3) 0);
}

.focus-ring::before {
  content: "";
  position: absolute;
  inset: clamp(10px, 1.2vw, 16px);
  border-radius: 50%;
  background: var(--surface);
}

.focus-time {
  position: relative;
  z-index: 1;
  font-size: clamp(2.6rem, 5.4vw, 4.6rem);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
  line-height: 0.95;
  letter-spacing: -0.05em;
}

.focus-info {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  gap: clamp(6px, 0.8vw, 10px);
}

.focus-mode {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.focus-mode .icon {
  width: 16px;
  height: 16px;
}

.focus-task-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.focus-task-line .icon {
  width: 16px;
  height: 16px;
  flex: none;
}

.focus-task-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.focus-select {
  width: min(100%, 460px);
  max-width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  color: var(--text-soft);
  font-size: 0.94rem;
  font-weight: 540;
  outline: none;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.focus-select:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.focus-select:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.focus-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 9px;
}

.focus-controls .btn {
  height: 46px;
  padding: 0 20px;
  border-radius: 12px;
  font-size: 0.94rem;
}

.focus-controls .btn.primary {
  padding: 0 24px;
  background-image: linear-gradient(135deg, var(--accent), #7c5bff);
  box-shadow: 0 8px 22px rgba(91, 108, 255, 0.24);
}

.focus-controls .btn.primary:hover {
  background-image: linear-gradient(135deg, var(--accent-strong), #6f4bff);
  box-shadow: 0 12px 28px rgba(91, 108, 255, 0.34);
}

.focus-controls .btn .icon {
  width: 18px;
  height: 18px;
}

.focus-hint {
  color: var(--muted-2);
  font-size: 0.8rem;
}

@media (hover: hover) and (pointer: fine) {
  .focus-card {
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  }

  .focus-card:hover,
  .focus-card:focus-within {
    transform: translateY(-2px);
    border-color: var(--accent-soft);
    box-shadow: var(--shadow-md);
  }

  .focus-ring {
    transition: transform 0.22s ease, filter 0.22s ease;
  }

  .focus-card:hover .focus-ring,
  .focus-card:focus-within .focus-ring {
    transform: scale(1.035);
    filter: drop-shadow(0 10px 24px var(--accent-soft));
  }

  .focus-time {
    transition: color 0.2s ease;
  }

  .focus-card:hover .focus-time,
  .focus-card:focus-within .focus-time {
    color: var(--accent-strong);
  }
}

/* Suggestions */

.suggestions {
  margin-bottom: 20px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
}

.suggestions-head {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 11px 13px;
  color: var(--text-soft);
  font-size: 0.83rem;
  font-weight: 620;
  text-align: left;
  transition: background-color 0.15s ease;
}

.suggestions-head:hover {
  background: var(--surface-hover);
}

.suggestions-head > .icon {
  width: 16px;
  height: 16px;
  color: var(--star);
}

.suggestions-count {
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
}

.suggestions-chevron {
  margin-left: auto;
  color: var(--muted-2);
  transition: transform 0.2s ease;
}

.suggestions.open .suggestions-chevron {
  transform: rotate(180deg);
}

.suggestions-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 5px;
  border-top: 1px solid var(--border);
}

.suggestion-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
}

.suggestion-item:hover {
  background: var(--surface-hover);
}

.suggestion-main {
  flex: 1;
  min-width: 0;
}

.suggestion-title {
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.suggestion-meta {
  display: flex;
  gap: 7px;
  margin-top: 1px;
  color: var(--muted-2);
  font-size: 0.68rem;
}

.suggestion-meta .overdue {
  color: var(--danger);
}

.suggestion-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.7rem;
  font-weight: 600;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.suggestion-add:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.suggestion-add .icon {
  width: 12px;
  height: 12px;
}

.suggestions-empty {
  padding: 11px 13px;
  color: var(--muted);
  font-size: 0.78rem;
}

/* --------------------------------------------------------------------------
   Task detail drawer
   -------------------------------------------------------------------------- */

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--detail-w);
  max-width: 100vw;
  height: 100dvh;
  border-left: 1px solid var(--border);
  background: var(--surface);
  box-shadow: -24px 0 70px rgba(12, 16, 28, 0.18);
  transform: translateX(103%);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  visibility: hidden;
}

.detail-panel.open {
  transform: translateX(0);
  visibility: visible;
}

#detail-overlay {
  z-index: 35;
}

.detail-content {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 17px;
  padding: 18px 20px calc(30px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.detail-head-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex-wrap: wrap;
}

.detail-list-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 220px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-list-chip .list-dot {
  width: 6px;
  height: 6px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.detail-title-input {
  width: 100%;
  padding: 2px 0 6px;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font-size: 1.28rem;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.3;
  outline: none;
  transition: border-color 0.15s ease;
}

.detail-title-input:focus {
  border-bottom-color: var(--border);
}

.detail-complete-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.84rem;
  font-weight: 540;
  text-align: left;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.detail-complete-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
}

.detail-complete-row .task-check {
  margin-top: 0;
}

.detail-complete-row.is-complete {
  color: var(--muted);
}

.detail-chip-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 33px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 560;
  transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

.chip-toggle .icon {
  width: 15px;
  height: 15px;
  transition: transform 0.18s ease;
}

.chip-toggle:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.chip-toggle:active {
  transform: scale(0.97);
}

.chip-toggle:hover .icon {
  transform: scale(1.08);
}

.chip-toggle.important.active {
  border-color: rgba(245, 166, 35, 0.3);
  background: rgba(245, 166, 35, 0.12);
  color: #b9770a;
}

html[data-theme="dark"] .chip-toggle.important.active {
  color: var(--star);
}

.chip-toggle.important.active .icon {
  fill: currentColor;
}

.chip-toggle.myday.active {
  border-color: var(--accent-soft);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.chip-toggle.focus-chip {
  margin-left: auto;
}

.detail-section {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.detail-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted-2);
  font-size: 0.66rem;
  font-weight: 720;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.detail-label .icon {
  width: 13px;
  height: 13px;
}

.detail-field-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.control {
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.84rem;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.control:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.control.grow {
  flex: 1;
  min-width: 0;
}

.quick-presets {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.chip-btn {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 550;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.16s ease, box-shadow 0.18s ease;
}

.chip-btn:hover {
  border-color: var(--border-strong);
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.chip-btn:active {
  transform: scale(0.96);
}

.reminder-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-soft);
  font-size: 0.77rem;
  cursor: pointer;
}

.reminder-row input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

.notes-area {
  width: 100%;
  min-height: 92px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.83rem;
  line-height: 1.55;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.notes-area:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.steps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.steps-progress {
  color: var(--muted);
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.steps-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 4px;
  border-radius: 7px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
}

.step-item:hover {
  background: var(--surface-hover);
}

.step-item.dragging {
  opacity: 0.4;
}

.step-item.drop-before {
  box-shadow: inset 0 2px 0 var(--accent);
}

.step-item.drop-after {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.step-grip {
  display: grid;
  place-items: center;
  width: 14px;
  height: 20px;
  color: var(--muted-2);
  cursor: grab;
  flex: none;
}

.step-grip .icon {
  width: 13px;
  height: 13px;
}

.step-check {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.step-check .icon {
  width: 11px;
  height: 11px;
  stroke-width: 2.6;
}

.step-check:hover {
  border-color: var(--accent);
}

.step-item.completed .step-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

html[data-theme="dark"] .step-item.completed .step-check {
  color: #0e1222;
}

.step-title {
  flex: 1;
  min-width: 0;
  color: var(--text-soft);
  font-size: 0.81rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.step-item.completed .step-title {
  color: var(--muted);
  text-decoration: line-through;
}

.step-delete {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 5px;
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.step-item:hover .step-delete,
.step-delete:focus-visible {
  opacity: 1;
}

.step-delete:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

.step-delete .icon {
  width: 13px;
  height: 13px;
}

.step-empty {
  padding: 3px 2px;
  color: var(--muted-2);
  font-size: 0.77rem;
}

.step-add {
  display: flex;
  gap: 5px;
  margin-top: 3px;
}

.step-add .control {
  flex: 1;
  min-width: 0;
  height: 32px;
}

.step-add .icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.detail-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.detail-tag {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 0.71rem;
  font-weight: 600;
}

button.detail-tag {
  transition: background-color 0.15s ease;
}

button.detail-tag:hover {
  background: rgba(91, 108, 255, 0.18);
}

html[data-theme="dark"] button.detail-tag:hover {
  background: rgba(124, 140, 255, 0.22);
}

.detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 0.68rem;
}

.detail-foot .btn {
  height: 30px;
}

/* --------------------------------------------------------------------------
   Modals
   -------------------------------------------------------------------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 9, 15, 0.52);
  backdrop-filter: blur(3px);
  animation: fadeIn 0.18s ease;
}

.modal-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(520px, 100%);
  max-height: min(88dvh, 920px);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.modal.wide .modal-card {
  width: min(780px, 100%);
}

.modal-card.small {
  width: min(430px, 100%);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px 0;
}

.modal-head h2 {
  font-size: 1.14rem;
  font-weight: 720;
  letter-spacing: -0.025em;
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.5;
  max-width: 560px;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 17px 22px;
  overflow-y: auto;
}

.modal-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 14px 22px calc(15px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-soft);
  font-size: 0.76rem;
  font-weight: 620;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 400;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input,
.field select {
  height: 38px;
  padding: 0 10px;
}

.field textarea {
  min-height: 120px;
  padding: 9px 11px;
  line-height: 1.55;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.field.inline {
  flex: 1;
  min-width: 170px;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.6rem;
  font-weight: 720;
  letter-spacing: 0.05em;
}

.emoji-picker {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 5px;
}

.emoji-btn {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 1.05rem;
  line-height: 1;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.emoji-btn:hover {
  background: var(--surface-hover);
  transform: scale(1.06);
}

.emoji-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.color-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 2px 0;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  transition: transform 0.12s ease, outline-color 0.12s ease;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.active {
  outline: 2px solid var(--text-soft);
  outline-offset: 2px;
}

/* Tabs */

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  flex-wrap: wrap;
}

.tab {
  flex: 1;
  min-width: 118px;
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.tab:hover {
  color: var(--text-soft);
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

/* Dropzone & preview */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 18px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-l);
  background: var(--surface-2);
  text-align: center;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dropzone-icon {
  width: 27px;
  height: 27px;
  color: var(--muted);
}

.dropzone-text {
  color: var(--muted);
  font-size: 0.79rem;
}

.dropzone-file {
  min-height: 1em;
  color: var(--accent-strong);
  font-size: 0.71rem;
  font-weight: 600;
}

.file-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.migrate-preview {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.79rem;
}

.preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 620;
  flex-wrap: wrap;
}

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 190px;
  overflow-y: auto;
}

.preview-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.preview-item .icon {
  width: 12px;
  height: 12px;
  color: var(--success);
}

.preview-item.completed {
  color: var(--muted);
}

.preview-item.completed .preview-title {
  text-decoration: line-through;
}

.preview-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-empty {
  color: var(--muted);
  font-size: 0.79rem;
  line-height: 1.55;
}

.preview-error {
  color: var(--danger);
  font-size: 0.79rem;
  line-height: 1.5;
}

.preview-list-name {
  font-weight: 640;
}

.preview-more {
  color: var(--muted-2);
  font-size: 0.71rem;
}

.migrate-target {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Share */

.share-section {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--border);
}

.share-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.share-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.share-section-head h3 {
  font-size: 0.9rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.copy-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.copy-row input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.7rem;
  outline: none;
}

.copy-row input:focus {
  border-color: var(--accent);
  box-shadow: var(--ring);
}

.copy-row .icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.share-link-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
  background: var(--muted-2);
  box-shadow: 0 0 0 3px var(--surface-2);
}

.status-dot.ok {
  background: var(--success);
}

.status-dot.off {
  background: var(--warning);
}

.status-dot.checking {
  background: var(--muted);
  animation: pulse 1.2s ease-in-out infinite;
}

.share-room {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.room-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
}

.room-code {
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 0.86rem;
  font-weight: 760;
  letter-spacing: 0.12em;
}

.room-box .copy-row {
  flex: 1;
  min-width: 180px;
}

/* Settings */

.settings-body {
  gap: 21px;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 19px;
  border-bottom: 1px solid var(--border);
}

.settings-group:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.settings-group h3 {
  color: var(--muted-2);
  font-size: 0.68rem;
  font-weight: 730;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.85rem;
  flex-wrap: wrap;
}

.setting-row p {
  margin-top: 2px;
}

.setting-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.segmented {
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-2);
}

.segmented button {
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.segmented button:hover {
  color: var(--text-soft);
}

.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 40px;
  height: 23px;
  flex: none;
  cursor: pointer;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--border-strong);
  transition: background-color 0.2s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track::after {
  transform: translateX(17px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.export-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 13px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 600;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.export-btn .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.export-btn:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.export-btn:hover .icon {
  color: var(--accent-strong);
}

.shortcuts {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.shortcuts > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.79rem;
}

.shortcuts dt {
  display: flex;
  gap: 4px;
}

.shortcuts dd {
  color: var(--muted);
}

.about {
  gap: 5px;
}

.confirm-body {
  color: var(--text-soft);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Command palette
   -------------------------------------------------------------------------- */

.palette-modal {
  align-items: flex-start;
  padding-top: 9vh;
}

.palette {
  position: relative;
  width: min(620px, 100%);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.palette-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--border);
}

.palette-input-row > .icon {
  width: 19px;
  height: 19px;
  color: var(--muted);
}

.palette-input-row input {
  flex: 1;
  min-width: 0;
  height: 30px;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.98rem;
}

.palette-input-row input::placeholder {
  color: var(--muted-2);
}

.palette-results {
  max-height: min(420px, 58vh);
  padding: 5px;
  overflow-y: auto;
}

.palette-group-title {
  padding: 8px 10px 4px;
  color: var(--muted-2);
  font-size: 0.62rem;
  font-weight: 720;
  letter-spacing: 0.085em;
  text-transform: uppercase;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-soft);
  text-align: left;
  transition: background-color 0.1s ease;
}

.palette-item > .icon {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.palette-item.active {
  background: var(--accent-soft);
  color: var(--text);
}

.palette-item.active > .icon {
  color: var(--accent-strong);
}

.palette-item-main {
  flex: 1;
  min-width: 0;
}

.palette-item-title {
  overflow: hidden;
  font-size: 0.84rem;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-item-sub {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.palette-item-kbd {
  flex: none;
}

.palette-empty {
  padding: 28px 16px;
  color: var(--muted);
  font-size: 0.83rem;
  text-align: center;
}

.palette-foot {
  padding: 8px 15px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted-2);
  font-size: 0.67rem;
}

/* Shared list preview */

.shared-preview {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface-2);
}

.shared-list-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 660;
}

.shared-counts {
  color: var(--muted);
  font-size: 0.73rem;
}

.shared-tasks {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 170px;
  overflow-y: auto;
}

.shared-task {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.shared-task .icon {
  width: 12px;
  height: 12px;
  color: var(--success);
}

.shared-task.completed {
  color: var(--muted);
  text-decoration: line-through;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toasts {
  position: fixed;
  bottom: calc(22px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 130;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(430px, calc(100vw - 24px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  background: var(--toast-bg);
  color: var(--toast-text);
  box-shadow: var(--shadow-lg);
  font-size: 0.8rem;
  pointer-events: auto;
  animation: toastIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.toast > .icon {
  width: 17px;
  height: 17px;
  flex: none;
  color: #aab5ff;
}

.toast-msg {
  flex: 1;
  min-width: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.toast-action {
  flex: none;
  padding: 3px 7px;
  border-radius: 5px;
  color: #bcc5ff;
  font-size: 0.74rem;
  font-weight: 650;
  transition: background-color 0.15s ease;
}

.toast-action:hover {
  background: rgba(255, 255, 255, 0.1);
}

.toast-close {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 5px;
  color: rgba(255, 255, 255, 0.55);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.toast-close .icon {
  width: 13px;
  height: 13px;
}

.toast.leaving {
  animation: toastOut 0.2s ease forwards;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}

@keyframes checkPop {
  0% { transform: scale(0.8); }
  60% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* --------------------------------------------------------------------------
   Scrollbars
   -------------------------------------------------------------------------- */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 99px;
  background: var(--border-strong);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-2);
  background-clip: padding-box;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 80;
    width: min(360px, 88vw);
    height: 100dvh;
    border-right: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    transform: translateX(-104%);
    transition: transform 0.26s cubic-bezier(0.2, 0.9, 0.3, 1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-close {
    display: grid !important;
  }

  .sidebar-overlay {
    z-index: 75;
  }

  .topbar {
    height: 58px;
    padding: 0 16px;
  }

  .main {
    padding: 4px 18px 140px;
  }

  .view-header {
    padding-top: 15px;
  }

  .detail-panel {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 90;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: 92dvh;
    border-top: 1px solid var(--border);
    border-left: 0;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -24px 70px rgba(12, 16, 28, 0.28);
    transform: translateY(103%);
  }

  .detail-panel.open {
    transform: translateY(0);
  }

  .detail-panel::before {
    content: "";
    width: 38px;
    height: 4px;
    margin: 8px auto 0;
    border-radius: 99px;
    background: var(--border-strong);
    flex: none;
  }

  .detail-content {
    padding-top: 12px;
    max-height: calc(92dvh - 16px);
  }

  #detail-overlay {
    z-index: 85;
  }

  .bottom-nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: calc(62px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--border);
    background: var(--surface);
    box-shadow: 0 -8px 30px rgba(12, 16, 28, 0.08);
  }

  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--muted);
    font-size: 0.62rem;
    font-weight: 560;
    transition: color 0.15s ease;
  }

  .bottom-nav-item .icon {
    width: 20px;
    height: 20px;
  }

  .bottom-nav-item.active {
    color: var(--accent-strong);
  }

  .fab {
    position: fixed;
    right: 18px;
    bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 55;
    display: grid !important;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 16px;
    background: var(--accent);
    color: #fff;
    box-shadow: 0 10px 28px rgba(91, 108, 255, 0.42);
    transition: transform 0.12s ease, background-color 0.15s ease;
  }

  html[data-theme="dark"] .fab {
    color: #0e1222;
  }

  .fab:hover {
    background: var(--accent-strong);
  }

  .fab:active {
    transform: scale(0.94);
  }

  .fab .icon {
    width: 23px;
    height: 23px;
  }

  .toasts {
    bottom: calc(90px + env(safe-area-inset-bottom));
  }
}

@media (min-width: 1025px) {
  .topbar {
    position: relative;
    justify-content: center;
  }

  .topbar-actions {
    position: absolute;
    top: 50%;
    right: 30px;
    margin-left: 0;
    transform: translateY(-50%);
  }

  .main-col {
    margin-left: var(--rail-w);
    transition: margin-left 0.24s cubic-bezier(0.2, 0.9, 0.3, 1);
  }

  .app:has(.sidebar:is(:hover, .open)) .main-col {
    margin-left: var(--rail-expanded-w);
  }

  #menu-btn {
    display: none;
  }

  .sidebar {
    width: var(--rail-w);
    padding: 18px 10px 14px;
    transform: none;
    box-shadow: 6px 0 24px rgba(12, 16, 28, 0.06);
    transition: width 0.22s ease, padding 0.22s ease, box-shadow 0.22s ease;
  }

  .sidebar .brand-row {
    justify-content: center;
    padding: 0 0 18px;
  }

  .sidebar .brand {
    justify-content: center;
    gap: 0;
  }

  .sidebar .brand-mark {
    width: 40px;
    height: 40px;
  }

  .sidebar .smart-nav {
    gap: 4px;
  }

  .sidebar .nav-item {
    justify-content: center;
    gap: 0;
    padding: 12px 0;
  }

  .sidebar .nav-icon {
    width: 30px;
    height: 30px;
  }

  .sidebar .nav-icon .icon {
    width: 24px;
    height: 24px;
  }

  .sidebar .lists-heading {
    justify-content: center;
    padding: 0 0 8px;
  }

  .sidebar .custom-lists {
    padding: 1px 0 8px;
  }

  .sidebar .list-item {
    justify-content: center;
    gap: 0;
    padding: 11px 0;
  }

  .sidebar .list-emoji {
    width: 30px;
    font-size: 1.3rem;
  }

  .sidebar .side-action {
    justify-content: center;
    gap: 0;
    padding: 12px 0;
  }

  .sidebar .side-action-icon .icon {
    width: 21px;
    height: 21px;
  }

  .sidebar .brand-name,
  .sidebar .nav-label,
  .sidebar .nav-count,
  .sidebar .lists-heading > span,
  .sidebar .list-name,
  .sidebar .list-count,
  .sidebar .list-more,
  .sidebar .list-dot,
  .sidebar .side-action-label,
  .sidebar .side-action-badge,
  .sidebar .sidebar-note {
    display: none;
  }

  .sidebar .sidebar-close {
    display: none !important;
  }

  .sidebar .nav-label,
  .sidebar .side-action-label {
    white-space: nowrap;
  }

  .sidebar:is(:hover, .open) {
    width: var(--rail-expanded-w);
    padding: 20px 16px 14px;
    box-shadow: var(--shadow-lg);
  }

  .sidebar:is(:hover, .open) .brand-row {
    justify-content: space-between;
    padding: 0 6px 18px;
  }

  .sidebar:is(:hover, .open) .brand {
    justify-content: flex-start;
    gap: 10px;
  }

  .sidebar:is(:hover, .open) .brand-mark {
    width: 38px;
    height: 38px;
  }

  .sidebar:is(:hover, .open) .brand-name {
    display: inline;
  }

  .sidebar:is(:hover, .open) .nav-item {
    justify-content: flex-start;
    gap: 13px;
    padding: 11px 12px;
  }

  .sidebar:is(:hover, .open) .nav-icon {
    width: 27px;
    height: 27px;
  }

  .sidebar:is(:hover, .open) .nav-icon .icon {
    width: 22px;
    height: 22px;
  }

  .sidebar:is(:hover, .open) .nav-label {
    display: inline;
  }

  .sidebar:is(:hover, .open) .nav-count {
    display: inline-block;
  }

  .sidebar:is(:hover, .open) .lists-heading {
    justify-content: space-between;
    padding: 0 8px 6px;
  }

  .sidebar:is(:hover, .open) .lists-heading > span {
    display: inline;
  }

  .sidebar:is(:hover, .open) .custom-lists {
    padding: 1px 2px 8px;
  }

  .sidebar:is(:hover, .open) .list-item {
    justify-content: flex-start;
    gap: 10px;
    padding: 9px 10px;
  }

  .sidebar:is(:hover, .open) .list-dot {
    display: block;
  }

  .sidebar:is(:hover, .open) .list-emoji {
    width: 24px;
    font-size: 1.12rem;
  }

  .sidebar:is(:hover, .open) .list-name {
    display: block;
  }

  .sidebar:is(:hover, .open) .list-count {
    display: inline;
  }

  .sidebar:is(:hover, .open) .list-more {
    display: grid;
  }

  .sidebar:is(:hover, .open) .side-action {
    justify-content: flex-start;
    gap: 11px;
    padding: 10px 12px;
  }

  .sidebar:is(:hover, .open) .side-action-icon .icon {
    width: 19px;
    height: 19px;
  }

  .sidebar:is(:hover, .open) .side-action-label {
    display: block;
  }

  .sidebar:is(:hover, .open) .side-action-badge {
    display: inline-block;
  }

  .sidebar:is(:hover, .open) .sidebar-note {
    display: flex;
  }

  .sidebar:is(:hover, .open) .sidebar-close {
    display: grid !important;
  }
}

@media (max-width: 760px) {
  .topbar {
    gap: 8px;
    padding: 0 13px;
  }

  .search-trigger {
    flex: 1;
    width: auto;
    max-width: none;
  }

  .search-trigger kbd {
    display: none;
  }

  #undo-btn,
  #redo-btn {
    display: none;
  }

  .topbar-actions {
    gap: 2px;
  }

  .lang-switch {
    margin: 0 1px;
  }

  .lang-btn {
    padding: 4px 6px;
  }

  #settings-btn-top {
    display: none;
  }

  .main {
    padding: 2px 15px 142px;
  }

  .view-title {
    font-size: 1.45rem;
  }

  .view-icon {
    width: 39px;
    height: 39px;
    border-radius: 11px;
  }

  .view-icon .icon {
    width: 20px;
    height: 20px;
  }

  .view-actions .btn .btn-label {
    display: none;
  }

  .view-actions .btn {
    width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 9px;
  }

  .view-actions .btn .icon {
    width: 17px;
    height: 17px;
  }

  .view-actions {
    gap: 5px;
  }

  .focus-card {
    gap: 18px;
    padding: 18px;
  }

  .focus-ring {
    width: clamp(160px, 32vw, 200px);
    height: clamp(160px, 32vw, 200px);
  }

  .focus-time {
    font-size: clamp(2.4rem, 7.5vw, 3.4rem);
  }

  .demo-banner {
    flex-wrap: wrap;
    gap: 8px;
  }

  .demo-banner p {
    flex-basis: calc(100% - 46px);
  }

  .demo-banner-actions {
    margin-left: 41px;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    max-height: 92dvh;
    border-radius: 17px;
  }

  .modal-head {
    padding: 17px 16px 0;
  }

  .modal-body {
    padding: 14px 16px;
  }

  .modal-foot {
    padding: 12px 16px calc(13px + env(safe-area-inset-bottom));
  }

  .emoji-picker {
    grid-template-columns: repeat(6, 1fr);
  }

  .export-grid {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .palette-modal {
    padding: 8px;
    padding-top: 6vh;
  }

  .task {
    padding: 10px 8px 10px 10px;
  }

  .task-title {
    font-size: 0.88rem;
  }

  .task-meta {
    gap: 4px;
  }

  .toasts {
    width: calc(100vw - 20px);
  }

  .view-title-row {
    gap: 10px;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 0 11px;
  }

  .search-trigger-label {
    display: none;
  }

  .search-trigger {
    flex: none;
    width: 38px;
    padding: 0;
    justify-content: center;
  }

  .topbar-actions {
    margin-left: auto;
  }

  .main {
    padding: 2px 12px 142px;
  }

  .view-header {
    padding-bottom: 10px;
  }

  .view-title {
    font-size: 1.3rem;
  }

  .view-subtitle {
    font-size: 0.75rem;
  }

  .view-title-row {
    align-items: flex-start;
  }

  .view-actions {
    margin-left: auto;
  }

  .composer-list {
    max-width: 105px;
  }

  .composer {
    padding-left: 10px;
  }

  .composer-input {
    font-size: 0.85rem;
  }

  .focus-card {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 18px;
    padding: 20px 16px;
    text-align: center;
  }

  .focus-ring {
    width: clamp(160px, 52vw, 210px);
    height: clamp(160px, 52vw, 210px);
  }

  .focus-time {
    font-size: clamp(2.4rem, 10vw, 3.4rem);
  }

  .focus-info {
    align-items: center;
    width: 100%;
  }

  .focus-mode,
  .focus-task-line {
    justify-content: center;
  }

  .focus-select {
    width: min(100%, 360px);
  }

  .focus-controls {
    justify-content: center;
  }

  .focus-hint {
    text-align: center;
  }

  .group {
    margin-bottom: 19px;
  }

  .empty {
    padding: 42px 14px;
  }

  .detail-content {
    padding: 10px 14px calc(24px + env(safe-area-inset-bottom));
    gap: 15px;
  }

  .detail-title-input {
    font-size: 1.16rem;
  }

  .detail-field-row {
    gap: 5px;
  }

  .control {
    font-size: 0.76rem;
  }

  .detail-foot {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-foot .btn {
    flex: 1;
  }

  .modal-foot .spacer {
    display: none;
  }

  .modal-foot {
    gap: 6px;
  }

  .shortcuts > div {
    font-size: 0.75rem;
  }

  .copy-row {
    flex-wrap: wrap;
  }

  .copy-row input {
    flex-basis: calc(100% - 42px);
  }

  .copy-row .btn.primary {
    flex: 1;
  }

  .share-link-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .migrate-target {
    flex-direction: column;
  }

  .field.inline {
    min-width: 100%;
  }
}

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