:root {
    --bg: #f4f7f8;
    --surface: #ffffff;
    --surface-2: #eef4f5;
    --surface-3: #e5eff1;
    --text: #14242a;
    --muted: #61747c;
    --line: #d8e2e5;
    --accent: #087f86;
    --accent-2: #075d63;
    --electric: #16aeb8;
    --ok: #1d7a45;
    --bad: #a13838;
    --warn: #9a6510;
    --shadow: 0 12px 30px rgba(20, 36, 42, .08);
    color-scheme: light;
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; background: var(--bg); }
a { color: var(--accent-2); }
button, input, select, textarea { font: inherit; }
button:disabled { cursor: not-allowed; opacity: .48; }
.topbar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.topbar-inner { max-width: 1180px; margin: auto; min-height: 58px; padding: 8px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand span:last-child { display: grid; }
.brand small, .auth-brand small { color: var(--muted); font-size: .72rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(145deg, var(--electric), var(--accent-2)); color: white; font-weight: 800; letter-spacing: -.05em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.brand-mark.large { width: 52px; height: 52px; border-radius: 16px; font-size: 1.1rem; }
.userbox { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .86rem; }
.userbox form { margin: 0; }
.user-name { color: var(--muted); text-decoration: none; }
.user-name:hover { color: var(--text); }
.link-button { border: 0; background: none; color: var(--accent); padding: 6px; cursor: pointer; font-weight: 800; }
.main-nav { border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent); }
.main-nav-inner { width: min(1180px, calc(100% - 28px)); margin: auto; display: flex; align-items: center; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.main-nav-inner::-webkit-scrollbar { display: none; }
.main-nav a { flex: 0 0 auto; padding: 9px 12px 10px; text-decoration: none; color: var(--muted); font-size: .79rem; font-weight: 800; border-bottom: 2px solid transparent; }
.main-nav a:hover, .main-nav a.active { color: var(--text); border-bottom-color: var(--electric); }
.shell { width: min(1180px, calc(100% - 28px)); margin: 22px auto 50px; }
.shell.narrow { width: min(620px, calc(100% - 28px)); }
.hero { border-radius: 24px; padding: 28px; background: linear-gradient(135deg, #102d34, #0a6d72); color: white; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.hero.compact h1 { margin: 5px 0 8px; max-width: 760px; font-size: clamp(1.55rem, 4vw, 2.4rem); line-height: 1.08; }
.hero p { margin: 0; max-width: 800px; color: rgba(255,255,255,.84); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 4px 0 18px; }
.page-head h1 { margin: 4px 0 6px; font-size: clamp(1.65rem, 4vw, 2.35rem); line-height: 1.08; }
.page-head p { margin: 0; color: var(--muted); max-width: 790px; }
.action-head { align-items: flex-end; }
.eyebrow { font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 900; color: var(--accent); }
.hero .eyebrow { color: #91e3e4; }
.status-pill, .phase-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 8px 12px; font-size: .76rem; font-weight: 900; white-space: nowrap; }
.status-pill.ok { background: rgba(68, 214, 131, .16); color: #bff5d5; border: 1px solid rgba(191,245,213,.28); }
.status-pill.ready { background: rgba(36, 211, 222, .15); color: #c7fbff; border: 1px solid rgba(199,251,255,.26); }
.status-pill.warn { background: rgba(235, 174, 58, .15); color: #ffe6af; border: 1px solid rgba(255,230,175,.26); }
.status-pill.bad { background: rgba(255,130,130,.15); color: #ffd3d3; border: 1px solid rgba(255,211,211,.25); }
.status-pill.standalone { color: var(--text); }
.status-pill.standalone.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 32%, var(--line)); }
.status-pill.standalone.ready { color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 32%, var(--line)); }
.status-pill.standalone.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 11%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 32%, var(--line)); }
.status-pill.standalone.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 11%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 32%, var(--line)); }
.phase-chip { background: var(--surface-2); color: var(--accent-2); margin: 22px 0 4px; }
.grid { display: grid; gap: 16px; margin-top: 16px; }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.compact-metrics .card { min-height: 118px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: 0 8px 22px rgba(20,36,42,.04); }
.metric { display: grid; align-content: start; gap: 5px; }
.metric span, .metric small { color: var(--muted); }
.metric strong { font-size: 1.3rem; overflow-wrap: anywhere; }
.card-head { margin-bottom: 14px; }
.card-head h2 { margin: 4px 0 0; font-size: 1.15rem; }
.card-head.split { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mini-count { display: inline-flex; border-radius: 999px; background: var(--surface-2); color: var(--muted); padding: 6px 9px; font-size: .72rem; font-weight: 900; white-space: nowrap; }
.check-list, .pending-list { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; gap: 11px; }
.check-list li, .pending-list li { position: relative; padding-left: 26px; color: #34474f; }
.check-list li::before { content: "✓"; position: absolute; left: 0; color: var(--ok); font-weight: 900; }
.pending-list li::before { content: "•"; position: absolute; left: 7px; color: var(--warn); font-weight: 900; }
.notice-card { margin-top: 16px; display: flex; gap: 10px; align-items: baseline; border-left: 5px solid var(--accent); }
.notice-card p { margin: 0; color: var(--muted); }
.button { display: inline-flex; min-height: 42px; align-items: center; justify-content: center; border-radius: 12px; padding: 9px 15px; border: 1px solid transparent; text-decoration: none; cursor: pointer; font-weight: 900; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { background: var(--accent-2); }
.button.secondary { background: var(--surface-2); color: var(--accent-2); border-color: var(--line); }
.button.full { width: 100%; }
.alert { border-radius: 14px; padding: 12px 14px; margin: 0 0 14px; border: 1px solid var(--line); background: var(--surface); }
.alert-success { border-color: #b8dfc9; color: #1f6b40; background: #effaf4; }
.alert-warning { border-color: #ead5a5; color: #76500d; background: #fff9e9; }
.alert-error { border-color: #e5bbbb; color: #8d2f2f; background: #fff2f2; }
.auth-body { background: radial-gradient(circle at 10% 10%, #d9eff0, transparent 36%), #edf3f4; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.auth-card { width: min(430px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 28px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand div { display: grid; }
.auth-card h1 { margin: 14px 0 6px; }
.muted { color: var(--muted); }
.micro { color: var(--muted); font-size: .76rem; text-align: center; margin: 14px 0 0; }
label { display: grid; gap: 7px; font-weight: 750; font-size: .88rem; margin-top: 14px; }
label small { color: var(--muted); font-weight: 500; line-height: 1.35; }
input, select, textarea { width: 100%; min-height: 44px; border-radius: 12px; border: 1px solid #c8d5d9; padding: 9px 11px; background: white; color: var(--text); }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(8,127,134,.16); border-color: var(--accent); }
input:disabled, select:disabled, textarea:disabled { opacity: .72; cursor: not-allowed; }
form .button { margin-top: 16px; }
.footer { color: var(--muted); font-size: .72rem; text-align: center; padding: 18px; }
.quick-links { display: grid; gap: 9px; }
.quick-links a { display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; row-gap: 1px; align-items: center; text-decoration: none; color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 11px; background: var(--surface-2); }
.quick-links a > span { grid-row: 1 / span 2; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 13%, var(--surface)); color: var(--accent); font-size: .72rem; font-weight: 900; }
.quick-links a strong { font-size: .9rem; }
.quick-links a small { color: var(--muted); }
.company-logo { width: 130px; min-height: 76px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); display: grid; place-items: center; padding: 10px; }
.company-logo img { max-width: 100%; max-height: 68px; object-fit: contain; }
.form-card { padding: 22px; }
.narrow-card { max-width: 620px; margin-inline: auto; }
.form-section { display: flex; align-items: flex-start; gap: 12px; padding: 18px 0 4px; border-top: 1px solid var(--line); margin-top: 18px; }
.form-section:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.form-section h2 { margin: 0 0 3px; font-size: 1.04rem; }
.form-section p { margin: 0; color: var(--muted); font-size: .84rem; }
.section-number { flex: 0 0 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--accent); font-size: .7rem; font-weight: 900; }
.form-grid { display: grid; gap: 0 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.two-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-actions .button { margin-top: 0; }
.sticky-actions { padding-top: 16px; border-top: 1px solid var(--line); }
.switch-field { display: flex; align-items: center; gap: 9px; align-self: end; min-height: 44px; }
.switch-field input { width: 18px; min-height: 18px; }
.role-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.role-option { margin: 0; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); padding: 12px; cursor: pointer; }
.role-option input { flex: 0 0 18px; width: 18px; min-height: 18px; margin-top: 2px; }
.role-option span { display: grid; gap: 3px; }
.role-option small { color: var(--muted); }
.table-card { padding: 0; overflow: hidden; margin-top: 16px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.data-table th { text-align: left; color: var(--muted); font-size: .69rem; text-transform: uppercase; letter-spacing: .07em; background: var(--surface-2); }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table td strong, .data-table td small { display: block; }
.data-table td small { color: var(--muted); margin-top: 3px; }
.actions-col { width: 96px; text-align: right !important; }
.icon-actions { display: flex; justify-content: flex-end; gap: 6px; }
.inline-form { display: inline-flex; }
.inline-form .icon-button { margin-top: 0; }
.icon-button { width: 34px; height: 34px; min-height: 34px; padding: 0; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); text-decoration: none; cursor: pointer; font-weight: 900; }
.icon-button:hover { border-color: var(--accent); color: var(--accent); }
.icon-button.danger-soft { color: var(--bad); }
.icon-button.success-soft { color: var(--ok); }
.state-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; font-size: .7rem; font-weight: 900; }
.state-badge.active { color: var(--ok); background: color-mix(in srgb, var(--ok) 11%, var(--surface)); }
.state-badge.inactive { color: var(--muted); background: var(--surface-2); }
.warning-text { color: var(--warn) !important; }
.empty-state { padding: 34px; text-align: center; }
.empty-state p { color: var(--muted); margin-bottom: 0; }
.diagnostic-card { margin-top: 16px; }
.diagnostic-list { display: grid; gap: 8px; }
.diagnostic-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; background: var(--surface-2); }
.diagnostic-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; font-weight: 900; }
.diagnostic-item.pass .diagnostic-icon { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.diagnostic-item.fail .diagnostic-icon { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }
.diagnostic-item.warn .diagnostic-icon { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.diagnostic-item div { display: grid; gap: 2px; }
.diagnostic-item small { color: var(--muted); }
.diagnostic-value { color: var(--muted); font-size: .78rem; text-align: right; overflow-wrap: anywhere; }
.gate-list { display: grid; gap: 9px; }
.gate-item { display: grid; grid-template-columns: 30px 1fr 16px; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 14px; padding: 11px; text-decoration: none; color: var(--text); background: var(--surface-2); }
.gate-item > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; font-weight: 900; }
.gate-item.pass > span { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.gate-item.pending > span { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); }
.gate-item div { display: grid; gap: 2px; }
.gate-item small { color: var(--muted); }
.gate-item b { color: var(--muted); font-size: 1.2rem; }
.summary-list { margin: 0; display: grid; gap: 0; }
.summary-list > div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list dt { color: var(--muted); }
.summary-list dd { margin: 0; font-weight: 800; overflow-wrap: anywhere; }
.hash-value { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .72rem; }
.reopen-form { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 4px; }
.control-list { display: grid; gap: 10px; }
.control-item { border: 1px solid var(--line); border-radius: 15px; padding: 13px; background: var(--surface-2); }
.control-item.done { border-color: color-mix(in srgb, var(--ok) 38%, var(--line)); }
.control-check { margin: 0; display: flex; align-items: flex-start; gap: 10px; }
.control-check input { flex: 0 0 18px; width: 18px; min-height: 18px; margin-top: 2px; }
.control-check span { display: grid; gap: 3px; }
.control-check small { color: var(--muted); }
.evidence-field { margin-top: 11px; margin-left: 28px; }
.final-gate { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-left: 5px solid var(--warn); }
.final-gate.ready { border-left-color: var(--ok); }
.final-gate h2 { margin: 4px 0 5px; }
.final-gate p { margin: 0; color: var(--muted); }
.final-gate form { flex: 0 0 auto; }
.final-gate form .button { margin: 0; }
@media (max-width: 820px) {
    .grid.metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid.two { grid-template-columns: 1fr; }
    .hero { align-items: flex-start; flex-direction: column; padding: 22px; }
    .page-head, .action-head { align-items: flex-start; flex-direction: column; }
    .notice-card, .final-gate { align-items: flex-start; flex-direction: column; }
    .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.three .span-2 { grid-column: span 2; }
    .final-gate form { width: 100%; }
    .final-gate form .button { width: 100%; }
}
@media (max-width: 640px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
    .data-table tr:last-child { border-bottom: 0; }
    .data-table td { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 6px 0; border: 0; text-align: left !important; }
    .data-table td::before { content: attr(data-label); color: var(--muted); font-size: .69rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 900; }
    .actions-col { width: auto; }
    .icon-actions { justify-content: flex-start; }
    .role-grid { grid-template-columns: 1fr; }
    .diagnostic-item { grid-template-columns: 28px 1fr; }
    .diagnostic-value { grid-column: 2; text-align: left; }
}
@media (max-width: 520px) {
    .shell { width: min(100% - 20px, 1180px); margin-top: 12px; }
    .topbar-inner { padding-inline: 10px; }
    .main-nav-inner { width: calc(100% - 12px); }
    .grid.metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
    .card { border-radius: 16px; padding: 16px; }
    .metric { min-height: 100px; }
    .metric strong { font-size: 1.04rem; }
    .userbox > .user-name { display: none; }
    .auth-card { padding: 22px; }
    .form-grid.three, .form-grid.two-cols { grid-template-columns: 1fr; }
    .form-grid.three .span-2 { grid-column: auto; }
    .form-actions { flex-direction: column-reverse; }
    .form-actions .button { width: 100%; }
    .company-logo { width: 100%; }
    .summary-list > div { grid-template-columns: 1fr; gap: 3px; }
    .evidence-field { margin-left: 0; }
}
@media (prefers-color-scheme: dark) {
    :root { --bg:#0d1518; --surface:#172226; --surface-2:#1d2b30; --surface-3:#24363c; --text:#edf5f6; --muted:#a8b8bd; --line:#2d4046; --accent:#11a9b2; --accent-2:#43c7cf; --electric:#22c6d1; --ok:#39b86c; --bad:#dd6c6c; --warn:#d39a34; --shadow:0 14px 30px rgba(0,0,0,.28); color-scheme:dark; }
    input, select, textarea { background:#10191c; color:var(--text); border-color:#3a4e55; }
    .topbar { background:rgba(16,26,30,.95); }
    .check-list li, .pending-list li { color:#d4e0e3; }
    .alert-success { background:#173526; color:#b7e7ca; border-color:#275c3e; }
    .alert-warning { background:#382d17; color:#f4dca7; border-color:#645126; }
    .alert-error { background:#3b2020; color:#f1bebe; border-color:#683838; }
    .auth-body { background:radial-gradient(circle at 10% 10%, #183438, transparent 36%), #0f171a; }
    .hero { background: linear-gradient(135deg, #0c4148, #0a6a70); }
    .status-pill.standalone { background: var(--surface-2); }
}
