/* App UI — MKCircle design system: dark-blue #203864, cadmium-orange #ED7D31, Arial, square panels, pill buttons. */
:root {
  --dark-blue: #203864; --metallic-blue: #1F4E79; --han-blue: #4472C4; --orange: #ED7D31;
  --platinum: #E3E7EB; --alice: #EAF2FF; --alabaster: #F4EBE5; --ink: #111; --muted: #4d5866;
  --white: #fff; --ok: #2e7d4f; --err: #b42318;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f6f7f9; color: var(--ink); font-family: Arial, Helvetica, sans-serif; font-size: 15px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--han-blue); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; color: var(--dark-blue); padding: 8px 14px; z-index: 50; font-weight: 700; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.band { background: var(--dark-blue); color: #fff; }
.band-inner { max-width: 1100px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.band img { height: 54px; }
.band .eyebrow { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; opacity: .85; }
.band h1 { margin: 0; font-family: "Arial Black", Arial, sans-serif; font-weight: 900; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; }
.band .sp { flex: 1; }
.status-pill { font-size: 13px; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; padding: 4px 12px; }
.status-pill.ok::before { content: "●"; color: #6fcf97; margin-right: 6px; }
.status-pill.warn::before { content: "●"; color: var(--orange); margin-right: 6px; }

nav.tabs { background: #fff; border-bottom: 1px solid var(--platinum); }
nav.tabs .in { max-width: 1100px; margin: 0 auto; padding: 0 16px; display: flex; gap: 4px; overflow-x: auto; }
nav.tabs button { border: 0; background: none; padding: 14px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
nav.tabs button[aria-selected="true"] { color: var(--dark-blue); border-bottom-color: var(--orange); }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.notice { background: var(--alice); border-left: 4px solid var(--han-blue); padding: 12px 14px; margin-bottom: 20px; font-size: 14px; }
.notice.warn { background: #fff4ea; border-left-color: var(--orange); }
.notice.err { background: #fde2e1; border-left-color: var(--err); }
.notice.ok { background: #e8f5ec; border-left-color: var(--ok); }
.errsum { background: #fde2e1; border-left: 4px solid var(--err); padding: 12px 16px; margin-bottom: 18px; }
.errsum h3 { margin: 0 0 6px; font-size: 16px; color: var(--err); }
.errsum ul { margin: 0; padding-left: 20px; }
.errsum a { color: var(--ink); font-weight: 700; }
.ferr { color: var(--err); font-size: 14px; font-weight: 700; margin: 6px 0 0; }
.ferr::before { content: "! "; }
[aria-invalid="true"] { border-color: var(--err) !important; box-shadow: 0 0 0 1px var(--err); }
.req, .opt { font-weight: 400; font-size: 12px; color: var(--muted); margin-left: 6px; text-transform: lowercase; }
.emptystate { background: #fff; border: 1px dashed #b9c3cf; padding: 28px; text-align: center; }
.emptystate p { margin: 0 0 14px; }

h2.sec { font-family: "Arial Black", Arial, sans-serif; font-weight: 900; text-transform: uppercase; color: var(--dark-blue); font-size: 20px; margin: 0 0 4px; letter-spacing: .01em; }
.sub { color: var(--muted); margin: 0 0 20px; }

.btn { border-radius: 999px; padding: 9px 18px; font-weight: 700; cursor: pointer; border: 1px solid var(--dark-blue); background: var(--dark-blue); color: #fff; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.btn.ghost { background: #fff; color: var(--dark-blue); }
.btn.small { padding: 6px 14px; min-height: 40px; font-size: 14px; }
.link { background: none; border: 0; color: var(--han-blue); text-decoration: underline; cursor: pointer; padding: 6px 4px; min-height: 40px; font-weight: 700; }
.btn.danger { background: #fff; color: var(--err); border-color: #e8b4b0; }
.btn:disabled { opacity: .5; cursor: default; }

.card { background: #fff; border: 1px solid var(--platinum); border-top: 4px solid var(--dark-blue); padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; justify-content: space-between; }
.card h3 { margin: 0; color: var(--dark-blue); font-size: 18px; }
.meta { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.seq { font-weight: 700; color: var(--metallic-blue); font-size: 14px; margin: 8px 0 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--alabaster); padding: 2px 8px; margin-left: 8px; vertical-align: middle; color: var(--ink); }
.cands { margin-top: 14px; border-top: 1px solid var(--platinum); }
.cand { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--platinum); }
.cand b { color: var(--ink); }
.empty { color: var(--muted); padding: 10px 0; margin: 0; }

form.panel { background: #fff; border: 1px solid var(--platinum); padding: 22px; max-width: 820px; }
.field { margin: 0 0 16px; }
fieldset.field { border: 0; padding: 0; min-width: 0; }
legend.lbl { padding: 0; }
.field label, .lbl { display: block; font-weight: 700; margin-bottom: 6px; color: var(--dark-blue); }
.hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
input[type=text], select, textarea, input[type=number] { width: 100%; border: 1px solid #c4ccd6; background: #fff; padding: 10px 12px; min-height: 42px; }
textarea { min-height: 140px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.drop { border: 2px dashed #b9c3cf; background: #fafbfc; padding: 18px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.drop u { color: var(--han-blue); font-weight: 700; }
.drop .hint { margin: 0; }
.filechip { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--platinum); background: var(--alice); padding: 6px 12px; font-weight: 700; color: var(--dark-blue); }
.filechip span::before { content: "\2713  "; color: var(--ok); }
.tablewrap { overflow-x: auto; }
.drop.over { border-color: var(--orange); background: #fff8f2; }
.drop .file { font-weight: 700; color: var(--dark-blue); }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 8px 0; }

.osa-table { width: 100%; border-collapse: collapse; }
.osa-table th { text-align: left; background: var(--dark-blue); color: #fff; padding: 8px 10px; font-size: 13px; }
.osa-table td { padding: 8px 10px; border-bottom: 1px solid var(--platinum); vertical-align: middle; }
.osa-table th[scope=row] { background: none; color: var(--metallic-blue); font-size: 15px; width: 36%; border-bottom: 1px solid var(--platinum); padding: 8px 10px; }
.osa-table select { min-width: 150px; }
.osa-table input { max-width: 110px; }
/* OSA scores typed as SY / ST / R / A */
.scores { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.score label { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--dark-blue); margin-bottom: 6px; }
.code { display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 26px; padding: 0 6px; background: var(--dark-blue); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; }
.ties { margin-top: 12px; display: grid; gap: 10px; }
.tie { background: #fff4ea; border-left: 4px solid var(--orange); padding: 10px 14px; font-size: 14px; }
.tie p { margin: 0 0 4px; }
.tie ol { margin: 0; padding-left: 22px; }
.tie .link { min-height: 32px; padding: 2px 6px; }
details.fill { margin-top: 14px; border: 1px solid var(--platinum); background: #fbfcfd; padding: 10px 14px; }
details.fill summary { cursor: pointer; font-weight: 700; color: var(--metallic-blue); min-height: 32px; display: list-item; }
details.fill textarea { min-height: 80px; }
.lbl.small { font-size: 13px; margin-top: 8px; }
.demand { background: var(--alice); border-left: 4px solid var(--han-blue); padding: 10px 14px; margin: 0 0 16px; font-size: 14px; }
.demand .lbl { margin: 0 0 4px; }
.demand ol { margin: 0 0 6px; padding-left: 22px; }
.demand .hint { margin: 0; }
.lib-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.lib-head .sub { max-width: 720px; }
.signout { color: #fff; font-size: 13px; text-decoration: underline; padding: 8px 4px; }
.check { margin: 10px 0 0; font-size: 14px; font-weight: 700; min-height: 1.5em; }
.check.ok { color: var(--ok); } .check.bad { color: var(--err); } .check.warn { color: #9a5b00; }

.busy { display: none; align-items: center; gap: 12px; margin-top: 14px; color: var(--dark-blue); font-weight: 700; background: var(--alice); padding: 12px 14px; }
.busy.show { display: flex; }
.spin { width: 22px; height: 22px; border: 3px solid var(--platinum); border-top-color: var(--orange); border-radius: 50%; animation: s 0.9s linear infinite; }
@keyframes s { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 20px 16px 40px; }
@media (max-width: 640px) {
  .grid2 { grid-template-columns: 1fr; }
  .band img { height: 40px; }
  form.panel { padding: 16px; }
  .scores { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .osa-table thead { display: none; }
  .osa-table, .osa-table tbody { display: block; }
  .osa-table tr { display: grid; grid-template-columns: 1fr 96px; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--platinum); }
  .osa-table th[scope=row] { grid-column: 1 / -1; width: auto; border: 0; padding: 0; }
  .osa-table td { padding: 0; border: 0; }
  .osa-table select { min-width: 0; }
  .osa-table input { max-width: none; }
}

.btnrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.chatflow { margin-top: 20px; border-top: 4px solid var(--orange); background: #fffaf5; padding: 18px; }
.chatflow h3 { margin: 0 0 10px; color: var(--dark-blue); font-size: 18px; }
.chatflow ol { margin: 0 0 16px; padding-left: 22px; }
.chatflow li { margin-bottom: 16px; }
.chatflow textarea { margin-top: 8px; min-height: 110px; }
.chatflow details { margin-top: 8px; font-size: 14px; }
.chatflow details textarea { min-height: 160px; font-family: Menlo, Consolas, monospace; font-size: 12px; }
.chatflow code { background: var(--platinum); padding: 1px 5px; }
.attach { display: block; margin-top: 6px; background: var(--alice); border-left: 4px solid var(--han-blue); padding: 8px 10px; font-size: 14px; }
.copied { color: var(--ok); font-weight: 700; font-size: 14px; }
