/* ═══════════════════════════════════════════════════════
   Envoy — Design System
   Inspired by Linear, Attio, Vercel dashboard aesthetics
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ── Design tokens — Black / Grey / Red / White ── */
:root {
  /* Sidebar */
  --sidebar-w:      220px;
  --sidebar-bg:     #0a0a0a;
  --sidebar-border: rgba(255,255,255,.07);
  --sidebar-text:   #6b6b6b;
  --sidebar-hover:  rgba(255,255,255,.05);
  --sidebar-active: rgba(255,255,255,.08);

  /* Content */
  --bg:        #f4f4f4;
  --surface:   #ffffff;
  --surface-2: #f9f9f9;
  --surface-3: #f0f0f0;

  /* Borders */
  --border:   rgba(0,0,0,.08);
  --border-2: rgba(0,0,0,.14);

  /* Text */
  --text:   #0a0a0a;
  --text-2: #4a4a4a;
  --text-3: #9a9a9a;

  /* Accent — pure black */
  --accent:        #0a0a0a;
  --accent-hover:  #222;
  --accent-subtle: #f0f0f0;
  --accent-ring:   rgba(0,0,0,.08);

  /* Red — the ONE signal colour */
  --red:       #c8001e;
  --red-light: #e8001e;
  --red-bg:    #fff5f5;
  --red-ring:  #ffd7d7;

  /* Greys for everything else */
  --grey-1: #1a1a1a;
  --grey-2: #3a3a3a;
  --grey-3: #6a6a6a;
  --grey-4: #9a9a9a;
  --grey-5: #d4d4d4;
  --grey-6: #ebebeb;

  /* Shape */
  --r:    6px;
  --r-lg: 10px;
  --r-xl: 14px;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow:    0 4px 16px rgba(0,0,0,.09);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13.5px;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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


/* ═══════════════════════════════════════════════════════
   SHELL — sidebar + content layout
═══════════════════════════════════════════════════════ */

.shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  padding: 0 0 1.5rem;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1.1rem 1rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  margin-bottom: .5rem;
}

.brand-icon {
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-icon svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

.brand-name {
  font-size: .8rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .03em;
  line-height: 1.2;
}
.brand-sub {
  font-size: .65rem;
  color: var(--sidebar-text);
  letter-spacing: .02em;
}

.sidebar-section {
  padding: 0 .5rem;
  margin-bottom: .25rem;
}

.sidebar-section-label {
  font-size: .62rem;
  font-weight: 700;
  color: rgba(255,255,255,.2);
  text-transform: uppercase;
  letter-spacing: .1em;
  padding: .75rem .6rem .3rem;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .45rem .65rem;
  border-radius: 6px;
  color: var(--sidebar-text);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background .12s, color .12s;
  cursor: pointer;
  margin-bottom: 1px;
  position: relative;
}

.nav-item svg {
  width: 15px; height: 15px;
  flex-shrink: 0;
  opacity: .7;
  stroke-width: 1.75;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: rgba(255,255,255,.85);
  text-decoration: none;
}
.nav-item:hover svg { opacity: .9; }

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}
.nav-item.active svg { opacity: 1; }
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 2px;
  background: var(--red);
  border-radius: 0 2px 2px 0;
}

.sidebar-footer {
  margin-top: auto;
  padding: .75rem .5rem 0;
  border-top: 1px solid var(--sidebar-border);
}

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.topbar {
  height: 48px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 1.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 1rem;
}

.topbar-title {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
}

.topbar-spacer { flex: 1; }

.topbar-date {
  font-size: .75rem;
  color: var(--text-3);
}

.page-body {
  padding: 1.75rem;
  flex: 1;
  position: relative;
  z-index: 1;
}

/* ── Page header ── */
.page-header { margin-bottom: 1.5rem; }
.page-header h1 {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -.025em;
  margin-bottom: .2rem;
}
.page-header p { color: var(--text-3); font-size: .8rem; }

h1 { font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: 1.25rem; }
h2 { font-size: .9rem; font-weight: 600; margin: 1.5rem 0 .75rem; color: var(--text); }


