/* The portal's one stylesheet. Tokens are Baxter's (root DESIGN.md §4); layout is a top bar. */
:root {
  color-scheme: light;
  --page: #f5f6f8;
  --surface: #ffffff;
  --text-primary: #202632;
  --text-secondary: #526072;
  --text-muted: #606c7c;
  --border: #e3e6ec;
  --border-strong: #acb5c2;
  --accent: #2459bd;
  --accent-hover: #1c489d;
  --nav-surface: #202630;
  --nav-text: #f3f5f9;
  --nav-link: #dde2ea;
  --nav-active: #354154;
  --brand-amber: #fab219;
  --brand-amber-hover: #e29d0c;
  --success-text: #006300;
  --critical-text: #a01f1f;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

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

h1 { font-size: 24px; margin: 0 0 16px; }

/* --- Top bar ---------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  min-height: 56px;
  background: var(--nav-surface);
  color: var(--nav-text);
}

.brand,
.card-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
}

.brand:hover { color: inherit; }
.brand-name { font-weight: 700; letter-spacing: 0.06em; }
.brand-site::before { content: "·"; margin: 0 6px 0 2px; }

.topnav { display: flex; gap: 4px; flex: 1; }

.topnav a {
  color: var(--nav-link);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
}

.topnav a[aria-current="page"],
.topnav a:hover { background: var(--nav-active); color: var(--nav-text); }

.signout { display: flex; align-items: center; gap: 12px; margin: 0 0 0 auto; }
.who { color: var(--nav-link); font-size: 14px; }

.button-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--nav-text);
  text-decoration: underline;
  cursor: pointer;
}

/* --- Page ------------------------------------------------------------- */
.content {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 24px;
}

.count { color: var(--text-secondary); margin: 0 0 8px; }
.empty { color: var(--text-muted); }

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.plain-list li { padding: 12px 16px; border-top: 1px solid var(--border); }
.plain-list li:first-child { border-top: 0; }

/* --- Card pages ------------------------------------------------------- */
.card-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-amber);
  border-radius: 10px;
  padding: 28px 32px;
}

.card-brand { margin: 0 0 20px; }
.card-links { margin: 16px 0 0; font-size: 14px; }

/* --- Forms ------------------------------------------------------------ */
.field { margin: 0 0 16px; }

.field label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 6px;
}

.field input,
.field select {
  width: 100%;
  font: inherit;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
}

.field input:focus,
.field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.field input[type="file"] { padding: 7px 8px; background: var(--page); }

.button-primary {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border: 0;
  border-radius: 6px;
  background: var(--brand-amber);
  color: var(--text-primary);
  cursor: pointer;
}

.button-primary:hover { background: var(--brand-amber-hover); }
.button-block { width: 100%; }

.message { margin: 0 0 16px; padding: 10px 12px; border-radius: 6px; background: var(--page); }
.message p { margin: 0; }
.message.error { color: var(--critical-text); }
.message.success { color: var(--success-text); }

/* --- Admin screens ---------------------------------------------------- */
.page-head,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}

.page-head h1,
.panel-head h2 { margin: 0; }

.breadcrumb { margin: 0 0 8px; font-size: 14px; }
.subtitle { margin: -10px 0 24px; color: var(--text-secondary); }
h2 { font-size: 17px; margin: 0 0 12px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin: 0 0 20px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.panel .table { border: 0; }

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.table td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }

.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline; margin-left: 12px; }

/* A row that leads somewhere is clickable in full; the real anchor stays the target (root CLAUDE.md §7). */
.row-link { position: relative; }
.row-link:hover td { background: var(--page); }
.row-link-target { font-weight: 600; text-decoration: none; }
.row-link-target::after { content: ""; position: absolute; inset: 0; }
.row-link-target::before { content: "›"; float: right; color: var(--text-muted); }
.row-link a:not(.row-link-target) { position: relative; z-index: 1; }
/* A row that opens a file goes nowhere else, so no › . */
.row-link-file .row-link-target::before { content: none; }

.year { margin: 0 0 24px; }

.switch-list { list-style: none; margin: 0; padding: 0; }

.switch-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.switch-list li:first-child { border-top: 0; }
.switch-list form { margin: 0; }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  padding: 4px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-primary);
}

.switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border-strong);
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
}

.switch[aria-checked="true"] .switch-track { background: var(--accent); }
.switch[aria-checked="true"] .switch-track::after { left: 18px; }
.switch-word { min-width: 52px; text-align: left; }

.button-secondary {
  display: inline-block;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
}

.button-secondary:hover { background: var(--page); color: var(--text-primary); }
a.button-primary { display: inline-block; text-decoration: none; font-size: 14px; padding: 8px 14px; }
a.button-primary,
.button-secondary { white-space: nowrap; }
a.button-primary:hover { color: var(--text-primary); }

.button-link-dark {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.dialog {
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 24px;
  color: var(--text-primary);
}

.dialog::backdrop { background: rgba(32, 38, 50, 0.45); }
.dialog h2 { font-size: 20px; margin: 0 0 16px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 20px 0 0;
}

.form-page { max-width: 520px; }

.nowrap { white-space: nowrap; }
.muted { color: var(--text-muted); }
/* --- Web Connector ------------------------------------------------------ */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 24px; margin: 0 0 16px; font-size: 14px; }
.facts dt { color: var(--text-secondary); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.error-text { color: var(--critical-text); }
.password-once code { font-size: 15px; user-select: all; overflow-wrap: anywhere; }
.actions-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 16px; }
.actions-row form { margin: 0; }
.company-file label { display: block; font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: 6px; }
.status-line { margin: -8px 0 16px; font-size: 14px; color: var(--text-secondary); }

.pager { display: flex; gap: 16px; align-items: center; margin: 12px 0 0; font-size: 14px; color: var(--text-secondary); }

/* Upload forms report how far the file has got (core/static/js/upload-progress.js). */
.upload-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.upload-progress progress { flex: 1; height: 8px; accent-color: var(--accent); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .table th:nth-child(2),
  .table td:nth-child(2) { display: none; }
  /* The audit keeps Who and To; From is the column a phone can spare. */
  .table.audit th:nth-child(2),
  .table.audit td:nth-child(2) { display: table-cell; }
  .table.audit th:nth-child(5),
  .table.audit td:nth-child(5) { display: none; }
  .facts { grid-template-columns: 1fr; gap: 2px; }
  .facts dd { margin: 0 0 8px; }
  .actions { white-space: normal; }
  .actions form { display: block; margin: 4px 0 0; }

  .topbar { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .topnav { order: 3; flex-basis: 100%; }
  .who { display: none; }
  .content { padding: 24px 16px; }
  .card { padding: 24px 20px; }
}
