/*
    Synapse Partner Portal — global design system.

    The layout, density, and component shapes follow HubSpot's CRM conventions
    (white top bar, light left navigation, #f5f8fa canvas, slate text, crisp
    borders, compact tables). The brand accent is Synapse green in place of
    HubSpot orange. One stylesheet; pages compose these primitives.
*/

@import url('https://fonts.googleapis.com/css2?family=Lexend+Deca:wght@400;500;600;700&display=swap');

:root {
    /* Brand accent (Synapse green stands in for HubSpot orange) */
    --brand: #3f8a20;
    --brand-dark: #326d19;
    --brand-darker: #254d12;
    --brand-pale: #eaf5e6;
    --brand-pale-border: #cfe6c4;

    /* HubSpot slate text scale */
    --text: #33475b;
    --text-strong: #2d3e50;
    --text-muted: #516f90;
    --text-faint: #7c98b6;

    /* Borders / surfaces */
    --border: #cbd6e2;
    --border-light: #eaf0f6;
    --bg: #f5f8fa;
    --surface: #ffffff;

    /* Status */
    --blue: #0091ae;
    --green: #00a47c;
    --green-pale: #e5f5f0;
    --yellow: #b86e00;
    --yellow-pale: #fdf3e3;
    --red: #d9414e;
    --red-pale: #fbe6e8;
    --gray-pale: #eaf0f6;

    --radius: 3px;
    --radius-lg: 6px;
    --topbar-h: 54px;
    --sidebar-w: 244px;
    --font: "Lexend Deca", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --shadow-card: 0 1px 1px rgba(45, 62, 80, 0.08), 0 1px 2px rgba(45, 62, 80, 0.06);
    --shadow-pop: 0 4px 12px rgba(45, 62, 80, 0.16);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand-dark);
    text-decoration: none;
}

a:hover {
    color: var(--brand-darker);
    text-decoration: underline;
}

h1, h2, h3, h4 {
    color: var(--text-strong);
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

h1 { font-size: 22px; }
h2 { font-size: 16px; margin-bottom: 12px; }
h3 { font-size: 14px; }

code {
    background: var(--gray-pale);
    border-radius: var(--radius);
    padding: 1px 4px;
    font-size: 12px;
    color: var(--text-strong);
}

/* ---------------------------------------------------------------- chrome --- */

.nav-toggle {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.app-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 50;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-strong);
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}

.brand:hover {
    text-decoration: none;
    color: var(--text-strong);
}

.brand__mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    background: var(--brand);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.brand__mark::before {
    content: "";
    width: 12px;
    height: 12px;
    border-radius: 3px;
    background: #fff;
}

.brand__divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 4px;
}

.brand__app {
    color: var(--text-muted);
    font-weight: 500;
}

.topbar__spacer {
    flex: 1 1 auto;
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar__link {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.topbar__link:hover {
    color: var(--text-strong);
    text-decoration: none;
}

.topbar__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--brand-pale);
    color: var(--brand-darker);
    font-size: 12px;
    font-weight: 700;
}

.nav-toggle-label {
    display: none;
    font-size: 18px;
    line-height: 1;
    padding: 4px 6px;
    cursor: pointer;
    color: var(--text-muted);
}

.nav-scrim {
    display: none;
}

.app-sidebar {
    position: fixed;
    inset: var(--topbar-h) auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    z-index: 40;
    padding: 12px 12px 24px;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: block;
    padding: 7px 12px;
    border-radius: var(--radius);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--gray-pale);
    color: var(--text-strong);
    text-decoration: none;
}

.nav-item--active {
    background: var(--brand-pale);
    color: var(--brand-darker);
    font-weight: 600;
}

.nav-group {
    margin-top: 16px;
}

