:root {
  --navy: #062b4f;
  --teal: #087d79;
  --ink: #17354d;
  --muted: #526b7d;
  --line: #d9e4ea;
  --surface: #f4f7f9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--surface);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 3px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.demo-alert {
  padding: .55rem 1rem;
  background: var(--navy);
  color: white;
  font-size: .875rem;
  font-weight: 650;
  text-align: center;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: .75rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  background: white;
}
.brand { display: flex; align-items: center; gap: .8rem; color: var(--navy); }
.brand img { width: 134px; }
.brand span { width: 1px; height: 25px; background: var(--line); }
.brand strong { white-space: nowrap; }
.secondary-button {
  min-height: 40px;
  border: 1px solid #a8d7d4;
  border-radius: 8px;
  background: #edf9f8;
  padding: .5rem .75rem;
  color: #086c68;
  font-size: .875rem;
  font-weight: 700;
}
.secondary-button:hover { background: #dff4f2; }

.app-shell { display: grid; grid-template-columns: 235px minmax(0, 1fr); min-height: calc(100vh - 108px); }
.sidebar { display: flex; flex-direction: column; gap: 2rem; border-right: 1px solid var(--line); background: white; padding: 1.5rem 1rem; }
.sidebar nav { display: grid; gap: .4rem; }
.sidebar nav button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: .6rem .7rem;
  color: var(--muted);
  text-align: left;
  font-size: .875rem;
  font-weight: 700;
}
.sidebar nav button:hover { background: var(--surface); }
.sidebar nav button.active { background: #e4f5f3; color: #086c68; }
.sidebar nav b { min-width: 1.5rem; border-radius: 999px; background: white; padding: .1rem .3rem; text-align: center; }
.sidebar-note { border-top: 1px solid var(--line); padding: .9rem .65rem; font-size: .875rem; }
.sidebar-note p { margin: .4rem 0 0; color: var(--muted); line-height: 1.55; }
main { padding: clamp(1rem, 4vw, 3rem); }
.workflow-tabs {
  display: flex;
  gap: .35rem;
  width: fit-content;
  max-width: 100%;
  margin-bottom: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  padding: .25rem;
}
.workflow-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  padding: .45rem .85rem;
  color: var(--muted);
  font-weight: 700;
}
.workflow-tabs button:hover { background: var(--surface); }
.workflow-tabs button[aria-pressed="true"] { background: var(--navy); color: white; }
.page-head { margin-bottom: 1.4rem; }
.page-head h1 { margin: 0 0 .45rem; color: var(--navy); font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--muted); line-height: 1.55; }

.queue-card, .card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  box-shadow: 0 8px 25px rgba(6, 43, 79, .05);
}
.queue-head { border-bottom: 1px solid var(--line); padding: 1rem; }
.queue-head input, .field select, .field textarea {
  min-height: 41px;
  border: 1px solid #aebfc9;
  border-radius: 8px;
  background: white;
  padding: .55rem .7rem;
  color: var(--ink);
  font-size: .9rem;
}
.queue-head input { width: min(100%, 310px); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: .75rem 1rem; text-align: left; font-size: .875rem; }
th { background: #f7fafb; color: var(--muted); font-weight: 650; }
tr:last-child td { border-bottom: 0; }
td:last-child { text-align: right; }
td strong { color: var(--navy); }
.status {
  display: inline-block;
  border-radius: 999px;
  background: #fff4da;
  padding: .35rem .6rem;
  color: #785000;
  font-size: .875rem;
  font-weight: 700;
  line-height: 1.15;
}
.status.issue { background: #fff0e5; color: #92410f; }
.status.done { background: #e7f7ef; color: #0c6e52; }
.empty { padding: 2rem 1rem; color: var(--muted); text-align: center; }

.drawer {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: 0;
  background: var(--surface);
  color: var(--ink);
  overflow: auto;
}
.drawer-head {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  background: white;
  padding: .7rem clamp(1rem, 4vw, 3rem);
}
.drawer-id { display: grid; gap: .15rem; text-align: right; }
.drawer-id small, .eyebrow { color: var(--teal); font-size: .75rem; font-weight: 800; letter-spacing: .08em; }
.drawer-id strong { color: var(--navy); font-size: .875rem; }
.drawer-body { max-width: 1200px; margin: auto; padding: 1.6rem clamp(1rem, 4vw, 3rem) 3rem; }
.person-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.person-head h2 { margin: .35rem 0 0; color: var(--navy); font-size: clamp(1.6rem, 3vw, 2.25rem); letter-spacing: -.035em; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, .8fr); align-items: start; gap: 1rem; }
.card { padding: 1rem; }
.card-head { margin-bottom: 1rem; }
.card h3 { margin: 0 0 .35rem; color: var(--navy); font-size: 1.1rem; }
.card p { margin: 0; color: var(--muted); line-height: 1.55; }
.data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; margin: 0; }
.data-grid div { border-radius: 8px; background: var(--surface); padding: .65rem; }
.data-grid dt { color: var(--muted); font-size: .875rem; }
.data-grid dd { margin: .25rem 0 0; color: var(--navy); font-weight: 700; overflow-wrap: anywhere; }
.return-card { border-color: #add8d5; }
.result-options, .issue-fields { min-width: 0; margin: .9rem 0 0; border: 0; padding: 0; }
.result-options { display: grid; gap: .5rem; }
.result-options legend { margin-bottom: .4rem; }
.result-options label {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-height: 45px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .55rem .65rem;
  cursor: pointer;
}
.result-options label:has(:checked) { border-color: var(--teal); background: #eef9f8; }
.result-options input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--teal); }
.field { display: grid; gap: .4rem; margin-top: .75rem; }
.field textarea { resize: vertical; line-height: 1.45; }
.field select { appearance: none; padding-right: 1.9rem; background: linear-gradient(45deg, transparent 50%, #526b7d 50%) calc(100% - 14px) 50% / 5px 5px no-repeat, linear-gradient(135deg, #526b7d 50%, transparent 50%) calc(100% - 9px) 50% / 5px 5px no-repeat; }
.primary-button {
  width: 100%;
  min-height: 45px;
  margin-top: 1rem;
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  padding: .6rem;
  color: white;
  font-weight: 750;
}
.primary-button:hover { background: #066964; }
#result-detail { margin-top: .65rem; border-radius: 8px; background: var(--surface); padding: .65rem; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 880px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); padding: .6rem 1rem; }
  .sidebar nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sidebar-note { display: none; }
}
@media (max-width: 680px) {
  .brand { gap: .45rem; }
  .brand img { width: 90px; }
  .brand span { display: none; }
  .brand strong { white-space: normal; }
  .topbar { gap: .65rem; }
  .detail-layout { grid-template-columns: minmax(0, 1fr); }
  th, td { padding: .6rem; }
  .sent-at { display: none; }
}
@media (max-width: 490px) {
  .table-wrap { overflow-x: visible; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem .55rem; padding: .8rem; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { border: 0; padding: 0; }
  td:nth-child(2) { grid-column: 1; grid-row: 2; }
  td:nth-child(4) { grid-column: 1; grid-row: 3; }
  td:last-child { grid-column: 2; grid-row: 1 / 4; align-self: center; }
}
