/* ===========================================================================
   Social Automation Tool — interface styles
   A light, warm-grey workspace: fixed left sidebar, roomy content column,
   soft cards. Layered on top of Bootstrap 5, which supplies the grid,
   dropdowns, modals and tables.
   =========================================================================== */

:root {
    /* Surfaces */
    --bg:            #ffffff;
    --surface:       #fafaf9;
    --surface-2:     #f5f5f4;
    --surface-3:     #efedeb;

    /* Lines */
    --line:          #e7e5e4;
    --line-strong:   #d6d3d1;

    /* Type */
    --ink:           #1c1917;
    --ink-2:         #44403c;
    --ink-muted:     #78716c;
    --ink-faint:     #a8a29e;

    /* Accent — the mint green from the reference */
    --accent:        #a7e9a4;
    --accent-hover:  #93e08f;
    --accent-press:  #7fd67b;
    --accent-ink:    #14532d;
    --accent-soft:   #eefaed;

    /* Status */
    --info-bg:       #eff6ff;
    --info-ink:      #1d4ed8;
    --ok-bg:         #dcfce7;
    --ok-ink:        #166534;
    --warn-bg:       #fef3c7;
    --warn-ink:      #92400e;
    --danger-bg:     #fee2e2;
    --danger-ink:    #991b1b;
    --new-bg:        #fce7f3;
    --new-ink:       #9d174d;

    --radius:        12px;
    --radius-sm:     8px;
    --radius-pill:   999px;

    --sidebar-w:     236px;

    --shadow-sm:     0 1px 2px rgba(28, 25, 23, .04);
    --shadow-md:     0 4px 16px rgba(28, 25, 23, .08);
    --shadow-lg:     0 16px 48px rgba(28, 25, 23, .14);
}

* { -webkit-font-smoothing: antialiased; }

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--ink); }
a:hover { color: var(--ink-2); }

code {
    background: var(--surface-2);
    border-radius: 4px;
    padding: .1rem .3rem;
    color: var(--ink-2);
    font-size: .85em;
}

/* ===== Shell ============================================================ */

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    background: var(--bg);
    border-right: 1px solid var(--line);
    z-index: 1030;
}

.main {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
}

.content {
    padding: 0 2rem 3rem;
    width: 100%;
    /* Full width by request — no reading-measure cap. The tables and the
       calendar grid were the reason for the old 1400px limit and they both
       stretch cleanly, so nothing needed changing alongside this. */
    max-width: 100%;
}

/* ===== Sidebar ========================================================== */

.sidebar-top { padding: 1.25rem 1rem .5rem; }

.brand {
    display: block;
    text-align: center;
    font-weight: 800;
    font-size: 1.4rem;
    letter-spacing: -.02em;
    text-decoration: none;
    color: var(--ink);
    margin-bottom: 1rem;
}
.brand:hover { color: var(--ink); }

.btn-client {
    width: 100%;
    background: var(--accent);
    border: none;
    color: var(--accent-ink);
    font-weight: 700;
    border-radius: var(--radius-pill);
    padding: .55rem 1rem;
    font-size: .9rem;
    transition: background .15s ease;
}
.btn-client:hover,
.btn-client:focus { background: var(--accent-hover); color: var(--accent-ink); }
.btn-client::after { margin-left: .4rem; opacity: .6; }

.sidebar-nav {
    padding: .5rem .625rem;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.nav-item-link {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .5rem .7rem;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: background .12s ease, color .12s ease;
}
.nav-item-link:hover { background: var(--surface-2); color: var(--ink); }
.nav-item-link.active { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.nav-item-link .bi { font-size: 1rem; color: var(--ink-muted); }
.nav-item-link.active .bi { color: var(--accent-ink); }
.nav-item-link.disabled { opacity: .45; pointer-events: none; }

.nav-count {
    margin-left: auto;
    font-size: .78rem;
    color: var(--ink-muted);
    font-weight: 600;
}
.nav-count.is-hot {
    background: var(--warn-bg);
    color: var(--warn-ink);
    border-radius: var(--radius-pill);
    padding: 0 .45rem;
}

.badge-new {
    margin-left: auto;
    background: var(--new-bg);
    color: var(--new-ink);
    font-size: .68rem;
    font-weight: 700;
    border-radius: var(--radius-pill);
    padding: .1rem .45rem;
}

.sidebar-label {
    padding: 1.25rem 1.25rem .4rem;
    font-size: .78rem;
    color: var(--ink-muted);
    font-weight: 500;
}

.channel-list {
    padding: 0 .625rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .4rem .7rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--ink-2);
    font-size: .875rem;
}
.channel-item:hover { background: var(--surface-2); color: var(--ink); }
.channel-item .channel-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.channel-item.is-paused { opacity: .5; }

.channel-icon {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: .85rem;
    flex: 0 0 auto;
}

.channel-more {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .45rem .7rem;
    margin: .25rem .625rem 0;
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    text-decoration: none;
    font-size: .875rem;
}
.channel-more:hover { background: var(--surface-2); color: var(--ink); }
.channel-more .plus {
    width: 26px; height: 26px;
    border-radius: 7px;
    display: grid; place-items: center;
    background: var(--surface-2);
    color: var(--ink-2);
}

.sidebar-foot {
    border-top: 1px solid var(--line);
    padding: .75rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6ee7b7);
    color: var(--accent-ink);
    display: grid; place-items: center;
    font-weight: 700;
    font-size: .8rem;
    flex: 0 0 auto;
}
.sidebar-foot .who {
    min-width: 0;
    font-size: .78rem;
    color: var(--ink-muted);
    line-height: 1.25;
}
.sidebar-foot .who strong {
    display: block;
    color: var(--ink);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== Topbar =========================================================== */

.topbar {
    padding: 1.75rem 2rem 1.25rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.greeting { display: flex; align-items: center; gap: .85rem; }

.greeting-emoji {
    width: 46px; height: 46px;
    border-radius: 12px;
    background: var(--surface-2);
    display: grid; place-items: center;
    font-size: 1.4rem;
    flex: 0 0 auto;
}

.greeting h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0;
}
.greeting .sub {
    font-size: .85rem;
    color: var(--ink-muted);
    margin: .1rem 0 0;
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0;
}
.page-title .sub {
    font-size: .875rem;
    color: var(--ink-muted);
    margin: .25rem 0 0;
    max-width: 70ch;
}

/* ===== Stat strip ======================================================= */

.stat-strip {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    overflow: hidden;
}
.stat-strip.has-banner { border-radius: var(--radius) var(--radius) 0 0; border-bottom: none; }

.stat-cell {
    display: flex;
    align-items: center;
    gap: .85rem;
    padding: 1.1rem 1.5rem;
}
.stat-cell + .stat-cell { border-left: 1px solid var(--line); }

.stat-ring {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--bg);
    border: 1px solid var(--line-strong);
    display: grid; place-items: center;
    font-weight: 700;
    font-size: 1rem;
    flex: 0 0 auto;
}
.stat-cell .label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--ink-2);
}
.stat-cell .bi-info-circle { color: var(--ink-faint); font-size: .8rem; }

.strip-banner {
    background: var(--info-bg);
    border: 1px solid var(--line);
    border-top: none;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: .7rem 1.5rem;
    font-size: .875rem;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: .5rem;
}
.strip-banner a { color: var(--info-ink); font-weight: 600; }

/* ===== Section headings ================================================= */

.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 2rem 0 .85rem;
    letter-spacing: -.01em;
}

/* ===== Cards ============================================================ */

.card {
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: none;
}
.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: .92rem;
    padding: .85rem 1.15rem;
}
.card-body { padding: 1.15rem; }
.card-footer { background: transparent; border-top: 1px solid var(--line); }

/* Soft filled card, used for the "First steps" tiles and empty states */
.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.15rem 1.25rem;
    position: relative;
    height: 100%;
}
.tile h3 { font-size: .95rem; font-weight: 700; margin: 0 0 .3rem; }
.tile p  { font-size: .875rem; color: var(--ink-muted); margin: 0 0 .9rem; }
.tile .tile-check {
    position: absolute;
    top: 1.1rem; right: 1.15rem;
    color: var(--ink-faint);
    font-size: 1rem;
}
.tile .tile-check.is-done { color: #16a34a; }

.empty-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    min-height: 190px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--ink-muted);
    font-size: .875rem;
}
.empty-icon {
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--surface-3);
    display: grid; place-items: center;
    margin: 0 auto .75rem;
    color: var(--ink-muted);
    font-size: 1.15rem;
}

/* Panel with a header + flush list, used for "Up next" style lists */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .8rem 1.15rem;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: .9rem;
}
.panel-row {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .7rem 1.15rem;
    font-size: .85rem;
}
.panel-row + .panel-row { border-top: 1px solid var(--line); }

/* ===== Buttons ========================================================== */

.btn {
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 600;
    padding: .45rem .9rem;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.btn-lg { padding: .6rem 1.15rem; font-size: .95rem; border-radius: var(--radius-sm); }
.btn-sm { padding: .28rem .6rem; font-size: .8rem; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}
.btn-primary:hover,
.btn-primary:focus {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-ink);
}
.btn-primary:active,
.btn-primary:disabled {
    background: var(--accent-press) !important;
    border-color: var(--accent-press) !important;
    color: var(--accent-ink) !important;
}
.btn-check:checked + .btn-primary { background: var(--accent-press); border-color: var(--accent-press); }

.btn-outline-secondary {
    border-color: var(--line-strong);
    color: var(--ink-2);
    background: var(--bg);
}
.btn-outline-secondary:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.btn-outline-primary {
    border-color: var(--line-strong);
    color: var(--ink);
    background: var(--bg);
}
.btn-outline-primary:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.btn-outline-danger { border-color: #fca5a5; color: #b91c1c; }
.btn-outline-danger:hover { background: #fef2f2; border-color: #f87171; color: #991b1b; }

.btn-success { background: #16a34a; border-color: #16a34a; }
.btn-danger  { background: #dc2626; border-color: #dc2626; }

/* ===== Badges =========================================================== */

.badge {
    font-weight: 600;
    font-size: .72rem;
    border-radius: var(--radius-pill);
    padding: .25rem .6rem;
    letter-spacing: .01em;
}
.text-bg-primary   { background: var(--info-bg) !important;  color: var(--info-ink) !important; }
.text-bg-success   { background: var(--ok-bg) !important;    color: var(--ok-ink) !important; }
.text-bg-warning   { background: var(--warn-bg) !important;  color: var(--warn-ink) !important; }
.text-bg-danger    { background: var(--danger-bg) !important;color: var(--danger-ink) !important; }
.text-bg-info      { background: #e0f2fe !important;         color: #075985 !important; }
.text-bg-secondary { background: var(--surface-3) !important;color: var(--ink-2) !important; }
.text-bg-light     { background: var(--surface-2) !important;color: var(--ink-muted) !important; }
.text-bg-dark      { background: var(--ink) !important;      color: #fff !important; }

/* ===== Forms ============================================================ */

.form-label { font-size: .85rem; font-weight: 600; color: var(--ink-2); margin-bottom: .35rem; }
.form-text  { font-size: .78rem; color: var(--ink-muted); }

.form-control, .form-select {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    font-size: .9rem;
    padding: .5rem .7rem;
    color: var(--ink);
    background-color: var(--bg);
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent-press);
    box-shadow: 0 0 0 3px rgba(167, 233, 164, .35);
}
.form-control::placeholder { color: var(--ink-faint); }
.form-control-sm, .form-select-sm { font-size: .82rem; padding: .3rem .55rem; }

.form-check-input { border-color: var(--line-strong); }
.form-check-input:checked {
    background-color: var(--accent-press);
    border-color: var(--accent-press);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(167, 233, 164, .35); border-color: var(--accent-press); }

/* ===== Tables =========================================================== */

.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: .875rem; }
.table > thead > tr > th {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ink-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--line);
    padding: .7rem 1.15rem;
    background: var(--surface);
}
.table > tbody > tr > td {
    padding: .8rem 1.15rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.table > tbody > tr:last-child > td { border-bottom: none; }
.table-hover > tbody > tr:hover > * { background: var(--surface); }

/* ===== Alerts =========================================================== */

.alert {
    border-radius: var(--radius);
    border: 1px solid var(--line);
    font-size: .875rem;
    padding: .8rem 1.1rem;
}
.alert-success { background: var(--ok-bg);     border-color: #bbf7d0; color: var(--ok-ink); }
.alert-danger  { background: var(--danger-bg); border-color: #fecaca; color: var(--danger-ink); }
.alert-warning { background: var(--warn-bg);   border-color: #fde68a; color: var(--warn-ink); }
.alert-info    { background: var(--info-bg);   border-color: #bfdbfe; color: #1e40af; }
.alert-secondary { background: var(--surface); border-color: var(--line); color: var(--ink-2); }

/* ===== Dropdowns & modals =============================================== */

.dropdown-menu {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    font-size: .875rem;
    padding: .35rem;
}
.dropdown-item { border-radius: var(--radius-sm); padding: .45rem .7rem; }
.dropdown-item:active { background: var(--accent-soft); color: var(--ink); }

.modal-content {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.modal-header, .modal-footer { border-color: var(--line); padding: 1rem 1.25rem; }
.modal-body { padding: 1.25rem; }
.modal-title { font-size: 1rem; font-weight: 700; }

/* ===== Channel chips (compose target picker) ============================ */

/* Fixed-width columns, so a name gets room to be read. The icon-only row this
   replaced cut every label to ~8 characters — "balu Cha…", "image r…" — which
   left two accounts on the same platform impossible to tell apart. */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: .75rem .4rem;
    align-items: start;
}

.channel-chip {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}
.channel-chip input {
    position: absolute;
    opacity: 0;
    width: 0; height: 0;
}
.channel-chip label {
    display: grid;
    place-items: center;
    width: 48px; height: 48px;
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--ink-muted);
    font-size: 1.2rem;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .14s ease;
    position: relative;
}
.channel-chip label:hover { background: var(--surface-3); }
.channel-chip input:checked + label {
    background: var(--chip-brand, var(--ink));
    color: #fff;
    border-color: var(--chip-brand, var(--ink));
}
.channel-chip input:focus-visible + label { box-shadow: 0 0 0 3px rgba(167, 233, 164, .5); }
.channel-chip input:checked + label::after {
    content: "";
    position: absolute;
    right: -3px; bottom: -3px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
}
.channel-chip .chip-meta {
    display: block;
    text-align: center;
    font-size: .68rem;
    color: var(--ink-muted);
    margin-top: .3rem;
    max-width: 100%;
    line-height: 1.25;
    overflow-wrap: anywhere;
    /* Two lines, then an ellipsis; the full name is in the title attribute. */
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}

/* Only shown when a channel has a requirement the operator must act on. */
.channel-chip .chip-note {
    display: block;
    text-align: center;
    font-size: .62rem;
    font-weight: 600;
    color: var(--warn-ink);
    background: var(--warn-bg);
    border-radius: var(--radius-pill);
    padding: .05rem .4rem;
    margin-top: .2rem;
    max-width: 100%;
    line-height: 1.3;
}

/* ===== Composer ========================================================= */

.composer {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.composer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--line);
}
.composer-head h2 { font-size: 1.05rem; font-weight: 700; margin: 0; }

.composer-split {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
}
.composer-left  { padding: 1.25rem; border-right: 1px solid var(--line); }
.composer-right { padding: 1.25rem; background: var(--surface); }

.composer-editor {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    overflow: hidden;
}
.composer-editor textarea {
    border: none;
    border-radius: 0;
    resize: vertical;
    min-height: 230px;
    font-size: .95rem;
    line-height: 1.6;
    padding: 1rem;
}
.composer-editor textarea:focus { box-shadow: none; }

.composer-toolbar {
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem .75rem;
    border-top: 1px solid var(--line);
    background: var(--bg);
}
.composer-toolbar .tool {
    width: 30px; height: 30px;
    display: grid; place-items: center;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--ink-muted);
    font-size: .95rem;
}
.composer-toolbar .tool:hover { background: var(--surface-2); color: var(--ink); }
.composer-toolbar .count { margin-left: auto; font-size: .78rem; color: var(--ink-muted); }

.dropzone {
    border: 1.5px dashed var(--line-strong);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    color: var(--ink-muted);
    font-size: .82rem;
    background: var(--bg);
    cursor: pointer;
    transition: border-color .14s ease, background .14s ease;
}
.dropzone:hover, .dropzone.is-over {
    border-color: var(--accent-press);
    background: var(--accent-soft);
}
.dropzone .bi { font-size: 1.35rem; display: block; margin-bottom: .35rem; color: var(--ink-muted); }
.dropzone strong { color: #15803d; font-weight: 600; }
.dropzone input[type="file"] { display: none; }

.preview-empty {
    display: grid;
    place-items: center;
    text-align: center;
    color: var(--ink-muted);
    font-size: .875rem;
    min-height: 300px;
}
.preview-skeleton {
    width: 160px;
    margin: 0 auto 1.25rem;
    opacity: .55;
}
.preview-skeleton .sk-line {
    height: 8px;
    border-radius: 4px;
    background: var(--surface-3);
    margin-bottom: 6px;
}
.preview-skeleton .sk-block {
    height: 110px;
    border-radius: 8px;
    background: var(--surface-3);
    margin-top: 10px;
}

.preview-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .9rem 1rem;
    margin-bottom: .75rem;
}
.preview-card .pv-head {
    display: flex; align-items: center; gap: .5rem;
    margin-bottom: .5rem;
}
.preview-card .pv-body {
    font-size: .85rem;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--ink-2);
}
.preview-card .pv-media {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 3px;
    margin-top: .6rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.preview-card .pv-media.is-single { grid-template-columns: 1fr; }
.preview-card .pv-media-item {
    display: block;
    background: var(--surface-2);
    aspect-ratio: 1 / 1;
}
.preview-card .pv-media.is-single .pv-media-item { aspect-ratio: 16 / 9; }
.preview-card .pv-media-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.preview-card .pv-media-item.is-video,
.preview-card .pv-media-item.is-more {
    display: grid;
    place-items: center;
    color: var(--ink-muted);
    font-size: 1.1rem;
}
.preview-card .pv-media-item.is-more { font-size: .8rem; font-weight: 600; }

.preview-card .pv-limit { font-size: .72rem; margin-top: .5rem; color: var(--ink-muted); }
.preview-card.is-over { border-color: #fca5a5; }
.preview-card.is-over .pv-limit { color: var(--danger-ink); font-weight: 600; }

/* ===== Per-platform variants + media library ============================ */

.variant-toggle {
    background: none;
    border: none;
    padding: .35rem 0;
    font-size: .875rem;
    font-weight: 600;
    color: var(--ink-2);
    display: flex;
    align-items: center;
    gap: .4rem;
}
.variant-toggle:hover { color: var(--ink); }

.variant-panel {
    border-top: 1px solid var(--line);
    padding-top: .5rem;
}

.variant-block {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .85rem 1rem;
}
.variant-block .channel-icon { width: 20px; height: 20px; border-radius: 5px; font-size: .65rem; }

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: .5rem;
    max-height: 17rem;
    overflow-y: auto;
    padding: .25rem;
}

.library-item {
    position: relative;
    cursor: pointer;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface-2);
    display: block;
}
.library-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.library-item img,
.library-item .library-video {
    display: block;
    width: 100%;
    height: 72px;
    object-fit: cover;
}
.library-item .library-video {
    display: grid;
    place-items: center;
    color: var(--ink-muted);
    font-size: 1.3rem;
}
.library-item .library-name {
    display: block;
    font-size: .65rem;
    color: var(--ink-muted);
    padding: .2rem .3rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.library-item:has(input:checked) {
    border-color: var(--accent-press);
    background: var(--accent-soft);
}
.library-item:has(input:checked)::after {
    content: "✓";
    position: absolute;
    top: 4px; right: 4px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--accent-press);
    color: var(--accent-ink);
    font-size: .7rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

/* ===== Calendar grid ==================================================== */

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    background: var(--line);
    gap: 1px;
    border-radius: var(--radius);
    overflow: hidden;
}

.cal-head {
    background: var(--surface);
    padding: .5rem .6rem;
    font-size: .72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--ink-muted);
    text-align: center;
}

.cal-cell {
    background: var(--bg);
    min-height: 118px;
    padding: .35rem;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transition: background .12s ease;
}
.cal-week .cal-cell { min-height: 320px; }
.cal-cell.is-outside { background: var(--surface); }
.cal-cell.is-outside .cal-date { opacity: .45; }
.cal-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent-press); }
.cal-cell.is-drop { background: var(--accent-soft); }

.cal-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink-2);
    padding: 0 .15rem .1rem;
}
.cal-count {
    font-size: .62rem;
    font-weight: 700;
    background: var(--surface-2);
    color: var(--ink-muted);
    border-radius: var(--radius-pill);
    padding: 0 .35rem;
}

.cal-chip {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-size: .7rem;
    line-height: 1.3;
    padding: .22rem .35rem;
    border-radius: 5px;
    background: var(--surface-2);
    border-left: 3px solid var(--client-color, var(--ink-muted));
    color: var(--ink-2);
    cursor: default;
    overflow: hidden;
}
/* Month view shows the first few entries of a busy day and folds the rest
   behind "+N more". They stay in the page — only hidden — so drag, click and
   search-in-page keep working once the day is opened. */
.cal-cell:not(.is-expanded) .cal-chip.is-overflow { display: none; }
.cal-more {
    font-size: .68rem;
    font-weight: 600;
    color: var(--ink-muted);
    background: none;
    border: 0;
    border-radius: 5px;
    padding: .15rem .35rem;
    text-align: left;
    cursor: pointer;
}
.cal-more:hover, .cal-more:focus-visible { background: var(--surface-2); color: var(--ink); }

.cal-chip[draggable="true"] { cursor: grab; }
.cal-chip[draggable="true"]:active { cursor: grabbing; }
.cal-chip.is-dragging { opacity: .4; }
.cal-chip .cal-time { font-variant-numeric: tabular-nums; color: var(--ink-muted); flex: 0 0 auto; }
.cal-chip .cal-icon { flex: 0 0 auto; display: inline-flex; }
.cal-chip .cal-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cal-chip.status-published    { background: var(--ok-bg); }
.cal-chip.status-failed       { background: var(--danger-bg); }
.cal-chip.status-manual_pending { background: var(--warn-bg); }
.cal-chip.status-draft        { opacity: .65; border-style: dashed; }

/* ===== Bulk action bar ================================================== */

.bulk-bar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    background: var(--accent-soft);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: .6rem .9rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

/* ===== Alert list ======================================================= */

.alert-row {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .7rem 1.15rem;
    font-size: .875rem;
}
.alert-row + .alert-row { border-top: 1px solid var(--line); }
.alert-row .alert-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-top: .4rem;
    flex: 0 0 auto;
}
.alert-row.sev-error .alert-dot   { background: #dc2626; }
.alert-row.sev-warning .alert-dot { background: #d97706; }

@media (max-width: 767.98px) {
    .cal-grid { font-size: .8rem; }
    .cal-cell { min-height: 84px; }
    .cal-chip .cal-text { display: none; }
}

/* ===== Logs ============================================================= */

.run-output, .log-context {
    background: #1c1917;
    color: #e7e5e4;
    border-radius: var(--radius-sm);
    padding: .8rem 1rem;
    font-size: .78rem;
    line-height: 1.55;
    max-height: 22rem;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
}
.log-context { margin-top: .35rem; font-size: .72rem; }

/* ===== Health pills ===================================================== */

.health-pill {
    flex: 0 0 auto;
    padding: .18rem .6rem;
    border-radius: var(--radius-pill);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .05em;
}
.health-ok   { background: var(--ok-bg);     color: var(--ok-ink); }
.health-warn { background: var(--warn-bg);   color: var(--warn-ink); }
.health-fail { background: var(--danger-bg); color: var(--danger-ink); }

.list-group-item {
    background: transparent;
    border-color: var(--line);
    padding: .8rem 1.15rem;
    font-size: .875rem;
}

/* ===== Manual queue ===================================================== */

.manual-text {
    background: var(--surface);
    border-color: var(--line);
    font-size: .875rem;
    line-height: 1.6;
}

/* ===== Login ============================================================ */

.login-body {
    min-height: 100vh;
    /* A soft, static wash of white into the mint accent and a cool blue. */
    background: linear-gradient(
        135deg,
        #ffffff 0%,
        var(--accent-soft) 28%,
        #eef4ff 58%,
        #ffffff 100%
    );
}

/* A second, softer wash on top so the corners do not read as flat. */
.login-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(900px 420px at 12% 0%, rgba(167, 233, 164, .30), transparent 65%),
        radial-gradient(760px 380px at 88% 100%, rgba(186, 214, 255, .32), transparent 65%);
}

/* SignupGuard's trap for form-filling scripts. Moved off-screen rather than
   display:none, which the better scripts check for. Never visible to a person. */
.hp-field {
    position: absolute !important;
    left: -10000px;
    top: auto;
    width: 1px; height: 1px;
    overflow: hidden;
}

.login-wrap {
    display: flex; align-items: center; justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}
.login-card {
    width: 100%;
    max-width: 25rem;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    /* Above the ::before wash, which is fixed and would otherwise cover it. */
    position: relative;
    z-index: 1;
}
.login-mark {
    width: 52px; height: 52px;
    border-radius: 14px;
    background: var(--accent);
    color: var(--accent-ink);
    display: grid; place-items: center;
    font-weight: 800; font-size: 1.25rem;
    margin: 0 auto;
}

/* ===== Social sign-in =================================================== */

/*
 * Each button is its own <form> so the flow starts as a POST (login CSRF —
 * see the note at the top of oauth-login.php). The gap therefore has to come
 * from the stack rather than from margins on the buttons themselves.
 */
.social-signin {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.btn-social {
    --brand: var(--ink-2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    padding: .625rem 1rem;
    font-weight: 600;
    color: var(--ink);
    background: var(--bg);
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn-social:hover,
.btn-social:focus-visible {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
/* The brand colour lives on the icon only — a full brand-coloured button next
   to another one turns the screen into a paint chart. */
.btn-social .bi {
    color: var(--brand);
    font-size: 1.15rem;
    line-height: 1;
}

.social-divider {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .8rem;
    color: var(--ink-muted);
}
.social-divider::before,
.social-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* Rows on signin.php */
.identity-row {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .875rem 0;
    border-bottom: 1px solid var(--line);
}
.identity-row:last-child { border-bottom: 0; }
.identity-icon {
    width: 38px; height: 38px;
    flex: 0 0 38px;
    display: grid; place-items: center;
    border-radius: 10px;
    color: #fff;
    font-size: 1.05rem;
}

/* ===== Utilities ======================================================== */

.text-body-secondary { color: var(--ink-muted) !important; }
.border-top { border-color: var(--line) !important; }
.font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.hint {
    font-size: .8rem;
    color: var(--ink-muted);
}

/* ===== Responsive ======================================================= */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: var(--shadow-lg);
    }
    .sidebar.is-open { transform: none; }
    .main { margin-left: 0; }
    .content, .topbar { padding-left: 1rem; padding-right: 1rem; }
    .composer-split { grid-template-columns: 1fr; }
    .composer-left { border-right: none; border-bottom: 1px solid var(--line); }
    .sidebar-toggle { display: inline-flex !important; }
}

/* Phones: the greeting plus an action button is wider than the screen, and a
   topbar that cannot wrap pushed the whole page into a sideways scroll. */
@media (max-width: 575.98px) {
    .topbar { flex-wrap: wrap; }
    .topbar > div:first-child { min-width: 0; }
    .greeting h1 { font-size: 1.2rem; overflow-wrap: anywhere; }
    .greeting-emoji { display: none; }
}

.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--ink-2);
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(28, 25, 23, .35);
    z-index: 1029;
    display: none;
}
.sidebar-backdrop.is-open { display: block; }

/* ===== Dark mode ========================================================
   The reference design is light-first; this keeps the app usable for anyone
   whose OS is set to dark without inventing a second visual language.
   ======================================================================== */

/* Dark follows the OS unless the operator picked a theme with the toggle
   (assets/js/theme.js sets data-theme on <html>). The two blocks below must
   stay identical apart from their selector prefix. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:          #17161a;
        --surface:     #1e1d22;
        --surface-2:   #26252b;
        --surface-3:   #302f36;
        --line:        #2e2d34;
        --line-strong: #3d3c45;
        --ink:         #f5f5f4;
        --ink-2:       #d6d3d1;
        --ink-muted:   #a1a1aa;
        --ink-faint:   #71717a;
        --accent-soft: #1c2f22;
        --info-bg:     #14263f;
        --ok-bg:       #14311f;
        --ok-ink:      #86efac;
        --warn-bg:     #3a2c10;
        --warn-ink:    #fcd34d;
        --danger-bg:   #3b1618;
        --danger-ink:  #fca5a5;
        --new-bg:      #3a1428;
        --new-ink:     #f9a8d4;
    }
    :root:not([data-theme="light"]) body { background: var(--bg); color: var(--ink); }
    :root:not([data-theme="light"]) .table > thead > tr > th { background: var(--surface); }
    :root:not([data-theme="light"]) .form-control, :root:not([data-theme="light"]) .form-select { background-color: var(--surface); color: var(--ink); }
    :root:not([data-theme="light"]) .btn-outline-secondary, :root:not([data-theme="light"]) .btn-outline-primary { background: var(--surface); }
    :root:not([data-theme="light"]) .run-output, :root:not([data-theme="light"]) .log-context { background: #0e0d10; }
}

:root[data-theme="dark"] {
    --bg:          #17161a;
    --surface:     #1e1d22;
    --surface-2:   #26252b;
    --surface-3:   #302f36;
    --line:        #2e2d34;
    --line-strong: #3d3c45;
    --ink:         #f5f5f4;
    --ink-2:       #d6d3d1;
    --ink-muted:   #a1a1aa;
    --ink-faint:   #71717a;
    --accent-soft: #1c2f22;
    --info-bg:     #14263f;
    --ok-bg:       #14311f;
    --ok-ink:      #86efac;
    --warn-bg:     #3a2c10;
    --warn-ink:    #fcd34d;
    --danger-bg:   #3b1618;
    --danger-ink:  #fca5a5;
    --new-bg:      #3a1428;
    --new-ink:     #f9a8d4;
}
:root[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
:root[data-theme="dark"] .table > thead > tr > th { background: var(--surface); }
:root[data-theme="dark"] .form-control, :root[data-theme="dark"] .form-select { background-color: var(--surface); color: var(--ink); }
:root[data-theme="dark"] .btn-outline-secondary, :root[data-theme="dark"] .btn-outline-primary { background: var(--surface); }
:root[data-theme="dark"] .run-output, :root[data-theme="dark"] .log-context { background: #0e0d10; }

:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { color-scheme: dark; }
}

.theme-toggle {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-muted);
    border-radius: 999px;
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }
.theme-toggle.is-floating { position: fixed; top: 1rem; right: 1rem; z-index: 1050; }

/* ===========================================================================
   Connect a channel — the picker grid and the "how would you like to connect"
   chooser. Modelled on the two reference screens, using this project's own
   tokens so it stays consistent in both light and dark.
   =========================================================================== */

.connect-sheet {
    max-width: 780px;
    margin: 0 auto 2rem;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.75rem 1.75rem 1.5rem;
}

.connect-sheet-head {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1.5rem;
}

/* The head is a three-slot bar: back, centred mark, close. The spacer keeps the
   mark centred whether or not a back arrow is present. */
.connect-sheet-head > :first-child { margin-right: auto; }
.connect-sheet-head > :last-child  { margin-left: auto; }
.connect-sheet-head .connect-tile-sm { margin: 0 auto; }

.connect-back,
.connect-close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    color: var(--ink-2);
    text-decoration: none;
    flex: 0 0 auto;
    transition: background .12s ease, border-color .12s ease;
}

.connect-back:hover,
.connect-close:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--ink);
}

.connect-title {
    font-size: 1.35rem;
    font-weight: 600;
    letter-spacing: -.01em;
    margin: 0;
    color: var(--ink);
}

.connect-sub {
    font-size: .85rem;
    color: var(--ink-muted);
    margin: .3rem 0 0;
}

.connect-foot {
    font-size: .8rem;
    color: var(--ink-muted);
    text-align: center;
    margin: 1.5rem 0 0;
}

.connect-note {
    font-size: .8rem;
    color: var(--ink-muted);
    margin: 1.25rem 0 0;
    padding: .7rem .85rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}

/* --- the grid of channels ------------------------------------------------ */

.connect-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: .85rem;
}

.connect-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: .5rem;
    padding: 1.4rem .9rem 1.15rem;
    min-height: 148px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    text-decoration: none;
    text-align: center;
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.connect-card:hover {
    border-color: var(--line-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.connect-card:focus-visible {
    outline: 2px solid var(--accent-press);
    outline-offset: 2px;
}

/* Flagged-off channels stay clickable — an existing account still needs
   editing — but read as unavailable at a glance. */
.connect-card.is-off .connect-tile { filter: grayscale(1); opacity: .5; }
.connect-card.is-off .connect-card-name { color: var(--ink-muted); }

.connect-tile {
    width: 44px;
    height: 44px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.35rem;
    flex: 0 0 auto;
}

.connect-tile-sm {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: .95rem;
}

.connect-card-name {
    font-size: .92rem;
    font-weight: 600;
    color: var(--ink);
    line-height: 1.2;
}

.connect-card-sub {
    font-size: .76rem;
    color: var(--ink-muted);
    line-height: 1.3;
}

.connect-flag {
    position: absolute;
    top: .55rem;
    left: .6rem;
    font-size: .75rem;
    color: var(--ink-faint);
}

/* --- the "how would you like to connect" panels -------------------------- */

.route-grid {
    display: grid;
    grid-template-columns: 1.35fr 1fr;
    gap: 1rem;
    align-items: start;
    margin-top: 1.5rem;
}

/* Three routes (Instagram) get equal columns; two get a weighted split that
   gives the recommended one more room. */
.route-grid-3 { grid-template-columns: repeat(3, 1fr); }

.route-card {
    display: flex;
    flex-direction: column;
    gap: .6rem;
    padding: 1.35rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    height: 100%;
}

.route-card.is-primary { border-color: var(--line-strong); }
.route-card.is-blocked { background: var(--surface); }

.route-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--ink);
}

.route-badge {
    align-self: flex-start;
    font-size: .72rem;
    font-weight: 500;
    padding: .18rem .5rem;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.route-badge.is-muted {
    background: var(--surface-3);
    color: var(--ink-muted);
}

.route-features {
    list-style: none;
    margin: .35rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .5rem;
}

.route-features li {
    display: flex;
    gap: .5rem;
    font-size: .82rem;
    line-height: 1.4;
    color: var(--ink-2);
}

.route-features .bi {
    color: var(--accent-press);
    flex: 0 0 auto;
    margin-top: .12rem;
}

.route-card.is-blocked .route-features .bi { color: var(--ink-faint); }

.route-cta { margin-top: auto; }

.route-blocked {
    font-size: .78rem;
    color: var(--ink-muted);
    margin: .35rem 0 0;
    padding-top: .6rem;
    border-top: 1px solid var(--line);
}

@media (max-width: 720px) {
    .connect-sheet     { padding: 1.25rem 1rem; }
    .connect-grid      { grid-template-columns: repeat(2, 1fr); }
    .route-grid,
    .route-grid-3      { grid-template-columns: 1fr; }
}

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

/* Chip preview dialog on the calendar grid. */
.chip-preview-body {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: .85rem 1rem;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    font-size: .9rem;
    line-height: 1.55;
    color: var(--ink);
    max-height: 22rem;
    overflow-y: auto;
}

.chip-preview-media {
    width: 84px;
    height: 84px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
}

.cal-chip { cursor: pointer; }

/* ---------------------------------------------------------------------------
   Review funnel (reviews.php)

   The customer-facing page has its own self-contained styles in r.php — it is
   the only screen a stranger sees and must not inherit this app's chrome. What
   follows is only the operator's setup and dashboard.
   --------------------------------------------------------------------------- */

/* Numbered badge on each setup step's card header. */
.review-step {
    display: inline-grid;
    place-items: center;
    width: 1.4rem;
    height: 1.4rem;
    margin-right: .35rem;
    border-radius: var(--radius-pill);
    background: var(--accent);
    color: var(--accent-ink);
    font-size: .75rem;
    font-weight: 700;
}

.review-logo-preview {
    width: 84px;
    height: 84px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    border: 1px solid var(--line);
    background: #fff;
    padding: .3rem;
    flex: 0 0 auto;
}

.review-logo-empty {
    display: grid;
    place-items: center;
    background: var(--surface-2);
    color: var(--ink-faint);
    font-size: 1.5rem;
}

/* The QR preview. max-width rather than a fixed size so the SVG scales down on
   a narrow column instead of overflowing the card. */
.review-qr {
    max-width: 15rem;
}

.review-qr svg {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-sm);
}

/* Sample of the uploaded pool. */
.review-pool {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 22rem;
    overflow-y: auto;
}

.review-pool li {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--line);
    font-size: .875rem;
    line-height: 1.5;
}

.review-pool li:last-child { border-bottom: 0; }

.review-pool-stars {
    color: #f59e0b;
    font-size: .75rem;
    letter-spacing: -.05em;
    flex: 0 0 auto;
}

.review-pool-body {
    flex: 1 1 auto;
    color: var(--ink-2);
    /* Two lines is enough to recognise one without the list becoming a wall. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.review-pool-served {
    flex: 0 0 auto;
    font-size: .75rem;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
}

/* Thirty-day scan sparkline. */
.review-spark {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 3rem;
}

.review-spark-bar {
    flex: 1 1 0;
    min-height: 2px;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    transition: background .12s;
}

.review-spark-bar:hover { background: var(--accent-press); }

/* Template download strip above the review upload field. */
.review-template-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: .75rem .875rem;
    margin-bottom: .875rem;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
}

/* ===========================================================================
   Public pages — the landing page (home.php) and the policy pages. Everything
   here is under .public-*, on this project's own tokens, so both themes work
   without a second set of rules.
   =========================================================================== */

.public-body {
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.public-body main { flex: 1 0 auto; }

.public-container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.25rem;
}

/* --- Top bar -------------------------------------------------------------- */
.public-nav {
    position: sticky; top: 0; z-index: 1030;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
}
.public-nav-inner {
    display: flex; align-items: center; gap: 1.5rem;
    min-height: 64px;
}
.public-brand {
    display: inline-flex; align-items: center; gap: .625rem;
    font-weight: 700; font-size: 1.0625rem;
    color: var(--ink); text-decoration: none;
    white-space: nowrap;
}
.public-brand:hover { color: var(--ink); }
.public-brand-mark {
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-ink);
    display: grid; place-items: center;
    font-size: 1rem;
}
.public-nav-links { display: none; gap: 1.5rem; margin-right: auto; }
.public-nav-links a {
    color: var(--ink-muted); text-decoration: none; font-size: .9375rem;
}
.public-nav-links a:hover { color: var(--ink); }
.public-nav-actions {
    display: flex; align-items: center; gap: .5rem;
    margin-left: auto;
}
@media (min-width: 768px) {
    .public-nav-links { display: flex; }
    .public-nav-actions { margin-left: 0; }
}

/* --- Hero ----------------------------------------------------------------- */
.public-hero {
    position: relative;
    padding: 4rem 0 3.5rem;
    background:
        radial-gradient(820px 380px at 8% 0%, rgba(167, 233, 164, .22), transparent 65%),
        radial-gradient(700px 360px at 96% 30%, rgba(147, 190, 255, .16), transparent 65%);
    border-bottom: 1px solid var(--line);
}
.public-hero-inner {
    display: grid; gap: 2.5rem; align-items: center;
    grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 992px) {
    .public-hero { padding: 5.5rem 0 5rem; }
    .public-hero-inner { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 3.5rem; }
}
.public-eyebrow {
    display: inline-block;
    padding: .3rem .75rem;
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--ok-ink);
    font-size: .8125rem; font-weight: 600;
    margin-bottom: 1.125rem;
}
.public-hero h1 {
    font-size: clamp(2rem, 4.4vw, 3.125rem);
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 1.125rem;
    text-wrap: balance;
}
.public-lead {
    font-size: 1.125rem; line-height: 1.6;
    color: var(--ink-muted);
    max-width: 34rem;
    margin-bottom: 1.75rem;
}
.public-hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

/* The calendar illustration. */
.public-mock {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow-lg);
    padding: 1.125rem;
    max-width: 26rem;
    margin: 0 auto;
}
.public-mock-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: .25rem .375rem .875rem;
}
.public-mock-title { font-weight: 700; }
.public-mock-head .badge-soft {
    font-size: .75rem; font-weight: 600;
    padding: .2rem .625rem;
    border-radius: var(--radius-pill);
    background: var(--accent-soft); color: var(--ok-ink);
}
.public-mock-row {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem .625rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
}
.public-mock-row + .public-mock-row { margin-top: .5rem; }
.public-mock-chip,
.public-channel-icon {
    flex: 0 0 auto;
    width: 34px; height: 34px;
    border-radius: 10px;
    background: var(--brand, var(--ink));
    color: #fff;
    display: grid; place-items: center;
    font-size: 1rem;
}
.public-mock-text { min-width: 0; margin-right: auto; }
.public-mock-text strong {
    display: block; font-size: .875rem; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.public-mock-text span { font-size: .75rem; color: var(--ink-muted); }
.public-mock-state {
    flex: 0 0 auto;
    font-size: .6875rem; font-weight: 600;
    padding: .2rem .5rem;
    border-radius: var(--radius-pill);
    background: var(--info-bg); color: var(--info-ink);
}
.public-mock-state.is-ok { background: var(--ok-bg); color: var(--ok-ink); }

/* --- Sections ------------------------------------------------------------- */
.public-section { padding: 4rem 0; }
.public-section.is-tinted {
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.public-h2 {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 750;
    letter-spacing: -.01em;
    margin-bottom: .5rem;
    text-wrap: balance;
}
.public-sub {
    color: var(--ink-muted);
    font-size: 1.0625rem;
    max-width: 40rem;
    margin-bottom: 2rem;
}

.public-channels {
    list-style: none; padding: 0; margin: 0 0 1.25rem;
    display: grid; gap: .75rem;
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
}
.public-channels li {
    display: flex; align-items: center; gap: .75rem;
    padding: .75rem .875rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    font-weight: 600; font-size: .9375rem;
}

.public-grid {
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.public-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1.5rem;
}
.public-card-icon {
    width: 40px; height: 40px;
    border-radius: 12px;
    background: var(--accent-soft);
    color: var(--ok-ink);
    display: grid; place-items: center;
    font-size: 1.125rem;
    margin-bottom: 1rem;
}
.public-card h3,
.public-steps h3 { font-size: 1.0625rem; font-weight: 700; margin-bottom: .375rem; }
.public-card p,
.public-steps p { color: var(--ink-muted); font-size: .9375rem; line-height: 1.6; margin: 0; }

.public-steps {
    list-style: none; padding: 0; margin: 1.75rem 0 0;
    display: grid; gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.public-step-num {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-ink);
    display: grid; place-items: center;
    font-weight: 800;
    margin-bottom: .875rem;
}

.public-security { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) {
    .public-security { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 3.5rem; }
}
.public-checks { list-style: none; padding: 0; margin: 0; display: grid; gap: .875rem; }
.public-checks li {
    position: relative;
    padding-left: 2rem;
    line-height: 1.55;
}
.public-checks li > .bi {
    position: absolute; left: 0; top: .1rem;
    color: var(--ok-ink); font-size: 1.125rem;
}

.public-cta { text-align: center; }
.public-cta .public-h2 { margin-bottom: 1.5rem; }

/* --- Policy pages --------------------------------------------------------- */
.public-doc {
    max-width: 46rem;
    padding-top: 3rem; padding-bottom: 4rem;
    line-height: 1.7;
}
.public-doc-head {
    padding-bottom: 1.5rem; margin-bottom: 1.75rem;
    border-bottom: 1px solid var(--line);
}
.public-doc h1 { font-size: clamp(1.75rem, 3.4vw, 2.375rem); font-weight: 800; letter-spacing: -.02em; }
.public-doc h2 {
    font-size: 1.3125rem; font-weight: 700;
    margin: 2.25rem 0 .75rem;
    scroll-margin-top: 5rem;
}
.public-doc h3 { font-size: 1.0625rem; font-weight: 700; margin: 1.5rem 0 .5rem; }
.public-doc li + li { margin-top: .375rem; }
.public-doc a,
.public-checks a { color: var(--info-ink); }

/* --- Footer --------------------------------------------------------------- */
.public-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 2.5rem 0 2rem;
}
.public-footer-inner {
    display: flex; flex-wrap: wrap; gap: 1.5rem 3rem;
    justify-content: space-between; align-items: flex-start;
    margin-bottom: 1.5rem;
}
.public-footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; }
.public-footer-links a { color: var(--ink-muted); text-decoration: none; font-size: .9375rem; }
.public-footer-links a:hover { color: var(--ink); text-decoration: underline; }
.public-footer-note { font-size: .8125rem; max-width: 46rem; }

/* Policy links under the sign-in card. */
.login-legal {
    position: relative; z-index: 1;
    text-align: center;
    margin-top: 1rem;
    font-size: .8125rem;
}
.login-legal a { color: var(--ink-muted); text-decoration: none; margin: 0 .5rem; }
.login-legal a:hover { color: var(--ink); text-decoration: underline; }
