/* ═══════════════════════════════════════════════════════
   Transparenty — Claude-style White-Brown Card Design
   Design: Warm minimal + Clean card layout
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Base ──────────────────────────────────── */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #FAF9F6;
  --bg-sidebar: #F5F0EB;
  --bg-card: #FFFFFF;
  --bg-hover: #F5F0EB;
  --bg-active: #EDE7DF;
  --bg-input: #FFFFFF;
  --bg-table-header: #F5F0EB;

  --border: #E0D5C8;
  --border-light: #EDE7DF;

  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;

  --text-primary: #3D3029;
  --text-secondary: #7A6B5D;
  --text-muted: #A89888;

  --accent: #C4956A;
  --accent-hover: #B8860B;
  --accent-light: rgba(196, 149, 106, 0.1);
  --accent-text: #FFFFFF;

  --danger: #D98080;
  --warning: #D4A54A;
  --success: #7AB87A;

  --shadow: 0 2px 12px rgba(139, 109, 82, 0.08);
  --shadow-sm: 0 1px 4px rgba(139, 109, 82, 0.06);
  --shadow-lg: 0 4px 24px rgba(139, 109, 82, 0.1);

  --sidebar-width: 280px;
  --ai-panel-width: 340px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ── Dark Mode ─────────────────────────────────────── */

[data-theme="dark"] {
  --bg: #1A1715;
  --bg-sidebar: #211E1A;
  --bg-card: #2A2520;
  --bg-hover: #332E28;
  --bg-active: #3D3630;
  --bg-input: #2A2520;
  --bg-table-header: #2A2520;

  --border: #3D3630;
  --border-light: #332E28;

  --text-primary: #E8E0D8;
  --text-secondary: #A89888;
  --text-muted: #7A6B5D;

  --accent: #D4A574;
  --accent-hover: #C4956A;
  --accent-light: rgba(212, 165, 116, 0.12);
  --accent-text: #1A1715;

  --danger: #D98080;
  --warning: #D4A54A;
  --success: #7AB87A;

  --shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.25);
}

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── PIN Overlay ───────────────────────────────────── */

.pin-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 9999;
}

.pin-card {
  text-align: center;
  padding: 48px 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 360px;
  max-width: 90vw;
  animation: modalIn 0.3s ease-out;
}

.pin-logo {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.pin-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.pin-form {
  display: flex;
  gap: 8px;
}

.pin-input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 4px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.2s;
}

.pin-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.15);
}

.pin-submit {
  padding: 12px 24px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.pin-submit:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.pin-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.pin-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--danger);
}

/* ── Card Style (replaces .glass) ─────────────────── */

.glass {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ── Layout ────────────────────────────────────────── */

.app {
  display: flex;
  height: 100vh;
  position: relative;
}

/* ── Sidebar ───────────────────────────────────────── */

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  gap: 20px;
  border-radius: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  border-top: none;
  border-bottom: none;
  border-left: none;
  box-shadow: none;
  overflow-y: auto;
}

.logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
}

/* Date Navigation */

.date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-date {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text-primary);
}

/* View Navigation */

