/* ========================================
   ROOTS ADMIN DASHBOARD
   Depends on css/styles.css for the brand tokens in :root.
   This is a workspace, not a landing page: dense, quiet, quick to scan.
   ======================================== */

:root {
    --admin-bg:        #F4F5F6;
    --admin-surface:   #FFFFFF;
    --admin-line:      #E3E5E8;
    --admin-line-soft: #EFF1F3;
    --admin-ink:       #1F2225;
    --admin-ink-muted: #666B71;
    --admin-ink-faint: #8A9097;

    --sidebar-bg:      #241819;
    --sidebar-ink:     #B9AEAF;
    --sidebar-ink-dim: #7E7273;
    --sidebar-line:    #392A2B;
    --sidebar-active:  #FFFFFF;

    --sidebar-w: 258px;
    --header-h: 68px;

    --ok-bg:   #E4F1E7;  --ok-ink:   #1B5E32;
    --warn-bg: #FBEFD3;  --warn-ink: #7A5A12;
    --bad-bg:  #FAE3E3;  --bad-ink:  #8C2020;
    --neut-bg: #ECEEF0;  --neut-ink: #5A6067;
}

/* ========== Auth views (sign in, recovery, denied) ========== */

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

.auth-view.is-hidden { display: none; }

.auth-box {
    width: 100%;
    max-width: 400px;
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 12px;
    padding: 34px 32px 28px;
}

/* ---------- Sign in, two panel ---------- */

.auth-split {
    display: grid;
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1fr);
    width: 100%;
    max-width: 880px;
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 6px 28px rgba(36, 24, 25, 0.09);
}

.auth-aside {
    background: linear-gradient(150deg, var(--primary-red) 0%, var(--dark-red) 100%);
    color: var(--white);
    padding: 42px 34px;
    display: flex;
    align-items: center;
}

.auth-aside-inner { width: 100%; }

.auth-aside .brand-mark {
    display: block;
    color: var(--white);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.06em;
    line-height: 1.4;
}

.auth-aside .brand-sub {
    display: block;
    color: var(--light-orange);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 7px;
}

.auth-aside-text {
    font-size: 0.88rem;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.9);
    margin: 26px 0 20px;
}

.auth-aside-list {
    list-style: none;
    padding: 0;
    margin: 0 0 30px;
}

.auth-aside-list li {
    position: relative;
    padding-left: 22px;
    margin-bottom: 11px;
    font-size: 0.84rem;
    color: rgba(255, 255, 255, 0.88);
}

.auth-aside-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-orange);
}

.auth-aside-back {
    color: var(--light-orange);
    font-size: 0.82rem;
}

.auth-aside-back:hover { color: var(--white); }

.auth-panel { padding: 42px 38px 32px; }

.auth-title {
    font-size: 1.55rem;
    font-weight: 650;
    color: var(--admin-ink);
    margin: 0 0 6px;
}

.auth-subtitle {
    font-size: 0.87rem;
    color: var(--admin-ink-muted);
    margin: 0 0 26px;
    line-height: 1.55;
}

/* ---------- Show/hide password ---------- */

.password-wrap { position: relative; }

.password-wrap input { padding-right: 66px; width: 100%; }

.password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 6px 9px;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--admin-ink-muted);
    cursor: pointer;
    border-radius: 5px;
}

.password-toggle:hover { color: var(--primary-red); background: var(--admin-line-soft); }

.password-toggle:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 1px;
}

/* ---------- Help guide ---------- */

.auth-help {
    margin-top: 26px;
    border-top: 1px solid var(--admin-line-soft);
    padding-top: 18px;
}

.auth-help summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--admin-ink-muted);
    cursor: pointer;
    list-style: none;
    padding: 4px 0;
}

.auth-help summary::-webkit-details-marker { display: none; }

.auth-help summary:hover { color: var(--primary-red); }

.auth-help summary:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 3px;
    border-radius: 4px;
}

/* Rotates to point down when the guide is open. */
.auth-help summary::after {
    content: '';
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.18s;
}

.auth-help[open] summary::after { transform: rotate(45deg); }

.auth-help-body {
    margin-top: 14px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 8px;
}

.auth-help-body h2 {
    font-size: 0.85rem;
    font-weight: 650;
    color: var(--admin-ink);
    margin: 20px 0 6px;
}

