/* ==========================================================================
   Shelf — a book tracker
   Design tokens, then layout, then components. No frameworks, no build step.
   ========================================================================== */

:root {
  --ink-950: #070b16;
  --ink-900: #0b1120;
  --ink-850: #101728;
  --ink-800: #151d31;
  --ink-750: #1a2340;
  --ink-700: #202b4a;
  --line: #26314f;
  --line-soft: #1c2540;

  --text: #e9eefb;
  --text-dim: #b3bfda;
  --muted: #8b98b8;
  --muted-2: #6b7796;

  --accent: #f2b544;
  --accent-soft: rgba(242, 181, 68, 0.14);
  --accent-line: rgba(242, 181, 68, 0.38);
  --violet: #8b6cff;
  --violet-soft: rgba(139, 108, 255, 0.16);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, 0.14);
  --sky: #4cc4f5;
  --sky-soft: rgba(76, 196, 245, 0.14);
  --danger: #ff6b81;
  --danger-soft: rgba(255, 107, 129, 0.14);
  --warn: #ffc861;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.55);

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: Iowan Old Style, "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

/* Component classes set `display`, which would otherwise override the UA rule
   for [hidden] — so state that explicitly. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 78% -10%, rgba(139, 108, 255, 0.16), transparent 60%),
    radial-gradient(900px 500px at 8% 0%, rgba(242, 181, 68, 0.10), transparent 55%),
    var(--ink-950);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

::selection { background: var(--accent-soft); color: #fff; }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--ink-700); background-clip: content-box; }

/* =========================================================== app shell === */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "brand topbar" "sidebar main";
  height: 100vh;
  height: 100dvh;
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent);
  min-height: 60px;
}

.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: linear-gradient(150deg, var(--accent), #e0762c);
  display: grid; place-items: center;
  color: #241a05; font-size: 15px; font-weight: 800;
  box-shadow: 0 2px 10px rgba(242, 181, 68, 0.35);
  flex: none;
}

.brand-name {
  font-family: var(--serif);
  font-size: 19px;
  letter-spacing: 0.2px;
  font-weight: 600;
}
.brand-name em { color: var(--accent); font-style: normal; }

.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11, 17, 32, 0.72);
  backdrop-filter: blur(12px);
  min-height: 60px;
  position: relative;
  z-index: 5;
}

.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line-soft);
  padding: 14px 12px 24px;
  overflow-y: auto;
  background: rgba(10, 15, 29, 0.55);
}

.main {
  grid-area: main;
  overflow-y: auto;
  padding: 20px 24px 80px;
  scroll-behavior: smooth;
}

/* =============================================================== search === */

.search {
  position: relative;
  flex: 1 1 320px;
  max-width: 460px;
}
.search input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--ink-850);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search input::placeholder { color: var(--muted-2); }
.search input:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--muted-2); pointer-events: none; font-size: 14px;
}
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border-radius: 6px; border: 0;
  background: transparent; color: var(--muted); display: none; place-items: center;
}
.search.has-value .search-clear { display: grid; }
.search-clear:hover { background: var(--ink-750); color: var(--text); }

/* ============================================================== buttons === */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--ink-800);
  color: var(--text);
  font-weight: 550;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, color 0.15s;
}
.btn:hover { background: var(--ink-750); border-color: var(--ink-700); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
  background: linear-gradient(180deg, #f7c463, var(--accent));
  border-color: #d99a2b;
  color: #241a05;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(242, 181, 68, 0.25);
}
.btn-primary:hover { background: linear-gradient(180deg, #ffd27a, #f5bd50); border-color: #e0a53a; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--ink-800); color: var(--text); }

.btn-danger { background: var(--danger-soft); border-color: rgba(255, 107, 129, 0.35); color: #ff9aa9; }
.btn-danger:hover { background: rgba(255, 107, 129, 0.22); }

.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn-icon { width: 38px; padding: 0; justify-content: center; }

.btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ============================================================== sidebar === */

.side-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted-2);
  font-weight: 700;
  padding: 14px 10px 6px;
  display: flex; align-items: center; justify-content: space-between;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  text-align: left;
  font-weight: 500;
  transition: background 0.13s, color 0.13s;
}
.nav-item:hover { background: var(--ink-800); color: var(--text); }
.nav-item[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--text);
  font-weight: 650;
}
.nav-dot { width: 8px; height: 8px; border-radius: 99px; flex: none; background: var(--muted-2); }
.nav-label { flex: 1 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--ink-800);
  border: 1px solid var(--line-soft);
  border-radius: 99px;
  padding: 0 7px;
  min-width: 22px;
  text-align: center;
}
.nav-item[aria-current="true"] .nav-count { background: rgba(0, 0, 0, 0.25); color: var(--text); }