.view-nav {
  display: flex;
  gap: 4px;
  background: var(--bg-active);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.view-btn {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.view-btn:hover {
  color: var(--text-primary);
  background: rgba(196, 149, 106, 0.08);
}

.view-btn.active {
  color: var(--accent-text);
  background: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* Categories */

.categories-section h3,
.sidebar-stats h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.category-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  cursor: default;
  transition: background 0.15s;
}

.category-item:hover {
  background: var(--bg-hover);
}

.cat-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.cat-name {
  font-size: 13px;
  flex: 1;
  color: var(--text-primary);
}

.cat-edit,
.cat-delete {
  opacity: 0;
  transition: opacity 0.15s;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
}

.category-item:hover .cat-edit,
.category-item:hover .cat-delete {
  opacity: 0.6;
}

.cat-edit:hover {
  opacity: 1 !important;
  color: var(--accent);
}

.cat-delete:hover {
  opacity: 1 !important;
  color: var(--danger);
}

.btn-add-category {
  margin-top: 4px;
  padding: 6px 8px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.btn-add-category:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* Stats */

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}

.stat-card.stat-wide {
  grid-column: span 2;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* Sidebar Footer */

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn-ai {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.btn-ai:hover {
  background: rgba(196, 149, 106, 0.18);
  border-color: var(--accent);
}

/* ── Main Content ──────────────────────────────────── */

.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  min-width: 0;
  background: var(--bg);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.view-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.view-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Carry Over Notice ─────────────────────────────── */

.carry-over-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: rgba(212, 165, 74, 0.08);
  border-color: rgba(212, 165, 74, 0.25);
  font-size: 13px;
}

.carry-over-notice span {
  flex: 1;
  color: var(--warning);
}

/* ── Buttons ───────────────────────────────────────── */

.btn-primary {
  padding: 8px 16px;
  border: none;
  background: var(--accent);
  color: var(--accent-text);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary {
  padding: 8px 16px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-sm {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-sm:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-icon-sm {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  opacity: 0.5;
}

.btn-icon-sm:hover {
  opacity: 1;
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-dismiss {
  color: var(--text-muted);
}

/* ── Task Table ────────────────────────────────────── */

.task-table-wrapper {
  overflow-x: auto;
  padding: 4px;
}

.task-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.task-table thead th {
  padding: 10px 8px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--bg-table-header);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}

.task-table thead th:first-child {
  border-radius: var(--radius-xs) 0 0 0;
}

.task-table thead th:last-child {
  border-radius: 0 var(--radius-xs) 0 0;
}

.task-table tbody td {
  padding: 10px 8px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-primary);
}

.task-row {
  transition: background 0.15s;
}

.task-row:hover {
  background: var(--bg-hover);
}

.task-row.selected {
  background: var(--accent-light);
  outline: 1px solid rgba(196, 149, 106, 0.3);
  outline-offset: -1px;
}

.task-row.task-done {
  opacity: 0.5;
}

.task-row.task-done .col-title {
  text-decoration: line-through;
}

.task-row.dragging {
  opacity: 0.4;
}

.task-row.drag-over {
  border-top: 2px solid var(--accent);
}

/* Columns */

.col-drag {
  width: 30px;
  text-align: center;
}

.drag-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 16px;
  user-select: none;
  line-height: 1;
}

.drag-handle:active {
  cursor: grabbing;
}

.col-status { width: 90px; }
.col-priority { width: 80px; }
.col-title { min-width: 200px; }
.col-category { width: 100px; }
.col-date { width: 100px; }
.col-due { width: 70px; }
.col-time { width: 90px; }
.col-memo { width: 130px; max-width: 200px; }
.col-actions { width: 70px; text-align: right; white-space: nowrap; }

/* Status Badge — softer pastel versions */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: filter 0.15s;
  color: #fff;
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}

.status-badge:hover {
  filter: brightness(0.95);
}

/* Priority Badge */

.priority-badge {
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.priority-badge:hover {
  opacity: 0.8;
}

/* Category Badge */

.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.15s;
  color: var(--text-primary);
}

.cat-badge:hover {
  filter: brightness(0.95);
}

/* Editable cells */

.editable {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background 0.15s;
}

.editable:hover {
  background: var(--bg-hover);
}

.editing {
  background: var(--bg-active) !important;
}

.memo-cell {
  color: var(--text-secondary);
  font-size: 12px;
}

/* Inline editing */

.inline-input {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--accent);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  border-radius: 4px;
  outline: none;
}

.inline-textarea {
  min-height: 60px;
  resize: vertical;
}

.inline-select {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid var(--accent);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  border-radius: 4px;
  outline: none;
}

.inline-opt {
  display: inline-block;
  margin: 2px;
  padding: 2px 8px;
  border: none;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  color: #fff;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.inline-opt:hover,
.inline-opt.active {
  opacity: 1;
}

/* Empty State */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state p {
  font-size: 15px;
}

.empty-state .hint {
  font-size: 12px;
  margin-top: 8px;
}

.empty-state kbd {
  display: inline-block;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font);
  font-size: 11px;
  background: var(--bg-hover);
  color: var(--text-secondary);
}

/* Filter selects */

.filter-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 12px;
  border-radius: var(--radius-xs);
  outline: none;
  cursor: pointer;
}

.filter-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ── Calendar ──────────────────────────────────────── */

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 12px;
}

.cal-header {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.cal-cell {
  padding: 8px;
  min-height: 80px;
  border-radius: var(--radius-xs);
  background: var(--bg);
  cursor: pointer;
  transition: background 0.15s;
}

.cal-cell:hover:not(.empty) {
  background: var(--bg-hover);
}

.cal-cell.empty {
  cursor: default;
  background: transparent;
}

.cal-cell.today {
  border: 1px solid var(--accent);
  background: var(--accent-light);
}

.cal-cell.current {
  background: rgba(196, 149, 106, 0.08);
}

.cal-day {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.cal-tasks {
  margin-top: 6px;
}

.cal-count {
  font-size: 11px;
  color: var(--text-secondary);
}

.cal-progress {
  height: 3px;
  background: var(--border-light);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}

.cal-progress-bar {
  height: 100%;
  background: var(--success);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── AI Panel ──────────────────────────────────────── */

.ai-panel {
  width: var(--ai-panel-width);
  min-width: var(--ai-panel-width);
  flex-direction: column;
  border-radius: 0;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  border-right: none;
  border-top: none;
  border-bottom: none;
  box-shadow: none;
  overflow: hidden;
}

.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}

.ai-panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  display: flex;
}

.chat-msg.bot {
  justify-content: flex-start;
}

.chat-msg.user {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg.bot .chat-bubble {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

.chat-msg.user .chat-bubble {
  background: var(--accent);
  color: var(--accent-text);
  border-bottom-right-radius: 4px;
}

.ai-chat-input {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-light);
}

.ai-chat-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  border-radius: var(--radius-xs);
  outline: none;
}

.ai-chat-input input:focus {
  border-color: var(--accent);
}

.ai-chat-input input::placeholder {
  color: var(--text-muted);
}

/* ── Modals ────────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 48, 41, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  width: 480px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  animation: modalIn 0.2s ease-out;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

.modal-sm {
  width: 380px;
}

.modal-lg {
  width: 640px;
}

@keyframes modalIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Forms ─────────────────────────────────────────── */

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 13px;
  border-radius: var(--radius-xs);
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 149, 106, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

/* Color Picker */

.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.color-btn {
  width: 28px;
  height: 28px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
}

.color-btn:hover {
  transform: scale(1.15);
}

.color-btn.selected {
  border-color: var(--accent);
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--bg-card), 0 0 0 4px var(--accent);
}

