/* The Side Practice Kit — Client Portal
   Palette: paper #f6f7f8, card #ffffff, ink #141a22, muted #5a6472,
   hairline #e4e7ec, brand green #1e6b4f, deep green #155039, navy #12283a */

:root {
    --paper: #f6f7f8;
    --card: #ffffff;
    --ink: #141a22;
    --muted: #5a6472;
    --hairline: #e4e7ec;
    --green: #1e6b4f;
    --green-deep: #155039;
    --navy: #12283a;
    --red: #a04b3c;
    --amber: #b7791f;
    --amber-wash: #fbf1dc;
    --green-wash: #e8f2ee;
    --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Roboto, sans-serif;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow: 0 1px 3px rgba(20, 26, 34, 0.06), 0 8px 24px rgba(20, 26, 34, 0.06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--green); }
a:hover { color: var(--green-deep); }

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--ink);
    color: #fff;
    padding: 10px 16px;
    z-index: 1000;
}
.skip-link:focus { left: 8px; top: 8px; }

/* -- Logged-in shell -- */

.portal-header {
    background: var(--navy);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.portal-header .wordmark {
    color: #f6f7f8;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.portal-header nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.portal-header nav a {
    color: #c8d0da;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

.portal-header nav a:hover,
.portal-header nav a.active {
    color: #ffffff;
}

.portal-main {
    max-width: 880px;
    margin: 0 auto;
    padding: 40px 24px 64px;
}

.portal-main-narrow { max-width: 440px; }

.portal-page-header { margin-bottom: 28px; }
.portal-page-header .eyebrow {
    color: var(--green-deep);
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    display: block;
    margin-bottom: 6px;
}
.portal-page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 4px;
}
.portal-page-header p { color: var(--muted); margin: 0; }

.card {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card-spaced { margin-bottom: 24px; }
.card-title { margin-top: 0; }

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
}

/* -- Auth shell -- */

.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-card {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-top: 3px solid var(--green);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 40px 36px;
    max-width: 400px;
    width: 100%;
}

.auth-card-center { text-align: center; }
.error-code { font-size: 1.4rem; margin: 8px 0; }

.auth-wordmark {
    text-align: center;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink);
    margin-bottom: 8px;
}

.auth-subtitle {
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 24px;
}

/* -- Forms -- */

form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
}

form input[type="email"],
form input[type="password"],
form input[type="text"],
form select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--hairline);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    font-size: 15px;
    font-family: var(--sans);
    margin-bottom: 16px;
    outline: none;
}

form input:focus, form select:focus { border-color: var(--green); }

/* Engagement chips (admin lists) + inline remove forms */
.chip {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: #f6f7f8;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.inline-form { display: inline; }
.inline-form button { width: auto; padding: 0; }

form button,
.btn {
    display: inline-block;
    width: 100%;
    padding: 12px;
    background: var(--green);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    font-family: var(--sans);
    text-align: center;
    text-decoration: none;
}

form button:hover,
.btn:hover { background: var(--green-deep); color: #fff; }

.hint {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: -10px;
    margin-bottom: 16px;
}

.hint-tight { margin-top: 0; }

.error {
    color: var(--red);
    font-size: 14px;
    text-align: center;
    margin-bottom: 16px;
}

.success {
    color: var(--green-deep);
    font-size: 14px;
    text-align: center;
    margin-bottom: 16px;
    line-height: 1.5;
}

.back-link { text-align: center; margin-top: 16px; }
.back-link + .back-link { margin-top: 8px; }
.back-link a { color: var(--muted); font-size: 14px; text-decoration: none; }
.back-link a:hover { color: var(--green-deep); }

/* -- Course (Side Practice Kit) -- */

.course-overall {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--paper);
    padding: 12px 0 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--hairline);
}
.course-overall-row { display: flex; align-items: center; gap: 12px; }
.course-bar { flex: 1; height: 9px; background: #e9ecf0; border-radius: 99px; overflow: hidden; }
.course-bar > i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--green), var(--green-deep));
    border-radius: 99px;
    transition: width .35s ease;
}
.course-pct { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--green-deep); min-width: 3.2ch; text-align: right; }
.course-overall small { color: var(--muted); }

