/* ============================================================
   Lynkr CRM — application UI
   Palette + font carried over from the original project.
   Dark by default; [data-theme="light"] overrides.
   ============================================================ */
:root {
    --bg: #040F16;
    --surface: #071822;
    --surface-2: #0a2330;
    --surface-3: #0d3347;
    --surface-hover: #0b2a3b;
    --border: rgba(143, 199, 230, 0.16);
    --border-strong: rgba(143, 199, 230, 0.26);
    --text: #FFF9EC;
    --title: #FAFAFA;
    --muted: rgba(255, 249, 236, 0.55);
    --primary: #135075;
    --primary-hover: #196a9c;
    --primary-ink: #FFF9EC;
    --link: #2f86bd;
    --link-hover: #4aa3d6;
    --danger: #ff9b86;
    --shadow: 0 18px 50px rgba(0, 0, 0, .28), 0 1px 0 rgba(255, 255, 255, .03) inset;
    --radius: 8px;
    --font: "Urbanist", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
[data-theme="light"] {
    --bg: #f7f9fb;
    --surface: #ffffff;
    --surface-2: #f1f5f8;
    --surface-3: #e6eef3;
    --surface-hover: #edf4f8;
    --border: rgba(19, 80, 117, 0.14);
    --border-strong: rgba(19, 80, 117, 0.24);
    --text: #0d2630;
    --title: #04141d;
    --muted: #5a6b75;
    --primary: #135075;
    --primary-hover: #196a9c;
    --primary-ink: #ffffff;
    --link: #135075;
    --link-hover: #196a9c;
    --danger: #b4452f;
    --shadow: 0 18px 45px rgba(9, 39, 57, .08), 0 1px 0 rgba(255, 255, 255, .9) inset;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
    background:
        linear-gradient(180deg, rgba(19, 80, 117, .16) 0, rgba(19, 80, 117, 0) 260px),
        var(--bg);
    background-repeat: no-repeat;
    background-size: 100% 100vh;
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
    min-width: 320px;
}
h1, h2, h3, h4 { font-family: var(--font); color: var(--title); font-weight: 700; line-height: 1.18; letter-spacing: 0; }
h1 { font-size: 1.8rem; margin: 0 0 .45rem; }
h3 { font-size: 1.05rem; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }

/* ---- Buttons ---- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem;
    min-height: 36px;
    padding: .55rem .9rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-strong);
    background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,0)), var(--surface-2);
    color: var(--text);
    font: inherit; font-size: .92rem; font-weight: 650;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .15s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); color: var(--text); transform: translateY(-1px); }
.btn--primary { background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,0)), var(--primary); border-color: rgba(74, 163, 214, .35); color: var(--primary-ink); }
.btn--primary:hover { background: linear-gradient(180deg, rgba(255,255,255,.1), rgba(255,255,255,0)), var(--primary-hover); border-color: rgba(74, 163, 214, .55); color: #fff; }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: var(--surface-hover); }
.btn--block { width: 100%; justify-content: center; }
.btn--sm { min-height: 30px; padding: .35rem .65rem; font-size: .82rem; }
.btn--danger { color: var(--danger); border-color: transparent; background: transparent; }
.btn--danger:hover { background: rgba(255, 155, 134, .12); color: var(--danger); }
.icon-btn { background: transparent; border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); width: 36px; height: 36px; cursor: pointer; }
.icon-btn:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.inline-form { display: inline; margin: 0; }

/* ---- Inputs ---- */
input, select, textarea { font: inherit; }
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    width: 100%;
    min-height: 38px;
    padding: .55rem .7rem;
    background: color-mix(in srgb, var(--surface-2) 86%, var(--bg));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
textarea { resize: none; overflow: hidden; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { outline: none; background: var(--surface); border-color: rgba(74, 163, 214, .7); box-shadow: 0 0 0 3px rgba(25, 106, 156, .22); }
::placeholder { color: var(--muted); }

/* ---- Auth screens ---- */
.auth-shell { min-height: 85vh; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.auth-card { background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--border); border-radius: var(--radius); padding: 2.25rem; width: 100%; max-width: 420px; box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.auth-card--wide { max-width: 560px; }
.auth-card h1 { margin: 0 0 .5rem; }
.auth-card label { display: block; margin: 1.1rem 0 .25rem; font-size: .9rem; color: var(--muted); }
.auth-card .btn { margin-top: 1.25rem; }
.auth-actions { display: flex; gap: .75rem; margin-top: 1.5rem; }

/* ---- Generic form layout ---- */
label { display: block; margin: .8rem 0 .3rem; font-size: .82rem; font-weight: 650; color: var(--muted); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.form-error { background: rgba(255,155,134,.12); color: var(--danger); border: 1px solid rgba(255,155,134,.35); padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; }
.form-notice { background: rgba(82, 196, 140, .12); color: #7fe6b0; border: 1px solid rgba(82,196,140,.35); padding: .7rem .9rem; border-radius: var(--radius); margin-bottom: 1rem; }

/* ---- App shell (full width) ---- */
.app-nav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 1.25rem; padding: .65rem 2rem; background: color-mix(in srgb, var(--surface) 90%, transparent); border-bottom: 1px solid var(--border); backdrop-filter: blur(18px); }
.app-nav__brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.05rem; color: var(--title); }
.app-nav__brand img { height: 28px; }
.app-nav__links { display: flex; gap: .25rem; align-items: center; }
.app-nav__links a { color: var(--muted); font-size: .9rem; font-weight: 650; padding: .42rem .65rem; border-radius: var(--radius); }
.app-nav__links a:hover { color: var(--text); background: var(--surface-hover); }
.app-nav__right { margin-left: auto; display: flex; align-items: center; gap: .7rem; }
.app-nav__user { display: flex; flex-direction: column; line-height: 1.15; font-size: .9rem; text-align: right; }
.app-nav__user small { color: var(--muted); font-size: .75rem; }

.app-main { width: 100%; margin: 0; padding: 1.6rem 2rem 2.5rem; }
.app-main--narrow { max-width: 1040px; margin-left: auto; margin-right: auto; }
.app-main--form { max-width: 640px; margin-left: auto; margin-right: auto; }

.card { background: color-mix(in srgb, var(--surface) 94%, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.15rem; box-shadow: 0 1px 0 rgba(255,255,255,.025) inset; }
.card h3 { margin: 0 0 1rem; }
.card .btn { margin-top: 1rem; }
.card textarea, .app-main textarea { width: 100%; padding: .55rem .7rem; background: color-mix(in srgb, var(--surface-2) 86%, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); }
.soon { display: inline-block; margin-top: .5rem; font-size: .75rem; color: var(--muted); border: 1px dashed var(--border); padding: .15rem .55rem; border-radius: 8px; }

/* ---- Modal dialogs ---- */
.modal {
    width: min(520px, calc(100vw - 2rem));
    padding: 0;
    color: var(--text);
    background: transparent;
    border: 0;
}
.modal::backdrop { background: rgba(0, 0, 0, .58); backdrop-filter: blur(4px); }
.modal__panel {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    margin: 0;
    padding: 1.1rem;
    background: color-mix(in srgb, var(--surface) 96%, var(--bg));
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.modal__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.modal__head h3 { margin: .2rem 0 0; }
.modal__actions { display: flex; justify-content: flex-end; gap: .6rem; flex-wrap: wrap; margin-top: .25rem; }
.modal__actions .btn { margin-top: 0; }

/* ---- Section header ---- */
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.15rem; }
.section-head h1, .section-head h3 { margin: 0; }

/* ---- Pills / banners ---- */
.pill { display: inline-flex; align-items: center; min-height: 22px; padding: .08rem .5rem; border-radius: 999px; font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 800; background: var(--surface-2); border: 1px solid var(--border-strong); }
.pill--status { color: #8fc7e6; }
.pill--trialing { color: #8fd0ff; }
.pill--active { color: #7fe6b0; }
.pill--past_due, .pill--suspended { color: var(--danger); }
.pill--cancelled, .pill--invited { color: var(--muted); }
.banner { padding: .7rem 2rem; font-size: .9rem; }
.banner--warn { background: #3a2a12; color: #ffd9a0; }

/* ---- Dashboard stats ---- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .75rem; }
.stat { display: flex; flex-direction: column; gap: .25rem; padding: 1rem 1.05rem; background: color-mix(in srgb, var(--surface) 94%, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.stat:hover { background: var(--surface-hover); border-color: rgba(74, 163, 214, .42); color: var(--text); transform: translateY(-1px); }
.stat__num { font-size: 1.85rem; font-weight: 800; color: var(--title); line-height: 1; }
.stat__label { color: var(--muted); font-size: .85rem; }
.stat--accent .stat__num { color: var(--link-hover); }

/* ---- Tables ---- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: color-mix(in srgb, var(--surface) 94%, var(--bg)); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: .68rem .85rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table thead th { background: color-mix(in srgb, var(--surface-2) 90%, var(--bg)); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 800; }
.data-table thead th a { color: var(--muted); }
.data-table thead th a:hover { color: var(--text); }
.data-table tr:last-child td { border-bottom: none; }
.data-table select { padding: .35rem .5rem; }
/* Lay actions out horizontally WITHOUT making the <td> a flex container —
   display:flex on a table cell breaks row height/vertical-align and throws the
   border lines out. Keep the cell a normal cell; align the controls inside it. */
.row-actions { white-space: nowrap; }
.row-actions > * { vertical-align: middle; }
.row-actions > * + * { margin-left: .4rem; }
.row-actions .inline-form { display: inline-flex; align-items: center; }

/* Dashboard: two equal columns side by side; stacks on narrow screens. */
.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-top: 1.5rem; align-items: start; }
@media (max-width: 820px) { .dash-cols { grid-template-columns: 1fr; } }

/* Dashboard to-do rows with inline complete / reschedule / delete. */
.todo-item { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.todo-item:last-child { border-bottom: 0; }
.todo-item__desc { flex: 1; min-width: 140px; }
.todo-item__date { display: inline-flex; align-items: center; gap: .35rem; }
.todo-item__date input[type="date"] { padding: .3rem .5rem; }
.row-link { cursor: pointer; }
.row-link td a { color: var(--text); font-weight: 600; }
.row-link:hover { background: var(--surface-hover); }
.row-link td a:hover { color: var(--link-hover); }

/* ---- Section header actions ---- */
.section-head__actions { display: flex; gap: .6rem; align-items: center; }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; padding: 0 .35rem; border-radius: 999px; background: var(--primary); color: #fff; font-size: .72rem; font-weight: 700; }

/* ---- Filter panel (toggleable) ---- */
.filter-panel { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1rem; }
.filter-panel[hidden] { display: none; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem; }
.fg { display: flex; flex-direction: column; gap: .35rem; }
.fg > label { margin: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fg--wide { grid-column: span 2; }
.fg--full { width: 100%; }
@media (max-width: 560px) { .fg--wide { grid-column: span 1; } }
.date-range { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.date-range input[type="date"] { min-width: 145px; flex: 1; }
.date-range span { color: var(--muted); font-size: .8rem; }
.filter-actions { display: flex; gap: .6rem; }
.filter-statuses, .owner-checks { display: flex; flex-wrap: wrap; gap: .5rem; }
.owner-checks--picker {
    max-height: 15rem;
    overflow: auto;
    padding: .45rem;
    border: 1px solid var(--flat-line);
    border-radius: var(--radius-sm);
    background: var(--flat-panel);
}
.inline-check { display: flex; align-items: center; gap: .4rem; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: .4rem; min-height: 30px; padding: .32rem .72rem; border: 1px solid var(--border); border-radius: 999px; background: color-mix(in srgb, var(--surface-2) 88%, var(--bg)); cursor: pointer; font-size: .82rem; margin: 0; color: var(--text); user-select: none; transition: background .15s ease, border-color .15s ease, color .15s ease; }
/* Hide the native checkbox square — the pill itself shows selected state. */
.chip input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.chip:hover { border-color: rgba(74, 163, 214, .45); }
.chip:has(input:checked) { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---- Invite form ---- */
.invite-form { display: flex; gap: .7rem; flex-wrap: wrap; align-items: center; }
.invite-form input[type="email"], .invite-form select { width: auto; }
.invite-form input[type="email"] { flex: 1; min-width: 240px; }

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 1.25rem; }
.pagination__btns { display: flex; align-items: center; gap: 1rem; }

/* ---- Contact detail: two-column app layout ---- */
.detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1rem; align-items: start; }
.detail-layout .col-main, .detail-layout .col-side { display: flex; flex-direction: column; gap: 1rem; }
@media (max-width: 980px) { .detail-layout { grid-template-columns: 1fr; } }
/* legacy alias */
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 980px) { .detail-grid { grid-template-columns: 1fr; } }

/* ---- Notes ---- */
.note-add textarea { width: 100%; }
.note-list { list-style: none; padding: 0; margin: 1.25rem 0 0; }
.note-list li { border-top: 1px solid var(--border); padding: .85rem 0; }
.note-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: .8rem; }
.note-body { white-space: pre-wrap; margin: .35rem 0; }
.note-edit summary { cursor: pointer; color: var(--link); font-size: .85rem; }

a.app-nav__user { text-decoration: none; color: var(--text); }
a.app-nav__user:hover { opacity: .85; }

@media (max-width: 860px) {
    .app-nav { align-items: flex-start; flex-wrap: wrap; padding: .75rem 1rem; }
    .app-nav__links { order: 3; width: 100%; overflow-x: auto; padding-bottom: .1rem; scrollbar-width: none; }
    .app-nav__links::-webkit-scrollbar { display: none; }
    .app-nav__right { margin-left: auto; }
    .app-main { padding: 1.15rem 1rem 2rem; }
    .section-head { flex-direction: column; }
    .section-head__actions { width: 100%; flex-wrap: wrap; }
    .section-head__actions .btn { flex: 1; justify-content: center; }
    .data-table { display: block; overflow-x: auto; }
    .pagination { align-items: flex-start; flex-direction: column; gap: .8rem; }
}

/* Suburb autocomplete suggestions (G.5) */
.suburb-suggestions {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
    max-height: 220px;
    overflow-y: auto;
}
.suburb-suggestion {
    text-align: left;
    padding: .5rem .75rem;
    background: transparent;
    border: 0;
    color: var(--text);
    cursor: pointer;
    font: inherit;
}
.suburb-suggestion:hover {
    background: var(--primary);
    color: #fff;
}
.suburb-suggestion--status,
.suburb-suggestion--status:hover {
    background: transparent;
    color: var(--muted);
    cursor: default;
}

/* ---- Full-width linear CRM refresh (keeps existing Lynkr palette) ---- */
:root {
    --shell-x: clamp(1rem, 2vw, 2rem);
    --shell-y: clamp(1rem, 1.6vw, 1.5rem);
    --radius-sm: 5px;
    --radius-lg: 6px;
    --focus: 0 0 0 3px rgba(47, 134, 189, .25);
    --flat-line: color-mix(in srgb, var(--border) 82%, transparent);
    --flat-panel: color-mix(in srgb, var(--surface) 88%, var(--bg));
    --flat-panel-2: color-mix(in srgb, var(--surface-2) 82%, var(--bg));
}

body {
    background: var(--bg);
    color-scheme: dark;
}

[data-theme="light"] body {
    color-scheme: light;
    background: var(--bg);
}

h1 { font-size: clamp(1.65rem, 1.8vw, 2.15rem); font-weight: 800; letter-spacing: 0; margin: 0 0 .35rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1rem; }
:focus-visible { outline: none; box-shadow: var(--focus); }

.app-nav {
    gap: 1rem;
    min-height: 64px;
    padding: .7rem var(--shell-x);
    background: var(--surface);
    border-bottom: 1px solid var(--flat-line);
    box-shadow: none;
}

.app-nav__brand {
    min-width: max-content;
    padding-right: .8rem;
    color: var(--title);
}

.app-nav__brand img { height: 30px; width: auto; }

.app-nav__links {
    gap: 0;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.app-nav__links::-webkit-scrollbar { display: none; }

.app-nav__links a {
    display: inline-flex;
    align-items: center;
    gap: .42rem;
    min-height: 38px;
    padding: .48rem .72rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: color-mix(in srgb, var(--text) 66%, transparent);
    line-height: 1;
}

.app-nav__links a i { font-size: 1rem; line-height: 1; }
.app-nav__links a:hover {
    background: var(--surface-hover);
    border-color: var(--flat-line);
    color: var(--text);
}
.app-nav__links a.is-active {
    background: var(--surface-2);
    border-color: color-mix(in srgb, var(--primary-hover) 54%, var(--flat-line));
    color: var(--title);
}
.app-nav__links a.is-active::before {
    content: "";
    width: 3px;
    height: 18px;
    border-radius: 999px;
    background: var(--link-hover);
}

.app-nav__right { gap: .55rem; }
.app-nav__user {
    padding: .35rem .65rem;
    border-left: 1px solid var(--flat-line);
    border-radius: 0;
}
a.app-nav__user:hover { background: transparent; opacity: .85; }

.app-main {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: var(--shell-y) var(--shell-x) 3rem;
}

.app-main--narrow,
.app-main--form {
    max-width: none;
    margin: 0;
}

.page-kicker {
    margin-bottom: .4rem;
    color: var(--link-hover);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.page-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.25rem;
    margin: 0 0 1.1rem;
    padding: 0 0 1rem;
    border-bottom: 1px solid var(--flat-line);
}

.page-hero p { margin: 0; }
.page-hero__actions { display: flex; gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }

.section-head {
    align-items: center;
    margin-bottom: .8rem;
    padding-bottom: .65rem;
    border-bottom: 1px solid var(--flat-line);
}

.section-head h1,
.section-head h3 { margin: 0; }
.section-head__actions { flex-wrap: wrap; justify-content: flex-end; }

.card,
.auth-card,
.filter-panel,
.dash-cols > section {
    background: var(--flat-panel);
    border: 1px solid var(--flat-line);
    border-radius: var(--radius-lg);
    box-shadow: none;
}

.card,
.auth-card { padding: 1rem; }
.card h3 { margin-top: 0; }

.btn,
.icon-btn,
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    border-radius: var(--radius-sm);
}

.btn {
    min-height: 38px;
    padding: .52rem .82rem;
    background: transparent;
    border-color: var(--flat-line);
    box-shadow: none;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--link-hover) 42%, var(--flat-line));
    transform: none;
}

.btn--primary {
    background: var(--primary);
    border-color: var(--primary-hover);
}

.btn--primary:hover { background: var(--primary-hover); border-color: var(--link-hover); }
.btn--ghost { background: transparent; }
.btn--sm { min-height: 32px; padding: .34rem .62rem; }
.icon-btn { display: inline-grid; place-items: center; min-width: 38px; height: 38px; background: transparent; }

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    min-height: 40px;
    padding: .58rem .72rem;
    background: color-mix(in srgb, var(--surface-2) 70%, var(--bg));
    border-color: var(--flat-line);
}

input:focus, select:focus, textarea:focus {
    background: var(--surface);
}

label { color: color-mix(in srgb, var(--text) 62%, transparent); }

.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0;
    border: 1px solid var(--flat-line);
    border-radius: var(--radius-lg);
    background: var(--flat-panel);
    overflow: hidden;
}

.stat {
    min-height: 96px;
    padding: .9rem 1rem;
    background: transparent;
    border: 0;
    border-right: 1px solid var(--flat-line);
    border-bottom: 1px solid var(--flat-line);
    border-radius: 0;
    color: var(--text);
    box-shadow: none;
    transform: none;
}

.stat:hover {
    background: var(--surface-hover);
    border-color: var(--flat-line);
    transform: none;
}

.stat__num { font-size: clamp(1.75rem, 2.4vw, 2.35rem); font-weight: 800; letter-spacing: 0; }
.stat__label { color: var(--muted); font-size: .82rem; font-weight: 700; }
.stat--accent .stat__num { color: var(--link-hover); }

.dash-cols {
    grid-template-columns: minmax(0, 1.45fr) minmax(360px, .9fr);
    gap: 1rem;
    margin-top: 1rem;
}

.dash-cols > section {
    min-width: 0;
    padding: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--flat-panel);
    border: 1px solid var(--flat-line);
    border-radius: var(--radius-lg);
    box-shadow: none;
}

.data-table th,
.data-table td {
    padding: .72rem .85rem;
    border-bottom: 1px solid var(--flat-line);
}

.data-table thead th {
    background: var(--flat-panel-2);
    color: color-mix(in srgb, var(--text) 58%, transparent);
    letter-spacing: .07em;
}

.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:nth-child(even) { background: transparent; }
.data-table tbody tr:hover { background: var(--surface-hover); }

.pill {
    min-height: 23px;
    padding: .12rem .52rem;
    background: transparent;
    border-color: var(--flat-line);
    letter-spacing: .05em;
}
.filter-panel {
    margin-bottom: 1rem;
}

.chip {
    min-height: 33px;
    background: transparent;
    border-color: var(--flat-line);
}

.chip:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary-hover);
}

