:root {
  --bg: oklch(98.5% 0.005 80);
  --bg-2: oklch(96.5% 0.008 80);
  --bg-3: oklch(94% 0.01 80);
  --ink: oklch(22% 0.015 60);
  --ink-2: oklch(38% 0.012 60);
  --ink-3: oklch(55% 0.01 60);
  --ink-4: oklch(72% 0.008 60);
  --line: oklch(90% 0.01 80);
  --line-2: oklch(85% 0.012 80);

  --accent: oklch(72% 0.16 60);        /* amber */
  --accent-ink: oklch(30% 0.09 60);
  --accent-bg: oklch(96% 0.04 80);

  --urgent: oklch(58% 0.19 25);
  --urgent-bg: oklch(96% 0.04 25);
  --warn: oklch(72% 0.14 75);
  --warn-bg: oklch(96% 0.05 85);
  --ok: oklch(58% 0.12 155);
  --ok-bg: oklch(95% 0.04 155);
  --info: oklch(55% 0.09 245);
  --info-bg: oklch(96% 0.025 245);
  --violet: oklch(55% 0.14 300);
  --violet-bg: oklch(96% 0.03 300);

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 0 oklch(90% 0.01 80 / 0.6), 0 1px 2px oklch(30% 0.02 60 / 0.04);
  --shadow-pop: 0 1px 2px oklch(30% 0.02 60 / 0.06), 0 8px 24px oklch(30% 0.02 60 / 0.08);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
}

[data-accent="indigo"] {
  --accent: oklch(60% 0.17 275);
  --accent-ink: oklch(28% 0.13 275);
  --accent-bg: oklch(96% 0.03 275);
}
[data-accent="green"] {
  --accent: oklch(62% 0.14 155);
  --accent-ink: oklch(30% 0.1 155);
  --accent-bg: oklch(96% 0.03 155);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
button { font-family: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Layout */
.app {
  display: grid;
  grid-template-columns: 232px 1fr 340px;
  grid-template-rows: 52px 1fr;
  grid-template-areas:
    "sidebar topbar  topbar"
    "sidebar main    rail";
  height: 100vh;
  min-height: 680px;
}
.app[data-rail="false"] {
  grid-template-columns: 232px 1fr;
  grid-template-areas:
    "sidebar topbar"
    "sidebar main";
}

/* Sidebar */
.sidebar {
  grid-area: sidebar;
  border-right: 1px solid var(--line);
  background: var(--bg-2);
  display: flex; flex-direction: column;
  padding: 12px 10px;
  gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
  position: relative;
  overflow: hidden;
}
.brand-mark::after{
  content:""; position:absolute; left:0; right:0; bottom:4px; height:2px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 4px, transparent 4px 8px);
}
.brand-name { font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); margin-top: 1px; letter-spacing: 0; }
.nav-section-label {
  font-size: 10px; color: var(--ink-4); letter-spacing: 0.08em; text-transform: uppercase;
  padding: 10px 10px 4px;
  font-weight: 500;
}
.nav-item {
  all: unset;
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px; color: var(--ink-2);
  cursor: pointer;
}
.nav-item:hover { background: var(--bg-3); color: var(--ink); }
.nav-item[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
}
.nav-item[aria-current="page"] .nav-count { background: oklch(100% 0 0 / 0.15); color: var(--bg); }
.nav-icon { width: 16px; height: 16px; display: grid; place-items: center; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-count {
  font-family: var(--mono);
  font-size: 10.5px; font-weight: 500;
  background: var(--bg-3); color: var(--ink-3);
  padding: 1px 6px; border-radius: 10px;
  min-width: 18px; text-align: center;
}
.nav-count.urgent { background: var(--urgent-bg); color: var(--urgent); }

.sidebar-foot { margin-top: auto; padding: 10px 8px 2px; border-top: 1px solid var(--line); }
.user-row { display: flex; align-items: center; gap: 10px; padding: 4px 2px; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, oklch(75% 0.12 60), oklch(60% 0.14 40));
  color: white; font-weight: 600; font-size: 11px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 500; }
.user-email { font-size: 10.5px; color: var(--ink-3); font-family: var(--mono); }

