/* Abrq Management — local console styles.
   Hand-written, no build step, no Tailwind. */

:root {
  /* Brand scale */
  --brand-50:  #ecfdf5;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;
  --brand-900: #064e3b;
  --brand-950: #022c22;

  /* Secondary accents keep the operations UI from reading as one flat hue. */
  --accent:        #2563eb;
  --accent-soft:   #eff6ff;
  --accent-border: #bfdbfe;
  --ink-900:       #111827;
  --ink-700:       #374151;

  /* Surfaces */
  --bg:             #f6faf7;
  --bg-deep:        #eaf3ee;
  --surface:        #ffffff;
  --surface-soft:   #f4faf7;
  --surface-hover:  #f0f9f3;
  --border:         #e2efe7;
  --border-strong:  #c8e0d3;
  --border-focus:   #10b981;

  /* Text */
  --text:        #042f1f;
  --text-soft:   #244c3a;
  --text-muted:  #5a7567;
  --text-on-dark:#d1f0e0;

  /* Semantic */
  --danger:        #b91c1c;
  --danger-soft:   #fce8e8;
  --danger-border: #f6c4c4;
  --warn:          #b45309;
  --warn-soft:     #fef3c7;
  --warn-border:   #fde68a;
  --info:          #1d4ed8;
  --info-soft:     #e0e7ff;
  --info-border:   #c7d2fe;

  /* Effects */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 8px;
  --shadow-xs: 0 1px 1px rgba(2, 44, 34, 0.04);
  --shadow-sm: 0 1px 2px rgba(2, 44, 34, 0.05), 0 0 0 1px rgba(2, 44, 34, 0.02);
  --shadow:    0 4px 14px rgba(2, 44, 34, 0.07);
  --shadow-lg: 0 12px 32px rgba(2, 44, 34, 0.12);
  --ring:      0 0 0 3px rgba(16, 185, 129, 0.18);
  --transition: 120ms ease;
}

* { box-sizing: border-box; }

/* Defensive: any unsized inline SVG gets a sane default and never
   stretches its flex parent. Specific sizes are set per-context below. */
svg { flex-shrink: 0; }
svg:not([width]):not([height]) { width: 1em; height: 1em; }

html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI",
               "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: linear-gradient(180deg, #f7faf8 0%, #eef6f2 100%);
  background-attachment: fixed;
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--brand-700); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-800); text-decoration: underline; }

h1, h2, h3, h4 { color: var(--brand-950); font-weight: 650; letter-spacing: 0; }

::selection { background: var(--brand-200); color: var(--brand-950); }

/* ---------- Sidebar ---------- */

.sidebar {
  width: 248px;
  background:
    linear-gradient(180deg, #022c22 0%, #092f27 58%, #102a2b 100%);
  color: var(--text-on-dark);
  display: flex;
  flex-direction: column;
  padding: 1rem 0.85rem 1rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid #0f3a2c;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  padding: 0.35rem 0.55rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  letter-spacing: 0;
  border-radius: var(--radius-sm);
}
.sidebar .brand:hover { background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.sidebar .brand img { display: block; border-radius: 6px; }
.sidebar .brand .brand__sub {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  color: #7aa993;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 2px;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 0.9rem;
  flex: 1;
}
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: #b3d4c2;
  padding: 0.62rem 0.7rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}
.sidebar nav a .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.8; }
.sidebar nav a:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-decoration: none;
}
.sidebar nav a:hover .nav-icon { opacity: 1; }
.sidebar nav a.active {
  background: linear-gradient(180deg, #047857 0%, #065f46 100%);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.sidebar nav a.active .nav-icon { opacity: 1; }

.sidebar__footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.sidebar__meta {
  font-size: 0.7rem;
  color: #6e8f7d;
  padding: 0 0.5rem;
  letter-spacing: 0.04em;
}
.logout-form { padding: 0; margin: 0; }
.logout-form .btn-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  color: #b3d4c2;
  padding: 0.5rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  text-align: left;
}
.logout-form .btn-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  text-decoration: none;
}

/* ---------- Main ---------- */

.main {
  flex: 1;
  padding: 2rem clamp(1.25rem, 3vw, 2.5rem) 3rem;
  min-width: 0;
  max-width: 1320px;
  width: 100%;
}
@media (max-width: 900px) {
  .main { padding: 1.5rem 1.25rem 2rem; }
}
.main--auth {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    linear-gradient(135deg, rgba(2,44,34,0.96), rgba(37,99,235,0.82)),
    var(--brand-950);
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.4rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid var(--border);
}
.page-header h1 {
  font-size: 1.65rem;
  margin: 0;
  letter-spacing: 0;
}
.page-header p { margin: 0.25rem 0 0; }
.page-header .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.page-eyebrow {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand-700);
  margin-bottom: 0.35rem;
}