.pagination {
    padding-top: .9rem;
    border-top: 1px solid var(--flat-line);
    color: var(--muted);
}

.todo-list {
    border: 1px solid var(--flat-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--flat-panel);
}

.todo-item {
    padding: .68rem .75rem;
    background: transparent;
    border-bottom: 1px solid var(--flat-line);
}

.todo-item:hover { background: var(--surface-hover); }
.todo-item:last-child { border-bottom: 0; }

.todo-page-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: .5rem;
}

.todo-page-item__body {
    min-width: 0;
    overflow-wrap: anywhere;
}

.todo-page-item__actions {
    display: flex;
    gap: .5rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.banner {
    border-bottom: 1px solid rgba(255, 217, 160, .2);
    padding: .72rem var(--shell-x);
}

.form-error,
.form-notice {
    border-radius: var(--radius-sm);
    box-shadow: none;
}

.suburb-suggestions {
    border-color: var(--flat-line);
    border-radius: var(--radius-sm);
    box-shadow: none;
}

.auth-shell {
    min-height: calc(100vh - 80px);
}

.auth-card {
    max-width: 440px;
}

@media (max-width: 1120px) {
    .app-nav { flex-wrap: wrap; }
    .app-nav__links { order: 3; width: 100%; }
}

@media (max-width: 860px) {
    .app-nav { align-items: center; padding: .75rem 1rem; }
    .app-nav__brand span { display: none; }
    .app-nav__links a { min-width: 42px; justify-content: center; }
    .app-nav__links a span { display: none; }
    .app-nav__links a.is-active::before { display: none; }
    .app-nav__user { display: none; }
    .page-hero { align-items: stretch; flex-direction: column; }
    .page-hero__actions .btn { flex: 1; justify-content: center; }
    .section-head { align-items: stretch; }
    .dash-cols { grid-template-columns: 1fr; }
    .dash-cols > section { padding: .9rem; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .date-range { flex-direction: column; align-items: stretch; }
    .date-range span { display: none; }
}

@media (max-width: 520px) {
    body { font-size: 14px; }
    .app-nav__right form .btn { padding-inline: .65rem; }
    .stat-grid { grid-template-columns: 1fr; }
    .filter-actions, .pagination__btns, .page-hero__actions { width: 100%; flex-wrap: wrap; }
    .filter-actions .btn, .pagination__btns .btn, .page-hero__actions .btn { flex: 1; justify-content: center; }
    .todo-page-item { align-items: stretch; flex-direction: column; }
    .todo-page-item__actions { justify-content: flex-start; }
}
/* Contact detail workspace: slim details, wide notes, slim brief/actions. */
.detail-layout--three {
    display: grid;
    grid-template-columns: minmax(260px, .72fr) minmax(520px, 1.65fr) minmax(280px, .82fr);
    gap: 1rem;
    align-items: start;
}

.detail-layout--three .col-main,
.detail-layout--three .col-side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.detail-layout--three .card {
    min-width: 0;
}

.detail-layout--three .form-row {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

.detail-layout--three .contact-fees-row,
.detail-layout--three .brief-budget-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-layout--three .brief-counts-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-layout--three .brief-counts-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.owner-checks--stacked {
    flex-direction: column;
    align-items: stretch;
}

.owner-checks--stacked .chip {
    width: 100%;
    justify-content: flex-start;
}

.contact-proposal-form {
    display: grid;
    gap: .6rem;
}

.proposal-stack {
    display: flex;
    flex-direction: column;
    gap: .65rem;
    margin-top: 1rem;
}

.proposal-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .6rem;
    padding: .7rem 0;
    border-top: 1px solid var(--flat-line);
}

.proposal-item .row-actions {
    grid-column: 1 / -1;
}

@media (max-width: 1280px) {
    .detail-layout--three {
        grid-template-columns: minmax(240px, .78fr) minmax(460px, 1.5fr) minmax(260px, .82fr);
    }
}

@media (max-width: 1080px) {
    .detail-layout--three {
        grid-template-columns: minmax(240px, .85fr) minmax(0, 1.25fr);
    }
    .detail-layout--three .col-main--notes {
        grid-column: 1 / -1;
        order: 3;
    }
}

@media (max-width: 760px) {
    .detail-layout--three {
        grid-template-columns: 1fr;
    }
    .detail-layout--three .col-side--left,
    .detail-layout--three .col-main--notes,
    .detail-layout--three .col-side--right {
        order: initial;
    }
}

/* ============================================================
   Lynkr CRM — platform redesign
   Keeps the existing palette, reworks the product shell and
   core UI rhythm for a sharper operational workspace.
   ============================================================ */
:root {
    --shell-x: clamp(1rem, 2.4vw, 2.75rem);
    --shell-y: clamp(1rem, 1.8vw, 1.7rem);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 8px;
    --hairline: color-mix(in srgb, var(--border) 74%, transparent);
    --hairline-strong: color-mix(in srgb, var(--border-strong) 82%, var(--primary));
    --panel: color-mix(in srgb, var(--surface) 88%, var(--bg));
    --panel-raised: color-mix(in srgb, var(--surface-2) 74%, var(--surface));
    --panel-sunken: color-mix(in srgb, var(--surface) 70%, var(--bg));
    --accent-soft: rgba(47, 134, 189, .16);
    --focus: 0 0 0 3px rgba(47, 134, 189, .26);
    --shadow-sm: 0 10px 28px rgba(0, 0, 0, .16);
    --shadow-md: 0 22px 55px rgba(0, 0, 0, .24);
}

[data-theme="light"] {
    --hairline: rgba(19, 80, 117, .12);
    --hairline-strong: rgba(19, 80, 117, .22);
    --panel: #ffffff;
    --panel-raised: #f6f9fb;
    --panel-sunken: #eef4f7;
    --accent-soft: rgba(19, 80, 117, .1);
    --shadow-sm: 0 10px 30px rgba(9, 39, 57, .07);
    --shadow-md: 0 24px 60px rgba(9, 39, 57, .1);
}

html {
    background: var(--bg);
    scroll-behavior: smooth;
}

body {
    background:
        linear-gradient(180deg, rgba(19, 80, 117, .18) 0, transparent 22rem),
        radial-gradient(circle at 78% -12%, rgba(47, 134, 189, .2), transparent 26rem),
        var(--bg);
    color: var(--text);
    color-scheme: dark;
    font-size: 15px;
    line-height: 1.45;
    text-rendering: optimizeLegibility;
}

[data-theme="light"] body {
    background:
        linear-gradient(180deg, rgba(19, 80, 117, .08) 0, transparent 20rem),
        radial-gradient(circle at 78% -12%, rgba(47, 134, 189, .12), transparent 26rem),
        var(--bg);
    color-scheme: light;
}

::selection {
    background: rgba(74, 163, 214, .34);
    color: var(--title);
}

h1, h2, h3, h4 {
    letter-spacing: 0;
}

h1 {
    font-size: clamp(1.7rem, 2.2vw, 2.45rem);
    font-weight: 800;
    margin: 0 0 .35rem;
}

h2 { font-size: 1.28rem; }
h3 { font-size: 1rem; font-weight: 800; }

p { margin-top: 0; }
strong { color: var(--title); font-weight: 800; }
code {
    padding: .1rem .3rem;
    border: 1px solid var(--hairline);
    border-radius: 5px;
    background: var(--panel-sunken);
    color: var(--title);
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus);
}

/* App shell */
.app-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .9rem;
    min-height: 68px;
    padding: .72rem var(--shell-x);
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    border-bottom: 1px solid var(--hairline);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 16px 36px rgba(0, 0, 0, .14);
    backdrop-filter: blur(18px) saturate(1.25);
}

