/* Claims Intel · Portal Lookup — design system mirrors the Claims Intel app:
   navy sidebar, warm cream workspace, Manrope headings, IBM Plex body/data. */

:root {
  --font-display: "Manrope", "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  --ink: #102033;
  --ink-2: #33465c;
  --muted: #5d6d81;
  --faint: #8794a6;

  --ground: #ebe5da;
  --surface: #faf7f1;
  --surface-head: #fcfaf5;
  --card: #ffffff;
  --sunk: #f3eee5;
  --line: #e5dccd;
  --line-strong: #d6c9b5;

  --navy: #12233a;
  --navy-2: #1b3050;
  --navy-ink: #eef3f9;
  --navy-muted: #93a4bb;
  --primary: #0f3d6b;
  --primary-hover: #0a2f55;
  --primary-soft: #e8eff8;
  --amber: #e9a825;
  --link: #1d4ed8;

  --ok-bg: #e7f6ee; --ok-fg: #13663f; --ok-line: #c3e6d1;
  --warn-bg: #fff5da; --warn-fg: #875100; --warn-line: #f0dca0;
  --bad-bg: #fdedf0; --bad-fg: #b1213d; --bad-line: #f4cbd4;
  --info-bg: #eaf1fd; --info-fg: #1e4db4; --info-line: #cddcf8;
  --violet-bg: #f1ecfd; --violet-fg: #5636b8; --violet-line: #dcd2f7;
  --neutral-bg: #f1ece3; --neutral-fg: #56667a; --neutral-line: #e1d7c8;

  --r-xl: 28px;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;

  --shadow-card: 0 1px 2px rgba(16, 32, 51, 0.04);
  --shadow-float: 0 18px 48px -16px rgba(16, 32, 51, 0.35);
  --focus: 0 0 0 3px rgba(233, 168, 37, 0.45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 0% 0%, #f3eee6 0%, var(--ground) 60%) fixed, var(--ground);
  color: var(--ink);
  font: 14px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); font-weight: 800; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }
[hidden] { display: none !important; }
.mono { font-family: var(--font-mono); font-size: 0.92em; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -40px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { top: 12px; }

.eyebrow {
  font: 700 10.5px/1.2 var(--font-body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: none; }
[data-icon] svg { width: 100%; height: 100%; }

/* ---------------------------------------------------------------- Shell */

.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 12px;
  height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px 14px;
  background: linear-gradient(180deg, var(--navy) 0%, #0f1e33 100%);
  color: var(--navy-ink);
  border-radius: var(--r-xl);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.08);
  display: grid; place-items: center;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: grid; gap: 3px; }
.brand-text .eyebrow { color: var(--navy-muted); }
.brand-text strong { font: 800 21px/1.1 var(--font-display); letter-spacing: -0.01em; }

.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  color: #d6dfea;
  font-weight: 600;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.1); color: #fff; border-left-color: var(--amber); }