/* ---------- Panels & cards ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}
.panel + .panel { margin-top: 0; }
.panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
  min-height: 2rem;
}
.panel__header h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.panel__header h2 .panel-icon {
  width: 16px;
  height: 16px;
  color: var(--brand-600);
}
.panel__sub { color: var(--text-muted); font-size: 0.8rem; }

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.grid-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  align-items: start;
}
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }

/* ---------- KPIs ---------- */

.kpi-grid, .kpi-row {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.4rem;
}
.kpi-grid { grid-template-columns: repeat(4, 1fr); }
.kpi-row  { grid-template-columns: repeat(2, 1fr); max-width: 460px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px)  { .kpi-grid { grid-template-columns: 1fr; } }

.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-xs);
}
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
  opacity: 0.9;
}
.kpi--warn::before { background: linear-gradient(90deg, #f59e0b, #b45309); }
.kpi--danger::before { background: linear-gradient(90deg, #ef4444, #b91c1c); }
.kpi--neutral::before { background: linear-gradient(90deg, #94a3b8, #475569); }

.kpi__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}
.kpi__label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brand-700);
  font-weight: 600;
}
.kpi__icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand-700);
  border-radius: var(--radius-sm);
}
.kpi--warn .kpi__icon { background: var(--warn-soft); color: var(--warn); }
.kpi--danger .kpi__icon { background: var(--danger-soft); color: var(--danger); }
.kpi__icon svg { width: 16px; height: 16px; }

.kpi__value {
  font-size: 1.7rem;
  font-weight: 700;
  margin-top: 0.1rem;
  color: var(--brand-950);
  letter-spacing: 0;
  line-height: 1.1;
}
.kpi__value--warn { color: var(--warn); }
.kpi__value--danger { color: var(--danger); }
.kpi__hint { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.1rem; }

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

.btn, button.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  min-height: 2.25rem;
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition), box-shadow var(--transition);
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-hover);
  border-color: var(--brand-300);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

.btn--primary {
  background: linear-gradient(180deg, var(--brand-600), var(--brand-800));
  color: #fff;
  border-color: var(--brand-700);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset, var(--shadow-xs);
}
.btn--primary:hover {
  background: linear-gradient(180deg, var(--brand-700), var(--brand-800));
  border-color: var(--brand-800);
  color: #fff;
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--brand-700);
}
.btn--ghost:hover { background: var(--brand-50); border-color: var(--brand-100); }