[data-theme="light"] .app-nav {
    background: rgba(255, 255, 255, .86);
}

.app-nav__brand {
    min-width: max-content;
    padding: .32rem .75rem .32rem .35rem;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--title);
    font-size: 1rem;
    font-weight: 800;
}

.app-nav__brand:hover {
    background: var(--accent-soft);
    border-color: var(--hairline);
    color: var(--title);
}

.app-nav__brand img {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.app-nav__links {
    display: flex;
    align-items: center;
    gap: .24rem;
    min-width: 0;
    padding: .18rem;
    overflow-x: auto;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface) 54%, transparent);
    scrollbar-width: none;
}

.app-nav__links::-webkit-scrollbar { display: none; }

.app-nav__links a {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .42rem;
    min-height: 38px;
    padding: .48rem .68rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: color-mix(in srgb, var(--text) 66%, transparent);
    font-size: .88rem;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
}

.app-nav__links a i {
    font-size: 1.05rem;
    line-height: 1;
}

.app-nav__links a:hover {
    background: var(--surface-hover);
    border-color: var(--hairline);
    color: var(--title);
}

.app-nav__links a.is-active {
    background: linear-gradient(180deg, rgba(255, 255, 255, .065), transparent), var(--primary);
    border-color: color-mix(in srgb, var(--link-hover) 56%, var(--primary));
    color: #fff;
    box-shadow: 0 8px 20px rgba(19, 80, 117, .28);
}

.app-nav__links a.is-active::before {
    display: none;
}

.app-nav__right {
    display: flex;
    align-items: center;
    gap: .48rem;
    min-width: max-content;
}

.app-nav__user {
    max-width: 220px;
    padding: .42rem .7rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--surface-2) 46%, transparent);
    text-align: left;
}

.app-nav__user small {
    max-width: 100%;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

a.app-nav__user:hover {
    background: var(--surface-hover);
    opacity: 1;
}

.app-main {
    width: 100%;
    max-width: 1720px;
    margin: 0 auto;
    padding: var(--shell-y) var(--shell-x) 3.5rem;
}

.app-main--narrow {
    max-width: 1160px;
}

.app-main--form {
    max-width: 760px;
}

.page-kicker {
    margin: .15rem 0 .5rem;
    color: var(--link-hover);
    font-size: .72rem;
    font-weight: 850;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.page-hero,
.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin: 0 0 1.15rem;
    padding: .25rem 0 1.05rem;
    border-bottom: 1px solid var(--hairline);
}

.section-head {
    align-items: center;
    margin-bottom: 1rem;
}

.page-hero p,
.section-head p {
    margin: 0;
}

.page-hero__actions,
.section-head__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: .55rem;
    flex-wrap: wrap;
}

/* Panels */
.card,
.auth-card,
.filter-panel,
.dash-cols > section {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .045), transparent 9rem),
        var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card,
.auth-card {
    padding: 1.05rem;
}

.card h3,
.dash-cols h3 {
    margin: 0 0 .9rem;
}

.card .btn {
    margin-top: .85rem;
}

.dash-cols {
    grid-template-columns: minmax(0, 1.38fr) minmax(350px, .86fr);
    gap: 1rem;
    margin-top: 1rem;
}

.dash-cols > section {
    min-width: 0;
    padding: 1.05rem;
}

.auth-shell {
    min-height: calc(100vh - 76px);
    padding: clamp(1rem, 4vw, 3rem);
}

.auth-card {
    max-width: 440px;
    box-shadow: var(--shadow-md);
}

.auth-card--wide {
    max-width: 620px;
}

/* Controls */
.btn,
.icon-btn,
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    border-radius: var(--radius-sm);
}

.btn {
    min-height: 38px;
    padding: .52rem .84rem;
    border-color: var(--hairline-strong);
    background: linear-gradient(180deg, rgba(255, 255, 255, .04), transparent), var(--panel-raised);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset;
    font-size: .9rem;
    font-weight: 800;
    transform: translateY(0);
}

.btn:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, .065), transparent), var(--surface-hover);
    border-color: color-mix(in srgb, var(--link-hover) 48%, var(--hairline-strong));
    color: var(--title);
    transform: translateY(-1px);
}

.btn--primary {
    background: linear-gradient(180deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, 0)), var(--primary);
    border-color: color-mix(in srgb, var(--link-hover) 42%, var(--primary));
    color: var(--primary-ink);
    box-shadow: 0 10px 24px rgba(19, 80, 117, .24);
}

.btn--primary:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, .15), rgba(255, 255, 255, 0)), var(--primary-hover);
    color: #fff;
}

.btn--ghost {
    background: transparent;
    box-shadow: none;
}

.btn--danger {
    color: var(--danger);
}

.btn--danger:hover {
    background: rgba(255, 155, 134, .12);
    border-color: rgba(255, 155, 134, .32);
    color: var(--danger);
}

