:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-translucent: rgba(255, 255, 255, 0.78);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --accent: #0a84ff;
  --danger: #ff3b30;
  --border: #e5e5ea;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-translucent: rgba(28, 28, 30, 0.78);
    --text: #f5f5f7;
    --text-muted: #98989d;
    --danger: #ff453a;
    --border: #38383a;
  }
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #1c1c1e;
  --surface-translucent: rgba(28, 28, 30, 0.78);
  --text: #f5f5f7;
  --text-muted: #98989d;
  --danger: #ff453a;
  --border: #38383a;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}

.screen {
  max-width: 480px;
  margin: 0 auto;
  padding: 32px 20px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.card-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  background: var(--surface);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}

button.primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

button.primary:active {
  opacity: 0.85;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
}

.status {
  margin-top: 12px;
  font-size: 14px;
  min-height: 20px;
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: #30a46c;
}

/* Board */

.board-screen {
  padding: 24px 20px 100px;
}

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.board-header h1 {
  margin-bottom: 0;
}

.archive-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 14px;
  cursor: pointer;
  padding: 0;
}

.icon-button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: color 0.2s ease;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  display: block;
}

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

.board-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.column {
  background: var(--surface);
  border-radius: 16px;
  padding: 14px;
  width: 280px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  border: 2px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.column.drag-over {
  border-color: var(--accent);
  background: var(--accent-soft, rgba(10, 132, 255, 0.08));
}

.dragging-source {
  opacity: 0.35;
}

.task-card-ghost {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  transform: rotate(-2deg) scale(1.03);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  opacity: 0.95;
}

.column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.column-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.column h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-count {
  flex: 0 0 auto;
  background: var(--bg);
  color: var(--text-muted);
  border-radius: 999px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
}

.column-add {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.column-add:hover {
  background: var(--accent);
  color: #fff;
}

@media (max-width: 640px) {
  .column {
    width: 100%;
  }
}

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

.task-card {
  position: relative;
  padding: 0;
  box-shadow: none;
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
}

.task-card.done {
  opacity: 0.55;
}

.task-swipe-action {
  position: absolute;
  inset: 0;
  left: auto;
  width: 72px;
  background: var(--danger);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.task-card-inner {
  position: relative;
  padding: 10px 12px;
  cursor: pointer;
  background: hsl(var(--cat-hue, 210), 45%, 97%);
  border-left: 3px solid hsl(var(--cat-hue, 210), 55%, 62%);
  touch-action: pan-y;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .task-card-inner {
    background: hsl(var(--cat-hue, 210), 20%, 16%);
  }
}

:root[data-theme='dark'] .task-card-inner {
  background: hsl(var(--cat-hue, 210), 20%, 16%);
}

.task-card.done .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

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

.task-check {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin: -4px 0;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.task-check::after {
  content: '✓';
  font-size: 15px;
  line-height: 1;
  color: var(--accent);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.task-card.done .task-check {
  border-color: var(--accent);
}

.task-card.done .task-check::after {
  opacity: 1;
  transform: scale(1);
}

/* Отметката се вижда постоянно, но бледо на незавършени задачи; пълна видимост
   само при hover на устройства с мишка — на тъч устройства няма hover, затова
   остава леко видима без да е нужен допир. */
@media (hover: hover) and (pointer: fine) {
  .task-check {
    opacity: 0;
  }
  .task-card:hover .task-check,
  .task-card.done .task-check {
    opacity: 1;
  }
}

@media (hover: none) {
  .task-check {
    opacity: 0.4;
  }
  .task-card.done .task-check {
    opacity: 1;
  }
}

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

.task-title {
  font-size: 14px;
  margin-bottom: 4px;
}

.task-card.done .task-meta {
  display: none;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.task-expand {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}

.task-card.expanded .task-expand {
  max-height: 360px;
  opacity: 1;
}

.task-expand-inner {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.task-expand-details {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  margin: 0 0 10px;
  white-space: pre-line;
}

.task-expand-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.task-edit-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.task-edit-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.done-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2px 0 6px;
}

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

.due-soon {
  color: #ff9500;
}

.priority {
  font-size: 10px;
}

.priority-high {
  color: var(--danger);
}

.priority-medium {
  color: #ff9500;
}

.priority-low {
  color: var(--text-muted);
}

.empty-hint {
  color: var(--text-muted);
  font-size: 14px;
}

.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: rgba(10, 132, 255, 0.88);
  backdrop-filter: blur(12px) saturate(180%);
  -webkit-backdrop-filter: blur(12px) saturate(180%);
  color: #fff;
  font-size: 34px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 5;
}

.fab.open {
  transform: rotate(45deg);
}

/* Chat */

.chat-overlay {
  position: fixed;
  right: 24px;
  bottom: 96px;
  width: min(360px, calc(100vw - 48px));
  height: min(520px, calc(100vh - 140px));
  border-radius: 20px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  z-index: 25;
  animation: chat-pop-in 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chat-pop-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-overlay {
    animation: none;
  }
}

.chat-panel {
  background: var(--surface-translucent);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  width: 100%;
  height: 100%;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 85%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
}

.chat-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
}

.chat-msg-ai,
.chat-msg-ai-loading,
.chat-msg-ai-error {
  align-self: flex-start;
  background: var(--bg);
  color: var(--text);
}

.chat-msg-ai-error {
  color: var(--danger);
}

.proposal-list {
  margin: 8px 0;
  padding-left: 18px;
}

.proposal-due {
  color: var(--text-muted);
  font-size: 12px;
}

.chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  resize: none;
  height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}

.chat-send {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.chat-send:active {
  transform: scale(0.94);
}

.chat-send:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-attach-btn {
  flex: 0 0 auto;
  align-self: flex-end;
}

.chat-file-input {
  display: none;
}

.chat-attachment {
  margin: 0 16px 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-attachment-error {
  color: var(--danger);
}

.chat-attachment-ready .chat-attachment-name {
  color: var(--text);
}

.chat-attachment-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.chat-msg-attachment {
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.85;
}

/* Task panel + manual form */

.task-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  z-index: 25;
  animation: overlay-pop-in 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes overlay-pop-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .task-overlay {
    animation: none;
  }
}

.task-panel {
  background: var(--surface-translucent);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.task-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

.task-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.task-panel-body {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.task-panel-body label {
  margin-bottom: 14px;
}

.f-new-category {
  margin-bottom: 14px;
}

.task-panel-body input,
.task-panel-body select,
.task-panel-body textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}

.task-panel-body textarea {
  resize: vertical;
  min-height: 60px;
}

.quick-chips {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.chip {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.task-excerpt {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}

.task-done-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
}

.task-done-row input {
  width: auto;
  margin: 0;
}

.task-panel-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 14px;
}

.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: hsl(var(--cat-hue, 210), 65%, 55%);
  cursor: pointer;
  padding: 0;
}

.color-swatch.active {
  border-color: var(--text);
  box-shadow: 0 0 0 2px var(--surface);
}

.color-swatch-auto {
  width: auto;
  height: 32px;
  border-radius: 999px;
  padding: 0 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.color-swatch-auto.active {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: none;
}

.priority-buttons {
  display: flex;
  gap: 8px;
  margin: 6px 0 14px;
}

.priority-btn {
  flex: 1;
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.priority-btn-high.active {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.priority-btn-medium.active {
  background: #ff9500;
  border-color: #ff9500;
  color: #fff;
}

.priority-btn-low.active {
  background: var(--text-muted);
  border-color: var(--text-muted);
  color: #fff;
}

button.danger {
  background: none;
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* Undo toast */

.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #2c2c2e;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 26;
}

.undo-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

/* Offline + sync */

.offline-banner {
  background: #ff9500;
  color: #fff;
  text-align: center;
  font-size: 13px;
  padding: 6px 12px;
}

button.secondary {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  cursor: pointer;
}

.conflict-table {
  background: var(--bg);
  border-radius: 10px;
  overflow: hidden;
  margin-top: 4px;
}

.conflict-row {
  display: grid;
  grid-template-columns: 82px 1fr 1fr;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}

.conflict-row:last-child {
  border-bottom: none;
}

.conflict-row-header {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}

.conflict-row-label {
  color: var(--text-muted);
  font-size: 12px;
}

.conflict-row-value {
  overflow-wrap: break-word;
}

.conflict-row-diff .conflict-row-value {
  color: var(--accent);
  font-weight: 600;
}

.conflict-footer {
  display: flex;
  gap: 10px;
}

.conflict-footer button {
  flex: 1;
}

/* Settings menu */

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

.theme-options {
  display: flex;
  gap: 8px;
}

.theme-option {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.theme-option.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.settings-section-spacer {
  margin-top: 22px;
}

.font-scale-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.font-scale-row button {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.font-scale-row button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.font-scale-value {
  font-size: 14px;
  color: var(--text-muted);
  min-width: 44px;
  text-align: center;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.toggle-row > span:first-child {
  font-size: 14px;
  color: var(--text);
  display: block;
}

.toggle-row .hint {
  display: block;
  margin-top: 2px;
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 26px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}

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

.switch-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
}

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

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

/* Уважаваме system настройката за намалено движение: кратки cross-fade-ове
   вместо плъзгане/пружини/завъртане. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* App shell + sidebar */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.main-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 0;
}

.top-bar-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.top-bar .header-actions {
  flex: 0 0 auto;
}

.menu-toggle {
  display: flex;
  flex: 0 0 auto;
}

.board-area {
  flex: 1;
  min-width: 0;
}

.sidebar-container {
  flex: 0 0 auto;
}

.sidebar-container.desktop-collapsed {
  display: none;
}

.sidebar-overlay-backdrop {
  display: none;
}

.sidebar {
  width: 240px;
  height: 100vh;
  position: sticky;
  top: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  box-sizing: border-box;
  overflow-y: auto;
}

.sidebar-top {
  display: none;
}

.sidebar-section {
  margin-bottom: 26px;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding: 0 10px;
}

.sidebar-category-add {
  background: var(--bg);
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  margin-top: 4px;
}

.sidebar-category-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

.sidebar-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  margin-bottom: 2px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-item:hover {
  background: var(--bg);
}

.sidebar-category-row {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 2px;
}

.sidebar-category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex: 1;
  min-width: 0;
  width: auto;
  margin-bottom: 0;
  background: hsl(var(--cat-hue, 210), 70%, 93%);
  border-left: 3px solid hsl(var(--cat-hue, 210), 55%, 62%);
  border-radius: 6px;
}

.sidebar-category-edit {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.sidebar-category-row:hover .sidebar-category-edit,
.sidebar-category-edit:focus-visible {
  opacity: 1;
}

.sidebar-category-edit:hover {
  background: var(--bg);
  color: var(--accent);
}

@media (hover: none) {
  .sidebar-category-edit {
    opacity: 0.6;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .sidebar-category-item {
    background: hsl(var(--cat-hue, 210), 32%, 20%);
  }
}

:root[data-theme='dark'] .sidebar-category-item {
  background: hsl(var(--cat-hue, 210), 32%, 20%);
}

.sidebar-category-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-category-count {
  flex: 0 0 auto;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
}

.sidebar-item.active {
  background: var(--accent);
  border-left-color: transparent;
  color: #fff;
}

.sidebar-item.active .sidebar-category-count {
  background: rgba(255, 255, 255, 0.25);
}

.sidebar-empty-hint {
  padding: 0 10px;
  margin: 0;
}

.task-category-tag {
  background: var(--bg);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 11px;
}

.date-view-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 480px;
}

.all-view-controls {
  display: flex;
  justify-content: flex-end;
  max-width: 480px;
  margin-bottom: 12px;
}

.all-sort-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.all-sort {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

.all-view-group {
  max-width: 480px;
  margin-bottom: 20px;
}

.all-view-group .cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.all-view-group-header {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  background: hsl(var(--cat-hue, 210), 70%, 93%);
  color: hsl(var(--cat-hue, 210), 55%, 30%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .all-view-group-header {
    background: hsl(var(--cat-hue, 210), 32%, 20%);
    color: hsl(var(--cat-hue, 210), 60%, 82%);
  }
}

:root[data-theme='dark'] .all-view-group-header {
  background: hsl(var(--cat-hue, 210), 32%, 20%);
  color: hsl(var(--cat-hue, 210), 60%, 82%);
}

@media (max-width: 900px) {
  .menu-toggle {
    display: flex;
  }

  .sidebar-container {
    display: none;
  }

  .sidebar-container.mobile-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 15;
  }

  .sidebar-container.mobile-open .sidebar-overlay-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    animation: overlay-fade-in 0.2s ease;
  }

  .sidebar-container.mobile-open .sidebar {
    animation: sidebar-slide-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

  @keyframes sidebar-slide-in {
    from {
      transform: translateX(-100%);
    }
    to {
      transform: translateX(0);
    }
  }

  @keyframes overlay-fade-in {
    from {
      opacity: 0;
    }
    to {
      opacity: 1;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    .sidebar-container.mobile-open .sidebar-overlay-backdrop,
    .sidebar-container.mobile-open .sidebar {
      animation: none;
    }
  }

  .sidebar {
    position: relative;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
  }

  .sidebar-title {
    font-weight: 700;
    font-size: 18px;
    letter-spacing: -0.02em;
  }

  .sidebar-close {
    font-size: 28px;
    line-height: 1;
  }

  .top-bar-title {
    font-size: 22px;
  }
}
