:root {
  --bg: #0079bf;
  --topbar: rgba(0, 0, 0, 0.15);
  --sidebar-bg: #f4f5f7;
  --list-bg: #ebecf0;
  --card-bg: #ffffff;
  --text: #172b4d;
  --text-muted: #5e6c84;
  --accent: #0079bf;
  --danger: #eb5a46;
  --shadow: 0 1px 2px rgba(9, 30, 66, 0.25);
}

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

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--topbar);
  backdrop-filter: blur(4px);
  color: #fff;
  flex-shrink: 0;
}

.logo { font-weight: 800; font-size: 18px; letter-spacing: 0.5px; }

.topbar-board-name { font-weight: 600; opacity: 0.95; }

.topbar-spacer { flex: 1; }

.icon-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  transition: background 0.15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.35); }

.ghost-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.ghost-btn:hover { background: rgba(255, 255, 255, 0.35); }

/* ---------- Layout ---------- */
.layout { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  border-right: 1px solid rgba(9, 30, 66, 0.13);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: margin-left 0.2s ease;
}
.sidebar.collapsed { margin-left: -260px; }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(9, 30, 66, 0.13);
}
.sidebar-header h2 { font-size: 14px; text-transform: uppercase; color: var(--text-muted); letter-spacing: 0.5px; }
.sidebar-header .icon-btn { background: rgba(9, 30, 66, 0.08); color: var(--text); }
.sidebar-header .icon-btn:hover { background: rgba(9, 30, 66, 0.16); }

.board-list { list-style: none; overflow-y: auto; padding: 8px; flex: 1; }

.board-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 2px;
}
.board-list li:hover { background: rgba(9, 30, 66, 0.08); }
.board-list li.active { background: rgba(0, 121, 191, 0.16); font-weight: 600; }

.board-swatch { width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0; }
.board-list li span.name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-list li button.del {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 14px; opacity: 0; padding: 2px 6px; border-radius: 3px;
}
.board-list li:hover button.del { opacity: 1; }
.board-list li button.del:hover { background: rgba(9, 30, 66, 0.15); color: var(--danger); }

/* ---------- Board area ---------- */
.board-area { flex: 1; min-width: 0; overflow: hidden; }

.board-scroll {
  height: 100%;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  overflow-x: auto;
  overflow-y: hidden;
}

/* ---------- List ---------- */
.list {
  background: var(--list-bg);
  border-radius: 8px;
  width: 280px;
  flex-shrink: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}
.list.drag-over-list { outline: 2px dashed var(--accent); }
.list.dragging { opacity: 0.4; }

.list-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px 4px;
}
.list-title {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
  border: none;
  background: transparent;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--text);
  font-family: inherit;
}
.list-title:focus { background: #fff; outline: 2px solid var(--accent); }
.list-menu-btn {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 16px; padding: 2px 8px; border-radius: 4px;
}
.list-menu-btn:hover { background: rgba(9, 30, 66, 0.12); }

.cards {
  list-style: none;
  padding: 4px 8px;
  overflow-y: auto;
  flex: 1;
  min-height: 8px;
}

.card {
  position: relative;
  background: var(--card-bg);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  cursor: pointer;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid transparent;
}
.card:hover { border-color: rgba(9, 30, 66, 0.25); }
.card-title { white-space: pre-wrap; word-break: break-word; padding-right: 16px; }

.card-cover {
  height: 30px;
  border-radius: 6px 6px 0 0;
  margin: -8px -10px 8px;
}

/* ---------- Drag & drop ---------- */
.drag-handle {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1;
  color: var(--text-muted);
  cursor: grab;
  opacity: 0;
  border-radius: 3px;
  touch-action: none;
  user-select: none;
}
.card:hover .drag-handle { opacity: 0.55; }
.drag-handle:hover { opacity: 1 !important; background: rgba(9, 30, 66, 0.12); }
@media (hover: none) { .drag-handle { opacity: 0.55; } }

.list-grip {
  position: static;
  opacity: 0.5;
  font-size: 13px;
  padding: 4px 2px;
}
.list-header:hover .list-grip { opacity: 0.8; }

.drag-ghost {
  position: fixed;
  z-index: 999;
  margin: 0;
  list-style: none;
  pointer-events: none;
  opacity: 0.95;
  transform: rotate(3deg);
  box-shadow: 0 12px 32px rgba(9, 30, 66, 0.4);
  overflow: hidden;
}
.drag-hidden { display: none !important; }
.card-placeholder {
  margin-bottom: 8px;
  border-radius: 6px;
  background: rgba(9, 30, 66, 0.09);
  border: 2px dashed rgba(9, 30, 66, 0.25);
}
.list-placeholder {
  flex-shrink: 0;
  align-self: stretch;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.28);
  border: 2px dashed rgba(255, 255, 255, 0.65);
}
body.dragging-active { cursor: grabbing; user-select: none; }
body.dragging-active .card,
body.dragging-active .list { cursor: grabbing; }