.btn--sm {
    min-height: 32px;
    padding: .34rem .62rem;
    font-size: .8rem;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 38px;
    min-width: 38px;
    height: 38px;
    background: var(--panel-raised);
    border-color: var(--hairline-strong);
}

.icon-btn:hover {
    background: var(--surface-hover);
}

label {
    margin: .78rem 0 .3rem;
    color: color-mix(in srgb, var(--text) 64%, transparent);
    font-size: .78rem;
    font-weight: 800;
}

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    min-height: 40px;
    padding: .58rem .72rem;
    background: var(--panel-sunken);
    border-color: var(--hairline);
    color: var(--text);
}

textarea {
    line-height: 1.48;
}

input:hover, select:hover, textarea:hover {
    border-color: var(--hairline-strong);
}

input:focus, select:focus, textarea:focus {
    background: color-mix(in srgb, var(--surface) 88%, var(--bg));
    border-color: color-mix(in srgb, var(--link-hover) 72%, var(--hairline-strong));
    box-shadow: var(--focus);
}

select {
    cursor: pointer;
}

::placeholder {
    color: color-mix(in srgb, var(--muted) 78%, transparent);
}

.form-row {
    gap: .75rem;
}

.form-error,
.form-notice {
    border-radius: var(--radius);
    box-shadow: none;
}

.form-notice {
    background: rgba(82, 196, 140, .12);
}

/* Stats and tables */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
    gap: .75rem;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
}

.stat {
    position: relative;
    min-height: 112px;
    padding: 1rem;
    overflow: hidden;
    background:
        linear-gradient(160deg, rgba(255, 255, 255, .055), transparent 54%),
        var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.stat::after {
    content: "";
    position: absolute;
    inset: auto 1rem 1rem auto;
    width: 36px;
    height: 3px;
    border-radius: 999px;
    background: var(--link-hover);
    opacity: .62;
}

.stat:hover {
    background:
        linear-gradient(160deg, rgba(255, 255, 255, .075), transparent 54%),
        var(--surface-hover);
    border-color: color-mix(in srgb, var(--link-hover) 44%, var(--hairline));
    transform: translateY(-2px);
}

.stat__num {
    color: var(--title);
    font-size: clamp(1.9rem, 2.7vw, 2.75rem);
    font-weight: 850;
}

.stat__label {
    color: color-mix(in srgb, var(--text) 62%, transparent);
    font-size: .82rem;
    font-weight: 800;
}

.stat--accent {
    border-color: color-mix(in srgb, var(--link-hover) 42%, var(--hairline));
}

.stat--accent .stat__num {
    color: var(--link-hover);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.data-table th,
.data-table td {
    padding: .78rem .9rem;
    border-bottom: 1px solid var(--hairline);
    vertical-align: middle;
}

.data-table thead th {
    position: sticky;
    top: 68px;
    z-index: 2;
    background: color-mix(in srgb, var(--surface-2) 84%, var(--surface));
    color: color-mix(in srgb, var(--text) 58%, transparent);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.data-table thead th a {
    color: inherit;
}

.data-table thead th a:hover {
    color: var(--title);
}

.data-table tbody tr {
    transition: background .14s ease, color .14s ease;
}

.data-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface) 55%, transparent);
}

.data-table tbody tr:hover,
.row-link:hover {
    background: var(--surface-hover);
}

.row-link td a {
    color: var(--title);
    font-weight: 800;
}

.row-actions {
    white-space: nowrap;
}

.badge {
    min-width: 1.18rem;
    height: 1.18rem;
    background: var(--primary);
    font-size: .68rem;
}

.pill {
    min-height: 24px;
    padding: .14rem .55rem;
    border-color: var(--hairline-strong);
    background: color-mix(in srgb, var(--surface-2) 58%, transparent);
    font-size: .67rem;
    font-weight: 850;
    letter-spacing: .055em;
}

.pill--status,
.pill--trialing {
    color: var(--link-hover);
}

.pill--active {
    background: rgba(82, 196, 140, .12);
    border-color: rgba(82, 196, 140, .35);
    color: #7fe6b0;
}

/* Filters, chips, pagination */
.filter-panel {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
}

.filter-grid {
    gap: .75rem;
}

.fg > label {
    color: color-mix(in srgb, var(--text) 58%, transparent);
    font-size: .68rem;
    font-weight: 850;
    letter-spacing: .07em;
}

.filter-actions,
.filter-statuses,
.owner-checks {
    gap: .5rem;
}

.owner-checks--picker {
    border-color: var(--hairline);
    background: var(--panel-sunken);
}

.chip {
    min-height: 34px;
    padding: .34rem .68rem;
    background: var(--panel-sunken);
    border-color: var(--hairline);
    color: color-mix(in srgb, var(--text) 78%, transparent);
    font-weight: 750;
}

.chip:hover {
    border-color: color-mix(in srgb, var(--link-hover) 48%, var(--hairline));
    color: var(--title);
}

.chip:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: 0 8px 20px rgba(19, 80, 117, .2);
}

.pagination {
    margin-top: 1rem;
    padding: .85rem 0 0;
    border-top: 1px solid var(--hairline);
}

.pagination__btns {
    gap: .65rem;
}

/* Todos and notes */
.todo-list {
    overflow: hidden;
    background: var(--panel-sunken);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
}

.todo-item {
    padding: .68rem .75rem;
    border-bottom: 1px solid var(--hairline);
}

.todo-item:hover {
    background: var(--surface-hover);
}

.todo-item__desc,
.todo-page-item__body {
    overflow-wrap: anywhere;
}

.todo-page-item {
    padding: .8rem 0;
    border-bottom: 1px solid var(--hairline);
}

.note-list {
    margin-top: 1rem;
}

.note-list li {
    padding: .9rem 0;
    border-top: 1px solid var(--hairline);
}

.note-meta {
    color: color-mix(in srgb, var(--text) 52%, transparent);
}

.note-body {
    color: var(--title);
}

.note-edit summary {
    width: max-content;
    padding: .18rem 0;
    color: var(--link-hover);
    font-weight: 800;
}

/* Detail workspace */
.detail-layout,
.detail-grid {
    gap: 1rem;
}

.detail-layout--three {
    grid-template-columns: minmax(250px, .72fr) minmax(520px, 1.56fr) minmax(280px, .84fr);
    gap: 1rem;
}

.detail-layout--three .col-main,
.detail-layout--three .col-side {
    gap: 1rem;
}

.detail-layout--three .card {
    min-width: 0;
}

.detail-layout--three .form-row {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
}

.detail-layout--three .contact-fees-row,
.detail-layout--three .brief-budget-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-layout--three .brief-counts-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.owner-checks--stacked {
    flex-direction: column;
    align-items: stretch;
}

.owner-checks--stacked .chip {
    justify-content: flex-start;
    width: 100%;
}

.contact-proposal-form {
    display: grid;
    gap: .6rem;
}

.proposal-stack {
    display: flex;
    flex-direction: column;
    gap: .68rem;
    margin-top: 1rem;
}

.proposal-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .6rem;
    padding: .8rem;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--panel-sunken);
}

.proposal-item .row-actions {
    grid-column: 1 / -1;
}

/* Notices and autocomplete */
.banner {
    padding: .74rem var(--shell-x);
    border-bottom: 1px solid rgba(255, 217, 160, .22);
    font-weight: 750;
}

