/* ===========================================================================
   Load Order Ledger — visual system
   Palette: cold slate + frost-blue accent, quest-log spines for status.
   Display face: Cormorant (carved, sharp serif) — used sparingly for titles.
   Body face: Inter. Data/versions: JetBrains Mono.
=========================================================================== */

:root {
  --bg: #10131a;
  --bg-raised: #171b24;
  --panel: #1b202b;
  --panel-hover: #212736;
  --border: #2a3140;
  --border-soft: #232a37;

  --text: #e8ecf4;
  --text-dim: #9aa4b8;
  --text-faint: #626c80;

  --accent: #5db6dd;
  --accent-dim: #3d7f9c;
  --accent-soft: rgba(93, 182, 221, 0.14);

  --status-add: #6fae7c;
  --status-add-soft: rgba(111, 174, 124, 0.16);
  --status-update: #dba449;
  --status-update-soft: rgba(219, 164, 73, 0.16);
  --status-remove: #c2604c;
  --status-remove-soft: rgba(194, 96, 76, 0.16);
  --status-todo: #8f93d4;
  --status-todo-soft: rgba(143, 147, 212, 0.16);
  --status-progress: #4fb8a0;
  --status-progress-soft: rgba(79, 184, 160, 0.16);
  --status-done: #5b6472;
  --status-done-soft: rgba(91, 100, 114, 0.16);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-modal: 0 24px 64px rgba(0, 0, 0, 0.55);

  --font-display: 'Cormorant', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
}

/* Theme palettes — palette-only adaptations of each named modlist's artwork. */
:root[data-theme="skyrim"] {
  --bg: #090a0b; --bg-raised: #111315; --panel: #17191b; --panel-hover: #202326;
  --border: #3a3d40; --border-soft: #292c2f; --text: #f0f1f2; --text-dim: #b5b8bb; --text-faint: #74787d;
  --accent: #e6e8eb; --accent-dim: #9ba0a5; --accent-soft: rgba(230, 232, 235, .12);
  --status-add: #aeb3b7; --status-update: #dedede; --status-remove: #8b8f93; --status-todo: #c2c5c8; --status-progress: #d5d8da; --status-done: #656a6e;
  --status-add-soft: rgba(174,179,183,.15); --status-update-soft: rgba(222,222,222,.13); --status-remove-soft: rgba(139,143,147,.14); --status-todo-soft: rgba(194,197,200,.14); --status-progress-soft: rgba(213,216,218,.13); --status-done-soft: rgba(101,106,110,.16);
}
:root[data-theme="joj"] {
  --bg: #130302; --bg-raised: #1d0806; --panel: #26100d; --panel-hover: #331510;
  --border: #5a2119; --border-soft: #3c1712; --text: #fff0ec; --text-dim: #e0aaa0; --text-faint: #986158;
  --accent: #ff5832; --accent-dim: #bd321c; --accent-soft: rgba(255,88,50,.14);
  --status-add: #b9cf73; --status-update: #ffae4c; --status-remove: #ff7358; --status-todo: #de82dc; --status-progress: #69d0bd; --status-done: #80615d;
  --status-add-soft: rgba(185,207,115,.15); --status-update-soft: rgba(255,174,76,.15); --status-remove-soft: rgba(255,115,88,.15); --status-todo-soft: rgba(222,130,220,.15); --status-progress-soft: rgba(105,208,189,.15); --status-done-soft: rgba(128,97,93,.16);
}
:root[data-theme="tot"] {
  --bg: #030914; --bg-raised: #071222; --panel: #0b1930; --panel-hover: #102342;
  --border: #173d70; --border-soft: #112a4c; --text: #edf5ff; --text-dim: #a8c9f4; --text-faint: #668ab8;
  --accent: #4e9cff; --accent-dim: #2864be; --accent-soft: rgba(78,156,255,.14);
  --status-add: #82ce9c; --status-update: #f0be55; --status-remove: #ed6a65; --status-todo: #a68bf7; --status-progress: #59c9e5; --status-done: #526b89;
  --status-add-soft: rgba(130,206,156,.15); --status-update-soft: rgba(240,190,85,.15); --status-remove-soft: rgba(237,106,101,.15); --status-todo-soft: rgba(166,139,247,.15); --status-progress-soft: rgba(89,201,229,.15); --status-done-soft: rgba(82,107,137,.16);
}
:root[data-theme="mom"] {
  --bg: #160b02; --bg-raised: #241304; --panel: #301a06; --panel-hover: #40230a;
  --border: #6f4211; --border-soft: #482b0c; --text: #fff5df; --text-dim: #e8c78d; --text-faint: #a47c42;
  --accent: #f7af35; --accent-dim: #c97712; --accent-soft: rgba(247,175,53,.15);
  --status-add: #9fcf6d; --status-update: #ffe178; --status-remove: #ed7652; --status-todo: #d9a0e1; --status-progress: #67d1b5; --status-done: #80653e;
  --status-add-soft: rgba(159,207,109,.15); --status-update-soft: rgba(255,225,120,.15); --status-remove-soft: rgba(237,118,82,.15); --status-todo-soft: rgba(217,160,225,.15); --status-progress-soft: rgba(103,209,181,.15); --status-done-soft: rgba(128,101,62,.16);
}
:root[data-theme="dod"] {
  --bg: #100514; --bg-raised: #19081f; --panel: #24102d; --panel-hover: #32143f;
  --border: #58236d; --border-soft: #391646; --text: #f9edff; --text-dim: #d7afe7; --text-faint: #9160a4;
  --accent: #c366f3; --accent-dim: #8437ad; --accent-soft: rgba(195,102,243,.14);
  --status-add: #9bcf77; --status-update: #f1bd5b; --status-remove: #eb727d; --status-todo: #dc8ef2; --status-progress: #66d3c1; --status-done: #795785;
  --status-add-soft: rgba(155,207,119,.15); --status-update-soft: rgba(241,189,91,.15); --status-remove-soft: rgba(235,114,125,.15); --status-todo-soft: rgba(220,142,242,.15); --status-progress-soft: rgba(102,211,193,.15); --status-done-soft: rgba(121,87,133,.16);
}
:root[data-theme="vov"] {
  --bg: #03131b; --bg-raised: #071e28; --panel: #0b2a36; --panel-hover: #103947;
  --border: #216579; --border-soft: #164355; --text: #effdff; --text-dim: #b1e1e8; --text-faint: #6da8b5;
  --accent: #57dcea; --accent-dim: #268e9e; --accent-soft: rgba(87,220,234,.14);
  --status-add: #82d8a5; --status-update: #f0ce65; --status-remove: #ed7774; --status-todo: #a994ef; --status-progress: #5ce2e5; --status-done: #56818b;
  --status-add-soft: rgba(130,216,165,.15); --status-update-soft: rgba(240,206,101,.15); --status-remove-soft: rgba(237,119,116,.15); --status-todo-soft: rgba(169,148,239,.15); --status-progress-soft: rgba(92,226,229,.15); --status-done-soft: rgba(86,129,139,.16);
}
:root[data-theme="hoh"] {
  --bg: #091103; --bg-raised: #111c08; --panel: #19280d; --panel-hover: #243817;
  --border: #486b24; --border-soft: #304717; --text: #f2fae7; --text-dim: #c4dca5; --text-faint: #829b66;
  --accent: #a1cf48; --accent-dim: #638a26; --accent-soft: rgba(161,207,72,.14);
  --status-add: #a4d36e; --status-update: #e8c55f; --status-remove: #e8755b; --status-todo: #b28cde; --status-progress: #65cfa2; --status-done: #61774b;
  --status-add-soft: rgba(164,211,110,.15); --status-update-soft: rgba(232,197,95,.15); --status-remove-soft: rgba(232,117,91,.15); --status-todo-soft: rgba(178,140,222,.15); --status-progress-soft: rgba(101,207,162,.15); --status-done-soft: rgba(97,119,75,.16);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

body {
  background-image:
    radial-gradient(ellipse 900px 500px at 15% -10%, rgba(93, 182, 221, 0.06), transparent),
    radial-gradient(ellipse 700px 500px at 100% 0%, rgba(219, 164, 73, 0.04), transparent);
  background-attachment: fixed;
}

@media (prefers-reduced-motion: no-preference) {
  .btn, .card, .modal, .modal-overlay { transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease, opacity 0.15s ease; }
}

img { max-width: 100%; display: block; }

/* The `hidden` attribute must always win, even over components (modal, grid,
   banner) that set their own unconditional `display` value below — without
   this, elements toggled via `.hidden = true/false` in JS never actually
   hide, since author rules of equal specificity beat the browser's default
   `[hidden] { display: none }` UA rule. */
[hidden] { display: none !important; }

button, input, select, textarea { font-family: inherit; color: inherit; }

a { color: var(--accent); }

.app {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 24px 64px;
}

/* ------------------------------- Topbar --------------------------------- */

.topbar {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 0;
  border-bottom: 0;
  margin-bottom: 18px;
}

.topbar__identity { margin-right: 8px; }

.topbar__eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-dim);
  margin-bottom: 2px;
}