/* Topbar */
.topbar {
  grid-area: topbar;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  display: flex; align-items: center;
  padding: 0 20px;
  gap: 16px;
  position: relative;
  z-index: 2;
}
.topbar h1 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.topbar .crumb { color: var(--ink-3); font-weight: 400; }
.topbar-spacer { flex: 1; }
.scan-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 8px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  font-size: 12px; color: var(--ink-2);
}
.scan-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px oklch(58% 0.12 155 / 0.2); }
.scan-dot.scanning { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 oklch(72% 0.16 60 / 0.45); } 50% { box-shadow: 0 0 0 6px oklch(72% 0.16 60 / 0); } }
.scan-chip .mono { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

.btn {
  all: unset;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px; font-weight: 500;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink);
  cursor: pointer;
  transition: background .12s;
}
.btn:hover { background: var(--bg-3); }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { background: oklch(30% 0.02 60); }
.btn.danger { color: var(--urgent); border-color: oklch(90% 0.03 25); }
.btn.danger:hover { background: var(--urgent-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--bg-3); }
.btn.sm { padding: 3px 8px; font-size: 11.5px; }
.btn.tiny { padding: 2px 6px; font-size: 10.5px; }

/* Main */
.main {
  grid-area: main;
  overflow: auto;
  padding: 20px 28px 40px;
  background: var(--bg);
}
.main-inner { max-width: 880px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.page-sub { font-size: 13px; color: var(--ink-3); margin: 4px 0 0; max-width: 560px; }

.section-head {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 4px 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.section-head .count { font-family: var(--mono); color: var(--ink-4); text-transform: none; letter-spacing: 0; font-size: 10.5px; }
.section-head .line { flex: 1; height: 1px; background: var(--line); }

/* Thread card */
.thread {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: border-color .12s;
}
.thread.urgent { border-color: oklch(88% 0.06 25); }
.thread.dispute { border-left: 3px solid var(--urgent); }
.thread.tender { border-left: 3px solid var(--info); }
.thread.reply  { border-left: 3px solid var(--warn); }
.thread.action { border-left: 3px solid var(--accent); }
.thread.claim  { border-left: 3px solid var(--violet); }
.thread.fyi    { border-left: 3px solid var(--line-2); }
.thread.followup { border-left: 3px solid var(--urgent); }

.thread-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.thread-chev { color: var(--ink-4); transition: transform .15s; }
.thread[data-open="false"] .thread-chev { transform: rotate(-90deg); }
.thread-title { font-size: 14px; font-weight: 600; letter-spacing: -0.005em; flex: 1; }
.thread-meta { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }

.thread-body { padding: 0 14px 10px 14px; border-top: 1px dashed var(--line); position: relative; overflow: visible; }
.thread-body::before {
  content: ""; position: absolute;
  top: 10px; bottom: 16px; left: 28px;
  width: 1px;
  background: var(--line-2);
}

.task {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding: 12px 0 12px 6px;
  border-bottom: 1px dashed var(--line);
  position: relative;
}
.task:last-child { border-bottom: none; }
.task-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--line-2);
  position: relative; top: 6px; left: 6px;
}
.check {
  all: unset;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--ink-4);
  cursor: pointer;
  display: grid; place-items: center;
  margin-top: 2px;
  margin-left: 2px;
  transition: all .12s;
  flex-shrink: 0;
}
.check:hover { border-color: var(--ink); }
.check.checked { background: var(--ok); border-color: var(--ok); color: white; }

.task-body { min-width: 0; }
.task-title { font-size: 13.5px; font-weight: 500; color: var(--ink); line-height: 1.4; }
.task.done .task-title { text-decoration: line-through; color: var(--ink-4); }
.task-action { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; line-height: 1.45; }
.task-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--ink-3);
  flex-wrap: wrap;
}
.task-row .sep { color: var(--ink-4); }
.task-row a { color: var(--accent-ink); text-decoration: none; font-weight: 500; }
.task-row a:hover { text-decoration: underline; }

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1.5px 7px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  background: var(--bg-3);
  color: var(--ink-2);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge.urgent { background: var(--urgent-bg); color: var(--urgent); border-color: transparent; }