.banner--warn {
    background: color-mix(in srgb, #3a2a12 82%, var(--bg));
    color: #ffd9a0;
}

.suburb-suggestions {
    z-index: 10;
    border-color: var(--hairline-strong);
    border-radius: var(--radius-sm);
    background: var(--panel);
    box-shadow: var(--shadow-sm);
}

.suburb-suggestion {
    min-height: 38px;
}

.suburb-suggestion:hover {
    background: var(--primary);
}

/* Mobile */
@media (max-width: 1220px) {
    .app-nav {
        grid-template-columns: auto 1fr;
    }

    .app-nav__links {
        grid-column: 1 / -1;
        order: 3;
    }

    .app-nav__right {
        justify-self: end;
    }

    .detail-layout--three {
        grid-template-columns: minmax(240px, .86fr) minmax(0, 1.2fr);
    }

    .detail-layout--three .col-main--notes {
        grid-column: 1 / -1;
        order: 3;
    }
}

@media (max-width: 900px) {
    .app-main {
        padding: 1rem 1rem 2.4rem;
    }

    .page-hero,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .page-hero__actions,
    .section-head__actions {
        justify-content: flex-start;
        width: 100%;
    }

    .page-hero__actions .btn,
    .section-head__actions .btn {
        flex: 1;
        justify-content: center;
    }

    .dash-cols,
    .detail-layout,
    .detail-grid,
    .detail-layout--three {
        grid-template-columns: 1fr;
    }

    .detail-layout--three .col-side--left,
    .detail-layout--three .col-main--notes,
    .detail-layout--three .col-side--right {
        order: initial;
    }

    .data-table {
        display: block;
        overflow-x: auto;
    }

    .data-table thead th {
        position: static;
    }
}

@media (max-width: 680px) {
    body {
        font-size: 14px;
    }

    .app-nav {
        grid-template-columns: auto 1fr;
        gap: .6rem;
        min-height: 60px;
        padding: .6rem .75rem;
    }

    .app-nav__brand {
        padding-right: .35rem;
    }

    .app-nav__brand span,
    .app-nav__user {
        display: none;
    }

    .app-nav__links {
        gap: .18rem;
        padding: .15rem;
        border-radius: var(--radius-sm);
    }

    .app-nav__links a {
        min-width: 40px;
        min-height: 36px;
        padding: .46rem .54rem;
    }

    .app-nav__links a span {
        display: none;
    }

    .app-nav__right form .btn {
        padding-inline: .62rem;
    }

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

    .filter-actions,
    .pagination,
    .pagination__btns,
    .todo-page-item,
    .todo-page-item__actions {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-actions .btn,
    .pagination__btns .btn {
        justify-content: center;
        width: 100%;
    }

    .date-range {
        align-items: stretch;
        flex-direction: column;
    }

    .date-range span {
        display: none;
    }
}

@media (max-width: 460px) {
    .app-main {
        padding-inline: .75rem;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .card,
    .auth-card,
    .filter-panel,
    .dash-cols > section {
        padding: .9rem;
    }

    .detail-layout--three .contact-fees-row,
    .detail-layout--three .brief-budget-row,
    .detail-layout--three .brief-counts-row {
        grid-template-columns: 1fr;
    }
}

/* Keep table headers in flow; sticky headers can overlap the first row in dense lists. */
.data-table thead th {
    position: static;
    top: auto;
    z-index: auto;
}

/* ============================================================
   Enterprise CRM direction
   A restrained, dense, high-contrast operations UI using the
   existing Lynkr palette without decorative softness.
   ============================================================ */
:root {
    --radius: 6px;
    --radius-sm: 4px;
    --radius-lg: 6px;
    --shell-x: clamp(1rem, 2vw, 2.25rem);
    --shell-y: clamp(.9rem, 1.5vw, 1.35rem);
    --hairline: color-mix(in srgb, var(--border) 88%, transparent);
    --hairline-strong: color-mix(in srgb, var(--border-strong) 88%, var(--primary));
    --panel: color-mix(in srgb, var(--surface) 92%, var(--bg));
    --panel-alt: color-mix(in srgb, var(--surface-2) 76%, var(--bg));
    --panel-field: color-mix(in srgb, var(--surface) 62%, var(--bg));
    --focus: 0 0 0 2px rgba(74, 163, 214, .36);
    --shadow-sm: none;
    --shadow-md: none;
}

[data-theme="light"] {
    --hairline: rgba(19, 80, 117, .16);
    --hairline-strong: rgba(19, 80, 117, .28);
    --panel: #ffffff;
    --panel-alt: #f1f6f9;
    --panel-field: #f8fafc;
    --focus: 0 0 0 2px rgba(19, 80, 117, .24);
}

body,
[data-theme="light"] body {
    background: var(--bg);
    font-size: 14px;
    line-height: 1.42;
}

h1 {
    font-size: clamp(1.45rem, 1.55vw, 1.9rem);
    font-weight: 800;
}

h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; }

.muted {
    color: color-mix(in srgb, var(--text) 58%, transparent);
}

.small {
    font-size: .8rem;
}

/* Shell */
.app-nav {
    min-height: 58px;
    padding: .58rem var(--shell-x);
    background: var(--surface);
    border-bottom: 1px solid var(--hairline-strong);
    box-shadow: none;
    backdrop-filter: none;
}

[data-theme="light"] .app-nav {
    background: var(--surface);
}

.app-nav__brand {
    padding: .25rem .65rem .25rem .25rem;
    border-radius: var(--radius-sm);
    font-size: .95rem;
}

.app-nav__brand:hover {
    background: var(--surface-hover);
}

.app-nav__brand img {
    width: 28px;
    height: 28px;
}

.app-nav__links {
    gap: .12rem;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.app-nav__links a {
    min-height: 34px;
    padding: .42rem .58rem;
    border-radius: var(--radius-sm);
    color: color-mix(in srgb, var(--text) 68%, transparent);
    font-size: .82rem;
    font-weight: 750;
}

.app-nav__links a:hover {
    background: var(--surface-hover);
    border-color: transparent;
}

.app-nav__links a.is-active {
    background: var(--primary);
    border-color: transparent;
    color: var(--primary-ink);
    box-shadow: none;
}

.app-nav__right {
    gap: .4rem;
}

.app-nav__user {
    padding: .34rem .58rem;
    border-color: var(--hairline);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: .82rem;
}

.app-main {
    max-width: 1680px;
    padding: var(--shell-y) var(--shell-x) 2.5rem;
}

.app-main--narrow {
    max-width: 1120px;
}

.app-main--form {
    max-width: 720px;
}

.page-kicker {
    margin-bottom: .35rem;
    color: var(--link-hover);
    font-size: .68rem;
    letter-spacing: .08em;
}

.page-hero,
.section-head {
    margin-bottom: .9rem;
    padding: 0 0 .75rem;
    border-bottom-color: var(--hairline-strong);
}

.section-head {
    align-items: center;
}

.page-hero__actions,
.section-head__actions {
    gap: .45rem;
}

/* Surfaces */
.card,
.auth-card,
.filter-panel,
.dash-cols > section,
.data-table,
.todo-list,
.proposal-item,
.stat {
    background: var(--panel);
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    box-shadow: none;
}

.card,
.auth-card,
.dash-cols > section {
    padding: .9rem;
}

.card h3,
.dash-cols h3 {
    margin-bottom: .7rem;
}

.dash-cols {
    grid-template-columns: minmax(0, 1.4fr) minmax(340px, .85fr);
    gap: .85rem;
}

/* Controls */
.btn {
    min-height: 34px;
    padding: .43rem .68rem;
    border-color: var(--hairline-strong);
    border-radius: var(--radius-sm);
    background: var(--panel-alt);
    box-shadow: none;
    font-size: .82rem;
    font-weight: 800;
    transform: none;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--link-hover);
    transform: none;
}

.btn--primary,
.btn--primary:hover {
    background: var(--primary);
    border-color: var(--primary-hover);
    color: var(--primary-ink);
    box-shadow: none;
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.btn--ghost {
    background: transparent;
}

.btn--sm {
    min-height: 29px;
    padding: .28rem .5rem;
    font-size: .76rem;
}

.icon-btn {
    width: 34px;
    min-width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    background: var(--panel-alt);
    border-color: var(--hairline-strong);
    box-shadow: none;
}

label {
    margin: .65rem 0 .25rem;
    color: color-mix(in srgb, var(--text) 68%, transparent);
    font-size: .74rem;
    font-weight: 800;
}

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    min-height: 36px;
    padding: .48rem .6rem;
    border-color: var(--hairline);
    border-radius: var(--radius-sm);
    background: var(--panel-field);
    box-shadow: none;
}

input:hover, select:hover, textarea:hover {
    border-color: var(--hairline-strong);
}

input:focus, select:focus, textarea:focus {
    background: var(--surface);
    border-color: var(--link-hover);
    box-shadow: var(--focus);
}

.form-row,
.filter-grid {
    gap: .65rem;
}

/* Data density */
.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: .65rem;
}

.stat {
    min-height: 88px;
    padding: .8rem;
    background: var(--panel);
    overflow: hidden;
}

.stat::after {
    inset: auto 0 0 0;
    width: auto;
    height: 2px;
    border-radius: 0;
    opacity: .9;
}

.stat:hover {
    background: var(--surface-hover);
    border-color: var(--hairline-strong);
    transform: none;
}

.stat__num {
    font-size: clamp(1.55rem, 2vw, 2.1rem);
}

.stat__label {
    font-size: .76rem;
    color: color-mix(in srgb, var(--text) 62%, transparent);
}

.data-table {
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: .58rem .7rem;
    border-bottom-color: var(--hairline);
}

.data-table thead th {
    position: static;
    top: auto;
    z-index: auto;
    background: var(--panel-alt);
    border-bottom: 1px solid var(--hairline-strong);
    color: color-mix(in srgb, var(--text) 72%, transparent);
    font-size: .64rem;
    letter-spacing: .07em;
}

.data-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-2) 18%, transparent);
}

.data-table tbody tr:hover,
.row-link:hover {
    background: var(--surface-hover);
}

.row-link td a {
    font-weight: 800;
}

.pill {
    min-height: 21px;
    padding: .08rem .45rem;
    border-color: var(--hairline);
    border-radius: 999px;
    background: var(--panel-alt);
    font-size: .62rem;
}

.badge {
    min-width: 1.1rem;
    height: 1.1rem;
    font-size: .62rem;
}

/* Filters and detail workspaces */
.filter-panel {
    gap: .8rem;
    padding: .85rem;
}

.fg > label {
    font-size: .64rem;
}

.chip {
    min-height: 30px;
    padding: .28rem .58rem;
    border-color: var(--hairline);
    background: var(--panel-field);
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 750;
}

.chip:hover {
    border-color: var(--link-hover);
}

.chip:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary-hover);
    box-shadow: none;
}

.owner-checks--picker {
    background: var(--panel-field);
    border-color: var(--hairline);
}

.detail-layout,
.detail-grid,
.detail-layout--three {
    gap: .85rem;
}

.detail-layout--three {
    grid-template-columns: minmax(250px, .72fr) minmax(520px, 1.6fr) minmax(280px, .86fr);
}

.detail-layout--three .col-main,
.detail-layout--three .col-side {
    gap: .85rem;
}

.todo-list {
    background: var(--panel);
}

.todo-item {
    padding: .58rem .65rem;
    border-bottom-color: var(--hairline);
}

.todo-item:hover {
    background: var(--surface-hover);
}

.note-list {
    margin-top: .8rem;
}

.note-list li {
    padding: .72rem 0;
    border-top-color: var(--hairline);
}

.proposal-item {
    padding: .65rem;
    background: var(--panel-field);
}

.pagination {
    margin-top: .85rem;
    padding-top: .75rem;
    border-top-color: var(--hairline);
}

.banner {
    padding: .62rem var(--shell-x);
}