.btn--danger {
  background: #fff;
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn--danger:hover { background: var(--danger-soft); border-color: #e9a3a3; }

.btn--small { padding: 0.3rem 0.6rem; font-size: 0.78rem; }
.btn--icon-only { padding: 0.4rem; }

.btn .btn-icon { width: 14px; height: 14px; }

.btn-link {
  background: none;
  border: none;
  color: var(--brand-700);
  cursor: pointer;
  font: inherit;
  padding: 0.25rem 0;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.btn-link:hover { color: var(--brand-800); text-decoration: underline; }
.btn-link--danger { color: var(--danger); }
.btn-link--danger:hover { color: #7f1d1d; }

.btn-group { display: inline-flex; gap: 0.4rem; flex-wrap: wrap; }

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.table { width: 100%; border-collapse: collapse; }
.table th, .table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
}
.table thead {
  background: var(--surface-soft);
}
.table th {
  font-weight: 600;
  color: var(--brand-700);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border-strong);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table--linked tbody tr { cursor: pointer; }
.table .num, .table .right { text-align: right; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table .arrow { color: var(--brand-600); opacity: 0; transition: opacity var(--transition); }
.table--linked tbody tr:hover .arrow { opacity: 1; }

/* When tables are placed directly inside .panel they look better edge-to-edge */
.panel > .table { width: calc(100% + 2.5rem); margin: 0 -1.25rem -0.25rem; }
.panel > .table th:first-child,
.panel > .table td:first-child { padding-left: 1.25rem; }
.panel > .table th:last-child,
.panel > .table td:last-child { padding-right: 1.25rem; }

/* ---------- Pills ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--brand-50);
  color: var(--brand-800);
  border: 1px solid var(--brand-100);
  line-height: 1.4;
  white-space: nowrap;
}
.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.65;
}
.pill--no-dot::before { display: none; }

.pill--lead     { background: #fffbeb; color: #92660c; border-color: #fde68a; }
.pill--trial    { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-100); }
.pill--paid     { background: var(--brand-100); color: var(--brand-900); border-color: var(--brand-200); }
.pill--lapsed   { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.pill--lost     { background: #fce8e8; color: #7f1d1d; border-color: #f6c4c4; }
.pill--active   { background: var(--brand-100); color: var(--brand-900); border-color: var(--brand-200); }
.pill--replaced { background: #e8eef3; color: #314158; border-color: #d0dae3; }
.pill--revoked  { background: #fce8e8; color: #7f1d1d; border-color: #f6c4c4; }
.pill--extension{ background: #e9f7ee; color: var(--brand-800); border-color: var(--brand-100); }
.pill--internal { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.pill--draft    { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }
.pill--sent     { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-100); }
.pill--overdue  { background: #fdebd0; color: #92400e; border-color: #f6d29c; }
.pill--cancelled{ background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.pill--snapshot { background: var(--brand-50); color: var(--brand-800); border-color: var(--brand-100); }
.pill--export   { background: #e8eef3; color: #314158; border-color: #d0dae3; }
.pill--note,
.pill--call,
.pill--email,
.pill--meeting,
.pill--system {
  background: var(--brand-50);
  color: var(--brand-800);
  border-color: var(--brand-100);
}
.pill--failed   { background: #fce8e8; color: #7f1d1d; border-color: #f6c4c4; }
.pill--skipped  { background: #f3f4f6; color: #4b5563; border-color: #e5e7eb; }

.badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  background: var(--brand-700);
  color: #fff;
  border-radius: 4px;
  letter-spacing: 0.06em;
  margin-left: 0.25rem;
  font-weight: 600;
}

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

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem 1.1rem;
  margin-bottom: 1.1rem;
}
@media (max-width: 800px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
@media (max-width: 800px) {
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
}

.form-grid label,
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-800);
  letter-spacing: 0.01em;
}
.form-grid label.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
  color: var(--text);
}

input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="tel"], input[type="number"],
input[type="url"], input[type="date"], select, textarea {
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
  font-weight: 450;
  min-height: 2.35rem;
  width: 100%;
}
input::placeholder, textarea::placeholder { color: #9bb3a4; }
input:hover, select:hover, textarea:hover { border-color: var(--brand-300); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 80px; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23047857'><path d='M4.5 6 L8 9.5 L11.5 6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 14px;
  padding-right: 2rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.form-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; font-weight: 400; }

.filters {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
  background: var(--surface);
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  position: relative;
}
.filters input[type="search"] { min-width: 260px; flex: 1; max-width: 360px; }
.filters select { min-width: 140px; }

.inline-form {
  margin-top: 1rem;
  padding: 0;
  border-top: 1px solid var(--border);
}
.inline-form summary {
  cursor: pointer;
  color: var(--brand-700);
  font-weight: 600;
  padding: 0.65rem 0;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}
.inline-form summary::-webkit-details-marker { display: none; }
.inline-form summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 700;
  font-size: 0.85rem;
  transition: transform var(--transition);
}
.inline-form[open] summary::before { content: "−"; }
.inline-form[open] { padding-bottom: 0.4rem; }
.inline-form .form { padding: 0.5rem 0 0; }

/* ---------- Auth card ---------- */

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.25rem 2.25rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
}
.auth-card h1 {
  margin: 1rem 0 0.25rem;
  font-size: 1.4rem;
  letter-spacing: 0;
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  color: var(--brand-950);
  font-size: 0.95rem;
}
.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.1rem;
}
.auth-card .btn--primary {
  margin-top: 0.5rem;
  padding: 0.65rem;
  justify-content: center;
  font-size: 0.95rem;
}
.auth-card .muted { font-size: 0.85rem; }
.auth-foot {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
}

/* ---------- Misc ---------- */

.muted { color: var(--text-muted); font-size: 0.85rem; }
.text-danger { color: var(--danger); font-weight: 600; }
.text-warn { color: var(--warn); font-weight: 600; }
.text-success { color: var(--brand-700); font-weight: 600; }
.prewrap { white-space: pre-wrap; word-break: break-word; }

.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  background: #022c22;
  color: #d1f0e0;
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.55;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: var(--brand-50);
  color: var(--brand-900);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--brand-100);
}

.dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 0.65rem 1rem;
  margin: 0;
  font-size: 0.88rem;
}
.dl dt {
  color: var(--brand-700);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: center;
}
.dl dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.list { list-style: none; padding: 0; margin: 0; }
.list li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  min-height: 3rem;
}
.list li:last-child { border-bottom: 0; }

.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.contact-list li:last-child { border-bottom: 0; }

/* Activity feed */
.activity-feed {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  position: relative;
}
.activity-feed::before {
  content: "";
  position: absolute;
  top: 0.75rem; bottom: 0.75rem;
  left: 9px;
  width: 1px;
  background: var(--border);
}
.activity-feed li {
  padding: 0.6rem 0 0.85rem 2rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.activity-feed li:last-child { border-bottom: 0; }
.activity-feed li::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 1.05rem;
  width: 9px;
  height: 9px;
  background: var(--brand-500);
  border: 2px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--brand-200);
}
.activity-feed header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.activity-feed p { margin: 0.4rem 0 0; font-size: 0.88rem; color: var(--text-soft); }
.activity-feed .activity-meta { color: var(--text-muted); font-size: 0.78rem; }

/* Alerts */
.alert {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  font-size: 0.88rem;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  border: 1px solid transparent;
}
.alert--error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-border);
}
.alert--warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: var(--warn-border);
}
.alert--info {
  background: var(--brand-50);
  color: var(--brand-800);
  border-color: var(--brand-100);
}
.alert svg { flex-shrink: 0; margin-top: 1px; width: 16px; height: 16px; }

.empty {
  text-align: center;
  padding: 3rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
}
.empty p { margin: 0 0 1rem; font-size: 0.95rem; }
.empty__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--brand-50);
  color: var(--brand-700);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.85rem;
}
.empty__icon svg { width: 22px; height: 22px; }

.fp-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.fp-list code { word-break: break-all; font-size: 0.78rem; }

.confirm-input { width: 140px; margin-right: 0.25rem; }
.restore-form { display: flex; align-items: center; gap: 0.3rem; }
.inline { display: inline-flex; gap: 0.3rem; align-items: center; margin: 0; }
.inline select { width: auto; }

/* Subtle helper for "X days remaining" cells */
.days-warn { color: var(--warn); font-weight: 600; }
.days-danger { color: var(--danger); font-weight: 600; }

/* Soft section divider for stacked panels */
.section-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* Screen-reader only — keep an element accessible to AT but not visible. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Helpers for tag rows / breadcrumb-eyebrows / inline-form muted copy.
   These exist so templates can drop their inline `style=""` attributes. */
.tag-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.eyebrow-link, .page-eyebrow a {
  color: inherit;
}
.inline-form-copy {
  margin-top: 0.5rem;
}
.invoice-total {
  font-size: 1.05rem;
}
.notes-heading {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-700);
}
.kpi-grid--narrow {
  grid-template-columns: repeat(2, 1fr);
  max-width: 600px;
}
.alert--top-gap {
  margin-bottom: 1.5rem;
}

/* Header strip used inside the dashboard */
.welcome-strip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.welcome-strip .dot {
  width: 6px;
  height: 6px;
  background: var(--brand-500);
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
}

@media (max-width: 760px) {
  body {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    padding: 0.75rem;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .sidebar .brand {
    padding: 0.25rem 0.35rem 0.75rem;
    border-bottom: 0;
  }

  .sidebar nav {
    flex-direction: row;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.25rem 0 0;
    scrollbar-width: thin;
  }

  .sidebar nav a {
    flex: 0 0 auto;
    padding: 0.55rem 0.65rem;
  }

  .sidebar__footer {
    display: none;
  }

  .main {
    padding: 1.25rem 1rem 2rem;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 0.85rem;
  }

  .page-header .actions,
  .form-actions,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .actions .btn,
  .form-actions .btn,
  .filters .btn,
  .filters input[type="search"],
  .filters select {
    width: 100%;
    max-width: none;
  }

  .panel {
    padding: 1rem;
  }

  .panel > .table {
    width: calc(100% + 2rem);
    margin-left: -1rem;
    margin-right: -1rem;
  }

  .panel > .table th:first-child,
  .panel > .table td:first-child { padding-left: 1rem; }
  .panel > .table th:last-child,
  .panel > .table td:last-child { padding-right: 1rem; }

  .dl {
    grid-template-columns: 1fr;
    gap: 0.2rem 0;
  }

  .dl dd {
    margin-bottom: 0.65rem;
  }

  .list li,
  .contact-list li {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.45rem;
  }
}