.badge.action { background: var(--accent-bg); color: var(--accent-ink); border-color: transparent; }
.badge.reply  { background: var(--warn-bg); color: oklch(42% 0.12 75); border-color: transparent; }
.badge.tender { background: var(--info-bg); color: var(--info); border-color: transparent; }
.badge.dispute { background: var(--urgent-bg); color: var(--urgent); border-color: transparent; }
.badge.claim { background: var(--violet-bg); color: var(--violet); border-color: transparent; }
.badge.fyi { background: var(--bg-3); color: var(--ink-3); border-color: transparent; }
.badge.new { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.badge.rolled { background: transparent; color: var(--ink-3); border-color: var(--line-2); border-style: dashed; }

.thread-foot { display: flex; align-items: center; gap: 6px; padding: 8px 0 4px; }

/* Activity rail */
.rail {
  grid-area: rail;
  border-left: 1px solid var(--line);
  background: var(--bg-2);
  overflow: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}
.rail h3 { margin: 0; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.rail-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.pipeline { display: flex; flex-direction: column; gap: 6px; }
.pipe-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
}
.pipe-step .n { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); width: 14px; }
.pipe-step .label { flex: 1; color: var(--ink-2); }
.pipe-step .status {font-family: var(--mono); font-size: 10px; color: var(--ink-4); }
.pipe-step.active { background: var(--accent-bg); }
.pipe-step.active .label { color: var(--accent-ink); font-weight: 500; }
.pipe-step.active .status { color: var(--accent-ink); }
.pipe-step.done .label { color: var(--ink-2); }
.pipe-step.done .status { color: var(--ok); }

.log {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--ink-3);
  line-height: 1.55;
  max-height: 260px;
  overflow: auto;
}
.log .ts { color: var(--ink-4); margin-right: 6px; }
.log .ok { color: var(--ok); }
.log .warn { color: oklch(58% 0.14 60); }
.log .ai  { color: var(--violet); }

.stat-row { display: flex; gap: 8px; margin: 0 0 4px; }
.stat {
  flex: 1;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.stat .v { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.stat .l { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 1px; }

/* Toast */
.toast-wrap {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 50;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--ink); color: var(--bg);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 12.5px;
  box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 10px;
  animation: toast-in .24s ease-out;
}
.toast .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }
.toast .folder { font-family: var(--mono); background: oklch(100% 0 0 / 0.1); padding: 1px 6px; border-radius: 4px; font-size: 11px;}
@keyframes toast-in { from { transform: translateY(-10px); opacity: 0; } }

/* Thread suggestion banner */
.banner {
  background: var(--warn-bg);
  border: 1px solid oklch(88% 0.06 75);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
  animation: toast-in .24s ease-out;
}
.banner .icon { width: 20px; height: 20px; color: oklch(45% 0.14 75);}
.banner p { margin: 0; font-size: 12.5px; color: oklch(30% 0.08 60); flex: 1; }
.banner strong { color: oklch(22% 0.08 60); }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: oklch(20% 0.01 60 / 0.35);
  z-index: 100;
  display: grid; place-items: center;
  padding: 40px 20px;
  animation: fade-in .15s;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--bg);
  border-radius: 12px;
  box-shadow: var(--shadow-pop);
  width: 100%;
  max-width: 640px;
  max-height: 84vh;
  overflow: auto;
  animation: modal-in .2s ease-out;
}
@keyframes modal-in { from { transform: translateY(8px); opacity: 0; } }
.modal-head { padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 16px 22px 18px; }
.modal-foot { padding: 12px 22px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: space-between; background: var(--bg-2);}
.modal h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal .from-line { font-size: 12px; color: var(--ink-3); margin-top: 4px; font-family: var(--mono); }
.modal-section { margin-top: 14px; }
.modal-section .label { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; font-weight: 500; }
.snippet { font-size: 13px; color: var(--ink); line-height: 1.55; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; white-space: pre-wrap; }
.reply-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
  position: relative;
}
.reply-card .rl-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.reply-card .rl-label { font-size: 11px; font-weight: 500; color: var(--accent-ink); }
.reply-card pre { margin: 0; font-size: 12.5px; font-family: var(--sans); color: var(--ink); white-space: pre-wrap; line-height: 1.5; }
.folder-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px 10px; font-size: 12px; font-family: var(--mono);
  color: var(--ink-2);
}
.folder-pill .ic { color: var(--ink-3); }

