
:root{
  color-scheme: light;
  --page:#f4f4f1; --surface:#ffffff; --surface-2:#fcfcfb;
  --ink:#0b0b0b; --ink-2:#52514e; --muted:#898781;
  --line:#e1e0d9; --line-2:#c3c2b7;
  --brand:#1d5c4d; --brand-dark:#123f34; --brand-tint:#e7f0ed;
  --hi-bg:#fbe7e7; --hi-tx:#a02c2c; --hi:#d03b3b;
  --md-bg:#fdf3d7; --md-tx:#8a6100; --md:#fab219;
  --lo-bg:#e6f4e6; --lo-tx:#0a6b0a; --lo:#0ca30c;
  --none-bg:#eeeeeb; --none-tx:#52514e;
  --radius:10px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}
*{box-sizing:border-box; margin:0; padding:0}
html,body{height:100%}
body{background:var(--page); color:var(--ink); font-size:14px; line-height:1.45}
button{font:inherit; cursor:pointer}
input,select,textarea{font:inherit; color:var(--ink)}
textarea{resize:vertical}
.hidden{display:none !important}

/* ---------- generic ---------- */
.badge{display:inline-flex; align-items:center; gap:4px; padding:2px 9px; border-radius:99px; font-size:12px; font-weight:600; white-space:nowrap}
.badge.High{background:var(--hi-bg); color:var(--hi-tx)}
.badge.Medium{background:var(--md-bg); color:var(--md-tx)}
.badge.Low{background:var(--lo-bg); color:var(--lo-tx)}
.badge.None,.badge.unset{background:var(--none-bg); color:var(--none-tx)}
.badge.Strong{background:var(--lo-bg); color:var(--lo-tx)}
.badge.Adequate{background:#e8f0fb; color:#1c5cab}
.badge.Weak{background:var(--md-bg); color:var(--md-tx)}
.chip{display:inline-flex; align-items:center; gap:5px; padding:2px 9px; border-radius:99px; font-size:11.5px; font-weight:600}
.chip.pending{background:#eeeeeb; color:#52514e}
.chip.confirmed{background:#e8f0fb; color:#1c5cab}
.chip.changed{background:#f3ecfb; color:#5b3aa7}
.chip.retired{background:#f2f2ef; color:#898781; text-decoration:none}
.chip.new{background:var(--brand-tint); color:var(--brand-dark)}
.btn{border:1px solid var(--line-2); background:var(--surface); color:var(--ink); padding:8px 16px; border-radius:8px; font-weight:600; font-size:13.5px}
.btn:hover{background:var(--surface-2); border-color:var(--muted)}
.btn.primary{background:var(--brand); border-color:var(--brand); color:#fff}
.btn.primary:hover{background:var(--brand-dark)}
.btn.danger{color:var(--hi-tx); border-color:#e5c4c4}
.btn.danger:hover{background:var(--hi-bg)}
.btn:disabled{opacity:.45; cursor:not-allowed}
.btn.small{padding:5px 11px; font-size:12.5px}
.btn.sso{display:flex; align-items:center; justify-content:center; gap:9px; padding:10px 16px}
.ssodivider{display:flex; align-items:center; gap:10px; margin:16px 0 4px; color:var(--muted); font-size:12px}
.ssodivider::before,.ssodivider::after{content:""; flex:1; border-top:1px solid var(--line)}

/* ---------- start screen ---------- */
#startScreen{max-width:1060px; margin:0 auto; padding:48px 24px}
.brandline{display:flex; align-items:baseline; gap:12px; margin-bottom:6px}
.brandline h1{font-size:26px; letter-spacing:-.02em}
.brandline .fr{color:var(--brand); font-weight:800}
#startScreen .sub{color:var(--ink-2); margin-bottom:28px; max-width:640px}
.meta-row{display:flex; gap:14px; margin-bottom:26px; flex-wrap:wrap}
.meta-row label{display:block; font-size:12px; font-weight:700; color:var(--ink-2); margin-bottom:5px; text-transform:uppercase; letter-spacing:.04em}
.meta-row input,.meta-row select{padding:9px 12px; border:1px solid var(--line-2); border-radius:8px; background:var(--surface); min-width:230px}
.area-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(300px,1fr)); gap:14px}
.area-card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px; text-align:left; transition:box-shadow .12s, border-color .12s}
.area-card:hover{border-color:var(--brand); box-shadow:0 2px 10px rgba(18,63,52,.10)}
.area-card h3{font-size:16px; margin-bottom:2px}
.area-card .owner{color:var(--ink-2); font-size:12.5px; margin-bottom:10px}
.area-card .counts{display:flex; gap:6px; flex-wrap:wrap}
.startnote{margin-top:26px; padding:14px 16px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); color:var(--ink-2); font-size:13px; max-width:820px}
.resume-inline{margin-top:14px}

/* ---------- app shell ---------- */
#appScreen{display:flex; flex-direction:column; height:100vh}
header.topbar{background:var(--surface); border-bottom:1px solid var(--line); padding:10px 20px; display:flex; align-items:center; gap:18px; flex-wrap:wrap}
.topbar .id h2{font-size:16px}
.topbar .id .fr{color:var(--brand); font-weight:800}
.topbar .id small{color:var(--muted); display:block; font-size:11.5px}
.progresswrap{flex:1; min-width:220px; max-width:420px}
.progresswrap .lbl{display:flex; justify-content:space-between; font-size:11.5px; color:var(--ink-2); margin-bottom:3px}
.progressbar{height:8px; background:var(--line); border-radius:99px; overflow:hidden}
.progressbar>div{height:100%; background:var(--brand); border-radius:99px; transition:width .25s}
.topbar .actions{display:flex; gap:8px; align-items:center}
main.body{flex:1; display:flex; min-height:0}

/* list panel */
#listPanel{width:400px; min-width:320px; border-right:1px solid var(--line); background:var(--surface-2); display:flex; flex-direction:column}
.tilerow{display:grid; grid-template-columns:1fr 1fr 1fr 1fr; gap:8px; padding:12px 14px 4px}
.tile{background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:8px 10px}
.tile .v{font-size:19px; font-weight:700; letter-spacing:-.01em}
.tile .k{font-size:10.5px; color:var(--ink-2); text-transform:uppercase; letter-spacing:.04em; margin-top:1px}
.tile.warn .v{color:var(--hi-tx)}
.filters{padding:10px 14px; display:flex; gap:8px; flex-wrap:wrap; align-items:center}
.filters input[type=search]{flex:1; min-width:130px; padding:7px 10px; border:1px solid var(--line-2); border-radius:8px; background:var(--surface)}
.filters select{padding:7px 8px; border:1px solid var(--line-2); border-radius:8px; background:var(--surface); font-size:12.5px}
#riskList{flex:1; overflow-y:auto; padding:0 8px 90px}
.grouphead{position:sticky; top:0; background:var(--surface-2); padding:10px 8px 4px; font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; z-index:1}
.riskrow{width:100%; text-align:left; background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:9px 11px; margin-bottom:6px; display:block}
.riskrow:hover{border-color:var(--brand)}
.riskrow.active{border-color:var(--brand); box-shadow:0 0 0 2px var(--brand-tint)}
.riskrow .l1{display:flex; align-items:center; gap:8px; margin-bottom:3px}
.riskrow .rid{font-weight:700; font-size:12.5px; color:var(--brand-dark)}
.riskrow .desc{font-size:12.8px; color:var(--ink-2); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden}
.riskrow.retired .desc{text-decoration:line-through; color:var(--muted)}
.riskrow .l2{display:flex; gap:6px; margin-top:6px; align-items:center; flex-wrap:wrap}
.arrow{font-weight:800}
.arrow.up{color:var(--hi-tx)} .arrow.down{color:var(--lo-tx)} .arrow.flat{color:var(--muted)}
.addnewwrap{padding:10px 14px; border-top:1px solid var(--line); background:var(--surface-2)}

/* editor panel */
#editorPanel{flex:1; overflow-y:auto; padding:22px 28px 120px}
.placeholder{color:var(--muted); text-align:center; margin-top:120px; font-size:15px}
.edhead{display:flex; align-items:flex-start; gap:14px; margin-bottom:4px; flex-wrap:wrap}
.edhead h3{font-size:19px; letter-spacing:-.01em}
.edhead .spacer{flex:1}
.fixedmeta{display:flex; gap:22px; flex-wrap:wrap; margin:10px 0 18px; padding:12px 16px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius)}
.fixedmeta div{min-width:150px; max-width:340px}
.fixedmeta .k{font-size:10.5px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.05em}
.fixedmeta .v{font-size:13px; color:var(--ink-2); margin-top:2px}
.card{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px; margin-bottom:16px}
.card h4{font-size:13px; text-transform:uppercase; letter-spacing:.05em; color:var(--brand-dark); margin-bottom:12px}
.fieldgrid{display:grid; grid-template-columns:1fr 1fr; gap:14px}
.field{margin-bottom:12px}
.field:last-child{margin-bottom:0}
.field>label{display:block; font-size:12px; font-weight:700; color:var(--ink-2); margin-bottom:5px}
.field textarea,.field input[type=text],.field select{width:100%; padding:9px 11px; border:1px solid var(--line-2); border-radius:8px; background:var(--surface)}
.field .hint{font-size:11.5px; color:var(--muted); margin-top:4px}
.seg{display:inline-flex; border:1px solid var(--line-2); border-radius:8px; overflow:hidden}
.seg button{padding:7px 16px; background:var(--surface); border:0; border-right:1px solid var(--line-2); font-weight:600; font-size:13px; color:var(--ink-2)}
.seg button:last-child{border-right:0}
.seg button.sel-High{background:var(--hi-bg); color:var(--hi-tx)}
.seg button.sel-Medium{background:var(--md-bg); color:var(--md-tx)}
.seg button.sel-Low{background:var(--lo-bg); color:var(--lo-tx)}
.seg button.sel-Strong{background:var(--lo-bg); color:var(--lo-tx)}
.seg button.sel-Adequate{background:#e8f0fb; color:#1c5cab}
.seg button.sel-Weak{background:var(--md-bg); color:var(--md-tx)}
.seg button.sel-None{background:var(--none-bg); color:var(--none-tx)}
.histrow{display:flex; gap:10px; align-items:center; flex-wrap:wrap}
.histrow .h{display:flex; flex-direction:column; align-items:center; gap:3px; padding:8px 12px; background:var(--surface-2); border:1px solid var(--line); border-radius:8px; min-width:86px}
.histrow .h .yr{font-size:10.5px; font-weight:700; color:var(--muted); text-transform:uppercase}
.histrow .sep{color:var(--line-2); font-size:18px}
.histrow .h.now{border-color:var(--brand); background:var(--brand-tint)}
.rulebox{border-left:3px solid var(--md); background:var(--md-bg); padding:10px 14px; border-radius:0 8px 8px 0; margin-top:12px; font-size:12.8px; color:var(--md-tx)}
.rulebox.err{border-left-color:var(--hi); background:var(--hi-bg); color:var(--hi-tx)}
.rulebox ul{margin-left:16px; margin-top:4px}
.edactions{display:flex; gap:10px; margin-top:6px; flex-wrap:wrap; align-items:center}
.savednote{color:var(--lo-tx); font-weight:600; font-size:13px}
.escrow{display:flex; align-items:center; gap:9px; flex-wrap:wrap}
.escrow input[type=text]{flex:1; min-width:200px; padding:8px 11px; border:1px solid var(--line-2); border-radius:8px}
.switch{display:inline-flex; align-items:center; gap:8px; cursor:pointer; font-weight:600; font-size:13px; color:var(--ink-2)}
.switch input{width:16px; height:16px; accent-color:var(--brand)}

/* modal */
.modalback{position:fixed; inset:0; background:rgba(11,11,11,.42); display:flex; align-items:center; justify-content:center; z-index:40; padding:20px}
.modal{background:var(--surface); border-radius:14px; max-width:760px; width:100%; max-height:88vh; overflow-y:auto; padding:26px 28px; box-shadow:0 12px 40px rgba(0,0,0,.22)}
.modal h3{font-size:18px; margin-bottom:14px}
.modal .mrow{display:flex; justify-content:flex-end; gap:10px; margin-top:18px}

/* checklist / submit */
.check-item{display:flex; gap:12px; padding:11px 4px; border-bottom:1px solid var(--line); align-items:flex-start}
.check-item:last-child{border-bottom:0}
.ck{width:22px; height:22px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:800; flex-shrink:0}
.ck.ok{background:var(--lo-bg); color:var(--lo-tx)}
.ck.no{background:var(--hi-bg); color:var(--hi-tx)}
.check-item .t{font-weight:600}
.check-item .d{font-size:12.5px; color:var(--ink-2); margin-top:2px}
.check-item .d button{border:0; background:none; color:var(--brand); font-weight:700; text-decoration:underline; padding:0}
.summarybar{display:flex; gap:8px; flex-wrap:wrap; margin:10px 0}
.distbar{display:flex; height:14px; border-radius:99px; overflow:hidden; margin:6px 0 4px; background:var(--none-bg)}
.distbar div{height:100%; border-right:2px solid var(--surface)}
.distbar div:last-child{border-right:0}
.legendrow{display:flex; gap:14px; font-size:12px; color:var(--ink-2); flex-wrap:wrap}
.legendrow span{display:inline-flex; align-items:center; gap:5px}
.dot{width:9px; height:9px; border-radius:50%; display:inline-block}

/* help */
.helpgrid{display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; margin:12px 0}
.helpcard{border:1px solid var(--line); border-radius:10px; padding:12px}
.helpcard .t{font-weight:700; font-size:12.5px; text-transform:uppercase; letter-spacing:.04em; margin-bottom:5px; color:var(--brand-dark)}
.helpcard p{font-size:12.5px; color:var(--ink-2)}
kbd{background:var(--none-bg); border:1px solid var(--line-2); border-radius:5px; padding:1px 6px; font-size:11px}

@media (max-width: 860px){
  main.body{flex-direction:column}
  #listPanel{width:100%; max-height:46vh}
  .fieldgrid{grid-template-columns:1fr}
  .helpgrid{grid-template-columns:1fr}
}

/* ---------- login ---------- */
#loginScreen{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px}
.logincard{background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:34px 36px; width:400px; box-shadow:0 8px 30px rgba(18,63,52,.08)}
.logincard h1{font-size:22px; margin-bottom:2px}
.logincard .fr{color:var(--brand); font-weight:800}
.logincard .sub2{color:var(--ink-2); font-size:13px; margin-bottom:22px}
.logincard .field{margin-bottom:14px}
.logincard input{width:100%; padding:10px 12px; border:1px solid var(--line-2); border-radius:8px}
.loginerr{background:var(--hi-bg); color:var(--hi-tx); border-radius:8px; padding:9px 12px; font-size:13px; margin-bottom:12px}

/* ---------- dashboard ---------- */
#dashScreen{max-width:1180px; margin:0 auto; padding:26px 24px 80px}
.dashhead{display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin-bottom:20px}
.dashhead h1{font-size:22px}
.dashhead .fr{color:var(--brand); font-weight:800}
.dashhead .spacer{flex:1}
.cyclechip{background:var(--brand-tint); color:var(--brand-dark); font-weight:700; padding:4px 14px; border-radius:99px; font-size:13px}
.divgrid{display:grid; grid-template-columns:repeat(auto-fill,minmax(340px,1fr)); gap:14px; margin-bottom:24px}
.divcard{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:16px 18px}
.divcard .t{display:flex; align-items:center; gap:10px; margin-bottom:2px}
.divcard h3{font-size:16px}
.divcard .own{color:var(--ink-2); font-size:12px; margin-bottom:10px}
.subbadge{font-size:11px; font-weight:700; padding:2px 10px; border-radius:99px}
.subbadge.in{background:var(--lo-bg); color:var(--lo-tx)}
.subbadge.out{background:var(--md-bg); color:var(--md-tx)}
.divcard .pr{margin:8px 0 4px}
.divcard .actions2{display:flex; gap:8px; margin-top:12px; flex-wrap:wrap}
.section{background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); padding:18px 20px; margin-bottom:16px}
.section h4{font-size:13px; text-transform:uppercase; letter-spacing:.05em; color:var(--brand-dark); margin-bottom:12px}
table.plain{width:100%; border-collapse:collapse; font-size:13px}
table.plain th{text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--muted); padding:6px 8px; border-bottom:1px solid var(--line)}
table.plain td{padding:7px 8px; border-bottom:1px solid var(--line); vertical-align:top}
table.plain tr:last-child td{border-bottom:0}
.readonly-banner{background:var(--md-bg); color:var(--md-tx); padding:8px 20px; font-size:13px; font-weight:600}