/* ═══════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════ */
.login-wrap {
  max-width: 420px;
  margin: 8vh auto 0;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-xl);
  padding: 2.75rem 2.5rem;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 38px; height: 38px;
  background: var(--sidebar-bg);
  border-radius: 8px;
  margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
}
.login-logo svg { width: 18px; height: 18px; fill: none; stroke: #fff; stroke-width: 2; }

.login-wrap h1 { font-size: 1.1rem; margin-bottom: .2rem; }
.login-wrap .subtitle { color: var(--text-3); margin-bottom: 1.5rem; font-size: .78rem; }
.login-wrap label { display: block; text-align: left; font-size: .78rem; font-weight: 600; color: var(--text-2); margin-bottom: .35rem; }

.login-wrap input[type="text"],
.login-wrap input[type="password"] {
  width: 100%; padding: .55rem .75rem;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .875rem; font-family: inherit;
  margin-bottom: 1rem; outline: none; color: var(--text);
  background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.login-wrap input[type="text"]:focus,
.login-wrap input[type="password"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.login-wrap button {
  width: 100%; padding: .6rem;
  background: var(--sidebar-bg); color: #fff;
  border: none; border-radius: var(--r);
  font-size: .875rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: opacity .15s;
}
.login-wrap button:hover { opacity: .85; }

.error {
  color: var(--red); background: var(--red-bg);
  border: 1px solid var(--red-ring);
  border-radius: var(--r); padding: .45rem .7rem;
  margin-bottom: 1rem; font-size: .78rem; text-align: left;
}


/* ═══════════════════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════════════════ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.25rem 1rem;
  box-shadow: var(--shadow-xs);
  position: relative;
}

.stat-indicator {
  width: 10px; height: 10px; border-radius: 50%;
  margin-bottom: .6rem;
  margin-left: 4px;
  display: block;
}
.stat-card.high    .stat-indicator { background: #dc2626; outline: 2.5px solid #fca5a5; outline-offset: 2px; }
.stat-card.medium  .stat-indicator { background: #d97706; outline: 2.5px solid #fcd34d; outline-offset: 2px; }
.stat-card.low     .stat-indicator { background: #16a34a; outline: 2.5px solid #86efac; outline-offset: 2px; }
.stat-card.neutral .stat-indicator { background: var(--grey-3); outline: 2.5px solid var(--grey-6); outline-offset: 2px; }

.stat-num {
  font-size: 2rem; font-weight: 700;
  line-height: 1; letter-spacing: -.04em;
  color: var(--text);
}

.stat-label {
  font-size: .7rem; font-weight: 600;
  color: var(--text-3); margin-top: .3rem;
  text-transform: uppercase; letter-spacing: .06em;
}


/* ═══════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  background: var(--surface);
  font-size: .7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3);
  padding: .6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  font-size: .84rem; color: var(--text-2);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover td { background: var(--surface-2); }

.table-link {
  font-size: .78rem; font-weight: 500;
  color: var(--accent);
}
.table-link:hover { text-decoration: underline; }


/* ═══════════════════════════════════════════════════════
   BADGES / CHIPS
═══════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 600;
  padding: .18rem .5rem;
  border-radius: 99px;
  white-space: nowrap; letter-spacing: .02em;
  border: 1px solid transparent;
}

/* Status */
.badge.done     { background: var(--grey-6); color: var(--grey-2); border-color: var(--grey-5); }
.badge.open     { background: var(--grey-6); color: var(--grey-3); border-color: var(--grey-5); }
.badge.escalated{ background: var(--red-bg); color: var(--red);    border-color: var(--red-ring); }
.badge.cat      { background: var(--grey-6); color: var(--grey-2); border-color: var(--grey-5); }
.badge-ai       { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-manual   { background: #f0fdf4; color: #166534; border-color: #86efac; }

/* Priority */
.priority-high   { background: #fff1f1; color: #b91c1c; border-color: #fca5a5; }
.priority-medium { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.priority-low    { background: #f0fdf4; color: #166534; border-color: #86efac; }
.priority-none   { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }
.priority-review { background: var(--grey-6);  color: var(--grey-2); border-color: var(--grey-5); }

/* Dot-style priority for tables */
.priority-dot {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .8rem; font-weight: 500;
}
.priority-dot::before {
  content: ''; width: 7px; height: 7px;
  border-radius: 50%; flex-shrink: 0;
}
.priority-dot.high::before   { background: #dc2626; }
.priority-dot.medium::before { background: #d97706; }
.priority-dot.low::before    { background: #16a34a; }
.priority-dot.none::before   { background: var(--grey-5); }


/* ═══════════════════════════════════════════════════════
   COMMENT CARDS
═══════════════════════════════════════════════════════ */
.comment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1rem 1.25rem;
  margin-bottom: .6rem;
  box-shadow: var(--shadow-xs);
  scroll-margin-top: 4rem;
  transition: box-shadow .15s, border-color .15s;
}
.comment-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-2); }
.comment-card.highlighted {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.comment-header {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .35rem; margin-bottom: .6rem;
}
.author { font-weight: 600; font-size: .875rem; color: var(--text); }
.comment-meta { color: var(--text-3); font-size: .75rem; margin-left: auto; }

.comment-text {
  font-size: .84rem; line-height: 1.65;
  color: var(--text-2); white-space: pre-wrap;
  margin-bottom: .65rem;
}

.suggested {
  font-size: .78rem; color: var(--text-3);
  font-style: italic; line-height: 1.55;
  padding: .55rem .75rem;
  background: var(--surface-2);
  border-radius: var(--r);
  border-left: 2px solid var(--border-2);
  margin-top: .15rem;
}

details summary {
  font-size: .76rem; color: var(--accent);
  cursor: pointer; font-weight: 500; list-style: none;
  margin-bottom: .35rem;
}
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '› '; font-size: .9rem; }
details[open] summary::before { content: '‹ '; }


/* ═══════════════════════════════════════════════════════
   TRACKING FORM (inside comment cards)
═══════════════════════════════════════════════════════ */
.tracking-form {
  border-top: 1px solid var(--border);
  padding-top: .8rem; margin-top: .7rem;
}

.tracking-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: .35rem .75rem;
  align-items: center;
  margin-bottom: .65rem;
}

.tracking-grid label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .8rem; font-weight: 500; color: var(--text-2);
  cursor: pointer;
}

.tracking-grid input[type="checkbox"] {
  width: 14px; height: 14px;
  border-radius: 3px;
  accent-color: var(--accent);
  cursor: pointer; flex-shrink: 0;
}

.tracking-grid input[type="date"] {
  padding: .22rem .45rem;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .75rem; font-family: inherit; color: var(--text-2);
  background: var(--surface-2); outline: none;
  transition: border-color .15s;
}
.tracking-grid input[type="date"]:focus { border-color: var(--accent); }

.reclassify-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: .4rem .75rem; margin-bottom: .65rem;
}
.reclassify-label {
  font-size: .75rem; font-weight: 500; color: var(--text-3);
  white-space: nowrap;
}
.reclassify-select {
  padding: .22rem .45rem;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .75rem; font-family: inherit; color: var(--text-2);
  background: var(--surface-2); outline: none;
  transition: border-color .15s; cursor: pointer;
}
.reclassify-select:focus { border-color: var(--accent); }


/* ═══════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════ */
.btn-save, .btn-primary, .btn-lg, button[type="submit"] {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem 1rem;
  background: var(--text); color: #fff;
  border: none; border-radius: var(--r);
  font-size: .8rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: opacity .15s;
  white-space: nowrap;
}
.btn-save:hover, .btn-primary:hover,
.btn-lg:hover, button[type="submit"]:hover { opacity: .85; }

.btn-lg, button[type="submit"] { padding: .5rem 1.25rem; font-size: .84rem; }

.btn-secondary {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .4rem 1rem;
  background: var(--surface); color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .8rem; font-weight: 500; font-family: inherit;
  text-decoration: none; cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }

.btn-danger {
  background: var(--red);
}


/* ═══════════════════════════════════════════════════════
   FILTER BAR
═══════════════════════════════════════════════════════ */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: .65rem 1rem;
  box-shadow: var(--shadow-xs);
}

.filter-label {
  font-size: .7rem; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .07em; white-space: nowrap;
  margin-right: .25rem;
}

.filter-bar select, .filter-bar input[type="date"] {
  padding: .35rem .65rem;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .8rem; font-family: inherit; color: var(--text-2);
  background: var(--surface-2); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.filter-bar select:focus, .filter-bar input[type="date"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-ring);
}

.filter-bar button {
  padding: .35rem .9rem;
  background: var(--text); color: #fff;
  border: none; border-radius: var(--r);
  font-size: .8rem; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: opacity .15s;
}
.filter-bar button:hover { opacity: .8; }


/* ═══════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════ */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-xs);
}

.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block; font-size: .78rem; font-weight: 600;
  color: var(--text-2); margin-bottom: .35rem;
}

.form-group input, .form-group textarea {
  width: 100%; padding: .55rem .75rem;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .875rem; font-family: 'Inter', inherit;
  color: var(--text); background: var(--surface);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.form-group textarea { resize: vertical; line-height: 1.65; }
.form-group .hint { font-size: .72rem; color: var(--text-3); margin-top: .3rem; }


/* ═══════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════ */
.format-guide {
  background: var(--grey-6); border: 1px solid var(--grey-5);
  border-radius: var(--r); padding: .8rem 1rem;
  margin-bottom: 1.1rem; font-size: .8rem; color: var(--grey-2);
}
.format-guide pre {
  margin-top: .4rem; background: var(--surface-3);
  border-radius: 4px; padding: .55rem .8rem;
  font-size: .75rem; white-space: pre-wrap; color: var(--text);
}

.error-list {
  background: var(--red-bg); border: 1px solid var(--red-ring);
  border-radius: var(--r); padding: .7rem 1rem;
  margin-bottom: 1rem; font-size: .8rem; color: var(--red);
}
.error-list ul { margin: .35rem 0 0 1.15rem; }
.error-list li { margin-bottom: .15rem; }

.insight-box {
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--grey-2);
  border-radius: var(--r-lg); padding: .9rem 1.1rem;
  margin-bottom: 1.25rem; box-shadow: var(--shadow-xs);
}
.insight-title {
  font-size: .67rem; font-weight: 700; color: var(--grey-2);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: .3rem;
}
.insight-box p { margin: 0; font-size: .84rem; color: var(--text-2); line-height: 1.6; }


/* ═══════════════════════════════════════════════════════
   TRENDS / INTELLIGENCE PAGE
═══════════════════════════════════════════════════════ */
.trends-header { margin-bottom: 1.5rem; }
.trends-header h1 { margin-bottom: .2rem; }
.trends-header p  { color: var(--text-3); font-size: .8rem; }

.kpi-row {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: .75rem; margin-bottom: 1.25rem;
}

.kpi-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1rem 1.1rem;
  display: flex; flex-direction: column; gap: .15rem;
  box-shadow: var(--shadow-xs);
}
.kpi-label {
  font-size: .67rem; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .07em; font-weight: 600;
}
.kpi-value {
  font-size: 1.9rem; font-weight: 700;
  line-height: 1; letter-spacing: -.04em; color: var(--text);
}
.kpi-sub { font-size: .7rem; color: var(--text-3); }

