[hidden] { display: none !important; }

:root {
  --accent: #426784;
  --accent-dark: #31536e;
  --background: #eef3f7;
  --border: #d5dfe7;
  --card: #ffffff;
  --danger: #a63a35;
  --muted: #667985;
  --success: #287a58;
  --text: #243946;
  --warning-bg: #fff8e7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

button, input, select { font: inherit; }

.privacy-bar {
  padding: 10px 24px;
  border-bottom: 1px solid #bad2dd;
  background: #e5f1f5;
  color: #2b5c6d;
  text-align: center;
  font-size: 12px;
}

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: #fff;
  box-shadow: 0 1px 3px rgb(26 48 62 / 8%);
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  letter-spacing: .04em;
}

.brand-copy h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.brand-copy p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.shell {
  width: min(1480px, calc(100% - 36px));
  margin: 28px auto 64px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.page-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.03em; }
.page-heading p { max-width: 680px; margin: 7px 0 0; color: var(--muted); line-height: 1.55; }

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(290px, .6fr);
  gap: 20px;
}

.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  box-shadow: 0 1px 3px rgb(26 48 62 / 7%);
}

.card h3 { margin: 0 0 6px; font-size: 16px; }
.card-subtitle { margin: 0 0 18px; color: var(--muted); line-height: 1.5; }

.upload-zone {
  display: grid;
  min-height: 210px;
  padding: 28px;
  place-items: center;
  border: 2px dashed #aebfca;
  border-radius: 9px;
  background: #f8fafc;
  text-align: center;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragging {
  border-color: var(--accent);
  background: #eef5f9;
}

.upload-symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  place-items: center;
  border-radius: 50%;
  background: #e5eef4;
  color: var(--accent-dark);
  font-size: 24px;
}

.upload-zone strong { display: block; margin-bottom: 6px; font-size: 15px; }
.upload-zone span { color: var(--muted); font-size: 12px; }
.upload-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.form-row { display: flex; gap: 12px; margin-top: 16px; }
.field { flex: 1; }
.field label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12px; font-weight: 650; }

input, select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #b9c7d1;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus, button:focus-visible {
  outline: 3px solid rgb(66 103 132 / 24%);
  outline-offset: 1px;
}

.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 9px 17px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 650;
  cursor: pointer;
}

