:root { --navy:#14304f; --blue:#1f4e79; --green:#0f9d6a; --bg:#f3f6fb; --line:#d5dde8; --text:#1b2733; --muted:#64748b; --red:#b42318; }
* { box-sizing: border-box; }
body { margin:0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: var(--blue); }
.nav { background: linear-gradient(135deg, var(--navy), var(--blue)); color:#fff; padding:14px 20px; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; }
.nav a, .nav button.link { color:#fff; text-decoration:none; margin-left:16px; background:none; border:0; font:inherit; cursor:pointer; padding:0; }
.nav .brand { font-weight:700; font-size:1.15rem; margin-left:0; }
.wrap { max-width:640px; margin:0 auto; padding:28px 16px 64px; }
h1 { font-size:1.6rem; line-height:1.25; margin:0 0 6px; }
p.sub { color: var(--muted); margin:0 0 18px; }
.panel { background:#fff; border-radius:16px; padding:24px; box-shadow:0 4px 24px rgba(20,48,79,.08); }
.hero h1 { font-size:2rem; }
label { display:block; font-weight:600; margin:16px 0 6px; font-size:.95rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=file], select, textarea {
    width:100%; padding:11px 12px; border:1px solid var(--line); border-radius:10px; font:inherit; background:#fff; color: var(--text);
}
input:focus, select:focus, textarea:focus { outline:2px solid var(--blue); outline-offset:1px; border-color: var(--blue); }
textarea { min-height:140px; }
.hint { font-size:.85rem; color: var(--muted); margin-top:4px; }
.field-error { font-size:.85rem; color: var(--red); margin-top:4px; }
.check { display:flex; gap:10px; align-items:flex-start; margin-top:16px; font-weight:400; }
.check input { margin-top:4px; }
.choice { display:flex; gap:12px; margin:8px 0 4px; }
.choice label { flex:1; margin:0; border:2px solid var(--line); background:#fff; border-radius:12px; padding:14px; font-weight:600; cursor:pointer; text-align:center; }
.choice label:has(input:checked) { border-color: var(--blue); background:#eef4fb; }
.choice input { margin-right:6px; }
button.primary, .btn { display:inline-block; text-align:center; padding:12px 20px; background: var(--blue); color:#fff; border:0; border-radius:10px; font:inherit; font-weight:600; cursor:pointer; text-decoration:none; }
button.primary { width:100%; margin-top:24px; }
button.primary:disabled { opacity:.6; cursor:not-allowed; }
.btn.ghost { background:#fff; color: var(--blue); border:1px solid var(--blue); }
.errors { background:#fef2f2; border:1px solid #fca5a5; padding:12px 16px; border-radius:10px; margin:0 0 16px; }
.errors ul { margin:0; padding-left:18px; }
.flash { background:#ecfdf5; border:1px solid #6ee7b7; padding:12px 16px; border-radius:10px; margin-bottom:16px; }
.card { background:#fff; border-radius:14px; padding:18px; box-shadow:0 1px 3px rgba(0,0,0,.08); margin-bottom:14px; }
.code { font-weight:700; letter-spacing:.05em; color: var(--blue); margin:0 0 4px; }
.bar { background:#e5e7eb; border-radius:999px; height:10px; overflow:hidden; margin:8px 0; }
.bar span { display:block; height:100%; background: var(--green); }
.pill { display:inline-block; background:#e8eef6; color: var(--navy); padding:3px 10px; border-radius:999px; font-size:.85rem; }
.muted { color: var(--muted); font-size:.9rem; }
ul.slices { list-style:none; padding:0; margin:0; }
ul.slices li { display:flex; justify-content:space-between; padding:10px 0; border-bottom:1px solid #eef0f3; }
.phone-row { display:flex; gap:8px; }
.phone-row select { width:46%; flex:none; }
.pw-wrap { position:relative; }
.pw-wrap input { padding-right:70px; }
.pw-wrap button { position:absolute; right:8px; top:50%; transform:translateY(-50%); background:none; border:0; color: var(--blue); font:inherit; font-size:.85rem; cursor:pointer; }
.meter { height:8px; background:#e5e7eb; border-radius:999px; overflow:hidden; margin-top:10px; }
.meter span { display:block; height:100%; width:0; background: var(--red); transition: width .2s, background .2s; }
.rules { list-style:none; padding:0; margin:10px 0 0; display:grid; grid-template-columns:1fr 1fr; gap:2px 12px; font-size:.85rem; color: var(--muted); }
.rules li::before { content:"\25CB  "; }
.rules li.ok { color:#047857; }
.rules li.ok::before { content:"\2713  "; }
.hp { position:absolute; left:-9999px; top:-9999px; height:0; overflow:hidden; }
.modal { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:center; justify-content:center; padding:16px; }
.modal[hidden] { display:none; }
.modal .box { background:#fff; border-radius:14px; padding:24px; max-width:420px; }
.steps { display:grid; gap:12px; margin:0; padding:0; list-style:none; }
.steps li { padding-left:12px; border-left:4px solid var(--green); }

/* ---------- app shell: sidebar for signed-in people ---------- */
.shell { display:flex; min-height:100vh; }
.side { width:250px; flex:none; background:linear-gradient(180deg, var(--navy), #0e2339); color:#fff; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; padding:20px 14px; }
.side .brand { color:#fff; font-weight:800; font-size:1.2rem; text-decoration:none; padding:4px 10px 18px; display:block; }
.side .brand small { display:block; font-weight:500; font-size:.72rem; letter-spacing:.08em; text-transform:uppercase; color:#9fb6cf; }
.side nav { display:flex; flex-direction:column; gap:4px; flex:1; }
.side-link { display:flex; align-items:center; gap:12px; color:#dbe6f2; text-decoration:none; padding:11px 12px; border-radius:10px; font-weight:600; }
.side-link:hover { background:rgba(255,255,255,.08); color:#fff; }
.side-link.active { background:#fff; color:var(--navy); }
.side-link .ico { width:22px; text-align:center; font-size:1.05rem; }
.side-foot { border-top:1px solid rgba(255,255,255,.15); padding-top:14px; font-size:.9rem; }
.side-foot .who { font-weight:700; word-break:break-word; }
.role-badge { display:inline-block; margin:4px 0 12px; padding:2px 10px; border-radius:999px; background:rgba(255,255,255,.15); font-size:.78rem; letter-spacing:.04em; }
.side-foot button { width:100%; background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.25); color:#fff; border-radius:10px; padding:10px; font:inherit; font-weight:600; cursor:pointer; }
.side-foot button:hover { background:rgba(255,255,255,.2); }
.main { flex:1; min-width:0; }
.topbar { display:none; background:linear-gradient(135deg, var(--navy), var(--blue)); color:#fff; padding:12px 16px; align-items:center; justify-content:space-between; position:sticky; top:0; z-index:20; }
.topbar strong { font-size:1.05rem; }
.topbar button { background:rgba(255,255,255,.15); border:1px solid rgba(255,255,255,.3); color:#fff; border-radius:10px; padding:8px 14px; font:inherit; font-weight:600; cursor:pointer; }
.content { max-width:960px; margin:0 auto; padding:32px 28px 72px; }

/* ---------- buttons: each kind looks different ---------- */
.btn { transition: transform .05s, box-shadow .15s; box-shadow:0 1px 2px rgba(0,0,0,.15); }
.btn:hover { box-shadow:0 3px 10px rgba(20,48,79,.25); }
.btn:active { transform: translateY(1px); }
.btn.green { background: var(--green); }
.btn.navy { background: var(--navy); }
.btn.danger { background: var(--red); }
.btn.big { padding:14px 26px; font-size:1.05rem; }
.actions { display:flex; flex-wrap:wrap; gap:12px; margin-top:18px; }

/* ---------- dashboard pieces ---------- */
.role-card { background:#fff; border-radius:18px; padding:28px; box-shadow:0 4px 24px rgba(20,48,79,.08); border-top:6px solid var(--blue); }
.role-card.riser { border-top-color: var(--green); }
.role-card.lifter { border-top-color:#d97706; }
.role-card.steward { border-top-color: var(--navy); }
.role-tag { display:inline-block; padding:4px 12px; border-radius:999px; font-size:.8rem; font-weight:700; letter-spacing:.04em; text-transform:uppercase; background:#e8eef6; color: var(--navy); }
.riser .role-tag { background:#dcf5ea; color:#066a47; }
.lifter .role-tag { background:#fdecc8; color:#8a4b02; }
.role-card h1 { margin:12px 0 8px; font-size:1.8rem; }
.role-card p { margin:0 0 10px; }
.note { background:#f1f5fa; border-radius:12px; padding:12px 14px; font-size:.92rem; color:#33475c; }
.grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(190px, 1fr)); gap:14px; margin:20px 0; }
.stat { background:#fff; border-radius:14px; padding:18px; box-shadow:0 1px 3px rgba(0,0,0,.08); text-decoration:none; color:inherit; display:block; border-left:5px solid var(--blue); }
a.stat:hover { box-shadow:0 4px 14px rgba(20,48,79,.18); }
.stat .n { font-size:1.9rem; font-weight:800; color: var(--navy); line-height:1.1; }
.stat .l { color: var(--muted); font-size:.9rem; margin-top:4px; }
.stat.warn { border-left-color:#d97706; }
.stat.good { border-left-color: var(--green); }
.section-title { margin:28px 0 10px; font-size:1.15rem; }
.row { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.st { display:inline-block; padding:3px 10px; border-radius:999px; font-size:.82rem; font-weight:600; background:#e8eef6; color: var(--navy); }
.st.published { background:#dcf5ea; color:#066a47; }
.st.funded, .st.closed { background:#d9e8fb; color:#1a4f8b; }
.st.rejected, .st.expired { background:#fde4e1; color: var(--red); }
ol.how { margin:8px 0 0; padding-left:20px; }
ol.how li { margin-bottom:6px; }
.side-shade { display:none; }

@media (max-width: 860px) {
    .shell { display:block; }
    .topbar { display:flex; }
    .side { position:fixed; left:0; top:0; bottom:0; z-index:40; transform:translateX(-105%); transition:transform .2s; width:270px; }
    body.menu-open .side { transform:none; }
    body.menu-open .side-shade { display:block; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:30; }
    .content { padding:20px 16px 64px; }
}
@media (max-width: 520px) {
    .phone-row { flex-direction:column; }
    .phone-row select { width:100%; }
    .rules { grid-template-columns:1fr; }
    .choice { flex-direction:column; }
}
/* Waiting-for-approval notice */
.wait-note { display:flex; gap:12px; align-items:flex-start; background:#fff8e6; border:1px solid #f3d38a; border-radius:12px; padding:12px 14px; margin-top:12px; color:#6b4a00; }
.wait-note .wait-ico { font-size:1.5rem; line-height:1; }
.wait-note .wait-text strong { display:block; color:#4a3300; margin-bottom:2px; }
.wait-note .wait-text span { display:block; font-size:.92rem; }
/* Inbox */
.take { margin:16px 0; }
.take > summary { display:inline-block; cursor:pointer; list-style:none; background:var(--navy); color:#fff; padding:12px 20px; border-radius:12px; font-weight:700; }
.take > summary::-webkit-details-marker { display:none; }
.take[open] > summary { margin-bottom:12px; }
.folders { display:flex; flex-wrap:wrap; gap:8px; margin:18px 0 10px; }
.folders a { display:inline-flex; align-items:center; gap:8px; padding:9px 16px; border-radius:999px; background:#fff; border:1px solid #d7deea; color:var(--navy); text-decoration:none; font-weight:600; }
.folders a.active { background:var(--navy); color:#fff; border-color:var(--navy); }
.folders .count { background:#e8eef7; color:var(--navy); border-radius:999px; padding:1px 9px; font-size:.85rem; }
.folders a.active .count { background:rgba(255,255,255,.2); color:#fff; }
.toolbar { display:flex; flex-wrap:wrap; gap:12px; justify-content:space-between; align-items:center; margin:8px 0 14px; }
.chips { display:flex; flex-wrap:wrap; gap:6px; }
.chips a { padding:5px 12px; border-radius:999px; font-size:.9rem; color:#475569; text-decoration:none; background:#eef2f7; }
.chips a.active { background:#dbe7f7; color:var(--navy); font-weight:700; }
.search { display:flex; gap:8px; }
.search input[type=search] { min-width:240px; margin:0; }
.notice-line { background:#eef6ff; border:1px solid #cfe2fb; border-radius:10px; padding:9px 14px; }
.mail { background:#fff; border-radius:14px; box-shadow:0 1px 3px rgba(0,0,0,.08); overflow:hidden; }
.mail-row { display:grid; grid-template-columns:96px minmax(0,1fr) auto 110px 64px; gap:12px; align-items:center; padding:13px 16px; border-bottom:1px solid #e8edf4; text-decoration:none; color:inherit; }
.mail-row:last-child { border-bottom:0; }
.mail-row:hover { background:#f3f7fc; }
.mail-row .m-code { font-family:ui-monospace, Consolas, monospace; font-size:.85rem; color:#64748b; }
.mail-row .m-main { min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-weight:500; }
.mail-row.unread .m-main strong { font-weight:800; }
.mail-row .m-snip { color:#6b7280; font-weight:400; }
.mail-row .m-tags { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.mail-row .m-amt { text-align:right; font-weight:600; font-size:.92rem; }
.mail-row .m-time { text-align:right; color:#64748b; font-size:.88rem; }
.m-time.age-amber { color:#b45309; font-weight:700; }
.m-time.age-red { color:#b42318; font-weight:800; }
.pill.urgent { background:#fde8e6; color:#b42318; }
.mail-empty { padding:36px 20px; text-align:center; color:#64748b; }
.pager { display:flex; gap:10px; align-items:center; justify-content:flex-end; margin:14px 0; }
@media (max-width:760px) {
    .mail-row { grid-template-columns:minmax(0,1fr) auto; }
    .mail-row .m-code, .mail-row .m-amt, .mail-row .m-snip { display:none; }
    .mail-row .m-tags { grid-column:1 / -1; justify-content:flex-start; }
    .search input[type=search] { min-width:0; width:100%; }
}

/* Left menu submenu */
.sub-links { margin:2px 0 8px; }
.sub-links a, .sub-links .soon { display:block; padding:6px 12px 6px 46px; font-size:.92rem; color:#b8c4d6; text-decoration:none; border-radius:8px; }
.sub-links a:hover { color:#fff; }
.sub-links a.active { color:#fff; font-weight:700; }
.sub-links .soon { opacity:.6; }
/* Menu badges and labels */
.side-link .lbl { flex:1; }
.side-link .badge { background:#d97706; color:#fff; border-radius:999px; padding:1px 9px; font-size:.78rem; font-weight:700; }
.note-line { background:#f1f5fa; border-radius:10px; padding:9px 12px; margin:10px 0 0; font-size:.92rem; color:#33475c; }
.btn.green.big { background: var(--green); }

.side-terms{display:block;font-size:12px;margin:8px 0;color:inherit;opacity:.8;text-decoration:underline}

.inst .kv{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:10px 24px;margin:14px 0}
.inst .kv dt{font-size:12px;color:#64748b;text-transform:uppercase;letter-spacing:.04em}
.inst .kv dd{margin:2px 0 0;font-weight:600}
.inst .mono{font-family:ui-monospace,Menlo,Consolas,monospace;letter-spacing:.05em}
.pill.ok{background:#e6f6ef;color:#0b7a53}
.pill.warn{background:#fff4e0;color:#9a5b00}