.kpi-card.danger  .kpi-value { color: var(--red); }
.kpi-card.warning .kpi-value { color: var(--text); }
.kpi-card.ok      .kpi-value { color: var(--text); }
.kpi-card.neutral .kpi-value { color: var(--text); }

.chart-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-bottom: .75rem; }
.chart-row.single { grid-template-columns: 1fr; }

.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow-xs);
}
.chart-card-header {
  display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem;
}
.chart-card-header h2 { margin: 0; font-size: .82rem; font-weight: 600; color: var(--text); }
.chart-card-header p  { margin: .12rem 0 0; font-size: .7rem; color: var(--text-3); }

.chart-type-select {
  font-size: .72rem; border: 1px solid var(--border-2);
  border-radius: var(--r); padding: .22rem .5rem;
  color: var(--text-2); background: var(--surface-2);
  cursor: pointer; font-family: inherit; outline: none; flex-shrink: 0;
}
.chart-type-select:focus { border-color: var(--accent); }

.chart-wrap      { position: relative; height: 220px; }
.chart-wrap-tall { position: relative; height: 300px; }

.section-label {
  font-size: .67rem; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .11em;
  margin: 1.5rem 0 .6rem; display: block;
}


/* ═══════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════ */
.btn-delete-comment {
  background: none; border: none; cursor: pointer;
  color: var(--grey-5); padding: 2px;
  display: flex; align-items: center;
  transition: color .12s;
  flex-shrink: 0;
}
.btn-delete-comment:hover { color: var(--red); }
.btn-delete-comment svg { width: 14px; height: 14px; }