.topbar__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 40px;
  line-height: 1;
  margin: 0;
  letter-spacing: 0.01em;
}
.topbar__byline {
  display: block;
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 11px;
  letter-spacing: .08em;
}

.topbar__stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.topbar__stats span { white-space: nowrap; }
.topbar__stats b { color: var(--text); font-weight: 600; }

.topbar__actions {
  order: 1;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  width: 220px;
  outline: none;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.view-toggle {
  order: 2;
  width: 100%;
  display: flex;
  gap: 22px;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 2px 0 0;
}
.view-toggle__btn {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 10px 1px 11px;
  background: transparent;
  color: var(--text-dim);
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.view-toggle__btn:hover { color: var(--text); }
.view-toggle__btn.active { color: var(--accent); border-bottom-color: var(--accent); }

/* -------------------------------- Buttons -------------------------------- */

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 16px;
  cursor: pointer;
  white-space: nowrap;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn--primary { background: var(--accent); color: #0b1218; border-color: var(--accent); }
.btn--primary:hover { background: #74c2e5; }

.btn--secondary { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-dim); }
.btn--secondary:hover { background: rgba(93, 182, 221, 0.22); }

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

.btn--danger { background: transparent; color: var(--status-remove); border-color: var(--status-remove); }
.btn--danger:hover { background: var(--status-remove-soft); }

.btn--small { padding: 6px 10px; font-size: 12px; }

/* -------------------------------- Filters --------------------------------- */

.filterbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-pill {
  font-family: var(--font-mono);
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.filter-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.filter-pill:hover { border-color: var(--text-faint); color: var(--text); }
.filter-pill.active { background: var(--accent-soft); border-color: var(--accent-dim); color: var(--text); }

/* -------------------------------- Banner --------------------------------- */

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--status-update-soft);
  border: 1px solid rgba(219, 164, 73, 0.35);
  color: #f0d9a8;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 18px;
}

/* --------------------------------- Grid ----------------------------------- */

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

/* --------------------------------- Card ------------------------------------ */

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.card:hover { border-color: var(--border); background: var(--panel-hover); transform: translateY(-2px); }

.card__spine {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
}

.card__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(160deg, #1c222d, #12161d);
  overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; }
.card__media .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 34px;
  color: var(--text-faint);
}

.card__flag {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 22px 4px 9px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
  border: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 11px top 55%, right 7px top 55%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.card__flag:hover { filter: brightness(1.15); }
.card__flag option { background: var(--bg-raised); color: var(--text); }

.card__priority {
  position: absolute;
  top: 10px; right: 10px;
  font-size: 13px;
}

.card__body {
  padding: 13px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
}

.card__title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.2;
  margin: 0;
}

.card__author {
  font-size: 12px;
  color: var(--text-faint);
  margin: -3px 0 0;
}

.card__versions {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.card__versions .arrow { color: var(--text-faint); }
.card__versions .diff { color: var(--status-update); font-weight: 600; }

.card__notes {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 1.4em;
}

.card__checklist {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
}

.card__footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--border-soft);
}