@media (max-width: 1220px) {
    .app-nav {
        grid-template-columns: auto 1fr;
    }

    .app-nav__links {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .app-main {
        padding: .9rem 1rem 2.25rem;
    }

    .dash-cols,
    .detail-layout,
    .detail-grid,
    .detail-layout--three {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .app-nav {
        min-height: 56px;
        padding: .55rem .75rem;
    }

    .app-nav__links a {
        min-width: 38px;
        min-height: 34px;
    }

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

@media (max-width: 460px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Back-office CRM shell
   A structural redesign: fixed left navigation, table-first pages,
   compact toolbars, and quieter operational surfaces.
   ============================================================ */
:root {
    --bg: #06131b;
    --surface: #0a1a24;
    --surface-2: #102938;
    --surface-3: #15364a;
    --surface-hover: #123044;
    --border: rgba(146, 198, 224, .18);
    --border-strong: rgba(146, 198, 224, .34);
    --text: #fff9ec;
    --title: #ffffff;
    --muted: rgba(255, 249, 236, .58);
    --primary: #15567f;
    --primary-hover: #1a6d9f;
    --link: #55a8d9;
    --link-hover: #7cc4ee;
    --danger: #ff9b86;
    --nav-w: 238px;
    --shell-x: 1.35rem;
    --shell-y: 1.15rem;
    --radius: 4px;
    --radius-sm: 3px;
    --radius-lg: 4px;
    --panel: #091923;
    --panel-alt: #0d2330;
    --panel-field: #06131b;
    --line: rgba(146, 198, 224, .2);
    --line-strong: rgba(146, 198, 224, .36);
    --focus: 0 0 0 2px rgba(85, 168, 217, .36);
    --shadow: none;
    --shadow-sm: none;
    --shadow-md: none;
}

[data-theme="light"] {
    --bg: #f3f7fa;
    --surface: #ffffff;
    --surface-2: #eaf2f6;
    --surface-3: #dceaf1;
    --surface-hover: #e5f0f6;
    --border: rgba(19, 80, 117, .14);
    --border-strong: rgba(19, 80, 117, .3);
    --text: #102632;
    --title: #04141d;
    --muted: #60727c;
    --primary: #135075;
    --primary-hover: #196a9c;
    --link: #135075;
    --link-hover: #196a9c;
    --danger: #b4452f;
    --panel: #ffffff;
    --panel-alt: #eef5f8;
    --panel-field: #f8fafc;
    --line: rgba(19, 80, 117, .16);
    --line-strong: rgba(19, 80, 117, .3);
    --focus: 0 0 0 2px rgba(19, 80, 117, .24);
}

html,
body,
[data-theme="light"] body {
    background: var(--bg);
}

body {
    color: var(--text);
    font-size: 14px;
    line-height: 1.38;
    letter-spacing: 0;
    overflow-x: hidden;
}

h1 {
    font-size: 1.55rem;
    line-height: 1.12;
    margin: 0;
}

h2 { font-size: 1.1rem; }
h3 { font-size: .92rem; }
p { margin: 0 0 .65rem; }
a { color: var(--link); }
a:hover { color: var(--link-hover); }

.muted { color: var(--muted); }
.small { font-size: .78rem; }
:focus-visible { outline: none; box-shadow: var(--focus); }

/* Left-side product shell */
.app-nav {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-columns: 1fr;
    width: var(--nav-w);
    min-height: 100vh;
    padding: .85rem .75rem;
    gap: .8rem;
    background: var(--surface);
    border-right: 1px solid var(--line-strong);
    border-bottom: 0;
    box-shadow: none;
    backdrop-filter: none;
}

[data-theme="light"] .app-nav {
    background: var(--surface);
}

.app-nav__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    min-width: 0;
    padding: .45rem .5rem .8rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    color: var(--title);
    font-size: 1rem;
    font-weight: 850;
}

.app-nav__brand:hover {
    background: transparent;
    color: var(--title);
}

.app-nav__brand img {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

.app-nav__links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .12rem;
    min-width: 0;
    padding: 0;
    overflow: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.app-nav__links a {
    display: grid;
    grid-template-columns: 1.15rem minmax(0, 1fr);
    align-items: center;
    justify-content: start;
    gap: .62rem;
    min-height: 34px;
    padding: .44rem .55rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: color-mix(in srgb, var(--text) 72%, transparent);
    font-size: .84rem;
    font-weight: 750;
    text-align: left;
}

.app-nav__links a i {
    width: 1.15rem;
    color: color-mix(in srgb, var(--text) 54%, transparent);
    font-size: 1rem;
    text-align: center;
}

.app-nav__links a:hover {
    background: var(--surface-hover);
    border-color: var(--line);
    color: var(--title);
}

.app-nav__links a:hover i {
    color: var(--link-hover);
}

.app-nav__links a.is-active {
    background: var(--primary);
    border-color: var(--primary-hover);
    color: var(--primary-ink);
    box-shadow: none;
}

.app-nav__links a.is-active i {
    color: var(--primary-ink);
}

.app-nav__right {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: end;
    gap: .5rem;
    min-width: 0;
    padding-top: .75rem;
    border-top: 1px solid var(--line);
}

.app-nav__right .inline-form {
    grid-column: 1 / -1;
}

.app-nav__right .inline-form .btn {
    width: 100%;
    justify-content: center;
}

.app-nav__user {
    min-width: 0;
    padding: .38rem .45rem;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--title);
    font-size: .82rem;
    text-align: left;
}

.app-nav__user:hover {
    background: var(--surface-hover);
}

.app-nav__user small {
    display: block;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.banner {
    margin-left: var(--nav-w);
    width: calc(100% - var(--nav-w));
    max-width: calc(100vw - var(--nav-w));
    padding: .62rem var(--shell-x);
    border-bottom: 1px solid rgba(255, 217, 160, .24);
}

.app-main {
    max-width: none;
    width: auto;
    max-width: calc(100vw - var(--nav-w));
    min-height: 100vh;
    margin: 0 0 0 var(--nav-w);
    padding: var(--shell-y) var(--shell-x) 2.25rem;
    overflow-x: clip;
}

.app-main--narrow,
.app-main--form {
    max-width: none;
}

/* Page chrome: compact, toolbar-like */
.page-kicker {
    display: none;
}

.page-hero,
.section-head {
    align-items: center;
    margin: -.15rem 0 .85rem;
    padding: 0 0 .75rem;
    border-bottom: 1px solid var(--line-strong);
}

.page-hero p,
.section-head p {
    margin: .25rem 0 0;
}

.page-hero__actions,
.section-head__actions {
    gap: .4rem;
}

/* Back-office surfaces */
.card,
.auth-card,
.filter-panel,
.dash-cols > section,
.stat,
.data-table,
.todo-list,
.proposal-item,
.suburb-suggestions {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: none;
}

.card,
.auth-card,
.dash-cols > section,
.filter-panel {
    padding: .85rem;
}

.card h3,
.dash-cols h3 {
    margin: 0 0 .65rem;
    padding-bottom: .45rem;
    border-bottom: 1px solid var(--line);
    color: var(--title);
    font-size: .86rem;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.card .btn {
    margin-top: .7rem;
}

.auth-shell {
    min-height: 100vh;
    margin-left: 0;
    padding: 2rem;
}

.auth-card {
    max-width: 410px;
}

/* Tool controls */
.btn,
.icon-btn,
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    border-radius: var(--radius-sm);
}

.btn {
    min-height: 32px;
    padding: .38rem .62rem;
    background: var(--surface-2);
    border: 1px solid var(--line-strong);
    color: var(--text);
    box-shadow: none;
    font-size: .8rem;
    font-weight: 800;
    transform: none;
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--link-hover);
    color: var(--title);
    transform: none;
}

.btn--primary {
    background: var(--primary);
    border-color: var(--primary-hover);
    color: var(--primary-ink);
    box-shadow: none;
}

.btn--primary:hover {
    background: var(--primary-hover);
    color: #fff;
}

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

.btn--sm {
    min-height: 28px;
    padding: .25rem .48rem;
    font-size: .74rem;
}

.btn--danger {
    color: var(--danger);
}

.btn--danger:hover {
    background: rgba(255, 155, 134, .12);
    border-color: rgba(255, 155, 134, .36);
}

.icon-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    background: var(--surface-2);
    border-color: var(--line-strong);
}

label {
    margin: .58rem 0 .22rem;
    color: color-mix(in srgb, var(--text) 67%, transparent);
    font-size: .72rem;
    font-weight: 800;
}

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    min-height: 34px;
    padding: .44rem .55rem;
    background: var(--panel-field);
    border: 1px solid var(--line);
    color: var(--text);
    box-shadow: none;
}

input:hover, select:hover, textarea:hover {
    border-color: var(--line-strong);
}

input:focus, select:focus, textarea:focus {
    background: var(--surface);
    border-color: var(--link-hover);
    box-shadow: var(--focus);
}

.form-row,
.filter-grid {
    gap: .6rem;
}

/* Table-first workspace */
.data-table {
    width: 100%;
    overflow: hidden;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: .52rem .62rem;
    border-bottom: 1px solid var(--line);
}

.data-table thead th {
    position: static;
    top: auto;
    z-index: auto;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line-strong);
    color: color-mix(in srgb, var(--text) 76%, transparent);
    font-size: .62rem;
    font-weight: 900;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.data-table tbody tr:nth-child(even) {
    background: color-mix(in srgb, var(--surface-2) 18%, transparent);
}

.data-table tbody tr:hover,
.row-link:hover {
    background: var(--surface-hover);
}

.row-link td a {
    color: var(--title);
    font-weight: 800;
}

.row-actions > * + * {
    margin-left: .28rem;
}

/* Dashboard becomes counters + work queues, not promo cards */
.stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel);
}

.stat {
    min-height: 78px;
    padding: .72rem .78rem;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: transparent;
}

.stat::after {
    display: none;
}

.stat:hover {
    background: var(--surface-hover);
    border-color: var(--line);
    transform: none;
}

.stat__num {
    color: var(--title);
    font-size: 1.8rem;
    font-weight: 850;
}

.stat__label {
    color: var(--muted);
    font-size: .75rem;
    font-weight: 800;
}

.stat--accent {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
}

.stat--accent .stat__num {
    color: var(--link-hover);
}

.dash-cols {
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, .9fr);
    gap: .85rem;
    margin-top: .85rem;
}

/* Filters, chips, state */
.filter-panel {
    gap: .75rem;
    margin-bottom: .85rem;
    background: var(--panel-alt);
}

.fg > label {
    color: var(--muted);
    font-size: .62rem;
    letter-spacing: .07em;
}

.chip {
    min-height: 28px;
    padding: .24rem .52rem;
    background: var(--panel-field);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: color-mix(in srgb, var(--text) 78%, transparent);
    font-size: .76rem;
    font-weight: 800;
}

.chip:hover {
    border-color: var(--link-hover);
    color: var(--title);
}

.chip:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary-hover);
    color: #fff;
    box-shadow: none;
}

.pill {
    min-height: 20px;
    padding: .06rem .42rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-field);
    font-size: .6rem;
    font-weight: 900;
    letter-spacing: .055em;
}

.pill--status,
.pill--trialing {
    color: var(--link-hover);
}

.pill--active {
    background: rgba(82, 196, 140, .12);
    border-color: rgba(82, 196, 140, .35);
}

.badge {
    min-width: 1rem;
    height: 1rem;
    background: var(--primary);
    font-size: .6rem;
}

/* Detail workspace */
.detail-layout,
.detail-grid,
.detail-layout--three {
    gap: .85rem;
}

.detail-layout--three {
    grid-template-columns: minmax(245px, .7fr) minmax(520px, 1.58fr) minmax(280px, .86fr);
}

.detail-layout--three .col-main,
.detail-layout--three .col-side {
    gap: .85rem;
}

.detail-layout--three .form-row {
    grid-template-columns: repeat(auto-fit, minmax(125px, 1fr));
}

.owner-checks--picker {
    background: var(--panel-field);
    border-color: var(--line);
}

.todo-list {
    background: var(--panel);
}

.todo-item {
    padding: .52rem .62rem;
    border-bottom: 1px solid var(--line);
}

.todo-item:hover {
    background: var(--surface-hover);
}

.todo-page-item {
    padding: .62rem 0;
    border-bottom: 1px solid var(--line);
}

.note-list {
    margin-top: .75rem;
}

.note-list li {
    padding: .68rem 0;
    border-top: 1px solid var(--line);
}

.note-body {
    color: var(--title);
}

.proposal-stack {
    gap: .5rem;
}

.proposal-item {
    padding: .58rem;
    background: var(--panel-field);
}

.pagination {
    margin-top: .8rem;
    padding-top: .7rem;
    border-top: 1px solid var(--line);
}

.suburb-suggestions {
    border-color: var(--line-strong);
    background: var(--panel);
}

/* Responsive: sidebar becomes a compact top rail */
@media (max-width: 1080px) {
    :root {
        --nav-w: 0px;
    }

    .app-nav {
        position: sticky;
        top: 0;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-rows: auto;
        width: auto;
        min-height: 58px;
        padding: .55rem .75rem;
        border-right: 0;
        border-bottom: 1px solid var(--line-strong);
    }

    .app-nav__brand {
        padding: .25rem .55rem .25rem .25rem;
        border-bottom: 0;
    }

    .app-nav__links {
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
    }

    .app-nav__links a {
        display: inline-flex;
        grid-template-columns: none;
        white-space: nowrap;
    }

    .app-nav__right {
        display: flex;
        align-items: center;
        padding-top: 0;
        border-top: 0;
    }

    .app-nav__right .inline-form {
        grid-column: auto;
    }

    .app-nav__right .inline-form .btn {
        width: auto;
    }

    .banner,
    .app-main {
        margin-left: 0;
    }

    .dash-cols,
    .detail-layout,
    .detail-grid,
    .detail-layout--three {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 13px;
    }

    .app-nav {
        grid-template-columns: auto 1fr;
        gap: .5rem;
    }

    .app-nav__brand span,
    .app-nav__user {
        display: none;
    }

    .app-nav__links {
        grid-column: 1 / -1;
        order: 3;
    }

    .app-nav__links a {
        min-width: 36px;
        justify-content: center;
    }

    .app-nav__links a span {
        display: none;
    }

    .app-main {
        padding: .85rem .75rem 2rem;
    }

    .page-hero,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .page-hero__actions,
    .section-head__actions {
        justify-content: flex-start;
        width: 100%;
    }

    .page-hero__actions .btn,
    .section-head__actions .btn {
        flex: 1;
        justify-content: center;
    }

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

    .data-table {
        display: block;
        overflow-x: auto;
    }
}

