:root {
    --bg: #f0ece4; --bg2: #e8e2d8; --surface: #faf8f5; --surface2: #f3efe8; --surface3: #ece8e0;
    --border: #d4cdc0; --border2: #bfb8aa;
    --navy: #1a2744; --navy2: #243560; --navy3: #2f4480;
    --text: #1a1f2e; --text2: #3d4460; --muted: #7a8099; --faint: #a8afc5;
    --orange: #c95b1a; --orange2: #e06b22; --orange-bg: #fdf0e8; --orange-bd: #e8c4a8;
    --green: #1a6e3c; --green-bg: #e8f5ee; --green-bd: #a8d4b8;
    --red: #a8201a; --red-bg: #fbecea; --red-bd: #e0b0ac;
    --blue: #1a4d8a; --blue-bg: #e8f0fa; --blue-bd: #a8c4e8;
    --amber: #8a5c00; --amber-bg: #fdf6e3; --amber-bd: #e0d090;
    --topbar-h: calc(48px + env(safe-area-inset-top, 0px));
    --shadow: 0 1px 3px rgba(26,31,46,.12),0 4px 12px rgba(26,31,46,.06);
    --shadow-md: 0 4px 16px rgba(26,31,46,.14),0 1px 4px rgba(26,31,46,.08);
    --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Cascadia Mono", "Consolas", ui-monospace, monospace;
    --head: "Oswald", "Segoe UI", "Arial Narrow", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 13px; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }

.hidden { display: none !important; }
.hidden-input { display: none; }
.tb-spacer { flex: 1; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

.screen { height: 100vh; height: 100dvh; width: 100%; }

#screen-auth { display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, #1a2744 0%, #0f1729 100%); overflow: auto; }
.auth-card { background: var(--surface); border-radius: 16px; box-shadow: 0 18px 60px rgba(0,0,0,.4);
    padding: 40px 36px; width: 100%; max-width: 400px; margin: 20px; animation: rise .4s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.auth-form { margin-top: 8px; }
.auth-form h2 { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; color: var(--navy); font-size: 17px; margin-bottom: 6px; }
.form-hint { color: var(--muted); font-size: 12px; margin-bottom: 14px; }
.muted { color: var(--muted); }
.auth-hint { text-align: center; margin-top: 12px; }
.form-error { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; }

.startup-logo { font-family: var(--head); font-size: 42px; font-weight: 700; letter-spacing: 4px; color: var(--navy); text-align: center; }
.startup-logo.small { font-size: 26px; text-align: left; letter-spacing: 3px; }
.startup-sub { text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 1px; text-transform: uppercase; margin-top: 4px; margin-bottom: 18px; }
#screen-plans .startup-sub { text-align: left; margin: 2px 0 0; }

#screen-plans { background: var(--bg); overflow: auto; }
.plans-wrap { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.plans-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.plans-header-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.plans-toolbar { margin: 20px 0 14px; }
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.plan-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--navy); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); cursor: pointer; transition: transform .12s ease, box-shadow .12s ease; }
.plan-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.plan-card-name { font-family: var(--head); text-transform: uppercase; letter-spacing: .5px; font-size: 16px; color: var(--navy); margin-bottom: 4px; }
.plan-card-meta { color: var(--muted); font-size: 12px; }
.plan-card-actions { display: flex; gap: 6px; margin-top: 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13px; }
.empty-icon { font-size: 34px; margin-bottom: 8px; opacity: .6; }

#topbar { position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h); z-index: 300;
    background: var(--navy); display: flex; align-items: center; color: #fff; padding-right: 14px; padding-top: env(safe-area-inset-top, 0px); }
.tb-logo { width: 56px; text-align: center; font-size: 22px; }
.tb-brandwrap { line-height: 1; }
.tb-brand { font-family: var(--head); font-size: 18px; letter-spacing: 2px; font-weight: 700; }
.tb-brand-sub { font-size: 9px; letter-spacing: 2px; color: var(--faint); }
.tb-exname-wrap { display: flex; align-items: center; gap: 8px; margin-left: 28px; min-width: 0; }
.tb-exname-lbl { font-size: 10px; letter-spacing: 1.5px; color: var(--faint); flex: 0 0 auto; }
.tb-planname { font-weight: 600; color: #fff; max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-autosave { font-size: 11px; letter-spacing: 1px; color: var(--faint); opacity: 0; transition: opacity .2s; margin-right: 12px; }
.tb-autosave.show { opacity: 1; }
.tb-toolbox-btn { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); color: #fff; border-radius: 7px; padding: 6px 12px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; margin-left: 10px; transition: background .12s, border-color .12s; }
.tb-toolbox-btn:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.4); }