/* Disputes */
.dispute-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 12px;
  align-items: flex-start;
}
.dispute-card.escalated { border-left: 3px solid var(--urgent); box-shadow: 0 0 0 1px oklch(88% 0.06 25); }
.dispute-card.resolved { opacity: 0.65; }
.drag {
  color: var(--ink-4); cursor: grab; font-size: 14px; line-height: 1;
  padding-top: 4px;
  user-select: none;
}
.dispute-body .d-title { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.dispute-body .d-meta { font-size: 11.5px; color: var(--ink-3); font-family: var(--mono); }
.dispute-body .d-action { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.45; }
.dispute-actions { display: flex; align-items: center; gap: 6px; }
.state-pill {
  all: unset;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 20px;
  font-size: 11px; font-weight: 500;
  background: var(--bg-3); color: var(--ink-2);
  cursor: pointer;
  border: 1px solid var(--line);
}
.state-pill .d { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-4); }
.state-pill.open   { background: var(--info-bg); color: var(--info); border-color: transparent; } .state-pill.open .d { background: var(--info); }
.state-pill.progress { background: var(--warn-bg); color: oklch(42% 0.12 75); border-color: transparent; } .state-pill.progress .d { background: oklch(55% 0.14 75); }
.state-pill.resolved { background: var(--ok-bg); color: var(--ok); border-color: transparent; } .state-pill.resolved .d { background: var(--ok); }
.state-pill.escalated { background: var(--urgent-bg); color: var(--urgent); border-color: transparent; } .state-pill.escalated .d { background: var(--urgent); }

/* Folder rules table */
.rules {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.rules .row {
  display: grid;
  grid-template-columns: 160px 24px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.rules .row:last-child { border-bottom: none; }
.rules .row.head { background: var(--bg-2); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); font-weight: 500; padding: 8px 16px; }
.rules .arrow { color: var(--ink-4); text-align: center; }
.rules .folder-name { font-family: var(--mono); font-size: 12px; color: var(--ink); }

/* Settings form */
.form-card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 12px; }
.form-row { display: grid; grid-template-columns: 180px 1fr; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.form-row:last-child { border-bottom: none; }
.form-row .k { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.form-row .k-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  all: unset;
  padding: 5px 10px;
  border-radius: 20px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  font-size: 12px; color: var(--ink-2);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

input[type="text"], textarea {
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  width: 100%;
}
input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--bg); }

/* Done list */
.day-group { margin-bottom: 22px; }
.day-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.day-head h3 { margin: 0; font-size: 13px; font-weight: 600; }
.day-head .c { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
.done-item {
  display: grid; grid-template-columns: 20px 1fr auto;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 13px;
}
.done-item .check.checked { margin: 0; }
.done-item .t { font-weight: 500; }
.done-item .t s { color: var(--ink-4); text-decoration-thickness: 1px; }
.done-item .m { font-size: 11px; color: var(--ink-3); font-family: var(--mono); margin-top: 2px; }

/* Tweaks panel */
.tweaks {
  position: fixed;
  right: 16px; bottom: 16px;
  width: 260px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  z-index: 200;
  padding: 12px 14px;
  font-size: 12px;
}
.tweaks h4 { margin: 0 0 10px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; }
.tweaks .t-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.tweaks .t-row .k { color: var(--ink-2); }

/* Confirm dialog */
.confirm {
  max-width: 380px;
  text-align: left;
  padding: 0;
}
.confirm .body { padding: 24px 24px 8px; }
.confirm .body h3 { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: var(--ink); }
.confirm .body p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.confirm .modal-foot { margin-top: 0; padding: 16px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--line); background: #fafaf9; border-radius: 0 0 12px 12px; }
.btn.danger { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn.danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* Empty states */
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); font-size: 13px; }

/* Scrollbar polish */
.main::-webkit-scrollbar, .rail::-webkit-scrollbar, .log::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-thumb, .rail::-webkit-scrollbar-thumb, .log::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 2px solid var(--bg); }

/* Density */
[data-density="compact"] .task { padding: 8px 0; }
[data-density="compact"] .thread-head { padding: 9px 14px; }
[data-density="compact"] .task-title { font-size: 13px; }
[data-density="compact"] .main-inner { max-width: 920px; }

.kbd {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0 5px;
  color: var(--ink-3);
}

/* ---- Auth screen ---- */
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: var(--bg);
  padding: 20px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: var(--shadow-pop);
  text-align: center;
}
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 18px;
}
.auth-logo .brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  font-size: 20px;
}
.auth-card h1 {
  margin: 0 0 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-card p {
  margin: 0 0 22px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
}
.auth-error {
  background: var(--urgent-bg);
  color: var(--urgent);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  margin-bottom: 14px;
  text-align: left;
}
.auth-btn {
  width: 100%;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
  gap: 10px;
  margin-bottom: 16px;
}
.auth-note {
  font-size: 11.5px;
  color: var(--ink-3);
  line-height: 1.5;
}

/* ---- Spin keyframe ---- */
@keyframes spin {
  to { transform: rotate(360deg); }
}