.card__footer a {
  font-size: 12px;
  text-decoration: none;
  color: var(--text-dim);
}
.card__footer a:hover { color: var(--accent); }
.manager-download, .table-manager-download {
  border: 0; background: transparent; color: var(--accent); cursor: pointer;
  font-weight: 600; padding: 4px 0; text-align: left;
}
.manager-download { font-size: 12px; }
.manager-download:hover, .table-manager-download:hover { color: #8dd4f2; }

.card__footer-actions { display: flex; gap: 4px; }
.card__icon-btn {
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; font-size: 14px; padding: 4px 6px; border-radius: 4px;
}
.card__icon-btn:hover { color: var(--text); background: var(--border-soft); }

/* -------------------------------- Empty state ------------------------------ */

.empty {
  text-align: center;
  padding: 90px 20px;
  color: var(--text-dim);
}
.empty__rune { font-size: 28px; color: var(--accent-dim); margin-bottom: 6px; }
.empty h2 { font-family: var(--font-display); font-size: 26px; color: var(--text); margin: 0 0 6px; }
.empty p { max-width: 420px; margin: 0 auto 18px; font-size: 14px; }

/* -------------------------------- Table view -------------------------------- */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: var(--panel);
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  min-width: 760px;
}

.ledger-table thead th {
  text-align: left;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 500;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.sort-header {
  display: inline-flex; align-items: center; gap: 5px; padding: 0;
  border: 0; background: none; color: inherit; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.sort-header:hover, th.sorted .sort-header { color: var(--accent); }
.sort-indicator { width: 10px; color: var(--accent); font-size: 12px; }
.th-flag { width: 128px; }
.th-mod { min-width: 260px; }
.th-actions { width: 48px; }

.ledger-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.table-row { cursor: pointer; }
.table-row:hover { background: var(--panel-hover); }

.table-cell-flag { width: 128px; }

.quick-status {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.03em;
  border: none;
  border-radius: 999px;
  padding: 5px 22px 5px 10px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 11px top 55%, right 7px top 55%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
.quick-status option { background: var(--bg-raised); color: var(--text); }

.table-cell-mod { display: flex; align-items: center; gap: 10px; min-width: 240px; }

.expand-btn {
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; font-size: 11px; width: 16px; flex-shrink: 0;
  padding: 0;
}
.expand-btn:hover:not(.empty) { color: var(--text); }
.expand-btn.empty { cursor: default; }

.table-thumb {
  width: 40px; height: 30px; object-fit: cover;
  border-radius: 4px; flex-shrink: 0;
  background: var(--bg-raised);
}
.table-thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); color: var(--text-faint); font-size: 15px;
}

.table-mod-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.table-mod-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.table-mod-author { font-size: 11.5px; color: var(--text-faint); }
.table-manager-download { align-self: flex-start; font-size: 10.5px; }

/* -------------------------- Mod-manager file picker ------------------------- */

.download-picker__intro { margin: -4px 0 12px; color: var(--text-dim); font-weight: 600; }
#downloadModal .modal {
  height: min(760px, calc(100dvh - 80px));
  display: flex; flex-direction: column; overflow: hidden;
}
#downloadModal .modal__header { flex: 0 0 auto; }
#downloadModal .modal__body {
  display: flex; flex: 1; min-height: 0; flex-direction: column;
}
#downloadModal .modal__footer { flex: 0 0 auto; }
.download-picker {
  display: flex; flex: 1; min-height: 160px; flex-direction: column; gap: 12px;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding-right: 6px;
  scrollbar-width: thin; scrollbar-color: var(--text-faint) var(--bg-raised);
}
.download-picker::-webkit-scrollbar { width: 9px; }
.download-picker::-webkit-scrollbar-track { background: var(--bg-raised); border-radius: 999px; }
.download-picker::-webkit-scrollbar-thumb { background: var(--text-faint); border: 2px solid var(--bg-raised); border-radius: 999px; }
.download-picker::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
.download-group {
  flex: 0 0 auto;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  overflow: hidden; background: var(--panel);
}
.download-group summary {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--bg-raised); color: var(--text-dim); cursor: pointer;
  font: 600 11px var(--font-mono); letter-spacing: .055em; text-transform: uppercase;
}
.download-group summary:hover { color: var(--text); }
.download-group summary::marker { color: var(--text-faint); }
.download-group__count { margin-left: auto; min-width: 20px; padding: 2px 6px; border-radius: 999px; background: var(--border-soft); color: var(--text-faint); text-align: center; font-size: 9px; }
.download-group__files { display: flex; flex-direction: column; gap: 6px; padding: 7px; }
.download-group--old summary { color: var(--text-faint); }
.download-file {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); text-align: left; cursor: pointer;
}
.download-file:hover, .download-file:focus-visible { border-color: var(--accent-dim); background: var(--panel-hover); outline: none; }
.download-file.primary { border-left: 3px solid var(--status-add); padding-left: 10px; }
.download-file__main { display: flex; flex: 1; min-width: 0; flex-direction: column; gap: 4px; }
.download-file__main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.download-file__main span { color: var(--text-faint); font: 10.5px var(--font-mono); }
.download-file__badge { padding: 3px 7px; border-radius: 999px; color: var(--status-add); background: var(--status-add-soft); font: 9px var(--font-mono); text-transform: uppercase; }
.download-file__arrow { color: var(--accent); font-size: 18px; }
.download-picker__loading, .download-picker__error { padding: 24px 12px; color: var(--text-faint); text-align: center; }
.download-picker__hint { margin-top: 12px; }
.dependency-download {
  display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto;
  border: 0; border-radius: 4px; padding: 3px 5px;
  background: var(--accent-soft); color: var(--accent); cursor: pointer;
  font: 10px var(--font-mono); white-space: nowrap;
}
.dependency-download:hover { background: rgba(93, 182, 221, .24); }
.dependency-download--editor { margin-left: auto; }