.btn-reclassify {
  background: none; border: none; cursor: pointer;
  color: var(--grey-5); padding: 2px;
  display: flex; align-items: center;
  transition: color .12s;
  flex-shrink: 0;
}
.btn-reclassify:hover { color: var(--text-2); }
.btn-reclassify svg { width: 13px; height: 13px; }


/* ═══════════════════════════════════════════════════════
   RECLASSIFY DRAWER
═══════════════════════════════════════════════════════ */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.25);
  z-index: 140;
  backdrop-filter: blur(1px);
}
.drawer-overlay.open { display: block; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 340px;
  background: var(--surface);
  border-left: 1px solid var(--border-2);
  box-shadow: -8px 0 32px rgba(0,0,0,.1);
  z-index: 150;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1.1rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-eyebrow {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: .15rem;
}
.drawer-sub {
  font-size: .72rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.drawer-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3);
  padding: .2rem;
  border-radius: var(--r);
  display: flex; align-items: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.drawer-close:hover { background: var(--surface-3); color: var(--text); }
.drawer-close svg { width: 15px; height: 15px; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.drawer-preview {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: .75rem .9rem;
  font-size: .78rem;
  color: var(--text-2);
  line-height: 1.65;
  max-height: 110px;
  overflow-y: auto;
}

.drawer-field label {
  display: block;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .5rem;
}
.drawer-field select {
  width: 100%;
  padding: .5rem .65rem;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .84rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.drawer-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.drawer-priority-group {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.priority-pill input[type="radio"] { display: none; }
.priority-pill .badge {
  cursor: pointer;
  opacity: .45;
  transition: opacity .12s, box-shadow .12s;
}
.priority-pill input[type="radio"]:checked + .badge {
  opacity: 1;
  box-shadow: 0 0 0 2px currentColor;
}
.priority-pill:hover .badge { opacity: .75; }

.drawer-footer {
  display: flex;
  gap: .6rem;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.muted        { color: var(--text-3); font-size: .78rem; }
.result-count { font-size: .78rem; color: var(--text-3); margin-bottom: .75rem; }
.review-actions { display: flex; gap: .6rem; align-items: center; padding: 1rem 0; }

/* ═══════════════════════════════════════════════════════
   ADMIN PAGE
═══════════════════════════════════════════════════════ */
.admin-flash {
  padding: .6rem 1rem;
  border-radius: var(--r);
  font-size: .82rem;
  font-weight: 500;
  margin-bottom: 1rem;
  border: 1px solid transparent;
}
.admin-flash--ok  { background: #f0fdf4; color: #166534; border-color: #86efac; }
.admin-flash--err { background: #fff1f1; color: #b91c1c; border-color: #fca5a5; }

.admin-nav {
  display: flex; gap: 1rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .75rem;
}
.admin-nav a {
  font-size: .82rem; font-weight: 600;
  color: var(--text-3);
  text-decoration: none;
  padding: .25rem .1rem;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.admin-nav a:hover { color: var(--text); border-color: var(--border-2); }

.admin-section {
  margin-bottom: 2.5rem;
  scroll-margin-top: 4rem;
}

.admin-section-title {
  font-size: .9rem; font-weight: 700;
  color: var(--text);
  margin-bottom: 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.admin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xs);
}

.admin-card-title {
  font-size: .84rem; font-weight: 700;
  margin-bottom: .9rem;
  color: var(--text);
}

.admin-form {
  display: flex; flex-direction: column; gap: .65rem;
  max-width: 360px;
}

.admin-form-row {
  display: flex; flex-direction: column; gap: .25rem;
}

.admin-form-row label {
  font-size: .78rem; font-weight: 500; color: var(--text-2);
}

.admin-form-row input[type="text"],
.admin-form-row input[type="password"] {
  padding: .35rem .6rem;
  border: 1px solid var(--border-2);
  border-radius: var(--r);
  font-size: .82rem; font-family: inherit;
  background: var(--surface-2); color: var(--text);
  outline: none; transition: border-color .15s;
}
.admin-form-row input[type="text"]:focus,
.admin-form-row input[type="password"]:focus { border-color: var(--accent); }


/* ═══════════════════════════════════════════════════════
   WATERMARK — ARM wide logo, centred diagonal
═══════════════════════════════════════════════════════ */
.main-content::before {
  content: '';
  position: fixed;
  /* Extend beyond viewport edges so rotation doesn't leave bare corners */
  top: -40%;
  bottom: -40%;
  left: calc(var(--sidebar-w) - 30%);
  right: -30%;
  background-image: url('/static/img/arm-logo-wide.png');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: 55%;
  opacity: 0.055;
  transform: rotate(-22deg);
  pointer-events: none;
  z-index: 0;
}