.nav-group-title {
    padding: 0 12px 6px;
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.nav-menu {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-note {
    padding: 8px 12px;
    color: var(--text-faint);
    font-size: 12px;
    font-style: italic;
}

.nav-chip {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--brand-darker);
    background: var(--brand-pale);
    border: 1px solid var(--brand-pale-border);
    border-radius: 999px;
    padding: 2px 8px;
    white-space: nowrap;
}

.app-body {
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-banner {
    padding: 10px 24px;
    background: var(--brand-pale);
    border-bottom: 1px solid var(--brand-pale-border);
    color: var(--brand-darker);
    font-weight: 500;
}

.app-banner--error {
    background: var(--red-pale);
    border-bottom-color: #f0c3c7;
    color: var(--red);
}

.app-banner:empty {
    display: none;
}

.app-main {
    flex: 1 1 auto;
    width: 100%;
    padding: 20px 24px 40px;
}

.app-footer {
    padding: 14px 24px;
    color: var(--text-faint);
    font-size: 12px;
    border-top: 1px solid var(--border-light);
}

/* ------------------------------------------------------------- page head --- */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.page-head__sub {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.page-head__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lede {
    color: var(--text-muted);
    font-size: 15px;
}

/* ----------------------------------------------------------------- cards --- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}

.card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.card__header h2,
.card__header h3 {
    margin: 0;
}

.card__body {
    padding: 16px;
}

.card__body--flush {
    padding: 0;
}

.grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

/* ----------------------------------------------------------------- table --- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 13px;
}

.table th,
.table td {
    text-align: left;
    padding: 9px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table thead th {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.table tbody tr:hover {
    background: var(--bg);
}

.table tbody tr:last-child td {
    border-bottom: 0;
}

.table td.table__num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.row--overdue td {
    background: var(--red-pale);
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ----------------------------------------------------------------- chips --- */

.status-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--gray-pale);
    white-space: nowrap;
}

.status-chip--available {
    color: var(--green);
    background: var(--green-pale);
}

.status-chip--partial {
    color: var(--yellow);
    background: var(--yellow-pale);
}

.status-chip--unavailable {
    color: var(--text-muted);
    background: var(--gray-pale);
}

.status-chip--danger {
    color: var(--red);
    background: var(--red-pale);
}

.status-chip--brand {
    color: var(--brand-darker);
    background: var(--brand-pale);
}

.status-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
}

/* -------------------------------------------------------------- buttons --- */

.button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
}

.button:hover,
.btn:hover {
    text-decoration: none;
    background: var(--bg);
    color: var(--text-strong);
}

.btn--primary,
.button:not(.button--secondary):not(.button--small) {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.btn--primary:hover,
.button:not(.button--secondary):not(.button--small):hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.btn--secondary,
.button--secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-muted);
}

.btn--ghost:hover {
    background: var(--gray-pale);
    border-color: transparent;
    color: var(--text);
}

.btn--danger {
    background: var(--surface);
    border-color: var(--border);
    color: var(--red);
}

.btn--danger:hover {
    background: var(--red-pale);
    border-color: #f0c3c7;
    color: var(--red);
}

.btn--small,
.button--small {
    padding: 5px 10px;
    font-size: 12px;
}

.btn--block {
    width: 100%;
}

/* ----------------------------------------------------------------- forms --- */

.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 620px;
}

.form--wide {
    max-width: none;
}

.form .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form--inline {
    flex-direction: row;
    align-items: flex-end;
    gap: 10px;
    max-width: none;
    flex-wrap: wrap;
}

.form--inline input,
.form--inline select {
    width: auto;
}

.field,
.form label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-weight: 500;
    font-size: 12px;
    color: var(--text-muted);
}

.form label.checkbox,
.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    font-weight: 400;
    font-size: 13px;
    color: var(--text);
}

.form input,
.form select,
.form textarea,
.input,
.select,
.textarea {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font: inherit;
    font-size: 13px;
    color: var(--text-strong);
    background: var(--surface);
    width: 100%;
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.input:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 2px rgba(63, 138, 32, 0.18);
}

.form input[type="checkbox"],
.form input[type="radio"] {
    width: auto;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 0;
}

