:root {
  --c-primary: #185FA5;
  --c-primary-light: #E6F1FB;
  --c-primary-medium: #85B7EB;
  --c-primary-dark: #0C447C;
  --c-primary-darker: #042C53;
  --c-primary-darkest: #042C53;
  --c-bg: #F5F9FD;
  --c-surface: #EEF5FC;
  --c-surface-hover: #D6E8F8;
  --c-text: #042C53;
  --c-text-secondary: #0C447C;
  --c-text-muted: #185FA5;
  --c-border: #85B7EB;
  --c-border-light: #B5D4F4;
  --c-success: #1D9E75;
  --c-danger: #E24B4A;
  --c-info: #378ADD;
  --c-gray-50: #F1EFE8;
  --c-gray-100: #D3D1C7;
  --c-gray-400: #888780;
  --c-gray-800: #444441;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(12, 68, 124, 0.08);
  --shadow-md: 0 2px 8px rgba(12, 68, 124, 0.12);
  --shadow-lg: 0 4px 16px rgba(12, 68, 124, 0.16);
  --topbar-h: 52px;
  --capture-h: 52px;
  --bottombar-h: 44px;
  --sidebar-w: 200px;
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-tap-highlight-color: transparent;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: inherit; text-decoration: none; }

.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  background: var(--c-primary);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.app-title {
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
}
.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.menu-toggle {
  display: none;
  font-size: 20px;
  color: #fff;
  padding: 4px 8px;
}
.sync-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255,255,255,0.9);
}
.sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
}
.sync-dot.online { background: #4ade80; }
.sync-dot.offline { background: #fbbf24; }
.sync-dot.syncing { background: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
.icon-btn {
  color: #fff;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}
.icon-btn:hover { background: rgba(255,255,255,0.2); }

.quick-capture {
  height: var(--capture-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border-light);
  position: sticky;
  top: var(--topbar-h);
  z-index: 99;
}
.quick-capture input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--c-text);
}
.quick-capture input:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(24, 95, 165, 0.15);
}
.quick-capture select {
  padding: 8px 8px;
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--c-text-secondary);
  white-space: nowrap;
}
.btn-add {
  padding: 8px 16px;
  background: var(--c-primary);
  color: #fff;
  border-radius: var(--radius-md);
  font-weight: 500;
  white-space: nowrap;
}
.btn-add:hover { background: var(--c-primary-dark); }
.btn-add:active { transform: scale(0.97); }

.layout {
  display: flex;
  height: calc(100vh - var(--topbar-h) - var(--capture-h) - var(--bottombar-h));
  overflow: hidden;
}
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border-light);
  padding: 12px 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--c-border-light);
  margin-top: 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--c-text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  width: 100%;
}
.nav-item:hover { background: var(--c-surface-hover); }
.nav-item.active {
  background: var(--c-primary-light);
  color: var(--c-primary-darkest);
}
.nav-item .count {
  margin-left: auto;
  font-size: 12px;
  background: var(--c-primary);
  color: #fff;
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 600;
}
.filter-section {
  padding: 4px 12px 12px;
}
.filter-section h3 {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cat-toggle-all {
  font-size: 11px;
  font-weight: 500;
  color: var(--c-primary);
  background: transparent;
  border: 1px solid var(--c-border-light);
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}
.cat-toggle-all:hover {
  background: var(--c-surface-hover);
  border-color: var(--c-primary);
}
.cat-toggle-all.all-off {
  color: var(--c-text-muted);
}
.filter-hint {
  font-size: 10px;
  font-weight: 400;
  color: var(--c-gray-400);
  margin: 4px 2px 8px 2px;
}
.cat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--c-text-secondary);
  cursor: grab;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s, transform 0.12s;
  user-select: none;
  position: relative;
}
.cat-row:active { cursor: grabbing; }
.cat-row:hover { background: var(--c-surface-hover); }
.cat-row .cat-label {
  flex: 1;
  font-size: inherit;
  transform-origin: left center;
  transition: font-size 0.18s, transform 0.18s;
}
.cat-row[aria-checked="true"] .cat-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--c-text);
  transform: scale(1.04);
}
.cat-row:active .cat-label { transform: scale(1.12); }
.cat-row .cat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--cat-color);
  transition: transform 0.15s;
}
.cat-row:hover .cat-dot { transform: scale(1.25); }
.cat-row .cat-check {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  position: relative;
}
.cat-row .cat-check::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 0;
  width: 4px;
  height: 8px;
  border-style: solid;
  border-color: transparent;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.18s ease;
}
.cat-row[aria-checked="true"] .cat-check::after {
  transform: rotate(45deg) scale(1);
  border-color: var(--cat-color);
}
.cat-row[aria-checked="false"] .cat-label,
.cat-row[aria-checked="false"] .cat-dot { opacity: 0.45; }
.cat-row[aria-checked="false"]:hover .cat-label { transform: scale(1.04); }
/* SortableJS 拖拽状态 */
.cat-row.sortable-ghost {
  opacity: 0.35;
  background: var(--c-primary-light);
}
.cat-row.sortable-chosen { background: var(--c-surface-hover); }
.cat-row.sortable-drag { box-shadow: var(--shadow-lg); cursor: grabbing; }
.filter-section h3 .hint {
  display: none;
}
#categoryList {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.main-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.view {
  display: none;
  height: 100%;
  overflow: hidden;
}
.view.active { display: flex; flex-direction: column; }

