:root {
  --orange: #F3964E;
  --orange-dark: #E07F33;
  --orange-soft: #FDEFE3;
  --navy: #2B274F;
  --navy-soft: #4A4670;
  --ice: #C2E2F2;
  --ice-soft: #EAF5FB;
  --grey: #ECEDEF;
  --grey-mid: #8B8C8D;
  --white: #FFFFFF;
  --red: #C24141;
  --red-soft: #F9E7E7;
  --green: #3E8E5A;
  --green-soft: #E5F2EA;
  --amber: #B07B1E;
  --amber-soft: #F7EEDA;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(43, 39, 79, 0.10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  color: var(--navy);
  background: #F7F7F9;
  font-size: 14px;
  line-height: 1.5;
}
.boot { padding: 60px; text-align: center; color: var(--grey-mid); }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 13px; color: var(--navy);
  border: 1px solid #D5D6DB; border-radius: 6px; padding: 8px 10px; width: 100%;
  background: var(--white);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--orange); border-color: var(--orange); }
textarea { min-height: 90px; resize: vertical; }
a { color: var(--navy); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--orange);
  flex-direction: column; gap: 28px; padding: 20px;
}
.login-logo { width: 220px; max-width: 70vw; }
.login-card {
  background: var(--white); border-radius: 14px; padding: 34px; width: 380px; max-width: 92vw;
  box-shadow: 0 10px 40px rgba(43,39,79,.25);
}
.login-card h1 { font-size: 18px; margin-bottom: 4px; letter-spacing: .08em; text-transform: uppercase; }
.login-card p { color: var(--grey-mid); font-size: 13px; margin-bottom: 18px; }
.login-card label { display: block; font-size: 12px; font-weight: 600; margin: 12px 0 4px; }
.login-err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }
.strip { height: 8px; width: 220px; max-width: 70vw; background: var(--ice); border-radius: 4px; }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.topbar { display: none; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

.sidesearch { padding: 4px 14px 10px; position: relative; }
.sidesearch input {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15);
  color: var(--white); font-size: 12.5px;
}
.sidesearch input::placeholder { color: #9B98B8; }
.sidesearch input:focus { outline: 2px solid var(--orange); }
.search-results {
  display: none; position: absolute; left: 14px; right: 14px; top: 100%; z-index: 60;
  background: var(--white); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.3);
  max-height: 340px; overflow-y: auto;
}
.search-results button {
  display: block; width: 100%; text-align: left; background: none; border: none;
  padding: 8px 12px; border-bottom: 1px solid var(--grey); color: var(--navy);
}
.search-results button:hover { background: var(--ice-soft); }
.search-results button b { display: block; font-size: 13px; }
.search-results button span { font-size: 11px; color: var(--grey-mid); }
.search-none { padding: 12px; font-size: 12px; color: var(--grey-mid); }
.sidebar {
  width: 224px; background: var(--navy); color: var(--white); flex-shrink: 0;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .brand { padding: 20px 18px 12px; }
.sidebar .brand img { width: 130px; display: block; }
.sidebar .brand span {
  display: block; font-size: 10px; letter-spacing: .28em; color: var(--ice);
  text-transform: uppercase; margin-top: 6px;
}
.nav { flex: 1; padding: 10px 0; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: none; color: #C9C7DC; padding: 10px 18px; font-size: 13px; font-weight: 500;
}
.nav button:hover { color: var(--white); background: rgba(255,255,255,.06); }
.nav button.active { color: var(--white); background: rgba(243,150,78,.18); border-right: 3px solid var(--orange); }
.nav .navsep { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: #6E6A94; padding: 14px 18px 4px; }
.sidebar .whoami { padding: 14px 18px; font-size: 12px; color: #C9C7DC; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar .whoami b { color: var(--white); display: block; }
.sidebar .whoami button { background: none; border: none; color: var(--ice); font-size: 12px; padding: 4px 0; text-decoration: underline; }

.main { flex: 1; padding: 26px 30px 60px; max-width: 1280px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.page-head h2 { font-size: 21px; font-weight: 600; }
.page-hint { color: var(--grey-mid); font-size: 12.5px; margin-bottom: 18px; max-width: 860px; }

/* ---------- widgets ---------- */
.btn {
  background: var(--orange); color: var(--white); border: none; border-radius: 7px;
  padding: 9px 16px; font-size: 13px; font-weight: 600;
}
.btn:hover { background: var(--orange-dark); }
.btn.ghost { background: var(--white); color: var(--navy); border: 1px solid #D5D6DB; }
.btn.ghost:hover { border-color: var(--navy); background: var(--white); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--red); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat {
  background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
  cursor: pointer; border: 1px solid transparent;
}
.stat:hover { border-color: var(--orange); }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--grey-mid); margin-top: 2px; }
.stat.alert .n { color: var(--red); }
.stat.warn .n { color: var(--amber); }
.stat.good .n { color: var(--green); }

.panel { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.panel h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--navy-soft); margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 980px) {
  .two-col { grid-template-columns: 1fr; }
  .main { padding: 66px 14px 60px; }
  .topbar {
    display: flex; align-items: center; gap: 14px; position: fixed; top: 0; left: 0; right: 0;
    background: var(--navy); padding: 10px 14px; z-index: 40;
  }
  .topbar-logo { height: 20px; }
  .hamburger { background: none; border: none; color: var(--white); font-size: 20px; padding: 2px 6px; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 45;
    transform: translateX(-100%); transition: transform .18s ease;
    box-shadow: 4px 0 20px rgba(0,0,0,.3);
  }
  .sidebar.open { transform: translateX(0); }
}

@media print {
  .sidebar, .topbar, .backlink, .btn, .quick-actions { display: none !important; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; font-size: 12px; }
  .panel { box-shadow: none; border: none; padding: 0; }
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--grey-mid); padding: 8px 10px; border-bottom: 2px solid var(--grey); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--grey); vertical-align: top; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover td { background: var(--ice-soft); }
.table-wrap { overflow-x: auto; }

.chip {
  display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--grey); color: var(--navy);
}
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.orange { background: var(--orange-soft); color: var(--orange-dark); }
.chip.ice { background: var(--ice-soft); color: #2A6B8F; }
.chip.navy { background: var(--navy); color: var(--white); }

.due { font-weight: 600; white-space: nowrap; }
.due.overdue { color: var(--red); }
.due.soon { color: var(--amber); }

.filters { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.filters select, .filters input { width: auto; min-width: 140px; }
.tabbtns { display: flex; gap: 6px; flex-wrap: wrap; }
.tabbtns button {
  border: 1px solid #D5D6DB; background: var(--white); border-radius: 20px; padding: 6px 14px; font-size: 12.5px; font-weight: 500; color: var(--navy);
}
.tabbtns button.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

.empty { padding: 26px; text-align: center; color: var(--grey-mid); font-size: 13px; }
.empty b { display: block; color: var(--navy); margin-bottom: 4px; }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(43,39,79,.45); display: flex;
  align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50;
}
.modal {
  background: var(--white); border-radius: 14px; padding: 26px; width: 640px; max-width: 96vw;
  box-shadow: 0 16px 50px rgba(0,0,0,.25);
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.formgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.formgrid .full { grid-column: 1 / -1; }
.formgrid label { display: block; font-size: 11.5px; font-weight: 600; margin-bottom: 3px; color: var(--navy-soft); }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.modal .actions .left { margin-right: auto; }

/* ---------- detail ---------- */
.backlink { background: none; border: none; color: var(--grey-mid); font-size: 13px; padding: 0; margin-bottom: 10px; text-decoration: underline; }
.detail-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.detail-head h2 { font-size: 22px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--grey-mid); }
.kv dd { word-break: break-word; }

.checklist .stage { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--navy-soft); margin: 14px 0 6px; }
.checklist label { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; font-size: 13px; cursor: pointer; }
.checklist input { width: 16px; height: 16px; margin-top: 2px; flex-shrink: 0; }
.checklist label.done { color: var(--grey-mid); text-decoration: line-through; }
.progressbar { height: 8px; background: var(--grey); border-radius: 4px; overflow: hidden; margin: 8px 0 4px; }
.progressbar div { height: 100%; background: var(--orange); }

