/* Hermes Kanban — Linear-inspired theme
   Near-black canvas, separation via luminance steps (no borders),
   single indigo accent, Inter with cv01/ss03 features. */

:root {
  --bg: #08090a;                 /* canvas */
  --bg-panel: #0f1011;           /* panels / elevated canvas */
  --bg-surface: #191a1b;         /* cards, modals, toasts */
  --bg-surface-hover: #202124;   /* card hover */
  --bg-subtle: rgba(255, 255, 255, 0.02);       /* columns, report cards */
  --bg-subtle-hover: rgba(255, 255, 255, 0.045);
  --bg-input: rgba(255, 255, 255, 0.04);
  --text-1: #f7f8f8;             /* primary */
  --text-2: #d0d6e0;             /* secondary */
  --text-3: #8a8f98;             /* muted */
  --text-4: #62666d;             /* faint */
  --accent: #5e6ad2;             /* brand indigo */
  --accent-bright: #7170ff;      /* interactive */
  --accent-hover: #828fff;
  --danger: #f2555a;
  --success: #27a644;
  --success-bright: #3ecf8e;
  --hairline: rgba(255, 255, 255, 0.06);
  --radius: 8px;
  --radius-sm: 6px;
  --shadow-dialog: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 16px 48px rgba(0, 0, 0, 0.55);
  --shadow-pop: 0 8px 24px rgba(0, 0, 0, 0.45);
  --ring: 0 0 0 2px rgba(113, 112, 255, 0.4);
}

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

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text-1);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv01", "ss03";
  font-size: 14.5px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  color-scheme: dark;
}

.hidden { display: none !important; }

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

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(8, 9, 10, 0.82);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
}

.logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.topbar-right { display: flex; align-items: center; gap: 12px; }

.save-indicator { font-size: 12px; color: var(--text-4); min-width: 88px; text-align: right; transition: color 0.15s; }
.save-indicator.saving { color: var(--text-2); }
.save-indicator.saved { color: var(--success-bright); }
.save-indicator.error { color: var(--danger); }

.role-badge {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-3);
  background: var(--bg-subtle-hover);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  user-select: none;
}

/* ---------- tabs ---------- */

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

.tab {
  border: none;
  background: transparent;
  color: var(--text-3);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  user-select: none;
}

.tab:hover { color: var(--text-1); background: var(--bg-subtle); }
.tab.active { color: var(--text-1); background: var(--bg-subtle-hover); }

/* ---------- views ---------- */

main { padding: 28px 24px 48px; }

.view { max-width: 100%; margin: 0 auto; }

/* ---------- auth (borderless, centered) ---------- */

.auth {
  max-width: 360px;
  margin: 13vh auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.auth-mark {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.auth-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 8px; }

.auth-sub {
  color: var(--text-3);
  font-size: 13.5px;
  line-height: 1.55;
  margin-bottom: 24px;
}

.auth-sub strong { color: var(--text-1); font-weight: 600; }

.auth-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-hint { color: var(--text-4); font-size: 12px; margin-top: 18px; }

.auth input[type="password"] {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-input);
  color: var(--text-1);
  font: inherit;
  font-size: 14px;
  outline: none;
  transition: box-shadow 0.12s, background 0.12s;
}

.auth input[type="password"]::placeholder { color: var(--text-4); }
.auth input[type="password"]:focus { box-shadow: var(--ring); background: rgba(255, 255, 255, 0.055); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, opacity 0.12s;
  user-select: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) { background: var(--bg-subtle-hover); color: var(--text-1); }
.btn:active:not(:disabled) { background: rgba(255, 255, 255, 0.07); }
.btn:disabled { opacity: 0.45; cursor: default; }

.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: #6a77dd; color: #fff; }
.btn.primary:active:not(:disabled) { background: #525fc0; }

.btn.ghost { background: transparent; }

.btn.white { background: #f7f8f8; color: #0b0c0e; }
.btn.white:hover:not(:disabled) { background: #ffffff; color: #0b0c0e; }
.btn.white:active:not(:disabled) { background: #e2e4e7; color: #0b0c0e; }

.btn.danger { color: var(--danger); }
.btn.danger:hover:not(:disabled) { background: rgba(242, 85, 90, 0.12); color: #ff7b80; }

.btn.wide { width: 100%; padding: 9px 12px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--text-4);
  cursor: pointer;
  border-radius: 5px;
  transition: color 0.12s, background 0.12s;
}

.icon-btn:hover { color: var(--text-1); background: rgba(255, 255, 255, 0.07); }

/* ---------- board ---------- */

.board {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 55vh;
}

.loading { color: var(--text-3); padding: 48px; text-align: center; width: 100%; font-size: 13.5px; }
.loading a { color: var(--accent-bright); text-decoration: none; }
.loading a:hover { text-decoration: underline; }

.column {
  flex: 0 0 292px;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
  transition: background 0.15s;
}

.column:hover { background: rgba(255, 255, 255, 0.028); }
.column.drag-over { background: rgba(255, 255, 255, 0.05); box-shadow: var(--ring); }

.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 10px 8px 14px;
}

.column-title {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.005em;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.column-count {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-4);
  font-variant-numeric: tabular-nums;
}

.column-actions { display: flex; gap: 1px; opacity: 0; transition: opacity 0.12s; }
.column:hover .column-actions { opacity: 1; }

.column-cards {
  padding: 4px 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  flex: 1;
  min-height: 48px;
}

.card {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 9px 11px;
  cursor: grab;
  transition: background 0.12s, transform 0.08s, opacity 0.15s;
}

.card:hover { background: var(--bg-surface-hover); }
.card:active { cursor: grabbing; }
.card.dragging { opacity: 0.4; transform: rotate(1.5deg) scale(0.98); }

.card-title {
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  line-height: 1.45;
  word-break: break-word;
}

.card-notes {
  margin-top: 4px;
  color: var(--text-3);
  font-size: 12.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  margin-top: 6px;
}

.card-priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1;
}

.card-priority::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.card-priority.p0 { color: var(--danger); }
.card-priority.p1 { color: var(--accent-bright); }
.card-priority.p2 { color: var(--text-4); }

.card-label {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: var(--text-3);
  background: var(--bg-input);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

.modal .card-meta { margin: 0 0 12px; }

.board-footer { display: flex; justify-content: center; margin-top: 12px; }

.drop-hint {
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
  color: var(--text-4);
  font-size: 12.5px;
  text-align: center;
  padding: 16px 10px;
  pointer-events: none;
}

.drop-indicator {
  height: 2px;
  border-radius: 1px;
  background: var(--accent-bright);
  box-shadow: 0 0 0 3px rgba(113, 112, 255, 0.14);
  margin: 2px 4px;
  flex: none;
  pointer-events: none;
}

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  animation: fade-in 0.12s ease-out;
}

.modal {
  width: min(420px, calc(100vw - 40px));
  background: var(--bg-surface);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow-dialog);
  animation: pop-in 0.13s ease-out;
}

.modal h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 16px; }