.button:hover { background: var(--accent-dark); }
.button:disabled { cursor: wait; opacity: .58; }
.button.secondary { border: 1px solid var(--border); background: #fff; color: var(--text); }
.button.secondary:hover { background: #f5f8fa; }
.button.delete-batch-button {
  min-height: 32px;
  padding: 6px 11px;
  border-color: #d9a8a4;
  color: #8a3833;
}
.button.delete-batch-button:hover { border-color: #c97d77; background: #fbeceb; }

.billing-total-box {
  display: inline-flex;
  min-width: 92px;
  min-height: 34px;
  align-items: center;
  justify-content: flex-end;
  padding: 7px 10px;
  border: 1px solid #b9d9cf;
  border-radius: 7px;
  background: #edf8f4;
  color: #28624f;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  white-space: nowrap;
}

.billing-total-box.is-pending {
  justify-content: center;
  border-color: #d5dfe7;
  background: #f5f7f9;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.status {
  display: none;
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 6px;
  line-height: 1.45;
}

.status.visible { display: block; }
.status.success { border-left: 4px solid var(--success); background: #eaf6f0; color: #205e46; }
.status.error { border-left: 4px solid var(--danger); background: #fbeceb; color: #7e2f2b; }

.stat-list { display: grid; gap: 12px; margin-top: 18px; }
.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid #e7edf1;
}
.stat:last-child { padding-bottom: 0; border-bottom: 0; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 20px; font-weight: 750; }

.table-card { margin-top: 20px; overflow: hidden; padding: 0; }
.table-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.table-header h3 { margin: 0; font-size: 16px; }
.table-status { margin: 12px 22px; }
.table-kicker { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 18px; border-bottom: 1px solid #e8edf1; text-align: left; white-space: nowrap; }
th { background: #f7f9fb; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: 13px; }
.empty-row td { padding: 36px 18px; color: var(--muted); text-align: center; }

.review-table-wrap {
  width: 100%;
  overflow-x: hidden;
}

.review-table {
  table-layout: fixed;
}

.review-table th,
.review-table td {
  min-width: 0;
  padding: 11px 7px;
}

.review-table th {
  white-space: normal;
}

.review-table td {
  overflow-wrap: anywhere;
  white-space: normal;
}

.review-table .review-col-row { width: 4%; }
.review-table .review-col-patient { width: 11%; }
.review-table .review-col-phn { width: 9%; }
.review-table .review-col-radiologist { width: 13%; }
.review-table .review-col-timing { width: 23%; }
.review-table .review-col-shift { width: 7%; }
.review-table .review-col-code { width: 7%; }
.review-table .review-col-comments { width: 6%; }
.review-table .review-col-fee { width: 7%; }
.review-table .review-col-status { width: 7%; }
.review-table .review-col-actions { width: 6%; }

.review-table .phn-cell,
.review-table .fee-cell {
  overflow-wrap: normal;
  white-space: nowrap;
}

.review-table .row-actions-cell .button {
  min-height: 32px;
  max-width: 100%;
  padding: 6px 8px;
  font-size: 11px;
}

.code-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 16px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfd;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.claim-row {
  --claim-accent: #8293a0;
  --claim-tint: #f7f9fa;
  background: var(--claim-tint);
}

.claim-row:hover { filter: brightness(.985); }
.claim-row td:first-child { box-shadow: inset 4px 0 var(--claim-accent); }
.claim-row.is-excluded { background: #f2f4f5; color: #7b878e; }
.claim-row.is-excluded td { text-decoration-color: #9aa5ab; }
.claim-row.is-excluded td:not(:last-child) { opacity: .58; }

.claim-code,
.shift-badge,
.row-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .025em;
  white-space: nowrap;
}

.claim-code {
  border: 1px solid color-mix(in srgb, var(--claim-accent) 45%, white);
  background: var(--claim-tint);
  color: var(--claim-accent);
}

.claim-code.has-code-rule,
.shift-badge.has-shift-help,
.comment-badge.has-comment-help {
  cursor: help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.claim-code.has-code-rule:focus-visible,
.shift-badge.has-shift-help:focus-visible,
.comment-badge.has-comment-help:focus-visible {
  outline: 3px solid rgb(38 105 144 / 28%);
  outline-offset: 2px;
}

.review-tooltip {
  position: fixed;
  z-index: 100;
  display: grid;
  width: min(390px, calc(100vw - 20px));
  gap: 7px;
  padding: 13px 14px;
  border: 1px solid #344b58;
  border-radius: 8px;
  background: #172c38;
  box-shadow: 0 10px 30px rgb(15 35 46 / 28%);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  white-space: normal;
}

.review-tooltip[hidden] { display: none; }
.review-tooltip strong { color: #fff; font-size: 13px; }
.review-tooltip span { color: #edf3f6; white-space: pre-wrap; }
.review-tooltip small { color: #b9c9d1; font-size: 10px; }

.tone-0 { --claim-accent: #285f91; --claim-tint: #e8f2fb; }
.tone-1 { --claim-accent: #6c4a91; --claim-tint: #f1ebf8; }
.tone-2 { --claim-accent: #176c61; --claim-tint: #e4f4f0; }
.tone-3 { --claim-accent: #956113; --claim-tint: #fff3d9; }
.tone-4 { --claim-accent: #994b5c; --claim-tint: #fbecef; }
.tone-5 { --claim-accent: #53656f; --claim-tint: #edf1f3; }

.shift-badge { border: 1px solid transparent; }
.shift-tone-0 { border-color: #bad3e5; background: #edf6fb; color: #315f7a; }
.shift-tone-1 { border-color: #d2c5e4; background: #f5f0fa; color: #684f83; }
.shift-tone-2 { border-color: #b9d9cf; background: #edf8f4; color: #376b5d; }
.shift-tone-3 { border-color: #e5d1ac; background: #fff8e8; color: #805d20; }

.comments-cell { text-align: center; }
.comment-badge {
  display: inline-grid;
  width: 28px;
  height: 28px;
  border: 1px solid #9eb0ba;
  border-radius: 50%;
  place-items: center;
  background: #f7fafb;
  color: #5a6f79;
  font-size: 15px;
  line-height: 1;
}
.comment-badge.has-comment {
  border-color: #6d91a5;
  background: #e5f0f6;
  color: #285f7a;
  box-shadow: inset 0 0 0 2px rgb(255 255 255 / 55%);
}
.comment-badge.no-comment { opacity: .42; }

.row-status { background: #eef2f4; color: #50616b; text-transform: capitalize; }
.row-status-pending { background: #e8f3ed; color: #296548; }
.row-status-excluded { background: #eceff1; color: #68757c; }
.row-status-failed { background: #fbeceb; color: #8a3833; }
.row-status-submitted { background: #e8f0f8; color: #355f82; }
.row-status-dryrun_ok { background: #e5f3ea; color: #226344; }
.row-status-dryrun_flagged { background: #fff0d8; color: #805313; }
.row-status-dryrun_ok,
.row-status-dryrun_flagged { cursor: help; }

.review-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.fee-cell,
.timing-comparison-cell { font-variant-numeric: tabular-nums; }
.fee-cell { font-weight: 700; }

.timing-comparison {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.timing-line { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: baseline; }
.timing-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.timing-value { color: #425761; }
.submission-line .timing-value { color: #285f7a; font-weight: 750; }

.badge {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  background: #e8f0f5;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-card {
  width: min(430px, 100%);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 40px rgb(36 57 70 / 12%);
}

.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-card h1 { margin: 0; font-size: 21px; }
.login-card > p { margin: -12px 0 24px; color: var(--muted); line-height: 1.55; }
.login-card .field { margin-bottom: 14px; }
.login-card .button { width: 100%; margin-top: 4px; }
.login-error { min-height: 20px; margin: 12px 0 0; color: var(--danger); font-size: 12px; }

@media (max-width: 760px) {
  .site-header { align-items: flex-start; }
  .header-actions { margin-top: 2px; }
  .grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .form-row { flex-direction: column; }
}

@media (max-width: 980px) {
  .shell { width: min(720px, calc(100% - 24px)); }
  .table-header { align-items: flex-start; flex-direction: column; }
  .table-header .button { width: 100%; }
  .review-actions { width: 100%; }
  .review-table-wrap { padding: 12px; background: #f7f9fb; }
  .review-table,
  .review-table tbody {
    display: block;
  }
  .review-table colgroup,
  .review-table thead {
    display: none;
  }
  .review-table tbody {
    display: grid;
    gap: 12px;
  }
  .review-table .claim-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--border);
    border-left: 4px solid var(--claim-accent);
    border-radius: 8px;
    background: var(--card);
  }
  .review-table .claim-row td {
    display: grid;
    min-width: 0;
    gap: 4px;
    padding: 9px 11px;
    border-bottom: 1px solid #e8edf1;
    box-shadow: none;
  }
  .review-table .claim-row td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: .05em;
    text-transform: uppercase;
  }
  .review-table .claim-row .patient-cell,
  .review-table .claim-row .radiologist-cell,
  .review-table .claim-row .timing-comparison-cell {
    grid-column: 1 / -1;
  }
  .review-table .claim-row .comments-cell {
    justify-items: start;
    text-align: left;
  }
  .review-table .claim-row .row-actions-cell {
    align-content: end;
  }
  .review-table .claim-row .row-actions-cell:empty {
    display: none;
  }
  .review-table .claim-row .row-actions-cell .button {
    width: 100%;
  }
  .review-table .claim-row td:nth-last-child(-n + 2) {
    border-bottom: 0;
  }
}