.cards-none {
  font-size: 12px;
  color: var(--text-muted);
  padding: 6px 4px;
  font-style: italic;
}

/* ---------- Card labels & badges ---------- */
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.card-label {
  min-width: 40px;
  height: 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  color: rgba(0, 0, 0, 0.72);
  padding: 0 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}
.card:hover .card-label { height: auto; min-height: 16px; }

.card-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; align-items: center; }
.card-badge2 {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(9, 30, 66, 0.06);
}
.card-badge2.badge-due { cursor: pointer; }
.card-badge2.due-overdue { background: #ffe2dd; color: #ae2a19; }
.card-badge2.due-today,
.card-badge2.due-soon { background: #faf3d1; color: #a15c07; }
.card-badge2.due-done { background: #d6f2e0; color: #1f6e43; text-decoration: line-through; }
.card-badge2.badge-complete { background: #d6f2e0; color: #1f6e43; }

/* ---------- List header count ---------- */
.list-count {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(9, 30, 66, 0.08);
  border-radius: 10px;
  padding: 1px 8px;
  flex-shrink: 0;
}

/* ---------- Topbar filter ---------- */
.ghost-btn.active { background: #fff; color: var(--accent); font-weight: 700; }
.ghost-btn.dark { color: #fff; }

.filter-wrap { 
  position: relative;
  z-index: 1000;
  isolation: isolate;
}
.filter-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 280px;
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  padding: 14px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.filter-panel input[type="search"] {
  width: 100%;
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
}
.filter-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.filter-labels { display: flex; flex-direction: column; gap: 4px; }
.filter-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 2px 0;
}

/* ---------- Modal grid / sections ---------- */
.modal-grid { display: flex; gap: 20px; align-items: flex-start; }
.modal-main { flex: 1; min-width: 0; }
.modal-side { width: 200px; flex-shrink: 0; }
.modal-section { margin-top: 18px; }
.modal-heading { font-size: 18px; margin-bottom: 14px; }

.mini-btn {
  background: rgba(9, 30, 66, 0.08);
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}
.mini-btn:hover { background: rgba(9, 30, 66, 0.16); }
.mini-btn.danger { color: var(--danger); }
.mini-btn.danger:hover { background: var(--danger); color: #fff; }

/* ---------- Label picker ---------- */
.label-picker { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.label-row { display: flex; align-items: center; gap: 8px; }
.label-swatch { width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; }
.label-name {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  font-family: inherit;
  background: rgba(9, 30, 66, 0.05);
}
.label-name:focus { outline: none; border-color: var(--accent); background: #fff; }

/* ---------- Due editor ---------- */
.due-editor { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.due-editor input[type="date"] {
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
}
.due-done-toggle { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- Checklists ---------- */
.checklist { margin-bottom: 16px; }
.checklist-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.checklist-title {
  flex: 1;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  font-family: inherit;
  background: rgba(9, 30, 66, 0.05);
}
.checklist-title:focus { outline: none; border-color: var(--accent); background: #fff; }
.checklist-progress {
  height: 6px;
  background: rgba(9, 30, 66, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 2px;
}
.checklist-bar { height: 100%; background: var(--accent); transition: width 0.15s; }
.checklist-pct { font-size: 11px; color: var(--text-muted); }
.checklist-items { list-style: none; margin: 6px 0; }
.checklist-items li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.checklist-item-text {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 13px;
  font-family: inherit;
  background: transparent;
}
.checklist-item-text:hover { background: rgba(9, 30, 66, 0.05); }
.checklist-item-text:focus { outline: none; border-color: var(--accent); background: #fff; }
.checklist-item-text.done { text-decoration: line-through; color: var(--text-muted); }
.checklist-item-del {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
}
.checklist-item-del:hover { background: rgba(9, 30, 66, 0.12); color: var(--danger); }
.checklist-add input {
  width: 100%;
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: inherit;
}

/* ---------- Archive list ---------- */
.archive-list { list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.archive-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--list-bg);
  border-radius: 6px;
  padding: 10px 12px;
}
.archive-info { flex: 1; min-width: 0; }
.archive-title { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-sub { font-size: 12px; color: var(--text-muted); }
.archive-empty { color: var(--text-muted); font-size: 14px; padding: 8px 2px; background: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #172b4d;
  color: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 200;
  font-size: 14px;
}
.toast button {
  background: none;
  border: none;
  color: #7cc0ff;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
}
.toast button:hover { text-decoration: underline; }

.add-card-btn, .add-list-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 8px 12px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.add-card-btn { margin: 0 8px 8px; }
.add-card-btn:hover, .add-list-btn:hover { background: rgba(9, 30, 66, 0.12); color: var(--text); }

.add-list {
  width: 280px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.24);
  border-radius: 8px;
}
.add-list-btn { width: 100%; color: #fff; }
.add-list-btn:hover { background: rgba(255, 255, 255, 0.32); color: #fff; }

.composer { padding: 8px; }
.composer textarea {
  width: 100%;
  border: none;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  resize: none;
  box-shadow: var(--shadow);
  outline: 2px solid var(--accent);
}
.composer-actions { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.composer-actions .primary-btn { padding: 6px 14px; }
.composer-actions .cancel { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); }

/* ---------- Buttons ---------- */
.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.primary-btn:hover { background: #026aa7; }

.danger-btn {
  background: none;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.danger-btn:hover { background: var(--danger); color: #fff; }

.secondary-btn {
  background: rgba(9, 30, 66, 0.08);
  color: var(--text);
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}
.secondary-btn:hover { background: rgba(9, 30, 66, 0.16); }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 8vh;
  z-index: 100;
}
.modal {
  background: #fff;
  border-radius: 10px;
  width: min(640px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  padding: 22px;
  position: relative;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
.modal.modal-narrow { width: min(420px, 92vw); }
.modal-hint { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; }
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  color: var(--text-muted);
}
.modal-title-input {
  width: 100%;
  font-size: 18px;
  font-weight: 700;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 16px;
  font-family: inherit;
  color: var(--text);
}
.modal-title-input:focus { border-color: var(--accent); outline: none; }
.modal-label { display: block; font-size: 13px; font-weight: 700; color: var(--text-muted); margin-bottom: 6px; }
.modal-desc {
  width: 100%;
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  color: var(--text);
}
.modal-desc:focus { border-color: var(--accent); outline: none; }
.modal-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.modal-actions .danger-btn { margin-left: auto; }

/* Generic prompt / confirm / alert dialog */
#dialogModal .modal-heading { margin-bottom: 10px; }
#dialogModal .modal-actions { margin-top: 16px; }
#dialogMessage { white-space: pre-wrap; margin-bottom: 12px; }
.dialog-input {
  width: 100%;
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
}
.dialog-input:focus { border-color: var(--accent); outline: none; }

/* ---------- Misc ---------- */
.empty-state {
  color: #fff;
  opacity: 0.85;
  padding: 40px;
  font-size: 15px;
}

/* ---------- Topbar menu ---------- */
.menu-wrap { position: relative; }
.menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 210px;
  background: #fff;
  color: var(--text);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
  padding: 6px;
  z-index: 80;
  display: flex;
  flex-direction: column;
}
.menu-panel button {
  background: none;
  border: none;
  text-align: left;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}
.menu-panel button:hover { background: rgba(9, 30, 66, 0.08); }
.menu-panel .menu-danger { color: var(--danger); }
.menu-panel .menu-danger:hover { background: rgba(235, 90, 70, 0.12); }
.menu-sep { height: 1px; background: rgba(9, 30, 66, 0.12); margin: 4px 0; }

/* ---------- Modal side sections ---------- */
.modal-side > .modal-label { margin-top: 18px; }
.modal-side > .modal-label:first-child { margin-top: 0; }

.label-row { flex-wrap: wrap; }
.label-swatch-btn {
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 4px;
  flex-shrink: 0;
  cursor: pointer;
}
.label-del {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}
.label-del:hover { background: rgba(235, 90, 70, 0.14); color: var(--danger); }
.swatch-menu {
  flex-basis: 100%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 6px;
  background: rgba(9, 30, 66, 0.05);
  border-radius: 6px;
}
.swatch-menu button {
  height: 24px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
}
.swatch-menu button.sel { border-color: var(--text); }

/* ---------- Cover picker ---------- */
.cover-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.cover-swatch {
  width: 34px;
  height: 24px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(9, 30, 66, 0.06);
}
.cover-swatch.sel { border-color: var(--text); }
.cover-none { width: auto; padding: 0 8px; }

/* ---------- Due & move editors ---------- */
.due-inputs { display: flex; gap: 6px; flex-wrap: wrap; }
.due-editor input[type="time"] {
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
}
.move-editor { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.move-editor select {
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  background: #fff;
}
.card-meta { font-size: 12px; color: var(--text-muted); margin-top: 8px; }

/* ---------- Shortcuts ---------- */
.shortcuts { display: flex; flex-direction: column; gap: 8px; }
.shortcuts > div { display: flex; align-items: baseline; gap: 12px; }
.shortcuts dt { flex-shrink: 0; width: 140px; }
.shortcuts dd { font-size: 13px; color: var(--text-muted); }
kbd {
  display: inline-block;
  padding: 1px 6px;
  font: inherit;
  font-size: 12px;
  border: 1px solid rgba(9, 30, 66, 0.3);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #f4f5f7;
}

/* ---------- Calendar ---------- */
.modal.modal-wide { width: min(900px, 94vw); }
.cal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.cal-topbar .modal-heading { margin-bottom: 0; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-month { font-weight: 700; font-size: 14px; margin-left: 6px; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-dow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0;
}
.cal-cell {
  min-height: 96px;
  background: var(--list-bg);
  border-radius: 6px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow: hidden;
}
.cal-cell.cal-outside { opacity: 0.45; }
.cal-cell.cal-today { outline: 2px solid var(--accent); }
.cal-daynum { font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 2px 4px; }
.cal-today .cal-daynum { color: var(--accent); }
.cal-card {
  text-align: left;
  border: none;
  border-left: 3px solid var(--accent);
  background: rgba(9, 30, 66, 0.06);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-card:hover { background: rgba(9, 30, 66, 0.14); }
.cal-card.due-overdue { border-left-color: #ae2a19; }
.cal-card.due-today,
.cal-card.due-soon { border-left-color: #a15c07; }
.cal-card.due-done { border-left-color: #1f6e43; text-decoration: line-through; color: var(--text-muted); }

@media (max-width: 720px) {
  .cal-cell { min-height: 64px; }
  .cal-card { font-size: 11px; padding: 2px 4px; }
  .modal-grid { flex-direction: column; }
  .modal-side { width: 100%; }
  .modal-side > .modal-label:first-child { margin-top: 18px; }
  .filter-panel { width: min(280px, 90vw); }
  .shortcuts dt { width: 110px; }
}

@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; }
  .sidebar { position: absolute; z-index: 50; height: calc(100% - 48px); }
  .list, .add-list { width: 84vw; }
}

/* ---------- Markdown description ---------- */
.modal-hint-inline { font-weight: 400; font-size: 11px; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

.modal-desc-rendered {
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  min-height: 44px;
  cursor: text;
  background: rgba(9, 30, 66, 0.04);
  color: var(--text);
}
.modal-desc-rendered:hover { background: rgba(9, 30, 66, 0.07); }
.modal-desc-rendered:focus { outline: 2px solid var(--accent); }
.modal-desc-rendered > *:first-child { margin-top: 0; }
.modal-desc-rendered > *:last-child { margin-bottom: 0; }
.modal-desc-rendered p { margin: 0 0 8px; }
.modal-desc-rendered h1, .modal-desc-rendered h2, .modal-desc-rendered h3,
.modal-desc-rendered h4, .modal-desc-rendered h5, .modal-desc-rendered h6 { margin: 12px 0 6px; font-size: 15px; }
.modal-desc-rendered ul, .modal-desc-rendered ol { margin: 0 0 8px; padding-left: 20px; }
.modal-desc-rendered code {
  background: rgba(9, 30, 66, 0.1);
  border-radius: 3px;
  padding: 1px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.modal-desc-rendered a { color: var(--accent); }

/* ---------- Start / due fields ---------- */
.due-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-muted); }

/* ---------- Calendar: start-date-only cards ---------- */
.cal-card.due-start { border-left-style: dashed; border-left-color: var(--text-muted); }

/* ---------- Auth screen ---------- */
.auth-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(150deg, #0079bf, #5067c5);
  z-index: 300;
}
.auth-card {
  width: min(380px, 100%);
  background: #fff;
  border-radius: 12px;
  padding: 28px 26px 22px;
  box-shadow: 0 16px 48px rgba(9, 30, 66, 0.4);
}
.auth-logo { font-weight: 800; font-size: 26px; letter-spacing: 0.5px; color: var(--accent); text-align: center; }
.auth-tagline { text-align: center; color: var(--text-muted); font-size: 13px; margin: 6px 0 20px; }
.auth-error {
  background: #ffe2dd;
  color: #ae2a19;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
}
#authError { margin-bottom: 14px; }
.auth-sso-btn { width: 100%; padding: 11px; font-size: 14px; }

/* ---------- Topbar user + read-only badge ---------- */
.ro-badge {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-radius: 10px;
  padding: 2px 8px;
}
.menu-user {
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 12px 4px;
  line-height: 1.4;
}
.menu-user strong { display: block; color: var(--text); font-size: 13px; }

/* ---------- Board list role hint ---------- */
.board-list li .board-role {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  background: rgba(9, 30, 66, 0.08);
  border-radius: 8px;
  padding: 1px 6px;
  flex-shrink: 0;
}
.board-swatch-btn {
  width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;
  border: none; padding: 0; cursor: pointer;
}
.board-swatch-menu {
  position: absolute;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 6px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3);
}
.board-swatch-menu button { width: 22px; height: 22px; border: 2px solid transparent; border-radius: 4px; cursor: pointer; }
.board-swatch-menu button.sel { border-color: var(--text); }

/* ---------- Share modal ---------- */
.share-add { display: flex; gap: 6px; margin-bottom: 12px; }
.share-add input[type="email"] {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 13px;
  font-family: inherit;
}
.share-add select {
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 7px 6px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}
.share-add-error { background: #ffe2dd; color: #ae2a19; border-radius: 6px; padding: 7px 10px; font-size: 13px; margin-bottom: 10px; }
.share-list { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.share-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--list-bg);
  border-radius: 6px;
  padding: 8px 10px;
}
.share-member { flex: 1; min-width: 0; }
.share-member .share-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-member .share-email { font-size: 12px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-list select {
  border: 1px solid rgba(9, 30, 66, 0.25);
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  background: #fff;
}
.share-role-static { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; color: var(--text-muted); }
.share-remove {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  font-size: 13px; padding: 2px 6px; border-radius: 3px;
}
.share-remove:hover { background: rgba(235, 90, 70, 0.14); color: var(--danger); }

/* ---------- Viewer (read-only) board ---------- */
.viewer-board .add-card-btn,
.viewer-board .add-list,
.viewer-board .drag-handle,
.viewer-board .list-menu-btn,
.viewer-board .list-count + .list-menu-btn { display: none !important; }
.viewer-board .list-title,
.viewer-board .card-title { cursor: default; }
#cardModal.viewer-modal .modal-actions,
#cardModal.viewer-modal #addLabelBtn,
#cardModal.viewer-modal #addChecklistBtn,
#cardModal.viewer-modal .move-editor,
#cardModal.viewer-modal #cardModalDueClear { display: none; }
#cardModal.viewer-modal input,
#cardModal.viewer-modal textarea,
#cardModal.viewer-modal select { pointer-events: none; background: rgba(9, 30, 66, 0.04); }