.nav a [data-icon] { opacity: 0.9; }

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-foot .eyebrow { color: var(--navy-muted); font-size: 9.5px; }
.sidebar-foot .eyebrow + strong, .sidebar-foot .eyebrow + span { margin-bottom: 8px; }
.sidebar-foot strong { font-size: 13px; }
.runner-info { font-size: 12.5px; color: #c7d2df; }

.workspace {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  display: flex;
  flex-direction: column;
}

.runtime-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  min-height: 60px;
}
.runtime-label { color: #b06d00; }
.runtime-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; min-width: 0; }
.icon-btn.menu-btn { display: none; }

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  padding: 22px 28px 20px;
  background: var(--surface-head);
  border-bottom: 1px solid var(--line);
}
.page-head-text { display: grid; gap: 6px; min-width: 0; }
.crumb { font: 700 10.5px/1.2 var(--font-body); letter-spacing: 0.16em; text-transform: uppercase; color: var(--faint); }
.crumb b { color: var(--ink); font-weight: 700; }
.page-head h1 { font-size: 24px; line-height: 1.2; }
.page-head p { color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.view { padding: 22px 28px 40px; outline: none; }
.view-root { display: grid; gap: 18px; align-content: start; min-width: 0; }

/* ------------------------------------------------------------ Controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: #fdfbf7; border-color: #c7b89f; text-decoration: none; }
.btn [data-icon] { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 8px 18px -10px rgba(15, 61, 107, 0.7); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-dark:hover { background: #1c3149; border-color: #1c3149; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--sunk); border-color: transparent; }
.btn-danger { color: var(--bad-fg); border-color: var(--bad-line); background: var(--bad-bg); }
.btn-danger:hover { background: #fbe0e5; border-color: #eab3bf; }
.btn-sm { min-height: 30px; padding: 0 10px; border-radius: 9px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

.icon-btn {
  width: 38px; height: 38px;
  display: inline-grid; place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  cursor: pointer;
}
.icon-btn:hover { background: var(--sunk); }

.input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #fdfcf9;
  color: var(--ink);
}
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: #b69a6a; box-shadow: var(--focus); }
select.input { padding-right: 34px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235d6d81' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.search-input { position: relative; flex: 1 1 260px; min-width: 200px; }
.search-input [data-icon] { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--faint); pointer-events: none; }
.search-input .input { padding-left: 36px; }
.field-label { font-weight: 600; font-size: 13px; }
.field-error { color: var(--bad-fg); font-size: 13px; }
.hint { color: var(--muted); font-size: 12.5px; }

/* --------------------------------------------------------- Worker enrollment */

.modal {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  overflow: auto;
}
.modal::backdrop { background: rgba(16, 32, 51, 0.58); }
.modal-shell { display: grid; margin: 0; }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-head);
}
.modal-head h2 { margin-top: 4px; font-size: 18px; }
.modal-body { padding: 20px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-head);
}
.portal-access {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.portal-access legend { padding: 0 6px; }
.portal-access label { display: flex; align-items: flex-start; gap: 8px; }
.portal-access input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--primary); }
.code-display {
  display: block;
  padding: 18px;
  border: 1px solid var(--info-line);
  border-radius: var(--r-md);
  background: var(--info-bg);
  color: var(--info-fg);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.5;
  overflow-wrap: anywhere;
  text-align: center;
}

/* ------------------------------------------------------- Pills & chips */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--neutral-line);
  background: var(--neutral-bg);
  color: var(--neutral-fg);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.6;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-line); }