.sidebar-backdrop { display: none; }

.container { position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0;
    display: grid; grid-template-columns: 280px 1fr 380px; overflow: hidden; background: var(--bg); }

.sidebar-left { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.sidebar-header { padding: 16px 16px 12px; border-bottom: 1px solid var(--border); }
.logo { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; font-size: 16px; color: var(--navy); font-weight: 700; }
.progress-info { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--muted); margin: 12px 0 6px; letter-spacing: .3px; }
.progress-bar { height: 8px; background: var(--surface3); border-radius: 20px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--green); border-radius: 20px; transition: width .25s ease; }

.steps { list-style: none; flex: 1; overflow-y: auto; padding: 10px; }
.steps li { margin-bottom: 3px; }
.steps button { width: 100%; text-align: left; background: none; border: none; border-radius: 8px; padding: 9px 12px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--text2); cursor: pointer; letter-spacing: .2px; transition: background .12s, color .12s; }
.steps button:hover { background: var(--surface2); color: var(--navy); }
.steps button.active { background: var(--navy); color: #fff; }

.sidebar-footer { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 7px; background: var(--surface2); }
.sidebar-footer button { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border2); border-radius: 7px; padding: 8px 12px; font: inherit; font-size: 12px; font-weight: 600; color: var(--navy); cursor: pointer; transition: background .12s, border-color .12s; }
.sidebar-footer button:hover { background: var(--surface3); border-color: var(--navy3); }
.sidebar-footer #btn-new-plan-foot { color: var(--red); border-color: var(--red-bd); }
.sidebar-footer #btn-new-plan-foot:hover { background: var(--red-bg); }
.save-status { font-size: 11px; color: var(--muted); text-align: center; margin-top: 2px; letter-spacing: .3px; }
.save-status.saved { color: var(--green); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.main-header { padding: 16px 24px 12px; background: var(--surface); border-bottom: 1px solid var(--border); }
.breadcrumb { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.main-title { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; font-size: 20px; color: var(--navy); margin-top: 3px; }
.main-subtitle { font-size: 12px; color: var(--text2); margin-top: 2px; }
.main-content { flex: 1; overflow-y: auto; padding: 22px 24px; }
.step-content { display: none; animation: pageIn .2s ease; }
.step-content.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.section-placeholder { background: var(--surface); border: 1px dashed var(--border2); border-radius: 12px; padding: 34px 26px; color: var(--text2); font-size: 14px; line-height: 1.6; text-align: center; }
.export-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 4px; }
.export-actions .btn { padding: 11px 18px; font-size: 14px; }
.howto-box { border: 1px solid var(--border); border-left: 4px solid var(--navy); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; background: var(--surface2); }
.howto-title { font-family: var(--head); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; font-size: 13px; color: var(--navy); margin-bottom: 8px; }
.howto-box ol { margin: 0; padding-left: 20px; font-size: 13px; color: var(--text2); line-height: 1.6; }
.howto-box li { margin-bottom: 5px; }

.form-section { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 18px; box-shadow: var(--shadow); }
.form-section-title { font-family: var(--head); text-transform: uppercase; letter-spacing: .5px; font-size: 15px; color: var(--navy); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 2px solid var(--border); }
.form-group { margin-bottom: 12px; }
.form-group > label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text2); margin-bottom: 5px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }
.form-row.full .form-group { flex: 1 1 100%; }
.form-row.three .form-group { flex: 1 1 30%; }
.helper-text { font-size: 11px; color: var(--muted); margin-top: 4px; }
.required::after { content: " *"; color: var(--red); }