@media (max-width: 460px) {
    .stat-grid {
        grid-template-columns: 1fr;
    }

    .filter-actions,
    .pagination,
    .pagination__btns {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-actions .btn,
    .pagination__btns .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Sidebar alignment correction: clear old top-nav spacing from the fixed rail. */
@media (min-width: 1081px) {
    .app-nav {
        align-items: stretch;
    }

    .app-nav__brand,
    .app-nav__links,
    .app-nav__right {
        width: 100%;
        margin-left: 0;
    }

    .app-nav__links a {
        width: 100%;
    }

    .app-nav__right {
        align-self: end;
        align-items: stretch;
        grid-template-columns: 32px minmax(0, 1fr);
    }

    .app-nav__right .icon-btn {
        justify-self: start;
    }

    .app-nav__right .app-nav__user {
        width: 100%;
    }

    .app-nav__right .inline-form {
        display: block;
        width: 100%;
        margin: 0;
    }
}

/* ============================================================
   Softer layered rail + collapsible navigation
   Keeps the left-shell structure, restores richer color layering
   and rounded corners, and supports a persistent collapsed rail.
   ============================================================ */
:root {
    --bg: #041018;
    --surface: #071823;
    --surface-2: #0d2635;
    --surface-3: #14394d;
    --surface-hover: #102f42;
    --border: rgba(143, 199, 230, .18);
    --border-strong: rgba(143, 199, 230, .34);
    --text: #fff9ec;
    --title: #ffffff;
    --muted: rgba(255, 249, 236, .62);
    --primary: #15577f;
    --primary-hover: #1b6f9f;
    --link: #4aa3d6;
    --link-hover: #8fc7e6;
    --nav-w: 248px;
    --radius: 8px;
    --radius-sm: 6px;
    --radius-lg: 8px;
    --panel: color-mix(in srgb, var(--surface) 88%, var(--bg));
    --panel-alt: color-mix(in srgb, var(--surface-2) 82%, var(--surface));
    --panel-field: color-mix(in srgb, var(--surface) 72%, var(--bg));
    --line: rgba(143, 199, 230, .18);
    --line-strong: rgba(143, 199, 230, .32);
    --shadow-sm: 0 10px 26px rgba(0, 0, 0, .18);
    --shadow-md: 0 22px 48px rgba(0, 0, 0, .24);
}

[data-theme="light"] {
    --bg: #f6f9fb;
    --surface: #ffffff;
    --surface-2: #edf5f8;
    --surface-3: #dceaf1;
    --surface-hover: #e7f2f7;
    --border: rgba(19, 80, 117, .13);
    --border-strong: rgba(19, 80, 117, .24);
    --text: #0d2630;
    --title: #04141d;
    --muted: #60727c;
    --panel: #ffffff;
    --panel-alt: #f0f6f9;
    --panel-field: #f8fbfc;
    --line: rgba(19, 80, 117, .14);
    --line-strong: rgba(19, 80, 117, .24);
    --shadow-sm: 0 10px 24px rgba(9, 39, 57, .07);
    --shadow-md: 0 20px 44px rgba(9, 39, 57, .1);
}

html[data-nav="collapsed"] {
    --nav-w: 76px;
}

body {
    background:
        linear-gradient(180deg, rgba(19, 80, 117, .12), transparent 18rem),
        var(--bg);
}

[data-theme="light"] body {
    background:
        linear-gradient(180deg, rgba(19, 80, 117, .06), transparent 18rem),
        var(--bg);
}

.app-nav {
    padding: .85rem .72rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 15rem),
        var(--surface);
    border-right-color: var(--line-strong);
    box-shadow: 10px 0 34px rgba(0, 0, 0, .16);
    transition: width .18s ease, padding .18s ease;
}

[data-theme="light"] .app-nav {
    background: var(--surface);
    box-shadow: 10px 0 30px rgba(9, 39, 57, .06);
}

.app-nav__top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 32px;
    align-items: center;
    gap: .45rem;
    padding: 0 0 .72rem;
    border-bottom: 1px solid var(--line);
}

.app-nav__top .app-nav__brand {
    padding: .35rem .38rem;
    border: 0;
    min-width: 0;
}

.app-nav__top .app-nav__brand span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-nav__collapse {
    justify-self: end;
    width: 32px;
    min-width: 32px;
    height: 32px;
}

.app-nav__links {
    gap: .18rem;
    padding: .1rem 0;
}

.app-nav__links a {
    min-height: 36px;
    padding: .48rem .58rem;
    border-radius: var(--radius-sm);
}

.app-nav__links a.is-active {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .1), transparent),
        var(--primary);
    border-color: color-mix(in srgb, var(--link-hover) 45%, var(--primary));
}

.app-nav__right {
    padding-top: .72rem;
}

.app-nav__right .icon-btn,
.app-nav__right .btn,
.app-nav__user {
    border-radius: var(--radius-sm);
}

.card,
.auth-card,
.filter-panel,
.dash-cols > section,
.data-table,
.todo-list,
.proposal-item,
.suburb-suggestions,
.stat-grid {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card,
.auth-card,
.filter-panel,
.dash-cols > section {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), transparent 7rem),
        var(--panel);
}

.data-table,
.todo-list,
.stat-grid {
    background: var(--panel);
}

.data-table thead th {
    background: var(--panel-alt);
}

.stat {
    background: transparent;
}

.stat--accent {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .035), transparent),
        color-mix(in srgb, var(--primary) 18%, transparent);
}

.btn,
.icon-btn {
    border-radius: var(--radius-sm);
}

.btn {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .04), transparent),
        var(--surface-2);
}

.btn--primary {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .1), transparent),
        var(--primary);
}

input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    border-radius: var(--radius-sm);
}

@media (min-width: 1081px) {
    html[data-nav="collapsed"] .app-nav {
        padding-inline: .6rem;
    }

    html[data-nav="collapsed"] .app-nav__top {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: .5rem;
    }

    html[data-nav="collapsed"] .app-nav__brand {
        justify-content: center;
        padding: .2rem 0;
    }

    html[data-nav="collapsed"] .app-nav__brand span,
    html[data-nav="collapsed"] .app-nav__links a span,
    html[data-nav="collapsed"] .app-nav__user,
    html[data-nav="collapsed"] .app-nav__right .inline-form {
        display: none;
    }

    html[data-nav="collapsed"] .app-nav__collapse {
        justify-self: center;
    }

    html[data-nav="collapsed"] .app-nav__links a {
        display: flex;
        justify-content: center;
        width: 100%;
        padding-inline: .35rem;
    }

    html[data-nav="collapsed"] .app-nav__links a i {
        width: auto;
        font-size: 1.12rem;
    }

    html[data-nav="collapsed"] .app-nav__right {
        display: flex;
        justify-content: center;
        align-items: center;
    }

    html[data-nav="collapsed"] .app-nav__right .icon-btn {
        justify-self: center;
    }
}

@media (max-width: 1080px) {
    html[data-nav="collapsed"] {
        --nav-w: 0px;
    }

    .app-nav__top {
        display: flex;
        border-bottom: 0;
        padding: 0;
    }

    .app-nav__collapse {
        display: none;
    }

    .app-nav {
        box-shadow: 0 8px 24px rgba(0, 0, 0, .14);
    }
}

/* ============================================================
   Graphite palette experiment + collapsed nav tooltips
   Sharper corners, cooler neutral workspace, green-teal action
   color, and explicit hover labels for the icon rail.
   ============================================================ */
:root {
    --bg: #111417;
    --surface: #181d20;
    --surface-2: #20272b;
    --surface-3: #293238;
    --surface-hover: #263037;
    --border: rgba(205, 214, 219, .13);
    --border-strong: rgba(205, 214, 219, .24);
    --text: #e9edf0;
    --title: #f8fafb;
    --muted: rgba(233, 237, 240, .58);
    --primary: #2f7d6d;
    --primary-hover: #3b9a86;
    --primary-ink: #f8fffb;
    --link: #62b8a7;
    --link-hover: #8bd6c8;
    --danger: #e97862;
    --radius: 4px;
    --radius-sm: 3px;
    --radius-lg: 4px;
    --panel: #171c1f;
    --panel-alt: #20272b;
    --panel-field: #121619;
    --line: rgba(205, 214, 219, .13);
    --line-strong: rgba(205, 214, 219, .24);
    --focus: 0 0 0 2px rgba(98, 184, 167, .34);
    --shadow-sm: none;
    --shadow-md: none;
}

[data-theme="light"] {
    --bg: #f4f5f4;
    --surface: #ffffff;
    --surface-2: #eaeeec;
    --surface-3: #dce3e0;
    --surface-hover: #e4ebe8;
    --border: rgba(45, 68, 64, .14);
    --border-strong: rgba(45, 68, 64, .26);
    --text: #1c2423;
    --title: #0d1413;
    --muted: #62706d;
    --primary: #2f7d6d;
    --primary-hover: #276b5e;
    --primary-ink: #ffffff;
    --link: #276b5e;
    --link-hover: #1e554a;
    --danger: #a84231;
    --panel: #ffffff;
    --panel-alt: #eef2f0;
    --panel-field: #f8faf9;
    --line: rgba(45, 68, 64, .14);
    --line-strong: rgba(45, 68, 64, .26);
    --focus: 0 0 0 2px rgba(47, 125, 109, .26);
}

body,
[data-theme="light"] body {
    background: var(--bg);
}

.app-nav {
    background: var(--surface);
    box-shadow: none;
}

.card,
.auth-card,
.filter-panel,
.dash-cols > section {
    background: var(--panel);
    box-shadow: none;
}

.data-table,
.todo-list,
.stat-grid,
.proposal-item,
.suburb-suggestions {
    box-shadow: none;
}

.data-table thead th,
.btn,
.icon-btn {
    background: var(--panel-alt);
}

.btn--primary,
.btn--primary:hover,
.app-nav__links a.is-active,
.chip:has(input:checked) {
    background: var(--primary);
    border-color: var(--primary-hover);
}

.btn--primary:hover {
    background: var(--primary-hover);
}

.pill--status,
.pill--trialing,
.stat--accent .stat__num {
    color: var(--link-hover);
}

.stat--accent {
    background: color-mix(in srgb, var(--primary) 16%, transparent);
}