.mono { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
.mono.diff { color: var(--status-update); font-weight: 600; }

.priority-tag { font-size: 12px; color: var(--text-dim); text-transform: capitalize; }
.table-cell-muted { color: var(--text-faint); font-size: 12px; text-transform: capitalize; }

.table-cell-notes { max-width: 260px; }
.table-cell-actions { width: 48px; text-align: right; }
.table-delete-btn {
  border: 0; background: transparent; color: var(--text-faint); cursor: pointer;
  padding: 5px 4px; border-radius: 4px; font-size: 14px;
}
.table-delete-btn:hover { color: var(--status-remove); background: var(--status-remove-soft); }
.table-notes-text {
  display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px; font-size: 12.5px; color: var(--text-dim);
}
.table-checklist-count {
  display: block; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); margin-top: 2px;
}

.table-checklist-row td { background: var(--bg-raised); padding: 10px 14px 14px 44px; }
.table-checklist {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.table-checklist li {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-dim);
}
.table-checklist li.done .label { text-decoration: line-through; color: var(--text-faint); }
.table-checklist li.dependency img, .table-checklist li.dependency .thumb-placeholder {
  width: 24px; height: 24px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  background: var(--panel);
}
.table-checklist li.dependency .thumb-placeholder {
  display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 12px;
}
.table-checklist .ver { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.table-checklist li a { text-decoration: none; color: var(--text-faint); font-size: 12px; }
.table-checklist li a:hover { color: var(--accent); }
.table-checklist .label { flex: 1; }

.table-empty { padding: 32px 14px; color: var(--text-faint); text-align: center; }

/* --------------------------------- Modal ----------------------------------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(6, 8, 12, 0.72);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  overflow-y: auto;
  z-index: 100;
}

.modal {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 560px;
  box-shadow: var(--shadow-modal);
}
.modal--narrow { max-width: 460px; }

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-soft);
}
.modal__header h2 { font-family: var(--font-display); font-size: 24px; margin: 0; font-weight: 600; }

.modal__close {
  background: none; border: none; color: var(--text-dim);
  font-size: 22px; cursor: pointer; line-height: 1; padding: 4px;
}
.modal__close:hover { color: var(--text); }

.modal__body { padding: 20px; }

.modal__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}
.modal__footer-right { display: flex; gap: 8px; margin-left: auto; }

/* --------------------------------- Forms ------------------------------------ */

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; flex: 1; }
.field span { font-size: 12.5px; color: var(--text-dim); font-weight: 500; }
.field span em { font-style: normal; color: var(--text-faint); font-size: 11.5px; }
.field-label { font-size: 12.5px; color: var(--text-dim); font-weight: 500; display: block; margin-bottom: 6px; }

.field input, .field select, .field textarea,
.fetch-panel__row input {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, .fetch-panel__row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; font-family: var(--font-body); }

.field-row { display: flex; gap: 12px; }
.field-row .field { min-width: 0; }

.preview-row { display: flex; gap: 14px; margin-bottom: 4px; }
.preview-image {
  width: 96px; height: 72px; border-radius: var(--radius-sm);
  object-fit: cover; background: var(--panel); border: 1px solid var(--border-soft);
  flex-shrink: 0;
}
.preview-row__fields { flex: 1; }

.fetch-panel {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 18px;
}
.fetch-panel__label { font-size: 12.5px; color: var(--text-dim); margin: 0 0 8px; font-weight: 500; }
.fetch-panel__label .hint { display: block; color: var(--text-faint); font-weight: 400; margin-top: 2px; font-size: 11.5px; }
.fetch-panel__row { display: flex; gap: 8px; }
.fetch-panel__row input:first-child { max-width: 190px; }
.fetch-panel__status { font-size: 12.5px; margin: 8px 0 0; color: var(--text-dim); min-height: 1em; }
.fetch-panel__status.error { color: var(--status-remove); }
.fetch-panel__status.success { color: var(--status-add); }

.hint { font-size: 12px; color: var(--text-faint); margin: -6px 0 14px; }
.hint code { font-family: var(--font-mono); background: var(--panel); padding: 1px 5px; border-radius: 4px; }