.dot-want { background: var(--violet); }
.dot-reading { background: var(--accent); }
.dot-paused { background: var(--sky); }
.dot-finished { background: var(--ok); }
.dot-abandoned { background: var(--danger); }

.side-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 10px 2px;
}
.chip {
  border: 1px solid var(--line);
  background: var(--ink-850);
  color: var(--text-dim);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 12px;
  transition: all 0.13s;
}
.chip:hover { border-color: var(--ink-700); color: var(--text); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
  font-weight: 600;
}

.side-select {
  width: calc(100% - 20px);
  margin: 4px 10px 0;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--ink-850);
  padding: 0 8px;
}

/* ============================================================ stat cards === */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 0;
}
.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-family: var(--serif);
  font-size: 24px;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.stat-value small { font-size: 13px; color: var(--muted); font-family: var(--sans); }
.stat-sub { font-size: 11.5px; color: var(--muted); }

/* =============================================================== toolbar === */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.toolbar h1 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  margin: 0;
  letter-spacing: 0.1px;
}
.toolbar .count { color: var(--muted); font-size: 13px; }
.spacer { flex: 1 1 auto; }

.seg {
  display: inline-flex;
  background: var(--ink-850);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  height: 28px;
  padding: 0 11px;
  font-size: 12.5px;
  font-weight: 550;
}
.seg button[aria-pressed="true"] { background: var(--ink-700); color: var(--text); }

/* ================================================================= grid === */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 18px 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  border-radius: var(--radius);
  transition: transform 0.16s ease;
}
.card:hover { transform: translateY(-3px); }
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: var(--radius); }

.cover {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 6px 10px 10px 6px;
  overflow: hidden;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 12px 12px 20px;
  isolation: isolate;
}
/* the spine */
.cover::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 9px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.05));
  z-index: 2;
}
/* the sheen */
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.16), transparent 42%, rgba(0, 0, 0, 0.16));
  pointer-events: none;
  z-index: 1;
}
.cover-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.22;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.cover-author {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.cover-fav {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 3;
  font-size: 14px;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.6));
}
.cover-badge {
  position: absolute;
  left: 20px; bottom: 0; right: 0;
  z-index: 3;
  height: 4px;
  background: rgba(0, 0, 0, 0.35);
}
.cover-badge span { display: block; height: 100%; background: var(--accent); }