.module {
    background: var(--card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin: 16px 0;
    overflow: hidden;
}
.mhead {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    cursor: pointer;
    user-select: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    font: inherit;
    color: inherit;
}
.mhead:hover { background: #fbfcfd; }
.mnum {
    width: 34px;
    height: 34px;
    flex: none;
    border-radius: 9px;
    background: var(--navy);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: .9rem;
}
.mtitle { flex: 1; min-width: 0; }
.mtitle b { display: block; font-size: 1.05rem; }
.mtitle span { color: var(--muted); font-size: .82rem; }
.mprog { font-size: .78rem; color: var(--green-deep); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chev { transition: transform .25s; color: var(--muted); flex: none; }
.module.collapsed .chev { transform: rotate(-90deg); }
.module.collapsed .mbody { display: none; }
.mbody { padding: 2px 18px 16px; }

.step { border-top: 1px solid var(--hairline); padding: 14px 0; }
.step:first-child { border-top: 0; }
.step-main { display: flex; gap: 12px; align-items: flex-start; }
.cbox {
    appearance: none;
    -webkit-appearance: none;
    flex: none;
    width: 22px;
    height: 22px;
    border: 2px solid #c4ccd6;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    margin-top: 1px;
    transition: .15s;
}
.cbox:checked { background: var(--green); border-color: var(--green); }
.cbox:checked::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.cbox.sub { width: 18px; height: 18px; border-radius: 5px; }
.cbox.sub:checked::after { left: 4.5px; top: 1.5px; width: 4px; height: 8px; }
.step-txt { flex: 1; min-width: 0; }
.step-txt .st { font-weight: 600; font-size: 1rem; }
.step-txt.done .st { color: var(--muted); text-decoration: line-through; text-decoration-color: #bcc4ce; }
.asset {
    display: inline-block;
    margin-top: 3px;
    font-size: .76rem;
    color: var(--green-deep);
    background: var(--green-wash);
    padding: 2px 8px;
    border-radius: 99px;
    font-weight: 600;
}
.asset-dls {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.asset-dl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--green-deep);
    background: var(--green-wash);
    border: 1px solid var(--green-deep);
    padding: 5px 11px;
    border-radius: 8px;
    text-decoration: none;
    line-height: 1.2;
}
.asset-dl:hover { background: var(--green-deep); color: #fff; }
.asset-dl svg { flex: none; }
.tag-draft {
    display: inline-block;
    margin-left: 6px;
    font-size: .68rem;
    color: var(--amber);
    background: var(--amber-wash);
    padding: 2px 7px;
    border-radius: 99px;
    font-weight: 700;
    letter-spacing: .02em;
}
.step-actions { margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; }
.link {
    background: none;
    border: 0;
    color: var(--muted);
    font: inherit;
    font-size: .8rem;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.link:hover { color: var(--green-deep); }
.link b { color: var(--green-deep); }

.subs {
    margin: 10px 0 2px 34px;
    padding-left: 12px;
    border-left: 2px solid var(--hairline);
    display: none;
}
.step.open .subs { display: block; }
.sub-item { display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; }
.sub-item .lbl { font-size: .9rem; color: #3a434f; cursor: pointer; }
.sub-item .lbl.done { color: #98a2b0; text-decoration: line-through; text-decoration-color: #cdd4dd; }

/* -- Notes + question panels -- */

.panel { margin: 10px 0 2px 34px; display: none; }
.panel.open { display: block; }
.panel textarea {
    width: 100%;
    border: 1px solid var(--hairline);
    border-radius: 9px;
    padding: 9px 11px;
    font: inherit;
    font-size: .88rem;
    resize: vertical;
    min-height: 64px;
    background: #fcfdfe;
    color: var(--ink);
}
.panel textarea:focus { outline: 2px solid var(--green-wash); border-color: var(--green); }
.q-send-row { margin-top: 6px; }
.saved-flag { font-size: .72rem; color: var(--green-deep); opacity: 0; transition: .3s; }
.saved-flag.show { opacity: 1; }
.q-sent {
    font-size: .8rem;
    color: var(--green-deep);
    background: var(--green-wash);
    border-radius: 8px;
    padding: 8px 11px;
    margin-top: 8px;
    display: none;
}
.q-sent.show { display: block; }

/* -- Question history (client-visible replies, Phase 4) -- */

.q-history { margin: 10px 0 2px 34px; }
.q-item { font-size: .85rem; padding: 8px 0; }
.q-item + .q-item { border-top: 1px dashed var(--hairline); }
.q-item .q-asked { margin: 0 0 6px; color: var(--ink); }
.q-item .q-answer {
    margin: 0;
    color: var(--green-deep);
    background: var(--green-wash);
    border-radius: 8px;
    padding: 8px 11px;
}
.q-item .q-pending {
    margin: 0;
    display: inline-block;
    color: var(--amber);
    background: var(--amber-wash);
    border-radius: 8px;
    padding: 5px 10px;
    font-size: .78rem;
}

/* -- Admin -- */

.admin-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--navy);
    background: #c8d0da;
    padding: 2px 7px;
    border-radius: 99px;
    margin-left: 8px;
    vertical-align: middle;
}

.badge {
    display: inline-block;
    background: var(--red);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 99px;
    margin-left: 4px;
    vertical-align: middle;
}

.table-wrap { overflow-x: auto; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th,
.admin-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--hairline);
    font-size: .9rem;
}
.admin-table th {
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.admin-table tr:last-child td { border-bottom: none; }

.q-card { margin-bottom: 16px; }
.q-meta { color: var(--muted); font-size: .8rem; margin: 0 0 10px; }
.q-asked { margin: 0 0 14px; font-size: .95rem; }
.q-answer {
    margin: 0;
    color: var(--green-deep);
    background: var(--green-wash);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: .9rem;
}

form textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--hairline);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink);
    font-size: 15px;
    font-family: var(--sans);
    margin-bottom: 16px;
    min-height: 80px;
    resize: vertical;
    outline: none;
}
form textarea:focus { border-color: var(--green); }

/* -- Launch section: status pills -- */

.pill {
    display: inline-block;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .03em;
    padding: 2px 9px;
    border-radius: 99px;
    vertical-align: middle;
    white-space: nowrap;
}
.pill-pending, .pill-submitted { color: var(--muted); background: #eef0f3; }
.pill-in_progress, .pill-in_review { color: var(--amber); background: var(--amber-wash); }
.pill-done, .pill-approved { color: var(--green-deep); background: var(--green-wash); }
.pill-issue { color: var(--red); background: #f7e7e3; }

/* -- Launch section: client milestone tracker -- */

.ms-list { list-style: none; margin: 8px 0 0; padding: 0; }
.ms-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--hairline);
    position: relative;
}
.ms-item:first-child { border-top: 0; }
.ms-mark {
    flex: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #c4ccd6;
    margin-top: 2px;
    position: relative;
}
.ms-in_progress .ms-mark { border-color: var(--amber); background: var(--amber-wash); }
.ms-done .ms-mark { border-color: var(--green); background: var(--green); }
.ms-done .ms-mark::after {
    content: "";
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.ms-body { flex: 1; min-width: 0; }
.ms-title { font-weight: 600; font-size: 1rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ms-done .ms-title { color: var(--muted); }
.ms-blurb { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.ms-date { color: var(--muted); font-size: .76rem; margin-top: 4px; }

.cred-heading { margin: 22px 0 8px; font-size: 1rem; }
.cred-table td { vertical-align: middle; }

/* -- Launch section: admin controls -- */

.ms-admin-row {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-top: 1px solid var(--hairline);
}
.ms-admin-row:first-of-type { border-top: 0; }
.ms-admin-label { min-width: 0; }
.ms-admin-label b { display: block; font-size: .95rem; }
.ms-admin-label span { color: var(--muted); font-size: .8rem; }
.ms-admin-form { display: flex; gap: 8px; align-items: center; flex: none; }
.ms-admin-form select { width: auto; margin-bottom: 0; }

.btn-inline { width: auto; padding: 9px 16px; font-size: 14px; }

.cred-edit-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cred-edit-form select { width: auto; margin-bottom: 0; }
.cred-edit-form input[type="text"] { width: auto; flex: 1; min-width: 120px; margin-bottom: 0; }
.cred-add-form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--hairline); }

/* -- Launch section: action list (client) -- */

.action-list { list-style: none; margin: 8px 0 0; padding: 0; }
.action-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--hairline);
}
.action-item:first-child { border-top: 0; }
.action-owner { flex: none; }
.action-text { flex: 1; min-width: 0; font-size: .95rem; }
.action-item.is-done .action-text { color: var(--muted); text-decoration: line-through; text-decoration-color: #bcc4ce; }
.action-status { flex: none; color: var(--muted); font-size: .8rem; }
.action-toggle-form { flex: none; margin: 0; }
.action-toggle-form button { margin: 0; }
.btn-light {
    background: #eef0f3;
    color: var(--ink);
}
.btn-light:hover { background: #e2e6ea; color: var(--ink); }

/* -- Launch section: document vault -- */

.doc-list { list-style: none; margin: 8px 0 0; padding: 0; }
.doc-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 0;
    border-top: 1px solid var(--hairline);
}
.doc-item:first-child { border-top: 0; }
.doc-date { flex: none; color: var(--muted); font-size: .8rem; }
.cred-add-form input[type="file"] { margin-bottom: 8px; font-size: 14px; }

/* Danger zone — remove-access / permanent-delete controls (admin client page) */
.danger-zone { border-color: #e6c9c2; background: #fbf4f2; }
.danger-zone .card-title { color: var(--red); }
.danger-rule { border: 0; border-top: 1px solid #e6c9c2; margin: 18px 0; }
.danger-zone code { background: #f2ded8; padding: 1px 6px; border-radius: 5px; font-size: .85rem; }
.btn-danger {
    width: auto; padding: 9px 16px; background: var(--red); color: #fff;
    border: none; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.btn-danger:hover { background: #8a3e31; }
.removed-note { color: var(--red); font-weight: 600; }
.removed-clients-table td { vertical-align: middle; }