.checklist-editor { margin-bottom: 14px; }
.checklist-editor ul { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.checklist-editor li {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm); padding: 7px 9px; font-size: 13.5px;
}
.checklist-editor li span { flex: 1; }
.checklist-editor li.done span { text-decoration: line-through; color: var(--text-faint); }
.checklist-editor li button { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 15px; }
.checklist-editor li button:hover { color: var(--status-remove); }
.checklist-editor li .dependency-download {
  display: inline-flex; align-items: center; gap: 3px;
  margin-left: auto; padding: 3px 5px; border-radius: 4px;
  background: var(--accent-soft); color: var(--accent); font: 10px var(--font-mono);
}
.checklist-editor li .dependency-download:hover { background: rgba(93, 182, 221, .24); color: var(--accent); }
.checklist-editor__add { display: flex; gap: 8px; }
.checklist-editor__add--dependency { margin-top: 8px; }

.checklist-dependency { }
.checklist-editor li.checklist-dependency { gap: 10px; }
.checklist-dependency__thumb {
  width: 30px; height: 30px; border-radius: 5px; object-fit: cover; flex-shrink: 0;
  background: var(--bg-raised);
}
.checklist-dependency__thumb.placeholder {
  display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 13px;
}
.checklist-dependency__info { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.checklist-dependency__name { font-size: 13.5px; }
.checklist-dependency__version { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-faint); }
.checklist-dependency a { color: var(--text-faint); text-decoration: none; font-size: 13px; }
.checklist-dependency a:hover { color: var(--accent); }

.dep-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* -------------------------------- Capabilities (settings) -------------------- */

.capabilities-list {
  margin-bottom: 8px;
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}
.capabilities-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: var(--panel);
  font-size: 13px;
}
.capabilities-table th, .capabilities-table td {
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-soft);
}
.capabilities-table th {
  color: var(--text-faint);
  font: 10px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: .05em;
  background: var(--bg-raised);
}
.capabilities-table th:first-child { width: 74px; }
.capabilities-table th:last-child { width: 34px; }
.capabilities-table tbody tr:last-child td { border-bottom: 0; }
.capability-cell--enabled { text-align: left !important; }
.capability-cell--enabled input { display: block; margin: 0; cursor: pointer; }
.capability-row__label { color: var(--text-dim); }
.capability-row__keyword {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}
.capability-cell--action { padding-left: 2px !important; padding-right: 8px !important; }
.capability-cell--action button {
  background: none; border: none; color: var(--text-faint);
  cursor: pointer; font-size: 15px; padding: 0 2px;
}
.capability-cell--action button:hover { color: var(--status-remove); }
.capabilities-empty { color: var(--text-faint); text-align: center !important; padding: 18px !important; }
.help-tip {
  display: inline-grid; place-items: center; width: 15px; height: 15px;
  margin-left: 3px; border: 1px solid var(--text-faint); border-radius: 50%;
  font: 10px var(--font-body); color: var(--text-dim); cursor: help;
  text-transform: none; vertical-align: 1px;
}
.help-tip:hover, .help-tip:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.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; }
.capabilities-add { display: flex; gap: 8px; }
.capabilities-add input { flex: 1; }

/* -------------------------------- Theme picker ------------------------------ */