.auth-help-body h2:first-child { margin-top: 0; }

.auth-help-body p,
.auth-help-body li {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--admin-ink-muted);
}

.auth-help-body p { margin: 0 0 8px; }

.auth-help-body ol {
    margin: 0 0 10px;
    padding-left: 20px;
}

.auth-help-body li { margin-bottom: 5px; }

.auth-help-body li::marker { color: var(--primary-orange); }

.auth-help-note {
    background: var(--warn-bg);
    color: var(--warn-ink) !important;
    padding: 11px 14px;
    border-radius: 7px;
    margin: 10px 0 0 !important;
}

.auth-foot-mobile { display: none; }

@media (max-width: 780px) {
    .auth-split { grid-template-columns: 1fr; max-width: 430px; }
    .auth-aside { display: none; }
    .auth-panel { padding: 34px 26px 26px; }
    .auth-foot-mobile { display: block; }
    .auth-help-body { max-height: none; }
}

.auth-centered { text-align: center; }

.auth-spinner {
    width: 26px;
    height: 26px;
    margin: 4px auto 16px;
    border: 3px solid var(--admin-line);
    border-top-color: var(--primary-orange);
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

@keyframes auth-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-spinner {
        animation: none;
        border-top-color: var(--admin-line);
    }
}

.auth-brand { margin-bottom: 22px; }

.auth-brand .brand-mark {
    display: block;
    color: var(--primary-red);
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.07em;
    line-height: 1.4;
}

.auth-brand .brand-sub {
    display: block;
    color: var(--admin-ink-faint);
    font-size: 0.7rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    margin-top: 5px;
}

.auth-note {
    color: var(--admin-ink-muted);
    font-size: 0.86rem;
    line-height: 1.6;
    margin: 0 0 16px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.auth-form .form-group { margin-bottom: 0; }

.auth-error {
    display: none;
    background: var(--bad-bg);
    color: var(--bad-ink);
    padding: 11px 14px;
    border-radius: 7px;
    font-size: 0.85rem;
}

.link-button {
    background: none;
    border: none;
    padding: 4px 2px;
    font-family: inherit;
    font-size: 0.85rem;
    color: var(--admin-ink-muted);
    text-decoration: underline;
    cursor: pointer;
    align-self: center;
    transition: color 0.15s;
}

.link-button:hover { color: var(--primary-red); }

.link-button:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 2px;
    border-radius: 4px;
}

.auth-foot {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--admin-line-soft);
    text-align: center;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--admin-ink-muted);
    font-size: 0.84rem;
    text-decoration: none;
    transition: color 0.15s;
}

.back-link:hover { color: var(--primary-red); }

.back-link:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: 3px;
    border-radius: 4px;
}

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

body.admin-body {
    background: var(--admin-bg);
    color: var(--admin-ink);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.55;
    margin: 0;
}

.admin-shell { display: none; }
.admin-shell.is-active { display: block; }

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

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 60;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 22px 22px 18px;
    border-bottom: 1px solid var(--sidebar-line);
}

.sidebar-brand .brand-mark {
    display: block;
    color: var(--white);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.06em;
    line-height: 1.35;
}

.sidebar-brand .brand-sub {
    display: block;
    color: var(--sidebar-ink-dim);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-top: 6px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
}

.nav-group-label {
    font-size: 0.66rem;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--sidebar-ink-dim);
    padding: 0 10px;
    margin: 20px 0 8px;
}

.nav-group-label:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    margin-bottom: 2px;
    background: none;
    border: none;
    border-radius: 7px;
    color: var(--sidebar-ink);
    font-family: inherit;
    font-size: 0.885rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--sidebar-active); }

.nav-item[aria-current="page"] {
    background: rgba(243,156,18,0.15);
    color: var(--sidebar-active);
    font-weight: 600;
}

.nav-item:focus-visible {
    outline: 2px solid var(--primary-orange);
    outline-offset: -2px;
}

.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.85;
}

.nav-item[aria-current="page"] .nav-icon { opacity: 1; }

.nav-label { flex: 1; }