.modal-readonly-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.4;
  margin-bottom: 10px;
  word-break: break-word;
}

.modal-notes { margin-bottom: 4px; }

.modal-empty { color: var(--text-4); font-size: 13px; margin-bottom: 16px; }

.modal label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 12px;
}

.modal input[type="text"],
.modal textarea,
.modal select {
  width: 100%;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-input);
  color: var(--text-1);
  font: inherit;
  font-size: 13.5px;
  outline: none;
  resize: vertical;
  transition: box-shadow 0.12s, background 0.12s;
}

.modal input::placeholder, .modal textarea::placeholder { color: var(--text-4); }
.modal input:focus, .modal textarea:focus, .modal select:focus { box-shadow: var(--ring); background: rgba(255, 255, 255, 0.055); }

.modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.modal-actions .spacer { flex: 1; }

/* ---------- toasts ---------- */

.toast-root {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 100;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  box-shadow: var(--shadow-pop);
  animation: pop-in 0.15s ease-out;
  transition: opacity 0.25s, transform 0.25s;
  max-width: min(420px, calc(100vw - 40px));
}

.toast-success { color: var(--success-bright); }
.toast-error { color: var(--danger); }

.toast-out { opacity: 0; transform: translateY(6px); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.98) translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- daily reports ---------- */

.reports {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.reports-empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-3);
  font-size: 14px;
}

.reports-empty .muted { color: var(--text-4); margin-top: 6px; }

.report-card {
  background: var(--bg-subtle);
  border-radius: 10px;
  overflow: hidden;
}

.report-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px 6px;
}

.report-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.report-when { color: var(--text-4); font-size: 12px; white-space: nowrap; }

.report-section { padding: 14px 22px 20px; }

.report-section h3 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-4);
  margin-bottom: 10px;
}

/* ---------- stats tables ---------- */

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 12px;
}

.stats-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-4);
  font-weight: 600;
  padding: 6px 10px;
}

.stats-table td {
  padding: 8px 10px;
  vertical-align: top;
  color: var(--text-2);
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.stats-table tbody tr:first-child td { border-top: none; }
.stats-table tbody tr:hover td { background: rgba(255, 255, 255, 0.03); }

.stats-table .cell-name { font-weight: 500; color: var(--text-1); white-space: nowrap; }
.stats-table .cell-ver { color: var(--text-4); white-space: nowrap; }
.stats-table .cell-num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-4); }

/* ---------- status badges (dot + label) ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  color: var(--text-3);
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-new { color: var(--accent-bright); }
.badge-changed { color: var(--success-bright); }
.badge-unchanged { color: var(--text-4); }

/* ---------- markdown body ---------- */

.md { font-size: 13.5px; line-height: 1.65; color: var(--text-2); word-break: break-word; }

.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }

.md h1, .md h2, .md h3, .md h4 {
  margin: 16px 0 8px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.md h1 { font-size: 16px; }
.md h2 { font-size: 15px; }
.md h3 { font-size: 14px; }
.md h4 { font-size: 13.5px; }
.md h1:first-child, .md h2:first-child, .md h3:first-child, .md h4:first-child { margin-top: 0; }

.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin-bottom: 3px; }
.md li:last-child { margin-bottom: 0; }

.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 1px 5px;
  color: #b6c2ff;
}

.md pre {
  background: #0d0e10;
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 12px;
  overflow-x: auto;
}

.md pre code {
  background: transparent;
  padding: 0;
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
}

.md a { color: var(--accent-bright); text-decoration: none; }
.md a:hover { text-decoration: underline; }

.md hr {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin: 14px 0;
}

.md strong { color: var(--text-1); }

/* ---------- responsive ---------- */

@media (max-width: 640px) {
  main { padding: 20px 12px 40px; }
  .column { flex-basis: 80vw; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
  .report-head { flex-direction: column; gap: 2px; }
  .report-section { padding: 12px 16px 18px; }
  .stats-table { font-size: 12px; }
  .stats-table th, .stats-table td { padding: 5px 8px; }
}