legend {
    padding: 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

/* --------------------------------------------------------------- alerts --- */

.alert {
    padding: 11px 14px;
    border-radius: var(--radius);
    background: var(--yellow-pale);
    border: 1px solid #f0dcb4;
    color: var(--yellow);
    margin: 0 0 16px;
    font-size: 13px;
}

.alert--error {
    background: var(--red-pale);
    border-color: #f0c3c7;
    color: var(--red);
}

.alert--success {
    background: var(--green-pale);
    border-color: #bfe8dc;
    color: var(--green);
}

.alert--info {
    background: var(--brand-pale);
    border-color: var(--brand-pale-border);
    color: var(--brand-darker);
}

/* --------------------------------------------------------------- tiles ---- */

.tile-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.tile {
    display: block;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    color: var(--text-strong);
    font-weight: 600;
    font-size: 14px;
}

.tile:hover {
    text-decoration: none;
    border-color: var(--brand);
    color: var(--brand-darker);
}

.tile--muted {
    color: var(--text-faint);
}

/* ----------------------------------------------------------- empty state --- */

.empty {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-muted);
    font-size: 13px;
}

.empty strong {
    display: block;
    color: var(--text-strong);
    font-size: 14px;
    margin-bottom: 4px;
}

.provider-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 12px 0;
}

/* --------------------------------------------------------- agreement doc -- */

.agreement-doc {
    max-width: 760px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-strong);
}

.agreement-doc h1,
.agreement-doc h2,
.agreement-doc h3 {
    margin: 18px 0 8px;
}

.agreement-doc p,
.agreement-doc ul,
.agreement-doc ol {
    margin: 0 0 10px;
}

.agreement-doc ul,
.agreement-doc ol {
    padding-left: 22px;
}

.agreement-doc pre {
    padding: 12px;
    background: var(--bg);
    border-radius: var(--radius);
    overflow-x: auto;
}

.agreement-doc code {
    padding: 1px 5px;
    background: var(--bg);
    border-radius: 4px;
}

/* ----------------------------------------------------------- checklists --- */

.checklist {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checklist li {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
}

.checklist li:hover {
    border-color: var(--brand);
    background: var(--bg);
}

.checklist__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: inherit;
    text-decoration: none;
}

/* ---------------------------------------------------------- resource list -- */

.resource-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.resource-list li {
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.resource-list li strong {
    color: var(--text-strong);
}

.lesson-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lesson-list li {
    padding: 12px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

/* -------------------------------------------------------------- kanban ---- */

.board-actions {
    margin: 0 0 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.kanban {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    align-items: flex-start;
    padding-bottom: 6px;
}

.kanban-column {
    min-width: 252px;
    flex: 1 0 252px;
    background: #eef2f6;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 10px;
}

.kanban-column h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.kanban-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: var(--shadow-card);
}

.kanban-card a {
    font-weight: 600;
    color: var(--text-strong);
}

.kanban-card__meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin: 6px 0;
    font-size: 12px;
}

/* ------------------------------------------------------------- utilities -- */

.muted {
    color: var(--text-muted);
}

.tertiary {
    color: var(--text-faint);
}

.inline {
    display: inline;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nowrap {
    white-space: nowrap;
}

.mt-1 {
    margin-top: 12px;
}

.kanban-empty {
    padding: 6px;
    font-size: 12px;
}

/* ------------------------------------------------------------ responsive -- */

@media (max-width: 44rem) {
    .form .grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 60rem) {
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.15s ease;
        box-shadow: var(--shadow-pop);
    }

    .nav-toggle:checked ~ .app-sidebar {
        transform: translateX(0);
    }

    .nav-toggle:checked ~ .nav-scrim {
        display: block;
        position: fixed;
        inset: var(--topbar-h) 0 0 0;
        background: rgba(45, 62, 80, 0.4);
        z-index: 35;
    }

    .app-body {
        margin-left: 0;
    }

    .nav-toggle-label {
        display: inline-block;
    }

    .app-main {
        padding: 16px 16px 32px;
    }
}