.pill.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.pill.bad { background: var(--bad-bg); color: var(--bad-fg); border-color: var(--bad-line); }
.pill.info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-line); }
.pill.violet { background: var(--violet-bg); color: var(--violet-fg); border-color: var(--violet-line); }
.pill.portal { background: #fff; color: var(--ink-2); border-color: var(--line-strong); letter-spacing: 0.02em; }
.pill.live .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
  font-size: 12.5px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.chip:hover { border-color: #bfae92; text-decoration: none; }
.chip .count { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip[aria-pressed="true"] .count { color: #c9d4e2; }
.chip.portal-chip[aria-pressed="false"] { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }
.chip.portal-chip.empty-chip[aria-pressed="false"] { background: var(--card); border-color: var(--line); color: var(--faint); }
.chip.warn-chip { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); }
.chip.info-chip { background: var(--info-bg); border-color: var(--info-line); color: var(--info-fg); }
.chip.bad-chip { background: var(--bad-bg); border-color: var(--bad-line); color: var(--bad-fg); }
.chip.ok-chip { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); }

/* ON/OFF switch */
.switch {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 6px 8px 6px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font: 800 15px/1 var(--font-display);
  cursor: pointer;
}
.switch-track { position: relative; width: 54px; height: 30px; border-radius: 999px; background: #cdc2b0; transition: background 0.15s ease; flex: none; }
.switch-thumb { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 32, 51, 0.35); transition: transform 0.15s ease; }
.switch[aria-checked="true"] { border-color: var(--ok-line); background: var(--ok-bg); color: var(--ok-fg); }
.switch[aria-checked="true"] .switch-track { background: #2f9a64; }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(24px); }
.switch .switch-label { min-width: 30px; text-align: left; }
.switch[disabled] { opacity: 0.6; cursor: progress; }

.schedule-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 18px 20px; }
.schedule-head .titles { display: grid; gap: 4px; max-width: 70ch; }
.schedule-head h2 { font-size: 17px; }
.schedule-head p { color: var(--muted); }
.fact-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border-top: 1px solid var(--line); }
.fact-row > div { display: grid; gap: 4px; align-content: start; padding: 12px 20px; border-right: 1px solid var(--line); min-width: 0; }
.fact-row > div:last-child { border-right: 0; }
.fact-row strong { font-weight: 700; overflow-wrap: anywhere; }
.fact-row .sub { font-size: 12.5px; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 16px;
  width: fit-content;
  max-width: 100%;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { background: rgba(255, 255, 255, 0.6); }
.tab .count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.tab[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 32, 51, 0.12); }
.tab[aria-selected="true"] .count { color: var(--muted); }

/* ------------------------------------------------------ Panels & tiles */

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
}
.panel-pad { padding: 18px 20px; }
.panel-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-head .titles { display: grid; gap: 4px; }
.panel-head h2 { font-size: 16px; line-height: 1.3; }
.panel-head p { color: var(--muted); font-size: 13px; }
.panel-body { padding: 16px 20px 18px; }
.panel-soft { background: #fcfaf6; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.tiles.compact { grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); }
.tile {
  display: grid; gap: 6px; align-content: start;
  padding: 13px 15px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
a.tile:hover { border-color: var(--line-strong); text-decoration: none; box-shadow: 0 6px 16px -12px rgba(16, 32, 51, 0.5); }
.tile .eyebrow { color: inherit; opacity: 0.75; }
.tile .value { font: 800 22px/1.15 var(--font-display); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tile .value.sm { font-size: 16px; }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile.ok { background: #effaf4; border-color: var(--ok-line); color: var(--ok-fg); }
.tile.warn { background: #fffaea; border-color: var(--warn-line); color: var(--warn-fg); }
.tile.bad { background: #fdf2f4; border-color: var(--bad-line); color: var(--bad-fg); }
.tile.info { background: #f0f5fe; border-color: var(--info-line); color: var(--info-fg); }
.tile.sand { background: #f6f1e8; border-color: var(--neutral-line); }
.tile.ok .sub, .tile.warn .sub, .tile.bad .sub, .tile.info .sub { color: inherit; opacity: 0.8; }

.banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn-fg);
}
.banner.bad { border-color: var(--bad-line); background: var(--bad-bg); color: var(--bad-fg); }
.banner.info { border-color: var(--info-line); background: var(--info-bg); color: var(--info-fg); }
.banner .banner-text { flex: 1 1 280px; display: grid; gap: 2px; }
.banner strong { font-weight: 700; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.stack { display: grid; gap: 12px; align-content: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }

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

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.data-table th {
  position: sticky; top: 0;
  text-align: left;
  font: 700 10px/1.3 var(--font-body);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--sunk);
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: #fdfbf6; }
.data-table .num-col { text-align: right; font-variant-numeric: tabular-nums; }
.data-table .action-col { position: sticky; right: 0; background: var(--card); text-align: right; width: 1%; white-space: nowrap; box-shadow: -8px 0 12px -12px rgba(16, 32, 51, 0.35); }
.data-table tbody tr:hover .action-col { background: #fdfbf6; }
.data-table th.action-col { background: var(--sunk); }
.cell-main { display: block; font-weight: 600; color: var(--ink); }
.cell-main a { color: inherit; }
.cell-sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.cell-sub + .cell-sub { margin-top: 0; }
.cell-stack { display: grid; gap: 4px; justify-items: start; }
.claims-table td:first-child { min-width: 190px; }
.claims-table td:nth-child(2) { min-width: 170px; }
.claims-table td:nth-child(3) { min-width: 104px; }
.claims-table td:nth-child(4) { min-width: 160px; }
.claims-table td:nth-child(5) { min-width: 96px; }
.claims-table td:nth-child(6) { min-width: 170px; }

.money-line { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.money-line span:first-child { color: var(--muted); }
.money-line b { font-weight: 600; font-variant-numeric: tabular-nums; }

.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--line); }
.pagination .row { gap: 8px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.toolbar .input { width: auto; }
.toolbar select.input { min-width: 150px; }
.toolbar .search-input .input { width: 100%; }
.filter-stack { display: grid; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.filter-label { font: 700 10px/1 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-right: 4px; }

/* ------------------------------------------------ Empty, error, loading */

.state {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 36px 20px;
  color: var(--muted);
}
.state strong { color: var(--ink); font-size: 15px; }
.state.error strong { color: var(--bad-fg); }
.skeleton {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #efe9df 0%, #f7f3ec 50%, #efe9df 100%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton.lg { height: 22px; width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------ Key/value lists */

.kv { display: grid; }
.kv-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv-row dt { font: 700 10px/1.5 var(--font-body); letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); flex: none; max-width: 45%; }
.kv-row dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.kv-row dd.empty { color: var(--faint); font-weight: 400; }
.kv dl, dl.kv { margin: 0; }

.field-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.field-grid .fg-item { padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: grid; gap: 3px; min-width: 0; }
.field-grid .fg-item.wide { grid-column: 1 / -1; }
.field-grid .fg-item span { font: 700 10px/1.4 var(--font-body); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); }
.field-grid .fg-item strong { font-weight: 600; overflow-wrap: anywhere; white-space: pre-wrap; }
.field-grid .fg-item strong.empty { color: var(--faint); font-weight: 400; }
.field-grid pre { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.5 var(--font-mono); }

details.disclosure { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--card); }
details.disclosure > summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 20px;
  font-weight: 700;
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary .chev { transition: transform 0.15s ease; color: var(--muted); }
details.disclosure[open] > summary .chev { transform: rotate(90deg); }
details.disclosure > summary .summary-meta { font-weight: 500; color: var(--muted); font-size: 13px; margin-left: auto; }
details.disclosure .disclosure-body { padding: 0 20px 18px; display: grid; gap: 16px; }
.section-title { font: 700 13px/1.3 var(--font-body); color: var(--ink); margin-bottom: 8px; }

pre.code {
  margin: 0;
  max-height: 460px;
  overflow: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7f3ec;
  border: 1px solid var(--line);
  font: 12px/1.55 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.capture-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.capture-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--muted); }
.capture-table { border-collapse: collapse; font-size: 12.5px; min-width: 100%; }
.capture-table th, .capture-table td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.capture-table th { background: var(--sunk); font-weight: 600; }

/* ------------------------------------------------------- Claim workspace */

.claim-hero { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.claim-id { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.avatar {
  width: 52px; height: 52px; flex: none;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  display: grid; place-items: center;
  font: 800 17px/1 var(--font-display);
  box-shadow: 0 10px 22px -12px rgba(15, 61, 107, 0.8);
}
.claim-id h2 { font-size: 24px; line-height: 1.2; overflow-wrap: anywhere; }
.claim-id .meta { color: var(--muted); margin-top: 4px; }
.claim-id .pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.remarks { border-left: 3px solid var(--amber); padding: 10px 14px; background: #fffaeb; border-radius: 0 12px 12px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview { position: relative; }
.rerun-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
.rerun-facts dt { color: var(--muted); }
.rerun-facts dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.rerun-choice { display: grid; gap: 10px; border: 0; margin: 0; padding: 0; }
.rerun-choice label { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.rerun-choice label:has(input:checked) { border-color: var(--ink); }
.rerun-choice input { margin-top: 3px; }
.rerun-choice small { display: block; color: var(--muted); margin-top: 2px; }
pre.code.job-log { max-height: 520px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.job-log .log-time { color: var(--muted); }
.job-log .log-warn { color: var(--bad-fg); }
.preview pre.code { max-height: 220px; }
.preview.expanded pre.code { max-height: 70vh; }
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.doc-list li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; font-size: 13px; overflow-wrap: anywhere; }
.doc-list li [data-icon] { color: var(--muted); margin-top: 1px; }
.doc-list li > div { flex: 1; min-width: 0; }
.doc-list li > .nowrap { margin-left: auto; }
.doc-files { display: grid; gap: 6px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.doc-file { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.doc-file > div { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 620px) {
  .doc-file { display: grid; gap: 4px; }
}
.cell-sub.bad { color: var(--bad-fg); }

/* ----------------------------------------------------- Portal Ops / Logs */

.portal-name { display: grid; gap: 2px; }
.portal-name strong { font-weight: 700; }
.check { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; }
.check:disabled { cursor: not-allowed; }

.master-detail { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 18px; align-items: start; }
.run-list { display: grid; gap: 8px; padding: 14px; max-height: calc(100vh - 260px); overflow-y: auto; }
.run-card {
  display: grid; gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  text-align: left;
  cursor: pointer;
  width: 100%;
}
.run-card:hover { border-color: var(--line-strong); }
.run-card[aria-current="true"] { border: 2px solid var(--ink); padding: 11px 13px; }
.run-card .row-between { flex-wrap: nowrap; }
.run-card .title { font-weight: 700; overflow-wrap: anywhere; }
.run-card .meta { font-size: 12.5px; color: var(--muted); }
.run-card .err { font-size: 12.5px; color: var(--bad-fg); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.detail-sticky { position: sticky; top: 12px; }

.bar-list { display: grid; gap: 10px; }
.bar-item { display: grid; grid-template-columns: 140px minmax(0, 1fr) 56px; gap: 12px; align-items: center; color: inherit; text-decoration: none; font-size: 13px; }
.bar-item:hover { text-decoration: none; }
.bar-item:hover .bar-label { text-decoration: underline; }
.bar-track { display: block; height: 10px; border-radius: 99px; background: var(--sunk); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: var(--primary); min-width: 2px; }
.bar-fill.ok { background: #2f9a64; } .bar-fill.warn { background: #d99a1b; } .bar-fill.bad { background: #c9415b; }
.bar-fill.info { background: #3b6fd8; } .bar-fill.violet { background: #7355d6; } .bar-fill.neutral { background: #9aa6b5; }
.bar-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

.brief-list { list-style: none; margin: 0; padding: 0; }
.brief-list li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--line); }
.brief-list li:last-child { border-bottom: 0; }
.brief-list .brief-main { min-width: 0; display: grid; gap: 2px; }
.brief-list .brief-main a { font-weight: 600; color: var(--ink); }
.brief-list .brief-side { text-align: right; display: grid; gap: 4px; justify-items: end; flex: none; }

/* ------------------------------------------------------ Drawer & toasts */

.drawer-scrim, .sidebar-scrim { position: fixed; inset: 0; background: rgba(16, 32, 51, 0.35); z-index: 40; }
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px;
  width: min(420px, calc(100vw - 24px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-float);
  z-index: 50;
  display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 20px 22px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 20px; margin-top: 4px; }
.drawer-body { padding: 18px 22px; display: grid; gap: 8px; align-content: start; overflow-y: auto; }
.drawer-body .input + .field-label { margin-top: 8px; }
.drawer-body .btn-block { margin-top: 10px; }
.drawer-status { margin-top: 14px; padding: 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); display: grid; gap: 8px; }

.toasts { position: fixed; bottom: 16px; right: 16px; display: grid; gap: 8px; z-index: 60; width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-float);
  animation: toast-in 0.18s ease-out;
}
.toast .toast-text { flex: 1; display: grid; gap: 2px; min-width: 0; }
.toast .toast-text span { color: #c9d4e2; font-size: 12.5px; overflow-wrap: anywhere; }
.toast a { color: #ffd37a; font-weight: 600; }
.toast.ok { border-left: 4px solid #4cc38a; }
.toast.bad { border-left: 4px solid #f0768e; }
.toast.warn { border-left: 4px solid var(--amber); }
.toast button { background: transparent; border: 0; color: #c9d4e2; cursor: pointer; padding: 0 2px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------------------------------------------------------- Responsive */

@media (max-width: 1180px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .master-detail { grid-template-columns: minmax(0, 1fr); }
  .run-list { max-height: 420px; }
  .detail-sticky { position: static; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 0; gap: 0; }
  .sidebar {
    position: fixed; top: 8px; left: 8px; bottom: 8px;
    height: auto; width: 272px;
    z-index: 45;
    transform: translateX(-110%);
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: none; }
  .workspace { border-radius: 0; border-left: 0; border-right: 0; min-height: 100vh; }
  .icon-btn.menu-btn { display: inline-grid; }
  .runtime-bar { padding: 10px 16px; }
  .runtime-label { display: none; }
  .page-head { padding: 18px 16px; }
  .view { padding: 16px 16px 32px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .bar-item { grid-template-columns: 110px minmax(0, 1fr) 44px; }
}

@media (max-width: 560px) {
  #fetchClaimButton .label-long { display: none; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar .input, .toolbar select.input, .toolbar .search-input { width: 100%; flex-basis: 100%; }
  .tabs { width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .panel-head, .panel-body, .filter-stack, .pagination { padding-left: 14px; padding-right: 14px; }
  .claim-id h2 { font-size: 20px; }
  .kv-row { flex-direction: column; gap: 2px; }
  .kv-row dt { max-width: none; }
  .kv-row dd { text-align: left; }
  .fact-row > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .fact-row > div:last-child { border-bottom: 0; }
  .claims-table.is-empty { table-layout: fixed; min-width: 100%; }
  .claims-table.is-empty thead { display: none; }
  .claims-table td.empty-table-cell { min-width: 0; width: 100%; padding: 0; }
}

/* ------------------------------------------------------ Minimal UI additions */

.page-head { align-items: center; padding-top: 18px; padding-bottom: 16px; }

/* Sidebar alert, shown only when the local runner has stopped. */
.sidebar-foot.runner-alert { background: rgba(233, 168, 37, 0.14); border-color: rgba(233, 168, 37, 0.45); }
.sidebar-foot.runner-alert strong { color: #ffd37a; }

.chip [data-icon] { width: 14px; height: 14px; }

/* Claim page: one details list in two columns. */
.kv-columns .kv { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; }

/* Refresh Logs: timing and counts as plain lines. */
.run-line { color: var(--ink-2); font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .kv-columns .kv { grid-template-columns: minmax(0, 1fr); }
}


/* Portal claim timeline (IHX), shown in a drawer from the claim page. */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.timeline-item { display: grid; grid-template-columns: 18px 1fr; gap: 12px; position: relative; }
.timeline-item::before {
  content: ""; position: absolute; left: 8px; top: 18px; bottom: -18px;
  width: 1px; background: var(--line);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 11px; height: 11px; margin-top: 5px; border-radius: 50%;
  border: 2px solid var(--brand, #2f6fed); background: var(--card); box-sizing: border-box;
}
.timeline-content { display: grid; gap: 3px; min-width: 0; }
.timeline-content strong { font-size: 15px; }
.timeline-comments { margin: 0; font-size: 13px; color: var(--ink-2, #4a5568); word-break: break-word; }
.timeline-comments span { font-weight: 600; color: var(--ink, #1a202c); }
.timeline-detail { margin: 0; font-size: 13px; color: var(--ink-2, #4a5568); word-break: break-word; }
.timeline-date { margin: 2px 0 0; font-size: 12px; color: var(--muted, #718096); }


/* Signed-in user in the sidebar. */
.sidebar-foot.account { display: grid; gap: 2px; }
.sidebar-foot.account strong { font-size: 13px; overflow-wrap: anywhere; }
.sidebar-foot.account .btn { margin-top: 9px; }


/* Fetch drawer: multi-claim input, file upload and the preview list. */
.field-hint { margin: 2px 0 10px; font-size: 12px; color: var(--muted, #6b7280); }
textarea.input { resize: vertical; min-height: 68px; line-height: 1.5; }
.upload-row { gap: 10px; margin-bottom: 4px; }
.upload-row .muted { font-size: 12px; overflow-wrap: anywhere; }
.claim-preview {
  list-style: none; margin: 0 0 10px; padding: 8px 10px; display: grid; gap: 5px;
  max-height: 190px; overflow-y: auto;
  border: 1px solid var(--line, #e2e0da); border-radius: 12px; background: var(--card, #fff);
}
.claim-preview li { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.claim-preview li .muted { white-space: nowrap; }
.claim-preview li.bad .muted { color: #8f2f2f; white-space: normal; }


/* Scheduled fetch: what a run brings back. */
.schedule-period { border-top: 1px solid var(--line); }
.schedule-period .muted { margin: 0; font-size: 12.5px; }

/* Portal Ops: each portal's document download limit, in minutes. */
.limit-field { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.limit-field .input { width: 76px; min-height: 32px; padding: 4px 8px; border-radius: 10px; font-variant-numeric: tabular-nums; }
.limit-field .input:disabled { background: var(--sunk); color: var(--muted); cursor: not-allowed; }

/* Portal Credentials: delivery to each worker, and the change-login form. */
.cred-workers { display: grid; gap: 8px; }
.cred-worker .row { gap: 6px; flex-wrap: nowrap; }
.cred-worker .cell-sub { max-width: 340px; }
.inline-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.inline-check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.divider { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ------------------------------------------------------------ Sign-in pop-up */

.signin-pending {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 61;
  max-width: calc(100vw - 32px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--warn-line);
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn-fg);
  font-weight: 600;
  box-shadow: var(--shadow-float);
  cursor: pointer;
}
.signin-pending[hidden] { display: none; }

/* Claims: custom admission-date range next to the Admitted filter. */
.date-range { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.date-range[hidden] { display: none; }
.date-range label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.date-range .date-input { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.date-range .date-input .input { width: 128px; min-width: 0; }
.date-range .date-pick { width: 40px; height: 40px; }
/* The browser's own picker, opened by the calendar button; never shown itself. */
.date-range .date-native { position: absolute; right: 0; bottom: 0; width: 40px; height: 40px; opacity: 0; pointer-events: none; border: 0; padding: 0; }
@media (max-width: 560px) { .date-range, .date-range label, .date-range .date-input { width: 100%; } .date-range .date-input .input { flex: 1; } }