.form-group input[type="text"], .form-group input[type="email"], .form-group input[type="date"],
.form-group select, .form-group textarea {
    display: block; width: 100%; padding: 9px 11px; border: 1.5px solid var(--border);
    border-radius: 8px; font: inherit; font-size: 13px; background: #fff; color: var(--text); }
.form-group textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none; border-color: var(--navy3); box-shadow: 0 0 0 3px rgba(47,68,128,.12); }

.checklist { display: flex; flex-direction: column; gap: 2px; }
.checklist-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 8px; transition: background .12s; }
.checklist-item:hover { background: var(--surface2); }
.checklist-item input[type="checkbox"] { width: 17px; height: 17px; margin-top: 1px; flex: 0 0 auto; accent-color: var(--navy); cursor: pointer; }
.checklist-item label { font-size: 13px; color: var(--text); line-height: 1.4; cursor: pointer; }

.kinney-intro { font-size: 13px; color: var(--text2); margin-bottom: 16px; line-height: 1.5; }
.kinney-formula { display: inline-block; background: var(--surface2); border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-weight: 700; color: var(--navy); margin: 0 2px; }
.kinney-legend { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 16px; overflow: hidden; }
.kinney-legend summary { padding: 12px 16px; background: var(--surface2); cursor: pointer; font-size: 12px; font-weight: 700; color: var(--navy); list-style: none; user-select: none; }
.kinney-legend summary::-webkit-details-marker { display: none; }
.kinney-legend summary::before { content: '▸ '; color: var(--muted); }
.kinney-legend[open] summary::before { content: '▾ '; }
.kinney-legend-body { padding: 16px; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.kinney-legend-body table { width: 100%; border-collapse: collapse; font-size: 11px; }
.kinney-legend-body caption { font-weight: 700; text-align: left; margin-bottom: 6px; color: var(--navy); font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }
.kinney-legend-body td { padding: 3px 6px; border-bottom: 1px solid var(--border); }
.kinney-legend-body td:first-child { font-weight: 700; width: 38px; color: var(--text); }
.kinney-classes { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.kinney-class-chip { font-size: 11px; padding: 4px 10px; border-radius: 12px; font-weight: 600; color: #fff; }

.risk-card { border: 1px solid var(--border); border-left-width: 5px; border-radius: 8px; padding: 16px; margin-bottom: 14px; background: var(--surface); }
.risk-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.risk-num { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.risk-card-head input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; font-weight: 600; }
.risk-remove, .serie-remove, .si-remove, .deelnemer-remove, .prog-remove { border: none; background: var(--surface2); color: var(--red); border-radius: 6px; cursor: pointer; line-height: 1; flex-shrink: 0; }
.risk-remove { width: 30px; height: 30px; font-size: 16px; }
.risk-remove:hover, .serie-remove:hover, .si-remove:hover, .deelnemer-remove:hover, .prog-remove:hover { background: var(--red); color: #fff; }
.risk-scores { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 10px; align-items: end; }
.risk-scores.med-scores { grid-template-columns: 1fr 1fr 1fr 1fr auto; }
.risk-scores label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 4px; color: var(--text2); }
.risk-scores select { width: 100%; padding: 8px 6px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 12px; background: #fff; }
.risk-result { text-align: center; min-width: 120px; }
.risk-score-num { font-size: 22px; font-weight: 800; line-height: 1; }
.risk-badge { display: inline-block; margin-top: 4px; padding: 3px 10px; border-radius: 12px; font-size: 10px; font-weight: 700; color: #fff; text-transform: uppercase; letter-spacing: .3px; }
.risk-action { font-size: 11px; color: var(--text2); margin-top: 10px; padding: 8px 10px; background: var(--surface2); border-radius: 6px; }
.risk-measures { margin-top: 12px; }
.risk-measures label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 4px; color: var(--text2); }
.risk-measures textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; min-height: 56px; resize: vertical; }
.risk-rest-toggle { font-size: 11px; color: var(--navy3); cursor: pointer; margin-top: 10px; display: inline-block; font-weight: 600; }
.risk-rest { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.risk-rest-title { font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; margin-bottom: 8px; }
.risk-add-bar { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.risk-add-bar select, .risk-add-bar input { flex: 1; min-width: 140px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.risk-add-btn { padding: 10px 18px; background: var(--navy); color: #fff; border: none; border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 13px; white-space: nowrap; }
.risk-add-btn:hover { background: var(--navy2); }
.risk-empty { text-align: center; padding: 30px; color: var(--muted); font-size: 13px; border: 2px dashed var(--border); border-radius: 8px; margin-bottom: 14px; }
.risk-summary { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.risk-summary-item { flex: 1; min-width: 90px; text-align: center; padding: 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); }
.risk-summary-num { font-size: 24px; font-weight: 800; color: var(--navy); }
.risk-summary-label { font-size: 10px; text-transform: uppercase; color: var(--muted); font-weight: 600; letter-spacing: .3px; margin-top: 2px; }

.si-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.si-row input { flex: 1; min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.si-remove { width: 38px; height: 36px; font-size: 18px; }
.si-add-btn { margin-top: 2px; padding: 7px 14px; background: var(--surface2); color: var(--navy); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; }
.si-add-btn:hover { background: var(--surface3); }

.serie-card { border: 1px solid var(--border); border-left: 5px solid var(--navy); border-radius: 8px; padding: 16px; margin-bottom: 14px; background: var(--surface); }
.serie-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.serie-head input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 14px; font-weight: 700; color: var(--navy); }
.serie-remove { width: 32px; height: 32px; font-size: 17px; }
.serie-roles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--border); }
.serie-roles label { display: block; font-size: 11px; font-weight: 600; margin-bottom: 4px; color: var(--text2); }
.serie-roles input { width: 100%; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; }
.deelnemer-head { display: grid; grid-template-columns: 1fr 130px 38px; gap: 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 6px; padding: 0 2px; }
.deelnemer-row { display: grid; grid-template-columns: 1fr 130px 38px; gap: 8px; margin-bottom: 8px; }
.deelnemer-row input { padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; min-width: 0; }
.deelnemer-remove { font-size: 16px; }
.serie-add-deelnemer { margin-top: 4px; padding: 6px 12px; background: var(--surface2); color: var(--navy); border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-weight: 600; font-size: 12px; }
.serie-add-deelnemer:hover { background: var(--surface3); }

.prog-head { display: grid; gap: 8px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 6px; padding: 0 2px; }
.prog-row { display: grid; gap: 8px; margin-bottom: 8px; align-items: center; }
.prog-row input { padding: 9px 10px; border: 1px solid var(--border); border-radius: 6px; font: inherit; font-size: 13px; background: #fff; min-width: 0; }
.prog-tijd { text-align: center; }
.prog-remove { font-size: 16px; }
.prog-empty { text-align: center; padding: 30px; color: var(--muted); font-size: 13px; border: 2px dashed var(--border); border-radius: 8px; margin-bottom: 14px; }

.drag-handle { cursor: grab; color: var(--muted); user-select: none; font-size: 15px; line-height: 1; flex-shrink: 0; padding: 0 2px; align-self: center; }
.drag-handle:hover { color: var(--navy); }
.drag-handle:active { cursor: grabbing; }
.drag-over { outline: 2px dashed var(--navy3); outline-offset: 2px; }

@media (max-width: 720px) {
    .kinney-legend-body { grid-template-columns: 1fr; }
    .serie-roles { grid-template-columns: 1fr; }
}

.sidebar-right { background: var(--surface2); border-left: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.preview-header { padding: 16px 18px 12px; border-bottom: 1px solid var(--border); }
.preview-title { font-family: var(--head); text-transform: uppercase; letter-spacing: .5px; font-size: 14px; color: var(--navy); }
.preview-label { font-size: 11px; color: var(--muted); margin-top: 2px; letter-spacing: .5px; }
.preview-content { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.preview-box { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--navy); border-radius: 10px; padding: 14px 16px; box-shadow: var(--shadow); }
.preview-box-title { font-family: var(--head); text-transform: uppercase; letter-spacing: .5px; font-size: 13px; color: var(--navy); margin-bottom: 10px; }
.preview-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--surface3); }
.preview-row:last-child { border-bottom: none; }
.preview-label-text { font-size: 11px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; color: var(--muted); flex: 0 0 auto; }
.preview-value { font-size: 12px; color: var(--text); text-align: right; word-break: break-word; }

.btn { font: inherit; font-weight: 600; border: 1px solid transparent; border-radius: 7px; padding: 8px 14px; cursor: pointer; letter-spacing: .3px; transition: filter .12s, background .12s; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { filter: brightness(1.06); }
.btn-block { width: 100%; justify-content: center; margin-top: 10px; }
.btn-sm { padding: 6px 11px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; }
.btn-navy, .btn-primary { background: var(--navy); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-red, .btn-danger { background: var(--red); color: #fff; }
.btn-outline, .btn-secondary { background: var(--surface); color: var(--navy); border-color: var(--border2); }
.btn-red-outline { background: var(--surface); color: var(--red); border-color: var(--red-bd); }

.field { display: block; margin-bottom: 12px; }
.field-label { display: block; font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text2); margin-bottom: 5px; }
.field-input, .field-select, .field-textarea, .auth-card input {
    display: block; width: 100%; padding: 9px 11px; border: 1.5px solid var(--border); border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
.field-input:focus, .field-select:focus, .field-textarea:focus { outline: none; border-color: var(--navy3); box-shadow: 0 0 0 3px rgba(47,68,128,.12); }
.field-textarea { resize: vertical; min-height: 70px; }
.section-head { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; font-size: 13px; color: var(--navy); margin: 18px 0 10px; padding-bottom: 4px; border-bottom: 2px solid var(--border); }

.account-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border2); border-radius: 22px; padding: 4px 12px 4px 5px; color: var(--navy); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.account-chip:hover { border-color: var(--navy3); box-shadow: var(--shadow); }
.account-chip-tb { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); color: #fff; margin-left: 12px; }
.account-chip-tb:hover { border-color: rgba(255,255,255,.4); box-shadow: none; }
.chip-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; overflow: hidden; }
.avatar-fallback { background: var(--navy); color: #fff; font-family: var(--head); font-weight: 700; letter-spacing: .5px; }
.account-chip-tb .avatar-fallback { background: var(--orange); }

.overlay { position: fixed; inset: 0; z-index: 500; background: rgba(15,23,41,.55); display: none; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; }
.overlay.open { display: flex; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 480px; box-shadow: 0 20px 70px rgba(0,0,0,.4); animation: modalIn .2s ease; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--navy); color: #fff; border-radius: 14px 14px 0 0; }
.modal-head h3 { font-family: var(--head); text-transform: uppercase; letter-spacing: 1px; font-size: 15px; }
.modal-close { background: none; border: none; color: rgba(255,255,255,.7); font-size: 18px; cursor: pointer; }
.modal-close:hover { color: #fff; }
.modal-body { padding: 18px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); }
.confirm-body { font-size: 14px; color: var(--text); line-height: 1.5; }

.account-photo-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.account-avatar { width: 76px; height: 76px; border-radius: 50%; flex: 0 0 auto; background: var(--navy); color: #fff; font-family: var(--head); font-weight: 700; font-size: 28px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.account-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.account-photo-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.account-photo-actions .btn-block { margin-top: 0; }
.account-central-hint { font-size: 12px; line-height: 1.5; margin: 0; }
.account-info { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 2px 14px; margin-bottom: 14px; }
.account-info-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.account-info-row:last-child { border-bottom: none; }
.account-info-label { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .3px; text-transform: uppercase; }
.account-info-value { font-size: 13px; font-weight: 600; color: var(--text); word-break: break-word; text-align: right; }
.account-pw-sso { font-size: 13px; line-height: 1.5; color: var(--text2); background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
#m-account .section-head { margin-top: 18px; }

#toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 900; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; box-shadow: var(--shadow-md); animation: toastIn .2s ease; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.tb-creator { color: rgba(255,255,255,.6); font-size: 12px; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plan-card-creator { color: var(--muted); font-size: 12px; font-style: italic; margin-top: 2px; }
.plan-badge { display: inline-block; margin-top: 10px; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.plan-badge-owner { background: var(--navy); color: #fff; }
.plan-badge-edit { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
.plan-badge-view { background: var(--surface3); color: var(--text2); border: 1px solid var(--border2); }

.readonly-banner { margin: 14px 20px 0; padding: 10px 14px; background: var(--amber-bg); border: 1px solid var(--amber-bd); border-radius: 8px; color: var(--amber); font-size: 13px; font-weight: 600; }
#main-content.readonly .drag-handle { pointer-events: none; opacity: .35; }

.share-vis { display: flex; flex-direction: column; gap: 8px; }
.share-vis-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 8px; cursor: pointer; transition: border-color .12s, background .12s; }
.share-vis-opt:hover { border-color: var(--navy3); }
.share-vis-opt input { margin-top: 3px; flex: 0 0 auto; }
.share-vis-opt span { display: flex; flex-direction: column; gap: 2px; }
.share-vis-opt strong { font-size: 13px; color: var(--text); }
.share-vis-opt small { font-size: 12px; color: var(--muted); }

.share-search { position: relative; }
.share-results { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.share-result { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface2); }
.share-result-actions { display: flex; gap: 6px; flex: 0 0 auto; }

.share-access { display: flex; flex-direction: column; gap: 6px; }
.share-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.share-row-info { flex: 1 1 auto; min-width: 0; }
.share-row-name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-row-mail { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-badge { flex: 0 0 auto; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; background: var(--navy); color: #fff; }
.share-toggle { flex: 0 0 auto; display: inline-flex; border: 1px solid var(--border2); border-radius: 7px; overflow: hidden; }
.share-toggle-btn { font: inherit; font-size: 11px; font-weight: 600; padding: 4px 9px; border: none; background: var(--surface); color: var(--text2); cursor: pointer; }
.share-toggle-btn.active { background: var(--navy); color: #fff; }
.share-remove { flex: 0 0 auto; background: none; border: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.share-remove:hover { color: var(--red); background: var(--red-bg); }
.share-empty { font-size: 12px; color: var(--muted); padding: 8px 2px; }

@media (max-width: 1100px) {
    .container { grid-template-columns: 240px 1fr; }
    .sidebar-right { display: none; }
}

.presence-stack { display: flex; align-items: center; gap: 4px; margin-left: 18px; margin-right: 10px; }
.presence-stack:empty { display: none; }
.presence-chip { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; letter-spacing: .3px; color: #fff; border: 2px solid var(--navy);
    box-shadow: 0 0 0 1px rgba(255,255,255,.25); text-transform: uppercase; transition: opacity .2s; cursor: default; }
.presence-chip.afk { opacity: .4; }
.presence-chip.pulse { animation: chip-pulse 1.6s ease-in-out infinite; }
@keyframes chip-pulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 1px rgba(255,255,255,.25); }
    50% { transform: scale(1.12); box-shadow: 0 0 0 4px rgba(37, 99, 235, .3); }
}
.collab-focus { box-shadow: 0 0 0 2px var(--collab, #2563eb); border-radius: 6px; transition: box-shadow .15s; }
.collab-flag { position: absolute; z-index: 850; pointer-events: none; padding: 2px 7px; border-radius: 6px;
    font-size: 10px; font-weight: 700; letter-spacing: .3px; color: #fff; white-space: nowrap;
    box-shadow: var(--shadow); transform: translateY(-100%); }
.collab-flag.afk { opacity: .45; }

#btn-mobile-steps { display: none; }
@media (max-width: 820px) {
    #topbar { overflow: hidden; gap: 6px; padding: 0 8px; }
    .tb-brandwrap, .tb-exname-lbl, .tb-creator, .tb-btn-txt, #app-user, .tb-autosave { display: none !important; }
    .tb-exname-wrap { flex: 1 1 auto; min-width: 30px; margin-left: 4px; }
    .tb-planname { max-width: 100%; }
    .account-chip-tb { padding: 4px 5px; margin-left: 4px; }
    .tb-logo { width: 32px; font-size: 17px; }
    .tb-toolbox-btn { margin-left: 4px; padding: 6px 8px; }
    #topbar { padding-right: 8px; }
    .presence-stack { margin-left: 4px; margin-right: 2px; }
    #btn-mobile-steps { display: inline-flex; flex: none; }
    .container { grid-template-columns: 1fr; }
    .sidebar-left { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: min(300px, 85vw); z-index: 250; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.35); }
    body.nav-open .sidebar-left { transform: none; }
    .sidebar-backdrop { display: none; position: fixed; inset: 0; top: var(--topbar-h); background: rgba(15,23,41,.45); z-index: 240; }
    body.nav-open .sidebar-backdrop { display: block; }
    .main-content { -webkit-overflow-scrolling: touch; }
    .risk-scores, .risk-scores.med-scores { grid-template-columns: 1fr 1fr; }
    .kinney-legend-body { grid-template-columns: 1fr; }
    .overlay { padding: 8px; }
    .modal { max-width: 100%; }
    input, select, textarea { font-size: 16px !important; }
    .presence-stack { margin-left: 6px; margin-right: 4px; }
    .presence-stack:empty { display: none; }
    .presence-chip { width: 22px; height: 22px; font-size: 9px; margin-left: -7px; border-width: 1.5px; }
    .presence-chip:first-child { margin-left: 0; }
    .plans-header { flex-direction: column; align-items: stretch; gap: 10px; }
    .plans-header-right { flex-wrap: wrap; gap: 6px; }
    .plans-grid { grid-template-columns: 1fr; }
}

.storage-full-banner { background: #c0392b; color: #fff; text-align: center; padding: 10px 16px; font-size: 13px; font-weight: 700; position: sticky; top: 0; z-index: 400; }

html, body { touch-action: manipulation; }

input[type=date], input[type=time], input[type=datetime-local] {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
}
input::-webkit-date-and-time-value { text-align: left; }

@media (max-width: 820px) {
    .plans-wrap { padding: 18px 12px; }
    .main-content { padding-bottom: calc(26px + env(safe-area-inset-bottom, 0px)); }
    .sidebar-left { padding-bottom: env(safe-area-inset-bottom, 0px); }
    .overlay { overscroll-behavior: contain; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
    .modal { margin-bottom: 24px; }
    input[type=date], input[type=time], input[type=datetime-local] { width: 100%; min-height: 42px; }
}

@media (hover: none) {
    .btn:hover { filter: none; }
    .steps button:hover:not(.active) { background: none; color: var(--text2); }
    .tb-toolbox-btn:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
}

@media (display-mode: standalone) {
    html, body { overscroll-behavior-y: none; }
}

.presence-chip { cursor: pointer; }
.uprof-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.uprof-avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.uprof-fallback { display: inline-flex; align-items: center; justify-content: center; background: var(--surface2); color: var(--navy); font-weight: 800; font-size: 20px; border: 1px solid var(--border); }
.uprof-name { font-weight: 800; font-size: 16px; color: var(--navy); }
.uprof-status { font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 3px; display: block; }
.uprof-table { border-collapse: collapse; width: 100%; }
.uprof-table td { padding: 7px 12px 7px 0; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
.uprof-table tr:last-child td { border-bottom: none; }
.uprof-table td:first-child { font-weight: 700; width: 120px; color: var(--muted); }

.plan-card-shares { color: var(--muted); font-size: 11px; margin-top: 2px; }

.ic { width: 1em; height: 1em; display: inline-block; vertical-align: -0.125em; }
span.ico { display: inline-flex; width: 1em; height: 1em; vertical-align: -0.125em; flex: 0 0 auto; }
span.ico svg { width: 100%; height: 100%; }
.tb-toolbox-btn span.ico, .tb-toolbox-btn .ic { width: 15px; height: 15px; }
.tb-m-only span.ico, .tb-m-only .ic { width: 17px; height: 17px; }
.empty-icon span.ico, .empty-icon .ic { width: 1em; height: 1em; }

.icon-btn .ic { width: 13px; height: 13px; }

.step-mobile-nav { display: none; }
@media (max-width: 820px) {
    .step-mobile-nav { display: flex; justify-content: space-between; gap: 10px; padding: 20px 2px 10px; }
    .step-mobile-nav .btn { flex: 1; justify-content: center; min-height: 44px; }
    .step-mobile-nav #btn-step-prev { flex: 0 0 auto; }
}