/* ── Summary Modal ─────────────────────────────────── */

.summary-section {
  margin-bottom: 20px;
}

.summary-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.summary-empty {
  color: var(--text-muted);
  font-style: italic;
}

.summary-muted {
  color: var(--text-muted);
  font-size: 13px;
}

.summary-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.summary-stat {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-hover);
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-light);
}

.summary-big {
  display: block;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
}

.summary-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.summary-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--border-light);
  gap: 1px;
}

.bar-seg {
  transition: width 0.3s;
  min-width: 4px;
}

.summary-legend {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.summary-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-secondary);
}

.summary-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.summary-cat-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-primary);
}

.summary-cat-row span:first-child {
  width: 80px;
}

.summary-cat-row span:nth-child(2) {
  width: 70px;
  font-size: 12px;
  color: var(--text-secondary);
}

.mini-bar {
  flex: 1;
  height: 6px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.3s;
}

.summary-list {
  list-style: none;
  padding: 0;
}

.summary-list li {
  padding: 4px 0;
  font-size: 13px;
  color: var(--text-primary);
}

.summary-list li.done {
  opacity: 0.6;
}

.summary-warning {
  background: rgba(212, 165, 74, 0.08);
  padding: 12px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(212, 165, 74, 0.2);
  color: var(--text-primary);
}

.pattern-list li {
  padding: 6px 0;
  border-bottom: 1px solid var(--border-light);
}

.pattern-list li:last-child {
  border-bottom: none;
}

.summary-ai {
  background: var(--accent-light);
  padding: 16px;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(196, 149, 106, 0.2);
}

.summary-ai p {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
}

/* Loading */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Keyboard Shortcuts Modal ──────────────────────── */

.shortcuts-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-xs);
}

.shortcut-item kbd {
  display: inline-block;
  min-width: 50px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  background: var(--bg-hover);
  color: var(--accent);
}

.shortcut-item span {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Settings Button ───────────────────────────────── */

.btn-settings {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.btn-settings:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
}

/* ── Settings Page ────────────────────────────────── */

.settings-sections {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 640px;
}

.settings-card {
  padding: 24px;
}

.settings-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.settings-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.settings-actions {
  margin-top: 12px;
}

/* Column Order Drag List */

.column-order-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.column-order-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  cursor: grab;
  transition: all 0.15s;
  user-select: none;
}

.column-order-item:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.column-order-item:active {
  cursor: grabbing;
}

.column-order-item.dragging {
  opacity: 0.4;
  background: var(--accent-light);
}

.column-order-item.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.col-order-handle {
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
}

.col-order-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.col-order-key {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
}

/* Settings Category Management */

.settings-category-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-cat-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xs);
  transition: background 0.15s;
}

.settings-cat-item:hover {
  background: var(--bg-hover);
}

.settings-cat-color {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-cat-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-cat-badge {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 4px;
}

.settings-cat-actions {
  display: flex;
  gap: 4px;
}

/* ── Toast ─────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
}

.toast {
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transform: translateX(100%);
  opacity: 0;
  transition: all 0.3s ease;
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

/* ── Scrollbar ─────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Responsive ────────────────────────────────────── */

@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
    min-width: 240px;
    padding: 16px 12px;
  }

  .ai-panel {
    width: 300px;
    min-width: 300px;
  }
}

@media (max-width: 768px) {
  .app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 12px;
    gap: 12px;
    max-height: 200px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .categories-section,
  .sidebar-stats {
    display: none;
  }

  .sidebar-footer {
    flex-direction: row;
    margin-top: 0;
  }

  .main-content {
    padding: 16px;
  }

  .ai-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 500;
  }

  .summary-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
