:root{
  --navy:#10223a;--navy2:#173555;--ink:#172033;--muted:#667085;--line:#e6eaf0;
  --bg:#f4f6f8;--card:#fff;--green:#247a56;--amber:#b06a12;--red:#b13d45;--blue:#315f9b;
  --shadow:0 10px 30px rgba(22,34,54,.07);--radius:18px;
}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,system-ui,sans-serif;color:var(--ink);background:var(--bg)}
button,input,select,textarea{font:inherit}button{cursor:pointer}.shell{display:grid;grid-template-columns:276px 1fr;min-height:100vh}
.sidebar{background:linear-gradient(180deg,var(--navy) 0%,#0b192c 100%);color:#fff;padding:24px 18px;position:sticky;top:0;height:100vh;display:flex;flex-direction:column}
.brand{padding:8px 10px 24px;border-bottom:1px solid rgba(255,255,255,.12)}.brand-kicker{font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:#9fb2c9;font-weight:800}.brand h1{font-family:"Source Serif 4",serif;margin:6px 0 4px;font-size:25px;line-height:1.05}.brand p{margin:0;color:#b9c7d6;font-size:12px;line-height:1.45}
.nav{padding:20px 0;overflow:auto}.nav button{width:100%;border:0;background:transparent;color:#c8d4e1;text-align:left;padding:10px 12px;border-radius:10px;margin:2px 0;display:flex;gap:10px;align-items:center;font-weight:600;font-size:13px}.nav button:hover,.nav button.active{background:rgba(255,255,255,.10);color:#fff}.nav .icon{width:22px;text-align:center;opacity:.9}.sidebar-foot{margin-top:auto;padding:14px 10px 4px;border-top:1px solid rgba(255,255,255,.12);font-size:11px;color:#8fa4bb;line-height:1.5}
.main{min-width:0}.topbar{height:76px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;padding:0 34px;position:sticky;top:0;z-index:10}.topbar h2{margin:0;font-size:20px}.top-actions{display:flex;align-items:center;gap:10px}.pilot-chip{background:#eef4fb;color:#244c7c;border:1px solid #d7e4f3;border-radius:999px;padding:7px 10px;font-size:12px;font-weight:700}.avatar{width:36px;height:36px;border-radius:50%;background:var(--navy);display:grid;place-items:center;color:#fff;font-weight:800}
.content{padding:28px 34px 50px;max-width:1500px;margin:0 auto}.hero{display:flex;justify-content:space-between;gap:20px;align-items:flex-end;margin-bottom:24px}.eyebrow{font-size:12px;letter-spacing:.12em;text-transform:uppercase;color:var(--blue);font-weight:800}.hero h3{font-family:"Source Serif 4",serif;font-size:32px;margin:6px 0 5px}.hero p{margin:0;color:var(--muted);max-width:780px;line-height:1.55}.primary{border:0;background:var(--navy);color:#fff;border-radius:10px;padding:11px 16px;font-weight:800}.secondary{border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:10px;padding:10px 14px;font-weight:700}
.grid{display:grid;gap:18px}.kpis{grid-template-columns:repeat(4,minmax(0,1fr));margin-bottom:18px}.card{background:var(--card);border:1px solid var(--line);border-radius:var(--radius);box-shadow:var(--shadow)}.kpi{padding:18px}.kpi .label{font-size:12px;color:var(--muted);font-weight:700}.kpi .value{font-size:30px;font-weight:800;margin:7px 0 3px}.kpi .meta{font-size:12px;color:var(--muted)}.good{color:var(--green)}.warn{color:var(--amber)}.bad{color:var(--red)}
.dashboard-grid{grid-template-columns:1.3fr .8fr}.panel{padding:22px}.panel h4{margin:0 0 16px;font-size:16px}.readiness-wrap{display:grid;grid-template-columns:230px 1fr;align-items:center;gap:22px}.donut{width:210px;height:210px;border-radius:50%;background:conic-gradient(var(--green) 0 82%,#e9edf2 82%);display:grid;place-items:center;position:relative}.donut:after{content:"";position:absolute;width:152px;height:152px;background:#fff;border-radius:50%}.donut .center{position:relative;z-index:1;text-align:center}.donut .score{font-size:43px;font-weight:800}.donut .small{font-size:12px;color:var(--muted)}
.domain-list{display:grid;gap:10px}.domain{display:grid;grid-template-columns:1fr 52px;gap:10px;align-items:center}.domain .name{font-size:12px;font-weight:700}.bar{height:8px;background:#eef1f4;border-radius:999px;overflow:hidden;margin-top:5px}.bar span{display:block;height:100%;background:linear-gradient(90deg,#315f9b,#247a56);border-radius:999px}.domain .pct{text-align:right;font-size:12px;font-weight:800}
.alerts{display:grid;gap:10px}.alert{border:1px solid var(--line);border-left:4px solid var(--amber);border-radius:12px;padding:12px 13px}.alert.high{border-left-color:var(--red)}.alert .title{font-weight:800;font-size:13px}.alert .text{font-size:12px;color:var(--muted);margin-top:4px;line-height:1.45}
.section-card{padding:22px;margin-bottom:18px}.toolbar{display:flex;justify-content:space-between;gap:12px;align-items:center;margin-bottom:16px}.toolbar .search{flex:1;max-width:420px}.search input,.field input,.field select,.field textarea{width:100%;border:1px solid var(--line);border-radius:10px;padding:10px 12px;background:#fff}.table-wrap{overflow:auto}.table{width:100%;border-collapse:collapse;min-width:760px}.table th{text-align:left;font-size:11px;text-transform:uppercase;letter-spacing:.08em;color:var(--muted);padding:10px 12px;border-bottom:1px solid var(--line)}.table td{padding:13px 12px;border-bottom:1px solid #eef1f4;font-size:13px;vertical-align:top}.status{display:inline-flex;align-items:center;border-radius:999px;padding:5px 8px;font-size:11px;font-weight:800}.status.ready{background:#eaf6ef;color:#246848}.status.review{background:#fff3df;color:#9a5b09}.status.gap{background:#fdebec;color:#9b3138}.status.progress{background:#eaf1fb;color:#315f9b}.small-muted{font-size:12px;color:var(--muted)}
.columns{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.column{background:#f8fafc;border:1px solid var(--line);border-radius:14px;padding:14px}.column h5{margin:0 0 12px}.task{background:#fff;border:1px solid var(--line);border-radius:12px;padding:12px;margin-bottom:10px}.task .t{font-weight:800;font-size:13px}.task .d{font-size:11px;color:var(--muted);margin-top:5px;line-height:1.45}
.site-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}.check{display:flex;gap:12px;align-items:flex-start;padding:12px 0;border-bottom:1px solid #edf0f4}.check input{margin-top:3px}.check label{font-size:13px;font-weight:700}.check p{margin:3px 0 0;font-size:12px;color:var(--muted);font-weight:400;line-height:1.45}.ai-box{display:grid;grid-template-rows:1fr auto;min-height:450px}.ai-log{padding:18px;overflow:auto}.msg{max-width:760px;border-radius:14px;padding:12px 14px;margin-bottom:12px;line-height:1.5;font-size:13px}.msg.assistant{background:#eef4fb}.msg.user{background:var(--navy);color:#fff;margin-left:auto}.ai-compose{border-top:1px solid var(--line);padding:14px;display:flex;gap:10px}.ai-compose textarea{flex:1;min-height:58px;resize:vertical;border:1px solid var(--line);border-radius:10px;padding:10px}
.empty{padding:42px;text-align:center;color:var(--muted)}.badge{font-size:10px;border:1px solid var(--line);border-radius:6px;padding:2px 6px;color:var(--muted);font-weight:700}.mobile-menu{display:none}
@media(max-width:1100px){.kpis{grid-template-columns:repeat(2,1fr)}.dashboard-grid,.site-grid{grid-template-columns:1fr}.readiness-wrap{grid-template-columns:1fr}.donut{margin:auto}}
@media(max-width:780px){.shell{grid-template-columns:1fr}.sidebar{position:fixed;z-index:30;width:276px;transform:translateX(-100%);transition:.2s}.sidebar.open{transform:none}.topbar{padding:0 16px}.mobile-menu{display:block;border:0;background:#fff;font-size:22px}.content{padding:22px 16px}.hero{align-items:flex-start;flex-direction:column}.kpis{grid-template-columns:1fr}.columns{grid-template-columns:1fr}}
.demo-banner{background:#fff7e8;border:1px solid #f1d39a;color:#70420b;border-radius:12px;padding:11px 14px;margin-bottom:18px;font-size:12px;line-height:1.5}.source-card{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:16px 18px;margin-bottom:18px}.source-link{font-size:12px;font-weight:800;color:var(--blue);text-decoration:none;white-space:nowrap}.modal-backdrop{position:fixed;inset:0;background:rgba(8,20,36,.55);z-index:100;display:flex;align-items:flex-start;justify-content:center;padding:16px 20px;overflow-y:auto;overscroll-behavior:contain}.modal-card{width:min(620px,100%);background:#fff;border-radius:18px;box-shadow:0 24px 70px rgba(8,20,36,.28);padding:20px;max-height:calc(100dvh - 32px);overflow-y:auto;overflow-x:hidden;margin:auto 0;scrollbar-gutter:stable}.modal-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.modal-head h4{margin:0;font-size:18px}.modal-close{border:0;background:transparent;font-size:26px;line-height:1;color:var(--muted)}.modal-fields{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin:18px 0}.field{display:grid;gap:6px}.field span{font-size:11px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}.field:nth-child(3),.field:nth-child(4){grid-column:1/-1}.modal-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:8px;flex-wrap:wrap}.modal-card .modal-actions{position:sticky;bottom:-20px;background:linear-gradient(180deg,rgba(255,255,255,.9),#fff 28%);padding:14px 0 20px;margin-bottom:-20px;z-index:4}@media(max-height:760px){.modal-backdrop{padding:8px 14px}.modal-card{max-height:calc(100dvh - 16px);padding:16px;border-radius:14px}.modal-card .modal-actions{bottom:-16px;padding-bottom:16px;margin-bottom:-16px}}@media(max-width:640px){.modal-backdrop{padding:8px}.modal-card{max-height:calc(100dvh - 16px);padding:16px;border-radius:14px}.modal-card .modal-actions{bottom:-16px;margin-bottom:-16px;padding-bottom:16px}.modal-fields{grid-template-columns:1fr}.field,.field:nth-child(3),.field:nth-child(4){grid-column:auto}.source-card{align-items:flex-start;flex-direction:column}}

/* v0.3 backend/status and role controls */
.system-strip{display:flex;gap:18px;flex-wrap:wrap;align-items:center;background:#fff;border:1px solid var(--line);border-radius:12px;padding:10px 14px;margin-bottom:18px;font-size:12px;color:var(--muted)}
.system-strip strong{color:var(--ink)}
.system-dot{display:inline-block;width:8px;height:8px;border-radius:50%;margin:0 6px 0 4px;background:var(--red)}
.system-dot.online{background:var(--green)}
.role-select{border:1px solid var(--line);background:#fff;border-radius:9px;padding:7px 9px;font-size:12px;font-weight:700;color:var(--ink)}
.read-only-chip{display:inline-flex;align-items:center;border:1px solid #d9e1ea;background:#f7f9fb;color:#596579;border-radius:10px;padding:10px 12px;font-size:12px;font-weight:800}
@media(max-width:780px){.top-actions .pilot-chip{display:none}.role-select{max-width:145px}.system-strip{display:grid;gap:6px}}

/* v0.5 secure authentication and server-enforced role UI */
.role-chip{display:inline-flex;align-items:center;border:1px solid #d8e2ee;background:#f7faff;color:#2b4e78;border-radius:999px;padding:7px 10px;font-size:11px;font-weight:800}
.avatar-button{border:0;cursor:pointer}.avatar-button:hover{filter:brightness(1.15)}
.auth-shell{min-height:100vh;display:grid;place-items:center;padding:28px;background:radial-gradient(circle at top left,#e9f1fa 0,transparent 36%),linear-gradient(135deg,#f6f8fb 0%,#eef2f6 100%)}
.auth-card{width:min(470px,100%);background:#fff;border:1px solid var(--line);border-radius:24px;box-shadow:0 24px 80px rgba(16,34,58,.14);padding:34px}.auth-card h1,.auth-brand h1{font-family:"Source Serif 4",serif;margin:8px 0 8px;color:var(--navy)}.auth-card h1{font-size:30px}.auth-card>p{color:var(--muted);line-height:1.55;margin:0 0 22px}.auth-mark{width:54px;height:54px;border-radius:16px;background:var(--navy);color:#fff;display:grid;place-items:center;font-size:14px;font-weight:900;letter-spacing:.08em;margin-bottom:18px}.auth-mark.ok{background:var(--green);font-size:24px}.auth-form{display:grid;gap:14px}.auth-form label{display:grid;gap:6px}.auth-form label span{font-size:11px;font-weight:800;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}.auth-form input{width:100%;border:1px solid var(--line);border-radius:11px;padding:12px 13px;background:#fff}.auth-submit{width:100%;margin-top:2px}.auth-divider{display:flex;align-items:center;gap:12px;color:#98a2b3;font-size:11px;margin:18px 0}.auth-divider:before,.auth-divider:after{content:"";height:1px;background:var(--line);flex:1}.auth-google{width:100%}.auth-toggle{border:0;background:transparent;color:var(--blue);font-weight:800;width:100%;padding:14px 0 4px}.auth-foot{font-size:10px;color:#98a2b3;text-align:center;line-height:1.5;margin-top:18px}.auth-error,.modal-error{background:#fdebec;border:1px solid #f1b9bd;color:#8f2931;border-radius:10px;padding:10px 12px;font-size:12px;line-height:1.45;margin:0 0 14px}.pending-note{background:#eef4fb;border:1px solid #d7e4f3;color:#315f9b;border-radius:12px;padding:12px 14px;font-size:12px;line-height:1.5;margin:16px 0 20px}.auth-brand{text-align:center}.auth-brand p{color:var(--muted)}.auth-spinner{width:28px;height:28px;border:3px solid #d7e4f3;border-top-color:var(--navy);border-radius:50%;margin:18px auto 0;animation:rprspin .8s linear infinite}@keyframes rprspin{to{transform:rotate(360deg)}}.empty.compact{padding:18px;font-size:12px}
@media(max-width:780px){.role-chip{display:none}.auth-shell{padding:16px}.auth-card{padding:26px 22px;border-radius:18px}.auth-card h1{font-size:26px}}