.theme-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.theme-option {
  display: flex; align-items: center; gap: 9px; min-width: 0; padding: 9px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); cursor: pointer; text-align: left;
}
.theme-option:hover { border-color: var(--accent-dim); background: var(--panel-hover); }
.theme-option.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-option__swatches { display: flex; flex: 0 0 auto; overflow: hidden; border-radius: 5px; }
.theme-option__swatches i { display: block; width: 9px; height: 25px; }
.theme-option__copy { display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.theme-option__copy strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-option__copy small { color: var(--text-faint); font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ------------------------------ Kodex updates ------------------------------ */

.updates-panel { width: 100%; }
.updates-panel__header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 14px;
}
.updates-panel__header h2 { margin: 2px 0 4px; font-family: var(--font-display); font-size: 30px; }
.updates-panel__header p { max-width: 690px; margin: 0; color: var(--text-dim); font-size: 13px; line-height: 1.55; }
.updates-panel__actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-shrink: 0; }
.kodex-file-button { cursor: pointer; }
.btn:disabled { opacity: .48; cursor: not-allowed; }
.kodex-status { min-height: 22px; margin: 0 0 9px; color: var(--text-faint); font: 11px/1.5 var(--font-mono); }
.kodex-status.success { color: var(--status-done); }
.kodex-status.warning { color: var(--status-update); }
.kodex-status.error { color: var(--status-remove); }
.kodex-status.working { color: var(--accent); }
.kodex-progress {
  margin: 0 0 16px; padding: 13px 15px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-sm);
  background: var(--panel);
}
.kodex-progress__heading, .kodex-progress__details { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.kodex-progress__heading strong { color: var(--text); font-size: 12px; }
.kodex-progress__heading span { color: var(--accent); font: 600 11px var(--font-mono); }
.kodex-progress__track { height: 7px; margin: 10px 0 8px; overflow: hidden; border-radius: 999px; background: var(--bg); }
.kodex-progress__track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); transition: width .3s ease; }
.kodex-progress__details { color: var(--text-faint); font: 10px var(--font-mono); }
.kodex-progress__details time { flex-shrink: 0; }
.kodex-progress.is-complete .kodex-progress__track span { background: var(--status-done); }
.kodex-progress.is-complete .kodex-progress__heading span { color: var(--status-done); }
.kodex-progress.is-paused .kodex-progress__track span { background: var(--status-update); }
.kodex-progress.is-paused .kodex-progress__heading span { color: var(--status-update); }
.kodex-progress.is-failed { border-color: var(--status-remove); }
.kodex-progress.is-failed .kodex-progress__track span { background: var(--status-remove); }
.kodex-progress.is-indeterminate .kodex-progress__track span { width: 35% !important; animation: kodex-progress-scan 1.1s ease-in-out infinite; }
@keyframes kodex-progress-scan { from { transform: translateX(-110%); } to { transform: translateX(320%); } }
@media (prefers-reduced-motion: reduce) { .kodex-progress.is-indeterminate .kodex-progress__track span { animation: none; width: 100% !important; opacity: .55; } }
.kodex-summary {
  display: grid; grid-template-columns: minmax(260px, 1fr) repeat(5, minmax(88px, auto));
  margin-bottom: 16px; overflow: hidden;
  border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--panel);
}
.kodex-source, .kodex-stat { padding: 13px 16px; border-right: 1px solid var(--border-soft); }
.kodex-source { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.kodex-source strong { overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.kodex-source span { margin-top: 3px; color: var(--text-faint); font: 10px var(--font-mono); }
.kodex-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.kodex-stat:last-child { border-right: 0; }
.kodex-stat b { color: var(--text); font: 600 18px var(--font-mono); }
.kodex-stat span { color: var(--text-faint); font: 9px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.kodex-stat--updates b { color: var(--status-update); }
.kodex-stat--errors b { color: var(--status-remove); }
.kodex-stat--pending b { color: var(--accent); }
.kodex-inventory-controls {
  display: grid; grid-template-columns: minmax(260px, 420px) minmax(280px, 1fr);
  align-items: end; gap: 12px; margin: 0 0 13px;
}
.kodex-category-picker { display: flex; flex-direction: column; gap: 5px; }
.kodex-category-picker > span { color: var(--text-faint); font: 9px var(--font-mono); letter-spacing: .09em; text-transform: uppercase; }
.kodex-category-picker select, .kodex-inventory-search input {
  width: 100%; height: 39px; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); outline: none;
}
.kodex-category-picker select:focus, .kodex-inventory-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.kodex-inventory-search { position: relative; display: block; }
.kodex-inventory-search input { padding-right: 38px; }
.kodex-inventory-search button {
  position: absolute; top: 50%; right: 5px; width: 29px; height: 29px; transform: translateY(-50%);
  border: 0; border-radius: 6px; background: transparent; color: var(--text-faint); cursor: pointer; font-size: 18px;
}
.kodex-inventory-search button:hover { color: var(--text); background: var(--bg-raised); }
.kodex-list-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin: 0 0 10px;
}
.kodex-list-tabs { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.kodex-list-tabs button {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px;
  border: 1px solid transparent; border-radius: 999px; background: transparent;
  color: var(--text-dim); cursor: pointer; font: 11px var(--font-mono);
}
.kodex-list-tabs button:hover { color: var(--text); background: var(--panel); }
.kodex-list-tabs button.active { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-soft); }
.kodex-list-tabs button span { color: var(--text-faint); }
.kodex-list-count { color: var(--text-faint); font: 10px var(--font-mono); white-space: nowrap; }
.kodex-empty {
  padding: 68px 20px; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-dim);
}
.kodex-empty h3 { margin: 8px 0 6px; color: var(--text); font-family: var(--font-display); font-size: 24px; }
.kodex-empty p:not(.empty__rune) { max-width: 590px; margin: 0 auto 18px; font-size: 13px; line-height: 1.55; }
.kodex-table { min-width: 980px; }
.kodex-table .th-actions { width: 190px; }
.kodex-update-row:hover { background: var(--panel-hover); }
.kodex-priority { width: 72px; color: var(--text-faint); font-family: var(--font-mono); }
.kodex-disabled { color: var(--text-faint); font-size: 10.5px; }
.kodex-enabled { color: var(--text-faint); font-family: var(--font-mono); }
.kodex-enabled.is-enabled { color: var(--status-done); }
.kodex-separator-row td { background: var(--bg); color: var(--accent-dim); font: 600 10px var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.version-pill { color: var(--text-dim); font-family: var(--font-mono); font-size: 11.5px; white-space: nowrap; }
.version-pill--latest { color: var(--status-update); }
.kodex-status-badge { display: inline-block; border-radius: 999px; padding: 4px 8px; background: var(--bg-raised); color: var(--text-faint); font: 10px var(--font-mono); white-space: nowrap; }
.kodex-status-badge.status-current { color: var(--status-done); }
.kodex-status-badge.status-update { color: var(--status-update); background: var(--status-update-soft); }
.kodex-status-badge.status-deferred { color: var(--accent); background: var(--accent-soft); }
.kodex-status-badge.status-error { color: var(--status-remove); background: var(--status-remove-soft); }
.kodex-row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; white-space: nowrap; }
.kodex-row-actions a { color: var(--text-dim); font-size: 11px; text-decoration: none; }
.kodex-row-actions a:hover { color: var(--accent); }
.kodex-load-more { display: block; margin: 14px auto 0; }

/* -------------------------------- Scratchpad ------------------------------- */