@media (min-width: 1081px) {
    html[data-nav="collapsed"] .app-nav,
    html[data-nav="collapsed"] .app-nav__links {
        overflow: visible;
    }

    html[data-nav="collapsed"] .app-nav__links a {
        position: relative;
    }

    html[data-nav="collapsed"] .app-nav__links a::after {
        content: attr(aria-label);
        position: absolute;
        left: calc(100% + .65rem);
        top: 50%;
        z-index: 100;
        min-width: max-content;
        padding: .36rem .5rem;
        border: 1px solid var(--line-strong);
        border-radius: var(--radius-sm);
        background: var(--surface-3);
        color: var(--title);
        font-size: .76rem;
        font-weight: 800;
        line-height: 1;
        opacity: 0;
        pointer-events: none;
        transform: translateY(-50%) translateX(-4px);
        transition: opacity .12s ease, transform .12s ease;
        box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
    }

    html[data-nav="collapsed"] .app-nav__links a::before {
        content: "";
        position: absolute;
        left: calc(100% + .42rem);
        top: 50%;
        z-index: 101;
        width: .45rem;
        height: .45rem;
        background: var(--surface-3);
        border-left: 1px solid var(--line-strong);
        border-bottom: 1px solid var(--line-strong);
        opacity: 0;
        pointer-events: none;
        transform: translateY(-50%) rotate(45deg);
        transition: opacity .12s ease;
    }

    html[data-nav="collapsed"] .app-nav__links a:hover::after,
    html[data-nav="collapsed"] .app-nav__links a:focus-visible::after {
        opacity: 1;
        transform: translateY(-50%) translateX(0);
    }

    html[data-nav="collapsed"] .app-nav__links a:hover::before,
    html[data-nav="collapsed"] .app-nav__links a:focus-visible::before {
        opacity: 1;
    }
}

/* Square steel palette experiment: no rounding, no green accent. */
:root {
    --bg: #0f141a;
    --surface: #151b22;
    --surface-2: #1d2630;
    --surface-3: #263340;
    --surface-hover: #24313d;
    --border: rgba(194, 207, 219, .14);
    --border-strong: rgba(194, 207, 219, .26);
    --text: #e8eef3;
    --title: #f9fbfd;
    --muted: rgba(232, 238, 243, .6);
    --primary: #3d6fba;
    --primary-hover: #4f86d8;
    --primary-ink: #ffffff;
    --link: #7da8e6;
    --link-hover: #a8c8f4;
    --danger: #e87864;
    --radius: 0;
    --radius-sm: 0;
    --radius-lg: 0;
    --panel: #141a21;
    --panel-alt: #1d2630;
    --panel-field: #0f141a;
    --line: rgba(194, 207, 219, .14);
    --line-strong: rgba(194, 207, 219, .27);
    --focus: 0 0 0 2px rgba(125, 168, 230, .36);
}

[data-theme="light"] {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-2: #e9eef3;
    --surface-3: #d9e2eb;
    --surface-hover: #e2eaf2;
    --border: rgba(35, 58, 82, .14);
    --border-strong: rgba(35, 58, 82, .28);
    --text: #17222d;
    --title: #07111b;
    --muted: #62707d;
    --primary: #355f9f;
    --primary-hover: #2c5188;
    --primary-ink: #ffffff;
    --link: #355f9f;
    --link-hover: #284879;
    --danger: #a94431;
    --panel: #ffffff;
    --panel-alt: #eef2f6;
    --panel-field: #f8fafc;
    --line: rgba(35, 58, 82, .14);
    --line-strong: rgba(35, 58, 82, .28);
    --focus: 0 0 0 2px rgba(53, 95, 159, .26);
}

.app-nav,
.app-nav__brand,
.app-nav__top,
.app-nav__links a,
.app-nav__right .icon-btn,
.app-nav__right .btn,
.app-nav__user,
.card,
.auth-card,
.filter-panel,
.dash-cols > section,
.data-table,
.todo-list,
.proposal-item,
.suburb-suggestions,
.stat-grid,
.btn,
.icon-btn,
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea,
.chip,
.pill {
    border-radius: 0;
}

/* Old Lynkr color family trial + readability tune.
   Keeps the square collapsed-sidebar layout and component structure intact. */
:root {
    /* Maker's Mark — dark ("at the table") */
    --bg: #14201A;
    --surface: #1D2D24;
    --surface-2: #233029;
    --surface-3: #2A3A30;
    --surface-hover: #26392F;
    --border: rgba(174, 185, 172, .16);
    --border-strong: rgba(174, 185, 172, .28);
    --text: #E4DFD3;
    --title: #F2EEE4;
    --muted: rgba(228, 223, 211, .62);
    --primary: #D99F43;
    --primary-hover: #E6B05A;
    --primary-ink: #231A08;
    --link: #D99F43;
    --link-hover: #E8B662;
    --danger: #CF6A52;
    --panel: #1D2D24;
    --panel-alt: #233029;
    --panel-field: #14201A;
    --line: rgba(174, 185, 172, .16);
    --line-strong: rgba(174, 185, 172, .28);
    --focus: 0 0 0 2px rgba(217, 159, 67, .34);
}

[data-theme="light"] {
    /* Maker's Mark — light ("parchment") */
    --bg: #E4DFD3;
    --surface: #EDEAE0;
    --surface-2: #E7E2D7;
    --surface-3: #DED9CC;
    --surface-hover: #E9E5DB;
    --border: rgba(35, 59, 48, .14);
    --border-strong: rgba(35, 59, 48, .26);
    --text: #233B30;
    --title: #1B2C24;
    --muted: #74705F;
    --primary: #C6892C;
    --primary-hover: #B07823;
    --primary-ink: #2A1D07;
    --link: #8A5A1E;
    --link-hover: #6E4715;
    --danger: #7A2E22;
    --panel: #EDEAE0;
    --panel-alt: #E7E2D7;
    --panel-field: #F2EFE6;
    --line: rgba(35, 59, 48, .14);
    --line-strong: rgba(35, 59, 48, .26);
    --focus: 0 0 0 2px rgba(198, 137, 44, .30);
}

body {
    font-size: 15px;
    line-height: 1.48;
}

h1 {
    font-size: clamp(1.65rem, 1.8vw, 2rem);
    line-height: 1.16;
}

h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }

.app-nav__links a,
.btn,
input:not([type]), input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="tel"], input[type="date"], select, textarea {
    font-size: .88rem;
}

.data-table th,
.data-table td {
    font-size: .9rem;
}

.data-table thead th {
    font-size: .68rem;
}

label,
.fg > label {
    font-size: .76rem;
}

.small,
.stat__label,
.note-meta {
    font-size: .82rem;
}

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

/* Typography weight softening for readability. */
body,
input,
select,
textarea,
.data-table td,
.note-body,
.todo-item__desc {
    font-weight: 400;
}

h1,
h2,
h3,
.app-nav__brand,
.stat__num {
    font-weight: 700;
}

.app-nav__links a,
.btn,
label,
.fg > label,
.row-link td a,
.chip,
.pill,
.badge,
.stat__label,
.data-table thead th,
.note-edit summary {
    font-weight: 600;
}

.small,
.muted,
.note-meta,
.app-nav__user,
.app-nav__user small {
    font-weight: 400;
}

/* ---- Client portal management: final page-specific layout ---- */
.portal-manage-layout {
    display: grid;
    grid-template-columns: minmax(250px, .72fr) minmax(520px, 1.55fr) minmax(320px, .9fr);
    gap: 1rem;
    align-items: start;
}
.portal-manage-layout__config,
.portal-manage-layout__main,
.portal-manage-layout__side {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}
.portal-panel {
    min-width: 0;
}
.portal-panel .section-head {
    margin-bottom: .75rem;
    padding-bottom: .65rem;
}
.portal-panel form > .pill {
    margin: .15rem 0 .65rem;
}
.portal-stack {
    display: flex;
    flex-direction: column;
    gap: .7rem;
    margin-top: .9rem;
}
.portal-stack label,
.portal-stack .form-row label {
    margin-top: 0;
    margin-bottom: 0;
}
.portal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
    margin-top: .65rem;
}
.portal-actions .btn,
.portal-panel .btn {
    margin-top: 0;
}
.portal-item {
    border-top: 1px solid var(--hairline, var(--flat-line));
    padding: .75rem 0;
}
.portal-item:last-child {
    padding-bottom: 0;
}
.portal-item > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    cursor: pointer;
    list-style: none;
}
.portal-item > summary::-webkit-details-marker {
    display: none;
}
.portal-item > summary::before {
    content: "+";
    display: inline-grid;
    place-items: center;
    flex: 0 0 1.4rem;
    width: 1.4rem;
    height: 1.4rem;
    border: 1px solid var(--hairline, var(--flat-line));
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 800;
}
.portal-item[open] > summary::before {
    content: "-";
    color: var(--text);
}
.portal-item > summary > span:first-of-type {
    flex: 1;
    min-width: 0;
}
.portal-client-response {
    margin-top: .75rem;
    padding: .7rem .8rem;
    border: 1px solid var(--hairline, var(--flat-line));
    border-radius: var(--radius-sm);
}
.portal-client-response p {
    margin: .35rem 0 0;
    white-space: pre-wrap;
}
.portal-item--add {
    border-top: 1px solid var(--hairline, var(--flat-line));
}
.portal-item--add > summary {
    display: inline-flex;
    justify-content: center;
    margin-top: .75rem;
}
.portal-item--add > summary::before {
    display: none;
}
.portal-list-row,
.portal-doc-row {
    border-top: 1px solid var(--hairline, var(--flat-line));
    margin-top: .8rem;
    padding-top: .8rem;
}
.portal-list-row {
    display: grid;
    gap: .35rem;
}
.portal-list-row p {
    margin: .1rem 0 .25rem;
    white-space: pre-wrap;
}
.portal-doc-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
}
.portal-doc-row > span {
    min-width: 0;
    overflow-wrap: anywhere;
}
.portal-help {
    margin: .6rem 0 0;
}
.url-list-input {
    overflow: auto;
    white-space: pre;
}
@media (max-width: 1220px) {
    .portal-manage-layout {
        grid-template-columns: minmax(240px, .75fr) minmax(0, 1.5fr);
    }
    .portal-panel--properties {
        grid-column: auto;
        grid-row: auto;
    }
    .portal-manage-layout__main {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
    .portal-manage-layout__side {
        grid-column: 1;
    }
}
@media (max-width: 860px) {
    .portal-manage-layout {
        grid-template-columns: 1fr;
    }
    .portal-panel--properties,
    .portal-manage-layout__main,
    .portal-manage-layout__side {
        grid-column: auto;
        grid-row: auto;
    }
    .portal-doc-row {
        align-items: flex-start;
        flex-direction: column;
    }
}

.pill--portal-shortlisted { color: #8fc7e6; border-color: rgba(143, 199, 230, .42); }
.pill--portal-inspected { color: #ffd37a; border-color: rgba(255, 211, 122, .42); }
.pill--portal-offer_made { color: #c6a6ff; border-color: rgba(198, 166, 255, .42); }
.pill--portal-purchased { color: #7fe6b0; border-color: rgba(127, 230, 176, .42); }
.pill--portal-rejected { color: #ff9b86; border-color: rgba(255, 155, 134, .42); }

/* ============================================================================
   MAKER'S MARK — on-brand status accents (colours only).
   Appended last so it wins over the earlier stacked theme blocks. The palette
   lives in the :root / [data-theme="light"] variable blocks above. Typography
   stays on the original Urbanist (no font overrides here).
   ============================================================================ */
:root { --success: #8FBF9A; }
[data-theme="light"] { --success: #3B6D4F; }

/* Status-pill accents repointed to the palette. */
.pill--status { color: var(--primary); }
.pill--active, .pill--purchased, .pill--portal-purchased { color: var(--success); }
.pill--trialing { color: var(--link); }
.pill--past_due, .pill--suspended, .pill--cancelled, .pill--portal-rejected { color: var(--danger); }
.pill--invited { color: var(--muted); }