.card-meta { padding: 0 2px; }
.card-title {
  font-weight: 600;
  font-size: 13.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-author { color: var(--muted); font-size: 12px; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }

.pill {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 99px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill-want { background: var(--violet-soft); color: #b9a8ff; border-color: rgba(139, 108, 255, 0.3); }
.pill-reading { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.pill-paused { background: var(--sky-soft); color: #8fd8f7; border-color: rgba(76, 196, 245, 0.3); }
.pill-finished { background: var(--ok-soft); color: #7cf0bd; border-color: rgba(61, 220, 151, 0.3); }
.pill-abandoned { background: var(--danger-soft); color: #ff9aa9; border-color: rgba(255, 107, 129, 0.3); }

.tag {
  font-size: 11px;
  color: var(--muted);
  background: var(--ink-850);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 1px 6px;
}

.stars { display: inline-flex; gap: 1px; font-size: 11.5px; letter-spacing: 0.5px; color: var(--accent); }
.stars .off { color: var(--ink-700); }

.progress {
  height: 5px;
  border-radius: 99px;
  background: var(--ink-750);
  overflow: hidden;
  margin-top: 8px;
}
.progress > i {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), #f5d18a);
  border-radius: 99px;
  transition: width 0.3s ease;
}
.progress-label { font-size: 11px; color: var(--muted); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ================================================================ table === */

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  font-weight: 700;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: -20px;
  background: var(--ink-900);
  z-index: 2;
  white-space: nowrap;
}
.table th[data-sortable] { cursor: pointer; user-select: none; }
.table th[data-sortable]:hover { color: var(--text); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.table .t-title { font-weight: 600; }
.table .t-author { color: var(--muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .row-cover {
  width: 26px; height: 38px; border-radius: 3px 5px 5px 3px;
  box-shadow: var(--shadow-sm); flex: none;
}
.table .cell-title { display: flex; align-items: center; gap: 10px; }

/* ========================================================= empty state === */

.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.012);
}
.empty-art { font-size: 40px; margin-bottom: 10px; opacity: 0.85; }
.empty h2 { font-family: var(--serif); color: var(--text); font-size: 20px; margin: 0 0 6px; font-weight: 600; }
.empty p { margin: 0 auto 16px; max-width: 420px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ================================================================ modal === */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.72);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 50;
  animation: fade 0.14s ease;
}
.overlay[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } }

.modal {
  width: min(680px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  background: var(--ink-850);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 0.16s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(0.99); opacity: 0; } }
.modal-wide { width: min(880px, 100%); }

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
}
.modal-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  background: rgba(0, 0, 0, 0.16);
}

/* ================================================================= form === */

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  font-weight: 700;
  margin-bottom: 5px;
}
.field input, .field select, .field textarea {
  width: 100%;
  height: 38px;
  padding: 0 11px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--ink-900);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hint { font-size: 11.5px; color: var(--muted-2); margin-top: 4px; }
.err { font-size: 11.5px; color: #ff9aa9; margin-top: 4px; display: none; }
.err.show { display: block; }
.warn { font-size: 11.5px; color: var(--warn); margin-top: 4px; }

.seg-input { display: flex; gap: 6px; flex-wrap: wrap; }
.seg-input button {
  height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--ink-900);
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 550;
}
.seg-input button:hover { border-color: var(--ink-700); color: var(--text); }
.seg-input button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }

.star-input { display: flex; align-items: center; gap: 4px; }
.star-input button {
  border: 0; background: transparent; font-size: 20px; line-height: 1;
  color: var(--ink-700); padding: 0 1px; transition: color 0.1s, transform 0.1s;
}
.star-input button:hover { transform: scale(1.12); }
.star-input button.on { color: var(--accent); }
.star-input .clear-rating { font-size: 11.5px; color: var(--muted); margin-left: 8px; height: auto; }

/* ================================================================ detail === */

.detail-hero { display: flex; gap: 18px; align-items: flex-start; }
.detail-cover { width: 118px; flex: none; aspect-ratio: 2 / 3; }
.detail-meta { min-width: 0; flex: 1 1 auto; }
.detail-title { font-family: var(--serif); font-size: 22px; line-height: 1.22; margin: 0 0 3px; }
.detail-author { color: var(--text-dim); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; margin-top: 10px; }
.kv dt { color: var(--muted-2); }
.kv dd { margin: 0; }
.progress-editor { display: flex; align-items: center; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.progress-editor input { width: 92px; height: 34px; text-align: center; border-radius: 9px;
  border: 1px solid var(--line); background: var(--ink-900); padding: 0 8px; }
.notes-box {
  white-space: pre-wrap;
  background: var(--ink-900);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 11px 13px;
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 14px;
}
.section-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted-2); font-weight: 700; margin: 18px 0 8px;
}

/* ================================================================= chart === */

.chart { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(84px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.bar-row .name { color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 8px; border-radius: 99px; background: var(--ink-750); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--violet), #b39bff); }
.bar-row .val { color: var(--muted); font-variant-numeric: tabular-nums; }

.month-chart { display: flex; align-items: flex-end; gap: 6px; height: 108px; padding-top: 6px; }
.month-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 5px; min-width: 0; }
.month-bar {
  width: 100%;
  min-height: 3px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent), rgba(242, 181, 68, 0.35));
  transition: height 0.3s ease;
}
.month-bar.zero { background: var(--ink-750); }
.month-label { font-size: 10px; color: var(--muted-2); white-space: nowrap; }

/* ================================================================= toast === */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 80;
  pointer-events: none;
  width: min(520px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: var(--ink-800);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  animation: rise 0.2s ease;
  font-size: 13px;
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.toast-ok { border-color: rgba(61, 220, 151, 0.4); }
.toast-err { border-color: rgba(255, 107, 129, 0.45); }
.toast .msg { flex: 1 1 auto; min-width: 0; }
.toast button {
  border: 0; background: transparent; color: var(--accent);
  font-weight: 700; padding: 4px 6px; border-radius: 6px;
}
.toast button:hover { background: var(--accent-soft); }

/* ================================================================= misc === */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--ink-750);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  color: var(--text-dim);
}
.help-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; align-items: center; font-size: 13px; }
.help-list dt { text-align: right; }
.help-list dd { margin: 0; color: var(--text-dim); }
.import-area { min-height: 150px; font-family: var(--mono); font-size: 12px; }
.dropzone {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  transition: border-color 0.15s, background 0.15s;
}
.dropzone.drag { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }

/* =========================================================== responsive === */

@media (max-width: 880px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-areas: "brand" "topbar" "main";
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  .brand { border-right: 0; }
  .sidebar {
    display: none;
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    z-index: 60;
    background: var(--ink-900);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { display: block; }
  .main { padding: 16px 14px 70px; }
  .topbar { padding: 10px 14px; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px 12px; }
  .table th:nth-child(4), .table td:nth-child(4),
  .table th:nth-child(5), .table td:nth-child(5) { display: none; }
  .detail-hero { flex-direction: column; }
  .detail-cover { width: 104px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