.kanban-board {
  display: flex;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  height: 100%;
}
.kanban-column {
  flex: 1;
  min-width: 260px;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border-light);
  overflow: hidden;
}
.kanban-column-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--c-border-light);
}
.col-inbox .kanban-column-header { background: var(--c-primary-light); color: var(--c-primary-darkest); }
.col-progress .kanban-column-header { background: #FEF3C7; color: #92400E; }
.col-done .kanban-column-header { background: #DCFCE7; color: #166534; }
.col-review .kanban-column-header { background: #E0E7FF; color: #3730A3; }
.col-count {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.7;
}
.kanban-column-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 100px;
}
.kanban-column-body.sortable-ghost { opacity: 0.4; }
.kanban-column-body.sortable-drag { opacity: 0.8; }

.card {
  background: #fff;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border-light);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: grab;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--c-primary-medium);
}
.card:active { cursor: grabbing; }
.card-header {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 4px;
}
.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
  flex: 1;
  line-height: 1.4;
}
.card-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-coordination { background: #E6F1FB; color: #0C447C; }
.badge-gm_task { background: #FEE2E2; color: #991B1B; }
.badge-learning { background: #DBEAFE; color: #1E40AF; }
.badge-sop { background: #DCFCE7; color: #166534; }
.badge-noya { background: #F3E8FF; color: #6B21A8; }
.badge-optimization { background: #FFF7ED; color: #C2410C; }
.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--c-text-muted);
}
.card-date { }
.card-priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 10px;
  background: var(--c-surface);
}
.card-priority .pri-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}
.priority-high { color: var(--c-danger); background: #FDE7E7; }
.priority-high .pri-dot { background: var(--c-danger); }
.priority-medium { color: var(--c-text-secondary); background: #E6F1FB; }
.priority-medium .pri-dot { background: var(--c-primary); }
.priority-low { color: var(--c-gray-400); background: #F1EFE8; }
.priority-low .pri-dot { background: var(--c-gray-400); }
.card-completed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  color: var(--c-success);
  background: #E5F4EF;
}
.card-completed .comp-icon {
  font-size: 10px;
  font-weight: 700;
}
.card-notes-count {
  margin-left: auto;
  color: var(--c-text-muted);
}
.card-reminder {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: var(--c-danger);
  margin-top: 4px;
}
.empty-column {
  text-align: center;
  padding: 24px 12px;
  color: var(--c-text-muted);
  font-size: 12px;
}

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 44, 83, 0);
  z-index: 200;
  pointer-events: none;
  transition: background 0.25s ease;
}
.drawer-overlay.active {
  background: rgba(4, 44, 83, 0.35);
  pointer-events: auto;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 540px;
  max-width: 100%;
  background: var(--c-bg);
  box-shadow: -4px 0 24px rgba(4, 44, 83, 0.18);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}
.drawer-overlay.active .drawer { transform: translateX(0); }
.modal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--c-border-light);
  position: sticky;
  top: 0;
  background: var(--c-bg);
  z-index: 1;
  flex-shrink: 0;
}
.modal-body { padding: 16px 20px; flex: 1; overflow-y: auto; }
.modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--c-border-light);
  background: var(--c-bg);
  flex-shrink: 0;
}
.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}
.modal-close {
  font-size: 20px;
  color: var(--c-text-muted);
  padding: 4px 8px;
}
.modal-close:hover { color: var(--c-text); }
.modal-body { padding: 16px 20px; }
.modal-section { margin-bottom: 16px; }
.modal-section label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-muted);
  margin-bottom: 4px;
}
.modal-section input,
.modal-section select,
.modal-section textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--c-text);
}
.modal-section input:focus,
.modal-section select:focus,
.modal-section textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 2px rgba(24, 95, 165, 0.15);
}
.modal-section textarea { resize: vertical; min-height: 80px; }
.modal-row { display: flex; gap: 12px; }
.modal-row > * { flex: 1; }
.notes-list { margin-bottom: 8px; }
.note-item {
  background: var(--c-surface);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 4px;
  font-size: 13px;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.note-item .note-content { flex: 1; min-width: 0; }
.note-item .note-delete {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--c-text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.note-item:hover .note-delete { opacity: 1; }
.note-item .note-delete:hover {
  background: var(--c-danger);
  color: white;
}
.note-time {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 2px;
}
.reminder-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.reminder-row input[type="datetime-local"] {
  flex: 1;
  min-width: 160px;
}
.reminder-row .no-remind {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--c-text-muted);
  cursor: pointer;
  user-select: none;
}
.reminder-row .no-remind input { accent-color: var(--c-primary); }
.reminder-row.disabled input[type="datetime-local"] {
  opacity: 0.4;
  pointer-events: none;
}
/* 只读视图 */
.view-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1.4;
  margin-bottom: 12px;
}
.view-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.view-badges .pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.view-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin-bottom: 18px;
}
.view-grid.single { grid-template-columns: 1fr; }
.view-field {
  font-size: 13px;
}
.view-field .field-label {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-bottom: 4px;
}
.view-field .field-value {
  color: var(--c-text);
  word-break: break-word;
  line-height: 1.5;
}
.view-field .field-value.empty {
  color: var(--c-text-muted);
  font-style: italic;
}
.view-description {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  margin-bottom: 18px;
  color: var(--c-text);
  min-height: 36px;
}
.view-notes {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.view-note {
  padding: 8px 4px;
  border-bottom: 1px dashed var(--c-border-light);
  font-size: 13px;
}
.view-note:last-child { border-bottom: none; }
.view-note .note-text { color: var(--c-text); line-height: 1.5; word-break: break-word; }
.view-note .note-time { font-size: 11px; color: var(--c-text-muted); margin-top: 4px; }

/* ===== 附件模块 ===== */
.attachment-block { margin-top: 18px; }
.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 10px;
}
.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  background: var(--c-bg);
  transition: border-color 0.15s, background 0.15s;
}
.attachment-item:hover {
  border-color: var(--c-primary);
  background: var(--c-surface);
}
.att-icon {
  font-size: 18px;
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-surface);
  border-radius: var(--radius-sm);
}
.att-info {
  flex: 1;
  min-width: 0;
}
.att-name {
  font-size: 13px;
  color: var(--c-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-meta {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.att-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.att-btn {
  background: transparent;
  border: 1px solid var(--c-border-light);
  color: var(--c-text-secondary);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.att-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}
.att-btn.att-del {
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
}
.att-btn.att-del:hover {
  border-color: var(--c-danger);
  color: var(--c-danger);
}
.attachment-empty {
  color: var(--c-text-muted);
  font-size: 12px;
  font-style: italic;
  padding: 8px 4px;
}
.attachment-add {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.attachment-add .att-add-btn {
  font-size: 13px;
  padding: 6px 12px;
}
.attachment-add .att-add-tencent {
  background: #E6F1FB;
  border-color: #185FA5;
  color: #185FA5;
  font-weight: 500;
}
.attachment-add .att-add-tencent:hover {
  background: #185FA5;
  color: #fff;
}
.sidebar-sync {
  padding: 8px 12px;
  border-top: 1px solid var(--c-border-light);
  margin-top: 4px;
}
.nav-sync-btn {
  width: 100%;
  justify-content: center;
  background: #E6F1FB;
  color: #185FA5;
  border: 1px solid #185FA5;
  font-weight: 500;
  font-size: 13px;
}
.nav-sync-btn:hover {
  background: #185FA5;
  color: #fff;
}
.nav-sync-btn.syncing {
  opacity: 0.6;
  pointer-events: none;
}
.nav-export-btn {
  background: #FFF3E0;
  color: #E65100;
  border-color: #FF9800;
  margin-top: 6px;
}
.nav-export-btn:hover {
  background: #FF9800;
  color: #fff;
}
.pill-prio-high { background: #FDE7E7; color: #C0392B; }
.pill-prio-high .pri-dot { background: #C0392B; }
.pill-prio-medium { background: #E6F1FB; color: #185FA5; }
.pill-prio-medium .pri-dot { background: #185FA5; }
.pill-prio-low { background: #F1EFE8; color: #888780; }
.pill-prio-low .pri-dot { background: #888780; }
.pill-stage-inbox { background: #E6F1FB; color: #185FA5; }
.pill-stage-processing { background: #FEF3D9; color: #B45309; }
.pill-stage-done { background: #E5F4EF; color: #1D9E75; }
.pill-stage-review { background: #EDE9FE; color: #6D28D9; }
.modal-footer .btn-ghost {
  background: transparent;
  color: var(--c-text-secondary);
  border: 1px solid var(--c-border-light);
}
.modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--c-border-light);
  background: var(--c-bg);
  flex-shrink: 0;
}
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); }
.btn-success { background: var(--c-success); color: #fff; }
.btn-success:hover { background: #178862; }
.btn-success:disabled { background: #9ECABB; cursor: not-allowed; }
.btn-auto {
  background: var(--c-primary-light);
  color: var(--c-primary-darkest);
  border: 1px solid var(--c-primary-medium);
}
.btn-auto:hover {
  background: #d0e3f5;
  border-color: var(--c-primary);
}
.btn-danger { background: var(--c-danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-ghost { color: var(--c-text-secondary); }
.btn-ghost:hover { background: var(--c-surface-hover); }

.history-container {
  padding: 16px;
  overflow-y: auto;
  height: 100%;
}
.history-group {
  margin-bottom: 12px;
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--c-surface);
}
.history-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--c-primary-light);
  cursor: pointer;
  font-weight: 500;
  color: var(--c-primary-darkest);
  user-select: none;
}
.history-group-header .arrow {
  transition: transform 0.2s;
  font-size: 12px;
}
.history-group.collapsed .arrow { transform: rotate(-90deg); }
.history-group-body {
  padding: 4px 8px;
}
.history-group.collapsed .history-group-body { display: none; }
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--c-border-light);
}
.history-item:last-child { border-bottom: none; }
.history-item-title {
  flex: 1;
  font-size: 13px;
  color: var(--c-text);
}
.history-item-date {
  font-size: 11px;
  color: var(--c-text-muted);
  white-space: nowrap;
}

.reports-container {
  padding: 16px;
  overflow-y: auto;
  height: 100%;
}
.report-card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border-light);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.report-card h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--c-primary-darkest);
  margin-bottom: 8px;
}
.report-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.report-stat {
  text-align: center;
}
.report-stat-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-primary);
}
.report-stat-label {
  font-size: 11px;
  color: var(--c-text-muted);
}
.report-list { font-size: 13px; color: var(--c-text-secondary); }
.report-list-item {
  padding: 4px 0;
  border-bottom: 1px solid var(--c-border-light);
}
.report-list-item:last-child { border-bottom: none; }
.report-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.meeting-container {
  padding: 16px;
  overflow-y: auto;
  height: 100%;
}
.meeting-form {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border-light);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.meeting-list-item {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--c-border-light);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
}
.meeting-list-item:hover { border-color: var(--c-primary-medium); }
.meeting-list-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text);
}
.meeting-list-date {
  font-size: 12px;
  color: var(--c-text-muted);
}

/* ==================== WEEKLY REPORT ==================== */
.weekly-container {
  padding: 16px;
  overflow-y: auto;
  height: 100%;
}
.weekly-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 12px;
  gap: 12px;
}
.weekly-header-info { min-width: 0; flex: 1; }
.weekly-header-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-primary-darkest);
  margin-bottom: 2px;
}
.weekly-header-meta {
  font-size: 12px;
  color: var(--c-text-muted);
}
.weekly-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.weekly-form {
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.weekly-field {
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border-light);
}
.weekly-field:last-child { border-bottom: none; }
.weekly-field-primary {
  background: var(--c-primary-light);
  margin: -16px -20px 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--c-border-light);
}
.weekly-field-primary .weekly-textarea { background: #fff; }
.weekly-field-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.weekly-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.weekly-field-hint {
  font-size: 11px;
  color: var(--c-text-muted);
  margin-bottom: 8px;
}
.weekly-textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-bg);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-sm);
  resize: vertical;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}