.scratchpad { width: 100%; }
.scratchpad__header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px;
}
.scratchpad__header h2 { margin: 2px 0 0; font-family: var(--font-display); font-size: 30px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.note-card {
  position: relative; min-height: 180px; padding: 20px;
  background: linear-gradient(145deg, var(--bg-raised), var(--panel));
  border: 1px solid var(--border-soft); border-radius: var(--radius);
  cursor: pointer; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  transition: transform .16s ease, border-color .16s ease;
}
.note-card:hover, .note-card:focus-visible { transform: translateY(-2px); border-color: var(--accent-dim); outline: none; }
.note-card__pin { color: var(--accent); font-size: 12px; margin-bottom: 14px; }
.note-card h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 22px; }
.note-card p { margin: 0 0 22px; color: var(--text-dim); white-space: pre-wrap; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.note-card time { position: absolute; bottom: 16px; font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.notes-empty { grid-column: 1/-1; text-align: center; color: var(--text-dim); padding: 60px 20px; }
.notes-empty h3 { color: var(--text); font-family: var(--font-display); font-size: 24px; margin: 8px 0; }
.command-trigger { white-space: nowrap; }
kbd { font: 10px var(--font-mono); color: var(--text-faint); border: 1px solid var(--border); border-radius: 4px; padding: 2px 5px; background: var(--panel); }

/* -------------------------------- Go-to palette ---------------------------- */

.command-overlay {
  position: fixed; inset: 0; z-index: 300; padding: min(16vh, 130px) 18px 18px;
  background: rgba(5, 8, 12, .72); backdrop-filter: blur(5px);
}
.command-palette {
  width: min(640px, 100%); max-height: min(600px, 72vh); margin: 0 auto;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0,0,0,.55);
}
.command-palette__input { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); color: var(--accent); }
.command-palette__input input { flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 17px; }
.command-results { overflow-y: auto; padding: 8px; }
.command-result { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 8px; padding: 11px 12px; text-align: left; background: transparent; color: var(--text); cursor: pointer; }
.command-result.active { background: var(--accent-soft); }
.command-result__icon { width: 28px; height: 28px; display: grid; place-items: center; flex-shrink: 0; border-radius: 6px; background: var(--panel); color: var(--accent); }
.command-result__copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.command-result__copy strong, .command-result__copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.command-result__copy small { color: var(--text-faint); font-size: 12px; }
.command-result__type { color: var(--text-faint); font: 10px var(--font-mono); text-transform: uppercase; }
.command-empty { padding: 30px; text-align: center; color: var(--text-faint); }
.command-palette__footer { display: flex; gap: 18px; padding: 9px 14px; border-top: 1px solid var(--border-soft); color: var(--text-faint); font-size: 11px; }
.command-palette__footer span { display: flex; align-items: center; gap: 4px; }

/* -------------------------------- Capability-check panel (mod modal) --------- */

.capability-check {
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 18px;
}
.capability-check__rows { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.capability-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
}
.capability-chip:hover { background: rgba(93, 182, 221, 0.24); }
.capability-check__row.covered {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; color: var(--text-dim);
  background: var(--status-add-soft);
  border-radius: 999px;
  padding: 6px 12px;
}
.capability-check__dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--status-add); flex-shrink: 0;
}

/* -------------------------------- Card mini-checklist ------------------------ */

