:root {
  --navy: #142f46;
  --navy-2: #0d2233;
  --blue: #27739b;
  --paper: #f6f4ef;
  --white: #ffffff;
  --ink: #17232c;
  --muted: #61717d;
  --line: #d8dfe4;
  --green: #197449;
  --green-bg: #e8f5ed;
  --amber: #9a6200;
  --amber-bg: #fff4d9;
  --red: #a22d25;
  --shadow: 0 16px 40px rgba(13,34,51,.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
[hidden] { display: none !important; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--navy-2), var(--navy));
}
.login-card {
  width: min(100%, 430px);
  padding: 34px;
  border-top: 4px solid #d7aa35;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 24px 65px rgba(0,0,0,.28);
}
.login-card .eyebrow { color: var(--blue); }
.login-card h1 { color: var(--navy); font-size: 34px; line-height: 1.1; }
.login-copy { margin: 10px 0 24px; color: var(--muted); }
.login-card label { display: block; margin: 14px 0 6px; color: var(--navy); font-size: 12px; font-weight: 850; letter-spacing: .04em; text-transform: uppercase; }
.login-card input { width: 100%; border: 1px solid #aebcc5; border-radius: 9px; padding: 12px; font: inherit; }
.login-card input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,115,155,.14); }
.login-card button { width: 100%; margin-top: 20px; border: 0; border-radius: 9px; padding: 12px; color: white; background: var(--blue); font: inherit; font-weight: 850; cursor: pointer; }
.login-card button:disabled { opacity: .65; cursor: wait; }
.login-status { min-height: 20px; margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.login-status.error { color: var(--red); font-weight: 700; }
.login-help { margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.45; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(22px, 5vw, 72px);
  color: white;
  background: linear-gradient(120deg, var(--navy-2), var(--navy));
  border-bottom: 4px solid #d7aa35;
}
.eyebrow { margin: 0 0 5px; color: #9fc4d8; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1; }
.subtitle { margin: 8px 0 0; color: #d9e4ea; }
.safety-chip { white-space: nowrap; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 9px 13px; font-size: 12px; font-weight: 850; letter-spacing: .08em; }
.safety-chip span { display: inline-block; width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; background: #ffca48; box-shadow: 0 0 0 4px rgba(255,202,72,.15); }
.topbar-tools { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.account-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.account-chip strong { color: #ffca48; }
.account-chip span { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d9e4ea; }
.account-chip button { border: 1px solid rgba(255,255,255,.35); border-radius: 7px; padding: 5px 8px; color: white; background: transparent; font: inherit; cursor: pointer; }

main { display: grid; grid-template-columns: 290px minmax(0, 1fr); max-width: 1480px; margin: 0 auto; }
.sidebar { position: sticky; top: 0; align-self: start; min-height: calc(100vh - 141px); padding: 28px 22px 40px; border-right: 1px solid var(--line); background: rgba(255,255,255,.5); }
.search-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
#panelSearch { width: 100%; border: 1px solid #bac6ce; border-radius: 10px; padding: 11px 12px; background: white; color: var(--ink); font-size: 15px; outline: none; }
#panelSearch:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,115,155,.14); }
#panelNav { display: grid; gap: 9px; margin-top: 20px; }
.panel-button { width: 100%; padding: 13px 14px; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); cursor: pointer; transition: .15s ease; }
.panel-button:hover { border-color: #9db0bd; transform: translateY(-1px); }
.panel-button.active { color: white; border-color: var(--navy); background: var(--navy); box-shadow: 0 8px 20px rgba(20,47,70,.18); }
.panel-button strong { display: block; font-size: 15px; }
.panel-button small { display: block; margin-top: 3px; color: inherit; opacity: .72; }
.sidebar-note { margin-top: 24px; padding: 15px; border-left: 4px solid #d7aa35; border-radius: 8px; background: var(--amber-bg); color: #513b0f; font-size: 12px; line-height: 1.45; }
.sidebar-note p { margin: 5px 0 0; }

.panel-view { min-width: 0; padding: 34px clamp(22px, 4vw, 58px) 70px; }
.panel-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 22px; }
.panel-head h2 { margin: 0 0 7px; color: var(--navy); font-size: clamp(27px, 3.5vw, 42px); }
.panel-head p { margin: 0; max-width: 760px; color: var(--muted); line-height: 1.5; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.badge { display: inline-flex; padding: 6px 9px; border-radius: 999px; background: var(--green-bg); color: var(--green); font-size: 11px; font-weight: 850; letter-spacing: .05em; text-transform: uppercase; }
.badge.zero { background: #fde9e6; color: var(--red); }
.badge.status-draft { background: var(--amber-bg); color: var(--amber); }
.badge.status-pending { background: #e8eef8; color: #315a91; }
.badge.status-verified { background: var(--green-bg); color: var(--green); }
.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.action-link, .print-button { display: inline-flex; align-items: center; justify-content: center; min-height: 39px; border-radius: 9px; padding: 0 13px; font: inherit; font-size: 13px; font-weight: 800; text-decoration: none; cursor: pointer; }
.action-link { color: white; background: var(--blue); }
.print-button { color: var(--navy); background: white; border: 1px solid #aebcc5; }

.notice { margin: 18px 0 24px; padding: 14px 16px; border: 1px solid #e0bf67; border-radius: 10px; background: var(--amber-bg); color: #574113; line-height: 1.45; }
.references { margin: 0 0 26px; padding: 15px 17px 18px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 5px 14px rgba(13,34,51,.05); }
.references summary { color: var(--navy); font-weight: 850; cursor: pointer; }
.references > p { margin: 8px 0 15px; color: var(--muted); font-size: 13px; }
.reference-group + .reference-group { margin-top: 18px; }
.reference-group h4 { margin: 0 0 9px; color: var(--navy); font-size: 13px; }
.reference-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 11px; }
.reference-card { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #f8fafb; color: var(--ink); text-decoration: none; transition: .15s ease; }
.reference-card:hover { border-color: #8aa3b3; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13,34,51,.09); }
.reference-card img { display: block; width: 100%; height: 150px; object-fit: cover; background: #e8edf0; }
.reference-card span { display: block; padding: 8px 9px 9px; font-size: 12px; font-weight: 750; line-height: 1.3; }
.setup { display: grid; gap: 7px; margin-bottom: 25px; }
.setup h3, .section h3 { margin: 0; color: var(--navy); }
.checkline { display: flex; gap: 10px; align-items: flex-start; line-height: 1.45; }
.box { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; border: 1.5px solid #60717d; border-radius: 3px; background: white; }

.section { margin-top: 24px; scroll-margin-top: 18px; }
.section-title { display: flex; gap: 10px; align-items: baseline; margin-bottom: 7px; }
.section-code { color: var(--blue); font-weight: 900; }
.section-note { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 5px 14px rgba(13,34,51,.05); }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th { padding: 10px 11px; background: var(--navy); color: white; text-align: left; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
td { padding: 11px; border-top: 1px solid var(--line); vertical-align: top; font-size: 13px; line-height: 1.4; }
tbody tr:nth-child(even) td { background: #f8fafb; }
td.done { width: 42px; }
td.probe { color: #153f59; font-weight: 800; white-space: nowrap; }
td.expected { font-weight: 750; }
.final-reset { margin-top: 30px; padding: 20px; border-radius: 13px; background: #edf2f5; }
.revision { margin-top: 24px; }
.revision summary { color: var(--navy); font-weight: 800; cursor: pointer; }
.revision ul { color: var(--muted); line-height: 1.5; }
.empty { padding: 40px 0; color: var(--muted); text-align: center; }
.empty-state { max-width: 620px; margin: 80px auto; padding: 32px; border: 1px solid var(--line); border-radius: 14px; background: white; text-align: center; box-shadow: var(--shadow); }
.empty-state h2 { margin: 0 0 10px; color: var(--navy); }
.empty-state p { margin: 0; color: var(--muted); line-height: 1.5; }
footer { display: flex; justify-content: space-between; gap: 15px; padding: 18px clamp(22px,5vw,72px); color: #cfdbe2; background: var(--navy-2); font-size: 12px; }

@media (max-width: 850px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  main { display: block; }
  .sidebar { position: static; min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  #panelNav { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .panel-head { flex-direction: column; }
  .actions { justify-content: flex-start; }
  .topbar-tools { align-items: flex-start; }
}
@media (max-width: 590px) {
  #panelNav { grid-template-columns: 1fr; }
  .panel-view { padding-inline: 14px; }
  .safety-chip { white-space: normal; }
}

@media print {
  body { background: white; }
  .topbar, .sidebar, footer, .actions, .revision, .references { display: none !important; }
  main { display: block; }
  .panel-view { padding: 0; }
  .panel-head { margin-bottom: 12px; }
  .panel-head h2 { font-size: 24px; }
  .notice { break-inside: avoid; }
  .section { break-inside: avoid; margin-top: 15px; }
  .table-wrap { overflow: visible; box-shadow: none; }
  table { min-width: 0; }
  th, td { font-size: 9px; padding: 5px; }
}

.management{margin:1rem 0}.management button{margin:.3rem;padding:.55rem}.management form,.report{padding:1rem;border:1px solid #cbd5e1;border-radius:8px;margin:.6rem 0}.management label{display:block;margin:.8rem 0}.management textarea{display:block;width:100%;min-height:4rem;padding:.6rem;font:inherit}.management select{padding:.4rem;max-width:100%}.management details{margin:.7rem 0}.management [role=status]{font-weight:600}
@media print{.management{display:none}}