.weekly-textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
}
.weekly-sat-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.weekly-input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 13px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-bg);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, background 0.15s;
}
.weekly-input:focus {
  outline: none;
  border-color: var(--c-primary);
  background: #fff;
}
.weekly-input-num {
  flex: 0 0 80px;
  text-align: center;
  font-weight: 600;
}

.weekly-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-bottom: 16px;
}

.weekly-history {
  background: var(--c-surface);
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 32px;
}
.weekly-history-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.weekly-history-count {
  font-size: 11px;
  background: var(--c-primary-light);
  color: var(--c-primary-darkest);
  padding: 1px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.weekly-history-empty {
  font-size: 12px;
  color: var(--c-text-muted);
  text-align: center;
  padding: 16px 0;
}
.weekly-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.weekly-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--c-bg);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.15s;
}
.weekly-history-item:hover { background: var(--c-primary-light); }
.weekly-history-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text);
}
.weekly-history-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--c-text-muted);
}

.bottombar {
  height: var(--bottombar-h);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 16px;
  background: var(--c-surface);
  border-top: 1px solid var(--c-border-light);
}
.bottombar-label {
  font-size: 12px;
  color: var(--c-text-muted);
  margin-right: 12px;
  white-space: nowrap;
}
.tool-link {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--c-text-secondary);
  border-right: 1px solid var(--c-border-light);
}
.tool-link:last-child { border-right: none; }
.tool-link:hover { background: var(--c-surface-hover); color: var(--c-primary-dark); }
.tool-icon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: calc(var(--bottombar-h) + 16px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-primary-darkest);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-md);
  font-size: 13px;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}