.nav-badge {
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 11px;
    background: rgba(255,255,255,0.1);
    color: var(--sidebar-ink);
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.nav-badge.is-empty { opacity: 0.45; }

/* Pending is the one number that means "someone has to do something". */
.nav-badge.attention {
    background: var(--primary-orange);
    color: #3A2603;
}

.sidebar-foot {
    padding: 14px 16px 18px;
    border-top: 1px solid var(--sidebar-line);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.avatar {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary-red);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.sidebar-email {
    font-size: 0.74rem;
    color: var(--sidebar-ink-dim);
    word-break: break-all;
    line-height: 1.35;
}

.btn-signout {
    width: 100%;
    padding: 8px;
    background: none;
    border: 1px solid var(--sidebar-line);
    border-radius: 7px;
    color: var(--sidebar-ink);
    font-family: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-signout:hover { background: rgba(255,255,255,0.07); color: var(--white); }

/* ========== Main ========== */

.admin-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
}

.admin-header {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: var(--header-h);
    background: var(--admin-surface);
    border-bottom: 1px solid var(--admin-line);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 28px;
}

.sidebar-toggle {
    display: none;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--admin-line);
    border-radius: 7px;
    cursor: pointer;
    color: var(--admin-ink);
}

.header-text { flex: 1; min-width: 0; }

.header-text h1 {
    font-size: 1.16rem;
    font-weight: 650;
    margin: 0;
    line-height: 1.3;
}

.header-text p {
    margin: 1px 0 0;
    font-size: 0.82rem;
    color: var(--admin-ink-muted);
}

.header-avatar { flex-shrink: 0; }

.admin-content { padding: 26px 28px 60px; }

.section { display: none; }
.section.is-active { display: block; }

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

.panel {
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 10px;
}

.panel + .panel { margin-top: 18px; }

.panel-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--admin-line-soft);
}

.panel-head h2 {
    font-size: 0.95rem;
    font-weight: 650;
    margin: 0;
}

.panel-head p {
    margin: 3px 0 0;
    font-size: 0.81rem;
    color: var(--admin-ink-muted);
}

.panel-body { padding: 20px; }

/* ========== Stat grid ========== */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(178px, 100%), 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.stat {
    background: var(--admin-surface);
    border: 1px solid var(--admin-line);
    border-radius: 10px;
    padding: 15px 17px;
    text-align: left;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
}

.stat:hover { border-color: var(--admin-ink-faint); }

.stat:focus-visible { outline: 2px solid var(--primary-orange); outline-offset: 2px; }

.stat-label {
    font-size: 0.73rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--admin-ink-muted);
    margin-bottom: 7px;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 680;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat.pending .stat-value  { color: var(--primary-orange); }
.stat.approved .stat-value { color: var(--kenya-green); }
.stat.paused .stat-value   { color: var(--neut-ink); }
.stat.rejected .stat-value { color: var(--primary-red); }

.stat-hint {
    font-size: 0.75rem;
    color: var(--admin-ink-faint);
    margin-top: 5px;
}

/* ========== Dashboard split ========== */

/* min() is load bearing. A bare minmax(330px, 1fr) sets a hard floor that auto-fit
   cannot go below, so on a 360px phone, where roughly 328px is available after the
   content padding, the grid overflowed to the right. min(330px, 100%) lets the track
   collapse to the container when there is not room for the ideal width. */
.dash-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr));
    gap: 18px;
    margin-top: 18px;
}

.dash-split .panel + .panel { margin-top: 0; }

.panel-head-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

/* ========== Activity log ========== */

.activity {
    list-style: none;
    margin: 0;
    padding: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 10px 0 10px 15px;
    border-bottom: 1px solid var(--admin-line-soft);
    position: relative;
}

.activity-item:last-child { border-bottom: none; }

/* A small colour marker per event type, so the feed can be skimmed. */
.activity-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 15px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--admin-ink-faint);
}

.activity-item.tone-good::before   { background: var(--kenya-green); }
.activity-item.tone-bad::before    { background: var(--primary-red); }
.activity-item.tone-note::before   { background: #6B54A8; }
.activity-item.tone-muted::before  { background: var(--admin-ink-faint); }
.activity-item.tone-neutral::before { background: var(--primary-orange); }

.activity-body { min-width: 0; }

.activity-line {
    font-size: 0.86rem;
    line-height: 1.45;
    word-break: break-word;
}

.activity-rating {
    display: inline-block;
    margin-left: 7px;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--admin-line-soft);
    color: var(--admin-ink-muted);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
}

.activity-sub {
    font-size: 0.76rem;
    color: var(--admin-ink-faint);
    margin-top: 2px;
    word-break: break-word;
}

.activity-when {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--admin-ink-faint);
    white-space: nowrap;
    padding-top: 2px;
}

/* ========== Visitor pictograph ========== */

.picto { display: grid; gap: 13px; }

.picto-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
}

/* Grid children default to min-width:auto, so without this the figures column
   refuses to shrink below its content and pushes the row wide. */
.picto-row > * {
    min-width: 0;
}

.picto-label {
    font-size: 0.78rem;
    color: var(--admin-ink-muted);
    font-weight: 600;
}

.picto-figures {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    min-height: 22px;
}

.picto-figure {
    width: 12px;
    height: 20px;
    fill: var(--primary-orange);
    flex-shrink: 0;
}

.picto-figure.partial { opacity: 0.42; }

.picto-more {
    font-size: 0.74rem;
    color: var(--admin-ink-muted);
    font-weight: 600;
    margin-left: 3px;
    font-variant-numeric: tabular-nums;
}

.picto-none {
    font-size: 0.76rem;
    color: var(--admin-ink-faint);
    font-style: italic;
}

.picto-value {
    font-size: 1.15rem;
    font-weight: 680;
    color: var(--admin-ink);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: right;
}

/* A window that is longer than the history behind it. */
.picto-label.is-partial {
    color: var(--admin-ink-faint);
    cursor: help;
    border-bottom: 1px dotted var(--admin-line-soft);
}

.picto-note {
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--warn-ink);
    background: var(--warn-bg);
    padding: 10px 13px;
    border-radius: 7px;
    margin: 16px 0 0;
}

.picto-legend {
    font-size: 0.75rem;
    color: var(--admin-ink-faint);
    margin: 12px 0 0;
    line-height: 1.5;
}

/* ========== Trend strip ========== */

.trend {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--admin-line-soft);
}

.trend-bars {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 46px;
}

.trend-bar {
    flex: 1;
    background: var(--admin-line);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    transition: background 0.15s;
}

.trend-bar:hover { background: var(--admin-ink-faint); }
.trend-bar.is-today { background: var(--primary-orange); }

.trend-caption {
    font-size: 0.73rem;
    color: var(--admin-ink-faint);
    margin: 8px 0 0;
    font-variant-numeric: tabular-nums;
}

/* ========== Toolbar ========== */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 14px 20px;
    border-bottom: 1px solid var(--admin-line-soft);
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field.grow { flex: 1; min-width: 190px; }

.field label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--admin-ink-muted);
    font-weight: 600;
}

.field select,
.field input {
    padding: 7px 10px;
    border: 1px solid var(--admin-line);
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--admin-surface);
    color: var(--admin-ink);
    min-height: 34px;
}

.field select:focus,
.field input:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(243,156,18,0.14);
}

.field.hidden { display: none; }

/* ========== Table ========== */

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

.rv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.rv-table th {
    text-align: left;
    font-size: 0.7rem;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--admin-ink-muted);
    font-weight: 600;
    padding: 11px 16px;
    border-bottom: 1px solid var(--admin-line);
    white-space: nowrap;
}

.rv-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--admin-line-soft);
    vertical-align: middle;
}

.rv-table tbody tr:last-child td { border-bottom: none; }
.rv-table tbody tr:hover { background: #FAFBFB; }

.cell-customer { font-weight: 600; }

.cell-preview {
    color: var(--admin-ink-muted);
    font-size: 0.83rem;
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
    margin-top: 2px;
    font-weight: 400;
}

.cell-date {
    white-space: nowrap;
    color: var(--admin-ink-muted);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.cell-actions { text-align: right; white-space: nowrap; }

.stars { color: var(--primary-orange); white-space: nowrap; letter-spacing: 1px; }
.stars .star.empty { color: #D3D6D9; }

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

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.badge.pending  { background: var(--warn-bg); color: var(--warn-ink); }
.badge.approved { background: var(--ok-bg);   color: var(--ok-ink); }
.badge.rejected { background: var(--bad-bg);  color: var(--bad-ink); }
.badge.paused   { background: var(--neut-bg); color: var(--neut-ink); }

/* Marks a review whose wording an administrator has changed. */
.badge.edited {
    background: #EDE7F6;
    color: #4A3B78;
}

.badge.edited::before { display: none; }

/* ========== View toggle ========== */

.field-label-static {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--admin-ink-muted);
    font-weight: 600;
}

.view-toggle {
    display: inline-flex;
    border: 1px solid var(--admin-line);
    border-radius: 7px;
    overflow: hidden;
    min-height: 34px;
}

.view-btn {
    padding: 7px 14px;
    background: var(--admin-surface);
    border: none;
    font-family: inherit;
    font-size: 0.82rem;
    color: var(--admin-ink-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.view-btn + .view-btn { border-left: 1px solid var(--admin-line); }

.view-btn[aria-pressed="true"] {
    background: var(--admin-ink);
    color: var(--white);
    font-weight: 600;
}

.view-btn:focus-visible { outline: 2px solid var(--primary-orange); outline-offset: -2px; }

/* ========== Preview cards ==========
   Mirrors the public contact page card so an administrator can see what a
   visitor would see, including for reviews that are not currently public. */

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
    gap: 16px;
    padding: 20px;
}

.preview-card {
    background: var(--light-gray);
    border-radius: 10px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Anything not currently public is dimmed, so the difference between what is
   live and what is not is obvious at a glance. */
.preview-card.is-hidden-publicly {
    opacity: 0.62;
    background: #F1F2F3;
    border: 1px dashed var(--admin-line-soft);
}

.preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.preview-author { font-weight: 600; font-size: 0.93rem; }

.preview-text {
    color: var(--text-gray);
    line-height: 1.6;
    font-size: 0.88rem;
    white-space: pre-wrap;
    word-break: break-word;
    flex-grow: 1;
    margin-bottom: 12px;
}

.preview-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.preview-date { font-size: 0.76rem; color: var(--admin-ink-faint); }

.preview-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding-top: 12px;
    margin-top: 12px;
    border-top: 1px solid var(--admin-line-soft);
}

.preview-actions .btn-sm { margin-left: 0; }

/* ========== Edit dialog ========== */

.modal-wide { max-width: 560px; }

.edit-warning {
    background: var(--warn-bg);
    color: var(--warn-ink);
    padding: 11px 14px;
    border-radius: 7px;
    font-size: 0.82rem !important;
    line-height: 1.55;
    margin-bottom: 18px !important;
}

.field.stack { margin-bottom: 15px; }

.field.stack label {
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--admin-ink-muted);
    font-weight: 600;
    margin-bottom: 5px;
}

.field.stack input,
.field.stack select,
.field.stack textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--admin-line);
    border-radius: 7px;
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--admin-ink);
    background: var(--admin-surface);
}

.field.stack textarea { resize: vertical; line-height: 1.6; }

.field.stack input:focus,
.field.stack select:focus,
.field.stack textarea:focus {
    outline: none;
    border-color: var(--primary-orange);
    box-shadow: 0 0 0 3px rgba(243,156,18,0.14);
}

.char-count {
    font-size: 0.74rem;
    color: var(--admin-ink-faint);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.char-count.over { color: var(--primary-red); font-weight: 600; }

.original-text {
    background: #FAFAFB;
    border: 1px solid var(--admin-line-soft);
    border-radius: 7px;
    padding: 12px 14px;
    font-size: 0.83rem;
    line-height: 1.6;
    color: var(--admin-ink-muted);
    white-space: pre-wrap;
    word-break: break-word;
    margin-top: 6px;
}

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

.btn-sm {
    padding: 6px 12px;
    border: 1px solid var(--admin-line);
    border-radius: 6px;
    background: var(--admin-surface);
    color: var(--admin-ink);
    font-family: inherit;
    font-size: 0.79rem;
    font-weight: 550;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-sm + .btn-sm { margin-left: 6px; }
.btn-sm:hover { border-color: var(--admin-ink-faint); }
.btn-sm:focus-visible { outline: 2px solid var(--primary-orange); outline-offset: 1px; }
.btn-sm:disabled { opacity: 0.5; cursor: default; }

.btn-sm.primary  { background: var(--kenya-green); border-color: var(--kenya-green); color: var(--white); }
.btn-sm.primary:hover  { background: var(--kenya-green-light); }
.btn-sm.danger   { color: var(--primary-red); border-color: #E8C9C9; }
.btn-sm.danger:hover { background: var(--bad-bg); }

/* ========== States ========== */

.state {
    padding: 52px 24px;
    text-align: center;
}

.state-title {
    font-size: 0.98rem;
    font-weight: 650;
    margin-bottom: 6px;
}

.state-text {
    font-size: 0.86rem;
    color: var(--admin-ink-muted);
    max-width: 380px;
    margin: 0 auto;
}

.state-text + .btn-sm { margin-top: 16px; }

.skeleton-row {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #EDEFF1 25%, #F6F7F8 37%, #EDEFF1 63%);
    background-size: 400% 100%;
    animation: shimmer 1.3s ease infinite;
    margin: 14px 20px;
}

@keyframes shimmer {
    0%   { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ========== Pagination ========== */

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 13px 20px;
    border-top: 1px solid var(--admin-line-soft);
    font-size: 0.82rem;
    color: var(--admin-ink-muted);
}

.pager-controls { display: flex; align-items: center; gap: 8px; }
.pager-page { font-variant-numeric: tabular-nums; }

/* ========== Drawer ========== */

.drawer-scrim {
    position: fixed;
    inset: 0;
    background: rgba(20,14,14,0.42);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    z-index: 80;
}

.drawer-scrim.is-open { opacity: 1; visibility: visible; }

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(430px, 100%);
    background: var(--admin-surface);
    box-shadow: -4px 0 24px rgba(0,0,0,0.13);
    transform: translateX(100%);
    transition: transform 0.22s ease;
    z-index: 81;
    display: flex;
    flex-direction: column;
}

.drawer.is-open { transform: translateX(0); }

.drawer-head {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 22px 16px;
    border-bottom: 1px solid var(--admin-line-soft);
}

.drawer-head-main { flex: 1; min-width: 0; }

.drawer-name {
    font-size: 1.02rem;
    font-weight: 650;
    margin-bottom: 6px;
    word-break: break-word;
}

.drawer-close {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    background: none;
    border: none;
    border-radius: 6px;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--admin-ink-muted);
    cursor: pointer;
}

.drawer-close:hover { background: var(--admin-line-soft); }

.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px; }

.drawer-quote {
    background: #FAFAFB;
    border: 1px solid var(--admin-line-soft);
    border-radius: 8px;
    padding: 15px 16px;
    font-size: 0.9rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 20px;
}

.meta-list { display: grid; gap: 12px; }

.meta-row {
    display: grid;
    grid-template-columns: 108px 1fr;
    gap: 12px;
    font-size: 0.84rem;
}

.meta-key {
    color: var(--admin-ink-muted);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding-top: 2px;
}

.meta-val { word-break: break-word; font-variant-numeric: tabular-nums; }

.drawer-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 15px 22px;
    border-top: 1px solid var(--admin-line-soft);
    background: #FCFCFD;
}

.drawer-foot .btn-sm { margin-left: 0; }

/* ========== Confirm modal ========== */

.modal-scrim {
    position: fixed;
    inset: 0;
    background: rgba(20,14,14,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.16s, visibility 0.16s;
    z-index: 95;
}

.modal-scrim.is-open { opacity: 1; visibility: visible; }

.modal-card {
    background: var(--admin-surface);
    border-radius: 11px;
    width: 100%;
    max-width: 410px;
    padding: 24px;
    box-shadow: 0 16px 44px rgba(0,0,0,0.22);
}

.modal-card h2 { font-size: 1.05rem; font-weight: 650; margin: 0 0 9px; }

.modal-card p {
    font-size: 0.87rem;
    color: var(--admin-ink-muted);
    margin: 0 0 20px;
    line-height: 1.6;
}

.modal-actions { display: flex; justify-content: flex-end; gap: 9px; }

.btn-danger-solid {
    padding: 8px 16px;
    background: var(--primary-red);
    border: 1px solid var(--primary-red);
    border-radius: 6px;
    color: var(--white);
    font-family: inherit;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger-solid:hover { background: var(--dark-red); }

/* ========== Toast ========== */

.toast-stack {
    position: fixed;
    bottom: 22px;
    right: 22px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    z-index: 99;
}

.toast {
    background: var(--admin-ink);
    color: var(--white);
    padding: 11px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: 0 6px 20px rgba(0,0,0,0.2);
    animation: toast-in 0.2s ease;
    max-width: 330px;
}

.toast.error { background: var(--primary-red); }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ========== Settings ========== */

.setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding: 15px 0;
    border-bottom: 1px solid var(--admin-line-soft);
}

.setting-row:last-child { border-bottom: none; padding-bottom: 0; }
.setting-row:first-child { padding-top: 0; }

.setting-info { min-width: 0; }

.setting-name { font-size: 0.88rem; font-weight: 600; margin-bottom: 3px; }

.setting-desc {
    font-size: 0.81rem;
    color: var(--admin-ink-muted);
    max-width: 52ch;
}

.setting-value {
    font-size: 0.88rem;
    color: var(--admin-ink);
    word-break: break-all;
}

.readonly-pill {
    display: inline-block;
    padding: 6px 11px;
    background: var(--neut-bg);
    border-radius: 6px;
    font-size: 0.84rem;
    color: var(--neut-ink);
    word-break: break-all;
}

.inline-note {
    display: none;
    margin-top: 10px;
    padding: 10px 13px;
    border-radius: 7px;
    font-size: 0.83rem;
}

.inline-note.success { background: var(--ok-bg); color: var(--ok-ink); }
.inline-note.error   { background: var(--bad-bg); color: var(--bad-ink); }

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

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: 3px 0 20px rgba(0,0,0,0.2);
    }

    .sidebar.is-open { transform: translateX(0); }

    .admin-main { margin-left: 0; }

    .sidebar-toggle { display: flex; }

    .sidebar-scrim {
        position: fixed;
        inset: 0;
        background: rgba(20,14,14,0.42);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s, visibility 0.2s;
        z-index: 55;
    }

    .sidebar-scrim.is-open { opacity: 1; visibility: visible; }
}

@media (min-width: 1025px) {
    .sidebar-scrim { display: none; }
}

@media (max-width: 820px) {
    .admin-header { padding: 12px 16px; }
    .admin-content { padding: 18px 16px 48px; }

    /* Table collapses to a stack of cards. */
    .rv-table thead { display: none; }

    .rv-table,
    .rv-table tbody,
    .rv-table tr,
    .rv-table td { display: block; width: 100%; }

    .rv-table tr {
        border: 1px solid var(--admin-line);
        border-radius: 9px;
        padding: 13px 15px;
        margin-bottom: 11px;
    }

    .rv-table tbody tr:hover { background: none; }

    .rv-table td { border: none; padding: 3px 0; }

    .rv-table td[data-label]::before {
        content: attr(data-label);
        display: block;
        font-size: 0.68rem;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--admin-ink-muted);
        font-weight: 600;
        margin-bottom: 1px;
    }

    .cell-preview { white-space: normal; max-width: none; }
    .cell-actions { text-align: left; padding-top: 11px !important; white-space: normal; }
    .cell-actions .btn-sm { margin: 0 6px 6px 0; }

    .table-wrap { padding: 13px 15px 2px; }

    .meta-row { grid-template-columns: 1fr; gap: 2px; }
}

@media (max-width: 820px) {
    .preview-grid { grid-template-columns: 1fr; padding: 15px; }

    /* Reclaim width for the figures and the activity text. */
    .panel-body { padding: 16px; }

    .picto-row {
        grid-template-columns: 74px minmax(0, 1fr) auto;
        gap: 9px;
    }

    .picto-label { font-size: 0.73rem; }
    .picto-value { font-size: 1rem; min-width: 30px; }

    .activity-item { gap: 9px; }
    .activity-when { font-size: 0.7rem; }
}

@media (max-width: 420px) {
    /* Below this the label, figures and number will not sit on one line without
       squeezing the figures to nothing, so the number moves under the label. */
    .picto-row {
        grid-template-columns: 1fr auto;
        row-gap: 3px;
    }

    .picto-label { grid-column: 1; }
    .picto-value { grid-column: 2; grid-row: 1; }
    .picto-figures { grid-column: 1 / -1; grid-row: 2; }

    /* The timestamp drops below the entry rather than competing for the same line. */
    .activity-item {
        flex-direction: column;
        gap: 3px;
    }

    .activity-when { padding-top: 0; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 11px; }
    .stat-value { font-size: 1.55rem; }
    .toast-stack { left: 14px; right: 14px; bottom: 14px; }
    .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar, .drawer, .drawer-scrim, .modal-scrim, .sidebar-scrim, .toast {
        transition: none;
        animation: none;
    }
    .skeleton-row { animation: none; }
}