/* ---------- policy ---------- */
.policy-body { max-width: 760px; font-size: 14px; }
.policy-body h2 { font-size: 17px; margin: 18px 0 8px; }
.policy-body h3 { font-size: 14.5px; margin: 14px 0 6px; text-transform: none; letter-spacing: 0; color: var(--navy); }
.policy-body ul, .policy-body ol { margin: 6px 0 10px 22px; }
.policy-body p { margin-bottom: 10px; }

.explain p { font-size: 13px; max-width: 900px; margin-bottom: 8px; color: var(--navy-soft); }

/* ---------- staff tips ---------- */
.tipbox {
  background: var(--ice-soft); border: 1px solid var(--ice); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px; max-width: 980px;
}
.tipbox-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.tipbox-head b { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: #2A6B8F; }
.tipbox-head button, .tip-collapsed button {
  background: none; border: none; color: var(--grey-mid); font-size: 12px; text-decoration: underline; padding: 0;
}
.tipbox ol { margin: 0 0 0 20px; font-size: 13px; color: var(--navy-soft); }
.tipbox ol li { margin-bottom: 4px; }
.tip-collapsed { margin-bottom: 14px; }

/* ---------- site map ---------- */
.map-flow { display: flex; align-items: stretch; gap: 8px; overflow-x: auto; padding: 4px 0; }
.map-stage {
  background: var(--orange-soft); border: 1px solid var(--orange); border-radius: 10px;
  padding: 12px; min-width: 150px; flex: 1; cursor: pointer;
}
.map-stage:hover { background: var(--orange); color: var(--white); }
.map-stage:hover span { color: var(--white); }
.map-stage b { display: block; font-size: 13px; margin-bottom: 4px; }
.map-stage span { font-size: 11.5px; color: var(--navy-soft); display: block; }
.map-arrow { align-self: center; color: var(--orange-dark); font-size: 18px; flex-shrink: 0; }
.map-grid { display: grid; gap: 10px; }
.map-card {
  border: 1px solid var(--grey); border-radius: 10px; padding: 12px; cursor: pointer;
  border-left: 4px solid var(--orange);
}
.map-card:hover { background: var(--ice-soft); }
.map-card b { display: block; font-size: 13.5px; }
.map-card span { font-size: 12px; color: var(--grey-mid); }
.map-rhythm { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.map-rhythm b { font-size: 13px; display: block; margin-bottom: 6px; color: var(--navy); }
.map-rhythm ul { margin-left: 18px; font-size: 12.5px; color: var(--navy-soft); }
.map-rhythm li { margin-bottom: 4px; }

/* ---------- budget grid ---------- */
.budget-grid { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; margin-bottom: 8px; }
.budget-grid table { min-width: 1250px; font-size: 12px; }
.budget-grid th { position: sticky; top: 0; background: var(--white); }
.budget-grid td { padding: 4px 5px; }
.budget-grid td.bl { min-width: 210px; font-weight: 500; }
.budget-grid td.bt { font-weight: 700; white-space: nowrap; }
.budget-grid input { padding: 4px 6px; font-size: 12px; min-width: 68px; text-align: right; }
.budget-grid tr.calc td { background: #FBF8F4; font-weight: 600; white-space: nowrap; color: var(--navy); }
.budget-grid tr.sect td {
  background: var(--navy); color: var(--white); font-size: 11px; letter-spacing: .08em;
  text-transform: uppercase; padding: 5px 8px;
}
.vdiff { font-size: 10.5px; font-weight: 700; }
.vdiff.pos { color: var(--green); }
.vdiff.neg { color: var(--red); }

/* ---------- signing page ---------- */
.signpage { min-height: 100vh; background: #F7F7F9; }
.sign-main { max-width: 820px; margin: 0 auto; padding: 20px 22px 60px; }
.signed-ok { font-size: 14px; color: var(--green); }
.signed-ok b { font-size: 16px; }

/* ---------- franchisee portal ---------- */
.portal { min-height: 100vh; background: #F7F7F9; }
.portal-head {
  background: var(--navy); color: var(--white); padding: 14px 22px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.portal-head img { height: 22px; }
.portal-head span { font-size: 15px; font-weight: 600; letter-spacing: .04em; }
.portal-main { max-width: 1100px; margin: 0 auto; padding: 10px 22px 60px; }
.assessment {
  font-size: 12.5px; margin-top: 6px; padding: 8px 10px; border-radius: 6px;
  background: var(--grey); color: var(--navy);
}
.assessment.action-needed { background: var(--red-soft); }
.assessment.compliant { background: var(--green-soft); }
td select { width: auto; min-width: 130px; font-size: 12px; padding: 5px 8px; }

.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--navy); color: var(--white);
  padding: 12px 18px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow); z-index: 99;
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.feed { list-style: none; font-size: 12.5px; }
.feed li { padding: 6px 0; border-bottom: 1px solid var(--grey); color: var(--navy-soft); }
.feed .t { color: var(--grey-mid); font-size: 11px; }
.mini-list { list-style: none; }
.mini-list li { padding: 8px 0; border-bottom: 1px solid var(--grey); display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.mini-list .who { color: var(--grey-mid); font-size: 12px; }