.card__checklist-toggle {
  display: flex; justify-content: space-between; align-items: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
  cursor: pointer; padding: 2px 0;
}
.card__checklist-toggle:hover { color: var(--text-dim); }
.card__checklist-list {
  list-style: none; margin: 4px 0 0; padding: 8px;
  background: var(--bg-raised); border-radius: var(--radius-sm);
  display: flex; flex-direction: column; gap: 6px;
}
.card__checklist-list li {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-dim);
}
.card__checklist-list li.done .label { text-decoration: line-through; color: var(--text-faint); }
.card__checklist-list li.dependency img, .card__checklist-list li.dependency .thumb-placeholder {
  width: 20px; height: 20px; border-radius: 4px; object-fit: cover; flex-shrink: 0;
  background: var(--panel);
}
.card__checklist-list li.dependency .thumb-placeholder {
  display: flex; align-items: center; justify-content: center; color: var(--text-faint); font-size: 10px;
}
.card__checklist-list .ver { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.card__checklist-list li a { color: var(--text-faint); text-decoration: none; font-size: 11px; }
.card__checklist-list li a:hover { color: var(--accent); }
.card__checklist-list .label { flex: 1; }


/* --------------------------------- Toast ------------------------------------ */

.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  box-shadow: var(--shadow);
  z-index: 200;
}
.toast.error { border-color: var(--status-remove); color: #f3c3ba; }

/* --------------------------------- Responsive -------------------------------- */

@media (max-width: 720px) {
  .app { padding: 14px 14px 48px; }
  .topbar { gap: 12px; }
  .topbar__title { font-size: 32px; }
  .topbar__actions { width: 100%; }
  .search { flex: 1; }
  .search input { width: 100%; }
  .topbar__stats { order: 1; width: 100%; }
  .view-toggle { order: 2; width: 100%; overflow-x: auto; overflow-y: hidden; }
  .view-toggle__btn { flex: 0 0 auto; padding-inline: 11px; white-space: nowrap; }
  .command-trigger kbd { display: none; }
  .notes-grid { grid-template-columns: 1fr; }
  .theme-picker { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .updates-panel__header { align-items: stretch; flex-direction: column; }
  .updates-panel__actions { justify-content: stretch; }
  .updates-panel__actions .btn, .updates-panel__actions .kodex-file-button { flex: 1; text-align: center; }
  .kodex-summary { grid-template-columns: repeat(2, 1fr); }
  .kodex-source { grid-column: 1 / -1; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .kodex-stat { border-bottom: 1px solid var(--border-soft); }
  .kodex-list-toolbar { align-items: flex-start; flex-direction: column; }
  .kodex-inventory-controls { grid-template-columns: 1fr; }
  .kodex-progress__details { align-items: flex-start; flex-direction: column; gap: 4px; }
  .field-row { flex-direction: column; gap: 0; }
  .fetch-panel__row { flex-direction: column; }
  .fetch-panel__row input:first-child { max-width: none; }
  .preview-row { flex-direction: column; }
  .preview-image { width: 100%; height: 140px; }
  .modal-overlay { padding: 0; align-items: stretch; }
  .modal { max-width: none; border-radius: 0; min-height: 100%; }
  #downloadModal .modal { height: 100dvh; min-height: 0; }
  .dependency-download span { display: none; }
}
/* Account gateway */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-shell[hidden], .app[hidden] { display: none !important; }
.auth-card { width: min(430px, 100%); padding: 34px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.38); }
.auth-card__brand { margin: 4px 0 0; font-family: var(--font-display); font-size: 3rem; line-height: 1; }
.auth-card__byline { margin: 2px 0 30px; color: var(--muted); font-family: var(--font-mono); font-size: .72rem; }
.auth-card h2 { margin: 0 0 6px; font-family: var(--font-display); font-size: 1.75rem; }
.auth-card__intro, .auth-form__hint { color: var(--muted); }
.auth-form { display: grid; gap: 15px; margin-top: 24px; }
.auth-form__hint { margin: -4px 0 0; font-size: .78rem; }
.auth-form__submit { width: 100%; justify-content: center; margin-top: 4px; }
.auth-switch { width: 100%; margin-top: 18px; border: 0; background: none; color: var(--accent); cursor: pointer; }
.workspace-bar { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.workspace-bar select { min-width: 210px; padding: 8px 34px 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text); font-weight: 700; }
.workspace-bar__shared { margin-right: auto; color: var(--muted); font-family: var(--font-mono); font-size: .72rem; }
.th-label { min-width: 88px; text-align: center !important; }
.table-cell-label { text-align: center; }
.table-label-dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--label-color); box-shadow: 0 0 8px color-mix(in srgb, var(--label-color) 45%, transparent); }
.label-toggle { width: 24px; height: 24px; border: 1px solid color-mix(in srgb, var(--label-color) 55%, var(--border)); border-radius: 6px; background: transparent; color: #071015; cursor: pointer; }
.label-toggle.complete { background: var(--label-color); font-weight: 900; }
.th-labels { min-width: 230px; text-align: left !important; }
.table-cell-labels { min-width: 230px; }
.row-labels { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.row-label-wrap { display: inline-flex; align-items: stretch; border: 1px solid color-mix(in srgb, var(--label-color) 52%, var(--border)); border-radius: 6px; overflow: hidden; background: color-mix(in srgb, var(--label-color) 8%, var(--surface-2)); }
.row-label { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 3px 5px 3px 8px; border: 0; background: transparent; color: var(--text); cursor: pointer; font: 700 .78rem/1 var(--font-mono); }
.row-label__box { display: inline-grid; place-items: center; width: 18px; height: 18px; border: 1px solid color-mix(in srgb, var(--label-color) 75%, #fff); border-radius: 4px; color: #071015; font-size: .75rem; }
.row-label.complete .row-label__box { background: var(--label-color); box-shadow: 0 0 8px color-mix(in srgb, var(--label-color) 40%, transparent); }
.row-label__remove { width: 22px; border: 0; border-left: 1px solid color-mix(in srgb, var(--label-color) 30%, var(--border)); background: transparent; color: var(--muted); cursor: pointer; opacity: .4; }
.row-label-wrap:hover .row-label__remove, .row-label__remove:focus-visible { opacity: 1; }
.row-label-add { width: auto; max-width: 105px; min-height: 28px; padding: 3px 22px 3px 7px; border: 1px dashed var(--border-strong); border-radius: 6px; background: transparent; color: var(--muted); font: 600 .72rem/1 var(--font-mono); cursor: pointer; }
.table-label-editor { display: grid; gap: 7px; margin-top: 8px; }
.table-label-editor__row { display: grid; grid-template-columns: 14px 1fr 44px 30px; gap: 8px; align-items: center; }
.table-label-editor__row input[type="color"] { width: 40px; height: 32px; padding: 2px; }
.table-label-editor__row button, .table-member button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.table-members { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.table-member { padding: 5px 8px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); font-family: var(--font-mono); font-size: .75rem; }
@media (max-width: 700px) { .workspace-bar { flex-wrap: wrap; } .workspace-bar select { min-width: 0; width: 100%; } .workspace-bar__shared { width: 100%; } }
.admin-panel__header { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin: 18px 0; }
.admin-panel__header h2 { margin: 3px 0; font-family: var(--font-display); font-size: 2rem; }
.admin-panel__header p { margin: 0; color: var(--muted); }
.admin-summary { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.admin-summary > span { padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--muted); font-family: var(--font-mono); font-size: .75rem; }
.admin-summary strong { margin-right: 5px; color: var(--text); font-size: 1rem; }
.admin-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 14px; }
.admin-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.admin-card h3 { margin: 0 0 10px; font-family: var(--font-display); font-size: 1.35rem; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; font-size: .82rem; }
.admin-table th { color: var(--muted); font: 600 .68rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: .08em; }
.admin-table td small { display: block; margin-top: 3px; color: var(--muted); }
.presence { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--muted); }
.presence.online { background: #64d89b; box-shadow: 0 0 8px rgba(100,216,155,.45); }
.admin-toggle { padding: 5px 9px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.admin-toggle.active { border-color: var(--accent); color: var(--accent); }
.admin-toggle.danger { border-color: var(--status-remove); color: var(--status-remove); }
.admin-toggle:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }
