/* TFA Legacy Archive — design tokens & global styles */

:root {
  /* Brand */
  --tfa-red: #e11832;
  --tfa-red-hover: #f02c45;
  --tfa-red-dim: rgba(225, 24, 50, 0.12);
  --tfa-red-glow: rgba(225, 24, 50, 0.35);

  /* Dark (default) */
  --bg: #0a0a0b;
  --bg-1: #121214;
  --bg-2: #18181c;
  --bg-3: #222227;
  --border: #26262c;
  --border-strong: #34343c;
  --text: #ededee;
  --text-2: #9c9ca8;
  --text-3: #65656f;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.5);

  /* Status hues — neutralized so red can stay primary */
  --c-blue: #6aa3f5;
  --c-green: #5dd49a;
  --c-amber: #f5b54a;
  --c-purple: #b08bf2;
  --c-pink: #ec78ad;

  /* Tokens */
  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
  --gap: 14px;

  /* Density */
  --card-pad: 18px 20px;
  --card-gap: 10px;
  --card-name-size: 16px;
}

[data-theme="light"] {
  --bg: #f5f5f6;
  --bg-1: #ffffff;
  --bg-2: #fafafb;
  --bg-3: #f0f0f2;
  --border: #e4e4e8;
  --border-strong: #d2d2d8;
  --text: #18181c;
  --text-2: #52525c;
  --text-3: #87878f;
  --shadow: 0 12px 32px rgba(20, 20, 30, 0.08);
  --tfa-red-dim: rgba(225, 24, 50, 0.08);
}

[data-density="compact"] {
  --card-pad: 12px 14px;
  --card-gap: 6px;
  --card-name-size: 14px;
}

[data-density="cozy"] {
  --card-pad: 22px 24px;
  --card-gap: 14px;
  --card-name-size: 17px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-feature-settings: 'cv11' 1, 'ss01' 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
body { transition: background 0.18s ease, color 0.18s ease; }
::selection { background: var(--tfa-red); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

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

.mono { font-family: 'JetBrains Mono', ui-monospace, 'Menlo', monospace; font-feature-settings: 'ss02' 1; }

/* ======== TOPBAR ======== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex; align-items: center; gap: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--tfa-red);
  display: grid; place-items: center;
  color: #fff; font-weight: 800; font-size: 14px;
  letter-spacing: -0.5px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06) inset, 0 4px 14px var(--tfa-red-glow);
  font-family: 'Inter', sans-serif;
}
.brand-logo {
  height: 32px; width: auto; display: block;
  /* Logo PNG is red on transparent — works on both themes */
}
.brand-name {
  font-weight: 700; letter-spacing: -0.4px; font-size: 14.5px;
  display: flex; align-items: baseline; gap: 8px;
}
.brand-name .legacy {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; font-weight: 500;
  color: var(--text-3); letter-spacing: 0;
  padding: 2px 7px; border: 1px solid var(--border);
  border-radius: 4px; text-transform: uppercase;
}

/* Topbar search */
.topbar-search {
  flex: 1; max-width: 640px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  padding: 10px 14px 10px 40px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border 0.12s, box-shadow 0.12s;
}
.topbar-search input:focus {
  border-color: var(--tfa-red);
  box-shadow: 0 0 0 3px var(--tfa-red-dim);
}
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-search .icn {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); color: var(--text-3);
  pointer-events: none;
}
.topbar-search .kbd {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  padding: 2px 7px;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-3);
  pointer-events: none;
}

.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-2); cursor: pointer;
  transition: all 0.12s;
}
.icon-btn:hover { background: var(--bg-2); color: var(--text); border-color: var(--border); }
.icon-btn.active { background: var(--bg-2); color: var(--tfa-red); border-color: var(--border); }

.lang-toggle {
  display: flex; gap: 0;
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px; height: 34px;
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
}
.lang-toggle button {
  background: transparent; border: 0;
  padding: 0 10px; border-radius: 6px;
  color: var(--text-3); cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.4px;
  transition: all 0.12s;
}
.lang-toggle button.active { background: var(--bg-3); color: var(--text); }

.status-indicator {
  display: flex; align-items: center; gap: 7px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--text-3);
  padding: 0 10px;
  border-left: 1px solid var(--border);
  height: 22px;
}
.status-indicator .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-green);
  box-shadow: 0 0 8px color-mix(in srgb, var(--c-green) 60%, transparent);
}

/* ======== FILTER BAR ======== */
.filter-bar {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 14px 24px;
  display: flex; gap: 24px; align-items: flex-start;
  position: sticky; top: 59px; z-index: 15;
  backdrop-filter: blur(14px);
}
.filter-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1; }
.filter-group-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.filter-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.6px;
}

.chip {
  padding: 5px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-2);
  cursor: pointer; transition: all 0.12s;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip .count {
  font-size: 10px; color: var(--text-3);
  padding-left: 4px; margin-left: 2px;
  border-left: 1px solid var(--border);
}
.chip.active {
  background: var(--tfa-red); border-color: var(--tfa-red);
  color: #fff; font-weight: 500;
}
.chip.active .count { color: rgba(255,255,255,0.7); border-left-color: rgba(255,255,255,0.3); }

.chip.note-search {
  background: var(--tfa-red-dim);
  border-color: color-mix(in srgb, var(--tfa-red) 30%, transparent);
  color: var(--tfa-red);
}

/* ======== PICKER (dropdown modal for staff / type) ======== */
.filter-pickers { display: flex; gap: 16px; flex-wrap: wrap; }
.filter-status-wrap { flex: 1; min-width: 0; }

.picker-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 10px 6px 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-2);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s;
  min-width: 160px;
  justify-content: space-between;
  height: 30px;
}
.picker-trigger:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.picker-trigger.has-value {
  border-color: var(--tfa-red);
  color: var(--text);
  background: var(--tfa-red-dim);
}
.picker-trigger .picker-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex; align-items: center; gap: 6px;
}
.picker-trigger .picker-count-pill {
  background: var(--tfa-red);
  color: #fff;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}

.picker-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(3px);
  z-index: 60;
  opacity: 0; pointer-events: none;
  transition: opacity 0.18s;
}
.picker-overlay.open { opacity: 1; pointer-events: auto; }
[data-theme="light"] .picker-overlay { background: rgba(20,20,30,0.3); }

.picker {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(0.97);
  width: min(440px, 92vw);
  max-height: min(560px, 80vh);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 61;
  display: none;
  flex-direction: column;
  opacity: 0;
  transition: opacity 0.18s, transform 0.18s;
}
.picker.open {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.picker-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.picker-head strong {
  font-size: 13px; letter-spacing: -0.2px;
  text-transform: capitalize;
}
.picker-search-wrap {
  position: relative;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.picker-search-icn {
  position: absolute; left: 24px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
}
#picker-search {
  width: 100%;
  padding: 7px 10px 7px 32px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  outline: none;
}
#picker-search:focus {
  border-color: var(--tfa-red);
  box-shadow: 0 0 0 3px var(--tfa-red-dim);
}
.picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px 8px;
  display: flex; flex-direction: column;
  min-height: 80px;
}
.picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  transition: background 0.1s;
}
.picker-item:hover { background: var(--bg-2); }
.picker-item input {
  accent-color: var(--tfa-red);
  width: 14px; height: 14px;
  flex-shrink: 0;
}
.picker-item .pi-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item .pi-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.picker-item .pi-count {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  background: var(--bg-2);
  padding: 1px 6px; border-radius: 4px;
  flex-shrink: 0;
}
.picker-item.selected { background: var(--tfa-red-dim); }
.picker-foot {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.action-btn.primary {
  background: var(--tfa-red);
  color: #fff;
  border-color: var(--tfa-red);
}
.action-btn.primary:hover {
  background: var(--tfa-red-hover);
  border-color: var(--tfa-red-hover);
  color: #fff;
}

.picker-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
}

/* ======== MAIN ======== */
.container {
  max-width: 1280px; margin: 0 auto;
  padding: 22px 24px 80px;
}
.results-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-3);
  margin-bottom: 14px;
}
.results-meta .right { display: flex; gap: 12px; align-items: center; }
.sort-select {
  background: var(--bg-1); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px;
  font-size: 11px; color: var(--text-2);
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
}

/* ======== CARDS ======== */
.cards { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 720px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1180px) { .cards { grid-template-columns: 1fr 1fr 1fr; } }

.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-pad);
  cursor: pointer; position: relative;
  transition: border-color 0.12s, transform 0.12s, background 0.12s;
  display: flex; flex-direction: column;
  gap: var(--card-gap);
}
.card:hover {
  border-color: var(--border-strong);
  background: var(--bg-2);
}
.card.selected {
  border-color: var(--tfa-red);
  box-shadow: 0 0 0 3px var(--tfa-red-dim);
}
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--text-3);
  margin-bottom: 4px; word-break: break-all;
}
.card-id .sep { color: var(--border-strong); margin: 0 4px; }
.card-name {
  font-size: var(--card-name-size); font-weight: 600;
  line-height: 1.25; letter-spacing: -0.2px;
  color: var(--text);
}
.card-email {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-2);
  margin-top: 4px; word-break: break-all;
}
.card-email .copy-btn { opacity: 0; transition: opacity 0.1s; }
.card-email:hover .copy-btn { opacity: 1; }

.card-meta {
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}
.meta-row { display: flex; gap: 10px; align-items: baseline; }
.meta-k {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
  min-width: 56px; flex-shrink: 0; padding-top: 1px;
}
.meta-v { color: var(--text-2); flex: 1; line-height: 1.5; min-width: 0; }
.meta-v.mono { font-family: 'JetBrains Mono', monospace; font-size: 11px; }

.assignee-list { display: flex; flex-wrap: wrap; gap: 4px; }
.assignee {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px; color: var(--text-2);
}
.assignee-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.tag {
  padding: 1px 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-2);
}

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-3);
}
.note-snip {
  margin-top: 6px;
  background: var(--bg-2);
  border-left: 2px solid var(--tfa-red);
  padding: 8px 10px;
  border-radius: 0 6px 6px 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot .arrow { color: var(--text-2); transition: transform 0.15s, color 0.15s; }
.card:hover .arrow { color: var(--tfa-red); transform: translateX(2px); }

/* ======== STATUS PILL ======== */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 500;
  flex-shrink: 0; text-transform: lowercase;
  letter-spacing: 0.2px;
  border: 1px solid transparent;
}
.pill .pd { width: 5px; height: 5px; border-radius: 50%; }
.st-Active { background: color-mix(in srgb, var(--c-blue) 12%, transparent); color: var(--c-blue); }
.st-Active .pd { background: var(--c-blue); }
.st-Approved { background: color-mix(in srgb, var(--c-green) 14%, transparent); color: var(--c-green); }
.st-Approved .pd { background: var(--c-green); }
.st-Submitted { background: color-mix(in srgb, var(--c-purple) 14%, transparent); color: var(--c-purple); }
.st-Submitted .pd { background: var(--c-purple); }
.st-Closed { background: color-mix(in srgb, var(--text-3) 14%, transparent); color: var(--text-2); }
.st-Closed .pd { background: var(--text-3); }
.st-Refused, .st-RetainerVoided {
  background: var(--tfa-red-dim);
  color: var(--tfa-red);
}
.st-Refused .pd, .st-RetainerVoided .pd { background: var(--tfa-red); }
.st-Prospect { background: color-mix(in srgb, var(--c-amber) 14%, transparent); color: var(--c-amber); }
.st-Prospect .pd { background: var(--c-amber); }

/* ======== EMPTY ======== */
.empty {
  text-align: center; padding: 80px 20px;
  color: var(--text-3); grid-column: 1/-1;
}
.empty-art {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; white-space: pre;
  line-height: 1.4; margin-bottom: 16px; opacity: 0.4;
}

/* ======== DRAWER (right side) ======== */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
  z-index: 50;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
[data-theme="light"] .drawer-overlay { background: rgba(20, 20, 30, 0.35); }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 100vw);
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  z-index: 51;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  display: flex; align-items: flex-start; gap: 14px;
}
.drawer-header > .info { flex: 1; min-width: 0; }
.drawer-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--text-3);
  display: flex; align-items: center; gap: 8px;
}
.drawer-name {
  font-family: 'Manrope', 'Inter', sans-serif;
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.5px; line-height: 1.15;
  margin-top: 5px; color: var(--text);
}
.drawer-pills {
  display: flex; gap: 8px; align-items: center;
  margin-top: 10px; flex-wrap: wrap;
}
.drawer-close {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 32px; height: 32px; border-radius: 7px;
  cursor: pointer; display: grid; place-items: center;
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--bg-3); color: var(--text); }

.drawer-actions {
  display: flex; gap: 6px; padding: 10px 24px;
  border-bottom: 1px solid var(--border);
}
.action-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--text-2);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.12s;
}
.action-btn:hover { background: var(--bg-3); color: var(--text); border-color: var(--border-strong); }
.action-btn.copied { background: var(--tfa-red); border-color: var(--tfa-red); color: #fff; }

.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px 80px; }

.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.meta-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.meta-cell .l {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9.5px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
.meta-cell .v {
  font-size: 13px; color: var(--text);
  word-break: break-word; line-height: 1.4;
}
.meta-cell .v.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

.section-h {
  display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px;
}
.section-h .t { font-size: 14px; font-weight: 600; }
.section-h .c {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-3);
}

.timeline {
  position: relative; padding-left: 22px;
}
.timeline::before {
  content: ''; position: absolute;
  left: 6px; top: 8px; bottom: 8px;
  width: 1px; background: var(--border);
}
.note {
  position: relative;
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.note:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
.note::before {
  content: ''; position: absolute;
  left: -20px; top: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--bg-1);
  border: 2px solid var(--border-strong);
}
.note.recent::before {
  background: var(--tfa-red);
  border-color: var(--tfa-red);
  box-shadow: 0 0 0 4px var(--tfa-red-dim);
}
.note-meta {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.note-author {
  font-size: 12px; font-weight: 600;
  color: var(--text);
  display: inline-flex; align-items: center; gap: 6px;
}
.note-author .ad { width: 6px; height: 6px; border-radius: 50%; }
.note-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-3);
  padding: 2px 6px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.note-body {
  font-size: 13px; line-height: 1.65;
  color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}
.note-body .nt {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; font-weight: 600;
  background: var(--tfa-red-dim);
  color: var(--tfa-red);
  padding: 1px 6px;
  border-radius: 3px;
  margin-right: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  vertical-align: 1px;
}
.note-body mark {
  background: var(--tfa-red);
  color: #fff; padding: 0 3px; border-radius: 2px;
}

/* card highlight */
.card mark {
  background: transparent;
  color: var(--tfa-red);
  padding: 0;
  border-bottom: 1px dashed var(--tfa-red);
}

/* ======== LOGIN ======== */
.login-shell {
  position: fixed; inset: 0;
  background: var(--bg);
  display: grid; place-items: center;
  z-index: 100;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.login-card .lc-brand {
  display: flex; align-items: center; gap: 12px; margin-bottom: 28px;
}
.login-card h1 {
  font-size: 18px; font-weight: 700; letter-spacing: -0.3px;
  margin-bottom: 6px;
}
.login-card .sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--text-3);
  margin-bottom: 24px;
}
.login-card label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.login-card input {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text); font-size: 14px;
  outline: none;
  transition: border 0.12s, box-shadow 0.12s;
}
.login-card input:focus {
  border-color: var(--tfa-red);
  box-shadow: 0 0 0 3px var(--tfa-red-dim);
}
.login-card .btn {
  width: 100%; margin-top: 16px;
  padding: 11px 14px;
  background: var(--tfa-red);
  color: #fff; border: 0;
  border-radius: 8px;
  font-weight: 600; font-size: 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.login-card .btn:hover { background: var(--tfa-red-hover); }
.login-card .err {
  margin-top: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--tfa-red);
  min-height: 14px;
}
.login-card .footnote {
  margin-top: 28px; padding-top: 20px;
  border-top: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px; color: var(--text-3);
  line-height: 1.5;
}

/* ======== TOAST ======== */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  box-shadow: var(--shadow);
  z-index: 200;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ======== LOADING ======== */
.loading {
  display: grid; place-items: center;
  padding: 80px 20px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  grid-column: 1 / -1;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--tfa-red);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ======== FOOTER ======== */
.app-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-1);
  padding: 22px 24px 28px;
  margin-top: 40px;
}
.app-footer-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 6px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  color: var(--text-3);
  line-height: 1.6;
}
.app-footer .ft-line-1 {
  display: flex; align-items: center; gap: 6px;
  color: var(--text-2);
  font-size: 11px;
  margin-bottom: 2px;
}
.app-footer .ft-line-1 strong {
  color: var(--tfa-red); font-weight: 600;
  letter-spacing: 0.2px;
}
.app-footer .ft-line-1 .sep { color: var(--border-strong); }
.app-footer .ft-line-2 {
  display: flex; flex-wrap: wrap; gap: 8px;
  color: var(--text-2);
}
.app-footer .ft-line-3 {
  font-style: normal;
  max-width: 760px;
  letter-spacing: 0.1px;
}

/* responsive tweaks */
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
  .topbar-search { order: 3; flex-basis: 100%; max-width: none; }
  .filter-bar { padding: 12px 14px; flex-direction: column; gap: 12px; }
  .container { padding: 16px 14px 60px; }
  .status-indicator { display: none; }
}
/* === RESPONSIVE FIX === */
.topbar { max-width: 100%; overflow: hidden; }
.topbar-search { flex: 1; min-width: 0; max-width: 520px; }
.container { max-width: 1400px; margin: 0 auto; padding: 20px 20px 60px; width: 100%; }
.cards { width: 100%; }
.drawer { max-width: min(780px, 95vw); width: 100%; }
@media (max-width: 900px) {
  .topbar-search { max-width: 100%; }
  .cards { grid-template-columns: 1fr !important; }
}
@media (max-width: 1180px) {
  .cards { grid-template-columns: 1fr 1fr !important; }
}

/* === MAX WIDTH FIX === */
.container {
  max-width: 1440px !important;
  margin: 0 auto !important;
  padding: 20px 24px 60px !important;
  width: 100% !important;
}
.cards {
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)) !important;
  max-width: 100% !important;
}
@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr !important; }
}


/* === FIXES: notes btn + footer === */
#search-in-notes-btn {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--tfa-red-dim);
  border: 1px solid var(--tfa-red);
  border-radius: 4px;
  color: var(--tfa-red) !important;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  cursor: pointer;
  transition: background 0.12s;
}
#search-in-notes-btn:hover {
  background: var(--tfa-red);
  color: #fff !important;
}