.toast.toast-success {
  background: var(--c-success);
  font-weight: 500;
}
.toast.toast-error {
  background: var(--c-danger);
}

/* ===== Mobile Kanban Tabs (hidden on desktop) ===== */
.kanban-tabs {
  display: none;
}

/* ===== Long-press drag indicator (mobile) ===== */
.card-item.long-press-ready {
  transform: scale(1.03) rotate(1deg);
  box-shadow: var(--shadow-md);
  border-color: var(--c-primary);
  opacity: 0.92;
  transition: transform 0.15s, box-shadow 0.15s;
}

.kanban-hint {
  font-size: 12px;
  color: var(--c-text-secondary);
  background: var(--c-bg-1);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  margin: 0 0 8px 0;
  text-align: center;
}
.kanban-hint b { color: var(--c-primary); font-weight: 600; }

/* ===== Card Move Bar (visible on all) ===== */
.card-move-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.card-move-btn {
  flex: 1;
  min-width: 60px;
  padding: 7px 4px;
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  background: var(--c-bg);
  color: var(--c-text-secondary);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.card-move-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-light);
}
.card-move-btn.current {
  background: var(--c-primary);
  border-color: var(--c-primary);
  color: #fff;
}

@media (max-width: 768px) {
  /* ===== Mobile Kanban: Tab Mode ===== */
  .kanban-tabs {
    display: flex;
    gap: 0;
    padding: 0;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border-light);
    flex-shrink: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .kanban-tab {
    flex: 1;
    min-width: auto;
    padding: 10px 4px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text-muted);
    border: none;
    background: transparent;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
  }
  .kanban-tab.active {
    color: var(--c-primary);
    border-bottom-color: var(--c-primary);
    font-weight: 600;
  }
  .kanban-tab .tab-count {
    font-size: 10px;
    background: var(--c-border-light);
    color: var(--c-text-secondary);
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 3px;
  }
  .kanban-tab.active .tab-count {
    background: var(--c-primary-light);
    color: var(--c-primary);
  }

  .kanban-board {
    flex-direction: column;
    overflow-x: hidden;
    padding: 0;
  }
  .kanban-column {
    display: none !important;
    min-width: 100%;
    max-width: 100%;
    border-radius: 0;
    border: none;
  }
  .kanban-column.mobile-active {
    display: flex !important;
    flex: 1;
  }
  .kanban-column-header {
    position: sticky;
    top: 0;
    z-index: 5;
    font-size: 13px;
  }

  /* ===== Compact Quick Capture ===== */
  :root {
    --topbar-h: 48px;
    --capture-h: 44px;
    --bottombar-h: 40px;
  }
  .topbar { padding: 0 10px; gap: 8px; }
  .app-title { font-size: 15px; }
  .sync-status .sync-text { display: none; }
  .quick-capture {
    height: var(--capture-h);
    padding: 0 10px;
    gap: 6px;
  }
  .quick-capture input {
    padding: 6px 10px;
    font-size: 13px;
  }
  .quick-capture select {
    max-width: 84px;
    padding: 6px 4px;
    font-size: 12px;
  }
  .btn-add {
    padding: 6px 12px;
    font-size: 13px;
  }

  /* ===== Bigger Touch Targets ===== */
  .card {
    padding: 12px 14px;
    margin-bottom: 8px;
  }
  .card-title { font-size: 14px; }
  .nav-item {
    padding: 14px 12px;
    font-size: 15px;
  }
  .cat-row { padding: 10px 10px; }

  /* ===== Full-screen Drawer ===== */
  .drawer {
    width: 100%;
    max-width: 100%;
  }
  .modal-header { padding: 12px 14px; }
  .modal-header h2 { font-size: 15px; }
  .modal-body { padding: 12px 14px; }
  .modal-footer {
    padding: 10px 14px;
    flex-wrap: wrap;
  }
  .modal-footer .btn {
    padding: 10px 14px;
    font-size: 14px;
    flex: 1;
    min-width: 80px;
  }
  .modal-row { flex-direction: column; gap: 0; }

  /* ===== View Grid: Single Column ===== */
  .view-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .view-title { font-size: 17px; }

  /* ===== Bottom Bar: Icons Only ===== */
  .bottombar {
    padding: 0 6px;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bottombar-label { display: none; }
  .tool-link {
    padding: 0 10px;
    font-size: 0;
    gap: 0;
    border-right: none;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .tool-link .tool-icon {
    width: 26px;
    height: 26px;
    font-size: 11px;
  }

  /* ===== Card Move Bar: Bigger on Mobile ===== */
  .card-move-btn {
    padding: 10px 4px;
    font-size: 13px;
  }

  /* ===== Sidebar ===== */
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed;
    top: calc(var(--topbar-h) + var(--capture-h));
    left: 0;
    bottom: var(--bottombar-h);
    z-index: 98;
    transform: translateX(-100%);
    transition: transform 0.25s;
    width: 240px;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: calc(var(--topbar-h) + var(--capture-h)) 0 var(--bottombar-h) 0;
    background: rgba(4, 44, 83, 0.3);
    z-index: 97;
  }
  .sidebar-overlay.active { display: block; }

  /* ===== Reports & Weekly ===== */
  .report-stats { gap: 12px; }
  .report-card { padding: 12px 14px; }
  .weekly-form { padding: 12px 14px; }
  .weekly-field-primary {
    margin: -12px -14px 12px;
    padding: 12px 14px;
  }
  .weekly-header {
    padding: 10px 14px;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .weekly-header-actions { width: 100%; }
  .weekly-header-actions .btn { flex: 1; }

  /* ===== Attachments ===== */
  .attachment-item { flex-wrap: wrap; }
  .att-actions { width: 100%; justify-content: flex-end; }
  .attachment-add .att-add-btn {
    padding: 8px 10px;
    font-size: 12px;
  }

  /* ===== Toast Higher ===== */
  .toast {
    bottom: calc(var(--bottombar-h) + 12px);
  }

  /* ===== History & Meeting ===== */
  .history-container, .reports-container, .meeting-container, .weekly-container {
    padding: 10px 12px;
  }
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--c-text-muted);
}
.empty-state h3 {
  font-size: 15px;
  margin-bottom: 8px;
  color: var(--c-text-secondary);
}

.search-bar {
  padding: 8px 16px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border-light);
}
.search-bar input {
  width: 100%;
  padding: 6px 12px;
  border: 1px solid var(--c-border-light);
  border-radius: var(--radius-md);
  background: #fff;
}
