:root {
  --ink: #103c3a;
  --muted: #5c706e;
  --line: #d9e6e2;
  --paper: #fff;
  --soft: #f7f1e7;
  --teal: #0d7771;
  --teal-dark: #075852;
  --bupa: #0079c8;
  --bupa-dark: #005b96;
  --red: #a93535;
  --red-soft: #fff0ee;
  --amber: #99600a;
  --amber-soft: #fff5df;
  --green: #176b4b;
  --green-soft: #eaf8f0;
  --shadow: 0 20px 55px rgba(16, 60, 58, .13);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 0%, rgba(0, 121, 200, .15), transparent 29%),
    var(--soft);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

button,
input,
select,
textarea { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

.page-shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 64px;
}

.masthead {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  padding: 28px 34px;
  border-radius: 26px;
  color: #fff;
  background: linear-gradient(135deg, var(--ink), var(--teal-dark) 62%, var(--teal));
  box-shadow: var(--shadow);
}

.masthead h1,
.masthead p,
.masthead .eyebrow { margin: 0; }
.masthead h1 { font-size: clamp(30px, 4vw, 48px); letter-spacing: -.04em; line-height: 1; }
.masthead p { margin-top: 7px; color: rgba(255, 255, 255, .72); }

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand img { object-fit: contain; }
.brand span { display: grid; }
.brand b { font-size: 17px; }
.brand small { color: rgba(255, 255, 255, .65); }

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--bupa);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.masthead .eyebrow { color: #f4cb75; }

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.button:disabled { cursor: wait; opacity: .58; }
.button-primary { color: #fff; background: var(--teal); }
.button-primary:hover { background: var(--teal-dark); }
.button-bupa { color: #fff; background: var(--bupa); }
.button-bupa:hover { background: var(--bupa-dark); }
.button-ghost { color: var(--ink); border-color: var(--line); background: #fff; }
.masthead .button-ghost { color: #fff; border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.09); }
.button-danger { color: var(--red); border-color: #ecc4c0; background: var(--red-soft); }

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 470px);
  gap: 48px;
  width: min(900px, 100%);
  margin: 44px auto 0;
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(16, 60, 58, .1);
  border-radius: 24px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
}

.login-card h2 { margin: 0; font-size: 32px; letter-spacing: -.03em; }
.login-card p { color: var(--muted); }
.login-card form { display: grid; gap: 16px; }

label {
  display: grid;
  gap: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 43px;
  padding: 10px 12px;
  border: 1px solid #bfd1cd;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 550;
}

textarea { resize: vertical; }
input:focus,
select:focus,
textarea:focus { outline: 3px solid rgba(0,121,200,.15); border-color: var(--bupa); }
input[readonly] { color: var(--muted); background: #edf3f1; }

.desk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 0 10px;
  padding: 14px 16px;
  border: 1px solid rgba(16,60,58,.1);
  border-radius: 15px;
  background: rgba(255,255,255,.86);
}

.session-label { display: block; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.security-note { padding: 12px 15px; border-radius: 12px; color: #64500f; background: #fff7d9; font-size: 13px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px;
  margin: 16px 0;
  overflow-x: auto;
  padding-bottom: 3px;
}

.metrics article {
  min-width: 132px;
  padding: 16px;
  border: 1px solid rgba(16,60,58,.09);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16,60,58,.06);
}

.metrics span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.metrics strong { font-size: 24px; letter-spacing: -.03em; }

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 390px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.claims-panel,
.detail-panel,
.reference-panel {
  border: 1px solid rgba(16,60,58,.1);
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 36px rgba(16,60,58,.07);
}

.claims-panel {
  position: sticky;
  top: 12px;
  padding: 18px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.panel-heading,
.detail-heading,
.section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h2,
.detail-heading h2,
.section-heading-row h3 { margin: 0; }
.search-label { margin-top: 16px; }
.search-label span { color: var(--muted); }

.filter-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.filter {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}
.filter.is-active { color: #fff; border-color: var(--teal); background: var(--teal); }

.claim-list { display: grid; gap: 8px; }
.claim-card {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: left;
}
.claim-card:hover,
.claim-card.is-active { border-color: var(--bupa); box-shadow: 0 0 0 2px rgba(0,121,200,.09); }
.claim-card-top { display: flex; justify-content: space-between; gap: 10px; }
.claim-card strong { overflow-wrap: anywhere; }
.claim-card small { display: block; margin-top: 4px; color: var(--muted); }
.claim-card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }

.mini-badge,
.status-badge,
.excess-state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--bupa-dark);
  background: #e5f4fd;
  font-size: 10px;
  font-weight: 850;
}
.mini-badge.is-red,
.status-badge.is-red,
.excess-state.is-red { color: var(--red); background: var(--red-soft); }
.mini-badge.is-amber,
.status-badge.is-amber,
.excess-state.is-amber { color: var(--amber); background: var(--amber-soft); }
.mini-badge.is-green,
.status-badge.is-green,
.excess-state.is-green { color: var(--green); background: var(--green-soft); }

.detail-panel { min-height: 540px; overflow: hidden; }
.detail-placeholder { display: grid; place-items: center; align-content: center; min-height: 540px; padding: 32px; text-align: center; }
.detail-placeholder h2 { margin: 14px 0 0; }
.detail-placeholder p { max-width: 420px; color: var(--muted); }
.placeholder-mark { display: grid; width: 62px; height: 62px; place-items: center; border-radius: 18px; color: #fff; background: var(--bupa); font-size: 30px; font-weight: 900; }

#claim-form { padding: 20px; }
.detail-heading { padding: 3px 3px 17px; }
.detail-heading h2 { letter-spacing: -.03em; }
.detail-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.form-section {
  margin: 0 -20px;
  padding: 20px;
  border-top: 1px solid var(--line);
}
.form-section h3 { margin: 0 0 14px; }
.section-heading-row { margin-bottom: 14px; }
.section-heading-row h3 { margin: 0; }

.form-grid { display: grid; gap: 13px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }

.excess-section { background: #fffaf7; }
.required-question {
  margin: 0 0 15px;
  padding: 12px 14px;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  color: #652d28;
  background: var(--red-soft);
  font-weight: 800;
}

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th,
td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td:last-child,
th:last-child { text-align: right; }

.audit-list { display: grid; gap: 9px; margin: 0; padding: 0; list-style: none; }
.audit-list li { padding: 11px 13px; border-left: 3px solid var(--bupa); border-radius: 8px; background: #f2f8fb; }
.audit-list small { display: block; margin-top: 3px; color: var(--muted); }

.save-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  box-shadow: 0 -12px 28px rgba(16,60,58,.06);
}
.save-bar .form-message { margin-right: auto; }
.form-message { min-height: 18px; margin: 0; color: var(--red); font-size: 12px; font-weight: 750; }
.form-message.is-success { color: var(--green); }
.empty-state { padding: 20px 5px; color: var(--muted); text-align: center; }

.reference-panel { margin-top: 16px; overflow: hidden; }
.reference-panel summary { padding: 17px 20px; cursor: pointer; font-weight: 850; }
.reference-content { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 24px; padding: 0 20px 22px; border-top: 1px solid var(--line); }
.reference-content h2 { margin-top: 20px; font-size: 20px; }
.guidance-card ol { padding-left: 20px; }
.guidance-card li { margin-bottom: 7px; }

dialog {
  width: min(680px, calc(100% - 24px));
  padding: 24px;
  border: 0;
  border-radius: 20px;
  color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(5, 30, 29, .58); }
.dialog-close { border: 0; color: var(--muted); background: transparent; cursor: pointer; font-size: 28px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1050px) {
  .masthead { grid-template-columns: minmax(0, 1fr) auto; }
  .brand { grid-column: 1 / -1; }
  .workspace { grid-template-columns: 320px minmax(0, 1fr); }
  .form-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-3 { grid-column: span 2; }
}

@media (max-width: 780px) {
  .page-shell { width: min(100% - 20px, 1440px); padding-top: 10px; }
  .masthead { grid-template-columns: 1fr; gap: 17px; padding: 24px; }
  .masthead .button-ghost { width: fit-content; }
  .login-card { grid-template-columns: 1fr; gap: 22px; margin-top: 18px; }
  .desk-toolbar { align-items: flex-start; }
  .workspace { grid-template-columns: 1fr; }
  .claims-panel { position: static; max-height: none; }
  .reference-content { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .masthead h1 { font-size: 34px; }
  .desk-toolbar,
  .panel-heading,
  .detail-heading,
  .section-heading-row,
  .save-bar { align-items: stretch; flex-direction: column; }
  .toolbar-actions { display: grid; grid-template-columns: 1fr; width: 100%; }
  .form-grid-2,
  .form-grid-3 { grid-template-columns: 1fr; }
  .span-2,
  .span-3 { grid-column: auto; }
  #claim-form { padding: 15px; }
  .form-section { margin: 0 -15px; padding: 17px 15px; }
  .save-bar { position: static; margin: 0 -15px -15px; padding: 14px 15px; }
  .save-bar .button { width: 100%; }
}
