/* ==========================================================================
   Watbanmee School — Admin UI
   A macOS-flavoured design system: system colours, translucent materials,
   capsule controls and a permanent dark appearance, set in Sarabun.

   Load with:  <link rel="stylesheet" href="{{ asset('css/admin.css') }}">
   Sections:   1 tokens · 2 base · 3 shell · 4 controls · 5 forms
               6 surfaces · 7 lists · 8 feedback · 9 login · 10 responsive
               11 dashboard
   ========================================================================== */

/* 1. Tokens ---------------------------------------------------------------- */

:root {
    color-scheme: dark;

    /* System accent + semantic colours */
    --accent: #0a84ff;
    --accent-pressed: #0a6fd8;
    --accent-soft: rgba(10, 132, 255, 0.22);
    --accent-ring: rgba(10, 132, 255, 0.45);
    --red: #ff453a;
    --red-soft: rgba(255, 69, 58, 0.18);
    --green: #30d158;
    --green-soft: rgba(48, 209, 88, 0.18);
    --orange: #ff9f0a;
    --orange-soft: rgba(255, 159, 10, 0.18);

    /* Materials */
    --desktop:
        radial-gradient(1100px 620px at 8% -8%, rgba(94, 92, 230, 0.34), transparent 62%),
        radial-gradient(900px 560px at 102% 4%, rgba(10, 132, 255, 0.24), transparent 58%),
        radial-gradient(900px 700px at 55% 112%, rgba(255, 55, 95, 0.13), transparent 60%),
        #0d0e12;
    --window: #1c1c1e;
    --surface: rgba(36, 36, 40, 0.66);
    --surface-raised: rgba(48, 48, 52, 0.7);
    --sidebar: rgba(28, 28, 32, 0.58);
    --toolbar: rgba(22, 22, 26, 0.62);
    --fill: rgba(120, 120, 128, 0.2);
    --fill-strong: rgba(120, 120, 128, 0.32);
    --control: #2f2f31;
    --control-hover: #3a3a3c;

    /* Text */
    --label: #f5f5f7;
    --label-secondary: rgba(235, 235, 245, 0.62);
    --label-tertiary: rgba(235, 235, 245, 0.38);

    /* Lines */
    --separator: rgba(255, 255, 255, 0.09);
    --border: rgba(255, 255, 255, 0.14);
    --border-strong: rgba(255, 255, 255, 0.22);

    /* Shape */
    --r-xs: 6px;
    --r-sm: 8px;
    --r-md: 11px;
    --r-lg: 16px;
    --r-xl: 22px;

    /* Depth */
    --shadow-control: 0 1px 1.5px rgba(0, 0, 0, 0.4), inset 0 0.5px 0 rgba(255, 255, 255, 0.07);
    --shadow-card: inset 0 0.5px 0 rgba(255, 255, 255, 0.07), 0 1px 2px rgba(0, 0, 0, 0.35), 0 14px 34px rgba(0, 0, 0, 0.3);
    --shadow-window: 0 32px 70px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.08);
    --shadow-popover: 0 14px 34px rgba(0, 0, 0, 0.55);
    --material-blur: saturate(180%) blur(22px);
    --teal: #40c8e0;
    --purple: #bf5af2;

    --font-sans: "Sarabun", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

/* 2. Base ------------------------------------------------------------------ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* Components that set display must still honour the hidden attribute. */
[hidden] { display: none !important; }

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--desktop);
    background-attachment: fixed;
    color: var(--label);
    font-family: var(--font-sans);
    font-size: 14.5px;
    line-height: 1.65;
    letter-spacing: -0.003em;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.35;
}

p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3.5px var(--accent-ring);
    border-radius: var(--r-sm);
}

.u-muted { color: var(--label-secondary); }
.u-mono { font-family: var(--font-mono); font-size: 0.92em; }
.u-nowrap { white-space: nowrap; }
.u-right { text-align: right; }

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* 3. Window shell ---------------------------------------------------------- */

.toolbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 56px;
    padding: 0 18px;
    border-bottom: 0.5px solid var(--separator);
    background: var(--toolbar);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
}

/* Decorative window buttons — a macOS cue, not interactive. */
.traffic {
    display: flex;
    gap: 8px;
    margin-right: 4px;
}

.traffic span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12);
}

.traffic span:nth-child(1) { background: #ff5f57; }
.traffic span:nth-child(2) { background: #febc2e; }
.traffic span:nth-child(3) { background: #28c840; }

.toolbar-lead {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.app-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--label);
    text-decoration: none;
}

.app-identity:hover { text-decoration: none; }

.app-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(160deg, #3d6ea8, #1d3f60);
    color: #ffd98a;
    box-shadow: var(--shadow-control);
}

.app-name {
    font-size: 13px;
    font-weight: 650;
    line-height: 1.25;
}

.app-name small {
    display: block;
    color: var(--label-secondary);
    font-size: 11px;
    font-weight: 500;
}

.toolbar-trail {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-user {
    color: var(--label-secondary);
    font-size: 12.5px;
}

.toolbar-user strong { color: var(--label); font-weight: 600; }

.shell {
    display: grid;
    grid-template-columns: 228px minmax(0, 1fr);
    align-items: start;
    width: min(1300px, calc(100% - 44px));
    margin: 26px auto 72px;
    gap: 26px;
}

.sidebar {
    position: sticky;
    top: 82px;
    padding: 10px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-lg);
    background: var(--sidebar);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
}

.sidebar-heading {
    margin: 6px 10px 8px;
    color: var(--label-tertiary);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    color: var(--label);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.15s ease;
}

.sidebar-item + .sidebar-item { margin-top: 2px; }
.sidebar-item:hover { background: var(--fill); text-decoration: none; }
.sidebar-item svg { flex: none; }

.sidebar-glyph {
    display: grid;
    flex: none;
    width: 26px;
    height: 26px;
    place-items: center;
    border-radius: 7px;
    background: linear-gradient(180deg, var(--glyph-top), var(--glyph-bottom));
    box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.35);
    color: #fff;
}

.sidebar-glyph svg { width: 16px; height: 16px; }
.sidebar-glyph--blue { --glyph-top: #3d9bff; --glyph-bottom: #0a6fe0; }
.sidebar-glyph--orange { --glyph-top: #ffb340; --glyph-bottom: #f08400; }
.sidebar-glyph--purple { --glyph-top: #c97cf5; --glyph-bottom: #9a3fd6; }
.sidebar-glyph--green { --glyph-top: #4bd96f; --glyph-bottom: #1fae47; }

.sidebar-item[aria-current="page"] {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

.sidebar-item[aria-current="page"] .sidebar-glyph { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); }

.sidebar-count {
    margin-left: auto;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--fill-strong);
    color: var(--label-secondary);
    font-size: 11px;
    font-weight: 600;
}

.sidebar-item[aria-current="page"] .sidebar-count {
    background: rgba(255, 255, 255, 0.25);
    color: #fff;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.page-eyebrow {
    margin-bottom: 4px;
    color: var(--accent);
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.page-header h1 { font-size: 27px; }

.page-header .subtitle {
    margin-top: 5px;
    color: var(--label-secondary);
    font-size: 13.5px;
}

/* 4. Controls -------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 34px;
    padding: 0 15px;
    border: 0.5px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--control);
    color: var(--label);
    font: inherit;
    font-size: 13.5px;
    font-weight: 550;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--shadow-control);
    transition: background 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}

.btn:hover { background: var(--control-hover); text-decoration: none; }
.btn:active { transform: scale(0.975); }

.btn-primary {
    border-color: transparent;
    background: var(--accent);
    color: #fff;
    font-weight: 600;
}

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

.btn-destructive { color: var(--red); }
.btn-destructive:hover { background: var(--red-soft); }

.btn-plain {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

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

.btn-sm { height: 28px; padding: 0 11px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 15px; }
.btn-block { width: 100%; }

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

.button-row .spacer { margin-left: auto; }

/* 5. Forms ----------------------------------------------------------------- */

.form { display: grid; gap: 20px; }

.field { display: grid; gap: 7px; }

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.field > label,
.field-label {
    color: var(--label);
    font-size: 13px;
    font-weight: 600;
}

.field .required { color: var(--red); }

.input,
.textarea,
.select {
    width: 100%;
    padding: 9px 12px;
    border: 0.5px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--control);
    color: var(--label);
    font: inherit;
    font-size: 14px;
    line-height: 1.6;
    box-shadow: var(--shadow-control);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder,
.textarea::placeholder { color: var(--label-tertiary); }

.input:focus,
.textarea:focus,
.select:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3.5px var(--accent-ring);
}

.textarea { resize: vertical; min-height: 92px; }

.select {
    appearance: none;
    padding-right: 34px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='16' viewBox='0 0 12 16'%3E%3Cpath fill='%23888' d='M6 1.5 9.5 6h-7L6 1.5Zm0 13L2.5 10h7L6 14.5Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
}

.input-file {
    padding: 8px 12px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--fill);
    color: var(--label-secondary);
    font: inherit;
    font-size: 13px;
    width: 100%;
}

.hint {
    display: block;
    color: var(--label-secondary);
    font-size: 12px;
    line-height: 1.65;
}

.field-error {
    color: var(--red);
    font-size: 12.5px;
}

/* A hint that belongs to the field row directly above it. */
.hint-tight { margin-top: -12px; }

.input-affix {
    display: flex;
    align-items: center;
    border: 0.5px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--control);
    box-shadow: var(--shadow-control);
    overflow: hidden;
}

.input-affix:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3.5px var(--accent-ring);
}

.input-affix .prefix {
    padding: 0 2px 0 12px;
    color: var(--label-tertiary);
    font-family: var(--font-mono);
    font-size: 12.5px;
    white-space: nowrap;
}

.input-affix .input {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding-left: 2px;
}

.input-affix .input:focus { box-shadow: none; }

/* macOS switch */
.switch-row {
    display: flex;
    align-items: center;
    gap: 11px;
    cursor: pointer;
}

.switch {
    position: relative;
    flex: none;
    width: 42px;
    height: 25px;
    appearance: none;
    margin: 0;
    border-radius: 999px;
    background: var(--fill-strong);
    cursor: pointer;
    transition: background 0.2s ease;
}

.switch::after {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
    content: "";
    transition: transform 0.2s cubic-bezier(0.3, 0.8, 0.4, 1);
}

.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(17px); }
.switch:focus-visible { box-shadow: 0 0 0 3.5px var(--accent-ring); }

.switch-label { font-size: 13.5px; font-weight: 550; }
.switch-row .hint { margin-top: 2px; }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13.5px;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

fieldset.group-box {
    display: grid;
    gap: 14px;
    margin: 0;
    padding: 16px 18px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-md);
    background: var(--fill);
}

fieldset.group-box legend {
    padding: 0 6px;
    color: var(--label-secondary);
    font-size: 12px;
    font-weight: 650;
}

.form-narrow { max-width: 540px; }

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 10px 18px;
    padding: 14px 16px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-md);
    background: var(--fill);
}

/* The cover preview shows the file as it is: edge to edge, own aspect ratio,
   never cropped and never letterboxed. */
.cover-preview {
    display: block;
    width: fit-content;
    max-width: min(100%, 360px);
    margin: 0 auto;
    overflow: hidden;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-md);
    background: var(--fill);
    transition: opacity 0.2s ease;
}

/* A thumbnail at the file's own ratio: portrait posters are capped by height,
   wide photos by the figure's width. */
.cover-preview img {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 360px;
    margin: 0 auto;
}

.cover-preview figcaption {
    padding: 9px 14px;
    border-top: 0.5px solid var(--separator);
    text-align: center;
}

.cover-preview figcaption:empty { display: none; }
.cover-preview.is-removed { opacity: 0.35; }

.cover-placeholder {
    padding: 26px;
    border: 1px dashed var(--border-strong);
    border-radius: var(--r-md);
    text-align: center;
}

/* 6. Surfaces -------------------------------------------------------------- */

.card {
    padding: 22px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-lg);
    background: var(--surface);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: var(--shadow-card);
}

.card-flush { padding: 0; overflow: hidden; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.card-header h2 { font-size: 16px; }

.card-subtitle {
    margin-top: 1px;
    color: var(--label-secondary);
    font-size: 12.5px;
}

.card-empty {
    padding: 18px 0 6px;
    color: var(--label-tertiary);
    text-align: center;
}

.card-section {
    padding: 16px 20px;
    border-bottom: 0.5px solid var(--separator);
}

.card-section:last-child { border-bottom: 0; }

.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr);
    gap: 22px;
    align-items: start;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stat {
    padding: 16px 18px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.stat .stat-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--label-secondary);
    font-size: 12.5px;
}

.stat .stat-value {
    display: block;
    margin-top: 4px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--label-tertiary);
}

.stat .dot-green { background: var(--green); }
.stat .dot-orange { background: var(--orange); }
.stat .dot-blue { background: var(--accent); }

/* 7. Lists and tables ------------------------------------------------------ */

.table { width: 100%; border-collapse: collapse; }

.table thead th {
    padding: 10px 16px;
    border-bottom: 0.5px solid var(--separator);
    background: var(--fill);
    color: var(--label-secondary);
    font-size: 11.5px;
    font-weight: 650;
    letter-spacing: 0.02em;
    text-align: left;
}

.table tbody td {
    padding: 13px 16px;
    border-bottom: 0.5px solid var(--separator);
    vertical-align: middle;
}

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

/* The first column holds the record title, so give it the spare width. */
.table th:first-child,
.table td:first-child { width: 46%; }
.table tbody tr:hover { background: var(--fill); }

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

.cell-primary .title {
    color: var(--label);
    font-size: 13.8px;
    font-weight: 600;
}

.cell-primary .meta {
    display: block;
    margin-top: 2px;
    color: var(--label-secondary);
    font-size: 12px;
}

.thumb {
    flex: none;
    width: 52px;
    height: 40px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-xs);
    background: var(--fill) center / cover no-repeat;
}

.thumb-empty {
    display: grid;
    place-items: center;
    color: var(--label-tertiary);
}

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 0.5px solid var(--separator);
}

.list-row:first-child { padding-top: 0; }
.list-row:last-child { padding-bottom: 0; border-bottom: 0; }
.list-row .title { color: var(--label); font-size: 13.8px; font-weight: 600; }
.list-row .title a { color: inherit; }
.list-row .meta { color: var(--label-secondary); font-size: 12px; }

.issue-tag {
    display: inline-block;
    margin-right: 6px;
    padding: 1px 6px;
    border-radius: 5px;
    background: var(--fill-strong);
    color: var(--label-secondary);
    font-size: 11px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--fill-strong);
    color: var(--label-secondary);
    font-size: 11.5px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-published { background: var(--green-soft); color: var(--green); }
.badge-scheduled { background: var(--orange-soft); color: var(--orange); }
.badge-draft { background: var(--fill-strong); color: var(--label-secondary); }
.badge-category { background: var(--accent-soft); color: var(--accent); }
.badge + .badge { margin-left: 4px; }

.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 7px;
}

.row-actions form { margin: 0; }

.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 18px;
    color: var(--label-secondary);
    font-size: 12.5px;
}

.pager .links { display: flex; gap: 8px; }

/* 8. Feedback -------------------------------------------------------------- */

.banner {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-md);
    background: var(--surface-raised);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: var(--shadow-card);
    font-size: 13.5px;
}

.banner svg { flex: none; margin-top: 2px; }
.banner-success { color: var(--green); }
.banner-warning { border-color: var(--orange-soft); background: var(--orange-soft); color: var(--orange); }
.banner-warning .banner-text { color: var(--label); }
.banner-warning code { font-family: var(--font-mono); font-size: 0.9em; }
.banner-success .banner-text { color: var(--label); }
.banner-error { border-color: var(--red-soft); background: var(--red-soft); color: var(--red); }
.banner-error strong { display: block; margin-bottom: 3px; }
.banner-error ul { margin: 0; padding-left: 18px; }

.empty-state {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 52px 24px;
    color: var(--label-secondary);
    text-align: center;
}

.empty-state .glyph {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    margin-bottom: 4px;
    border-radius: 50%;
    background: var(--fill);
    color: var(--label-tertiary);
}

.empty-state strong { color: var(--label); font-size: 14.5px; }

/* 9. Login ----------------------------------------------------------------- */

body.login-stage {
    display: grid;
    place-items: center;
    padding: 28px 20px;
    background: var(--desktop);
    background-attachment: fixed;
}

.login-window {
    width: min(100%, 420px);
    padding: 34px 32px 28px;
    border: 0.5px solid var(--border);
    border-radius: var(--r-xl);
    background: var(--surface-raised);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: var(--shadow-window);
}

.login-window .traffic { margin-bottom: 26px; }

.login-crest {
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    margin: 0 auto 16px;
    border-radius: 18px;
    background: linear-gradient(160deg, #3d6ea8, #1d3f60);
    color: #ffd98a;
    box-shadow: var(--shadow-popover);
}

.login-head { margin-bottom: 22px; text-align: center; }
.login-head h1 { font-size: 21px; }

.login-head p {
    margin-top: 5px;
    color: var(--label-secondary);
    font-size: 13px;
}

.login-form { display: grid; gap: 15px; }

.login-options svg { vertical-align: -1px; }

.login-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--label-secondary);
    font-size: 12.5px;
}

.login-footnote {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 0.5px solid var(--separator);
    color: var(--label-tertiary);
    font-size: 11.5px;
    line-height: 1.7;
    text-align: center;
}

/* 10. Responsive ----------------------------------------------------------- */

@media (max-width: 1180px) {
    .table .col-author { display: none; }
}

@media (max-width: 1000px) {
    .table .col-date { display: none; }
    .table .col-views { display: none; }
}

@media (max-width: 900px) {
    .shell {
        grid-template-columns: 1fr;
        width: calc(100% - 28px);
        margin-top: 18px;
        gap: 16px;
    }

    .sidebar {
        position: static;
        display: flex;
        gap: 6px;
        overflow-x: auto;
        padding: 8px;
    }

    .sidebar-heading { display: none; }
    .sidebar-item + .sidebar-item { margin-top: 0; }
    .sidebar-item { white-space: nowrap; }
    .sidebar-count { margin-left: 4px; }
    .toolbar-user { display: none; }
    .split-layout { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 620px) {
    .field-row { grid-template-columns: 1fr; }
    .traffic { display: none; }
    .card { padding: 18px; }
    .table .optional { display: none; }
    .thumb { display: none; }
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* Contact inbox --------------------------------------------------------- */
.contact-inbox-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.contact-inbox-tabs .btn[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.contact-inbox-tabs .btn span { padding: 0 7px; border-radius: 6px; background: var(--fill); font-variant-numeric: tabular-nums; }
.contact-inbox-search { display: flex; gap: 8px; max-width: 660px; margin-bottom: 20px; }
.contact-inbox-search .input { min-width: 0; }
.contact-inbox-row { display: flex; gap: 18px; align-items: center; padding: 22px; color: var(--label); border-bottom: 1px solid var(--separator); transition: background .15s ease; }
.contact-inbox-row:last-child { border-bottom: 0; }
.contact-inbox-row:hover { background: var(--fill); text-decoration: none; }
.contact-inbox-row--unread { background: var(--accent-soft); }
.contact-inbox-avatar { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border-radius: 14px; background: var(--fill-strong); color: var(--label-secondary); font-size: 18px; font-weight: 600; }
.contact-inbox-row--unread .contact-inbox-avatar { background: var(--accent); color: #fff; }
.contact-inbox-copy { min-width: 0; flex: 1; }
.contact-inbox-copy .title { display: block; overflow-wrap: anywhere; }
.contact-inbox-copy .meta { display: block; margin-top: 5px; overflow-wrap: anywhere; }
.contact-inbox-meta { display: grid; justify-items: end; gap: 8px; flex: none; }
.contact-inbox-arrow { color: var(--label-tertiary); }
.contact-message-subject { overflow-wrap: anywhere; }
.contact-message-detail { min-width: 0; }
.contact-message-sender { margin: 0; }
.contact-message-sender > div { display: grid; grid-template-columns: 115px minmax(0, 1fr); gap: 12px; padding: 9px 0; }
.contact-message-sender dt, .contact-message-timeline dt { color: var(--label-secondary); font-size: 13px; }
.contact-message-sender dd { margin: 0; overflow-wrap: anywhere; }
.contact-message-heading { margin-top: 25px; padding-top: 22px; border-top: 1px solid var(--separator); font-size: 16px; }
.contact-message-body { margin-top: 16px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.95; }
.contact-message-timeline { display: grid; gap: 14px; margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--separator); }
.contact-message-timeline dd { margin: 3px 0 0; font-size: 12px; }
@media (max-width: 600px) {
    .contact-inbox-row { flex-wrap: wrap; padding: 18px; gap: 12px; }
    .contact-inbox-copy { flex-basis: calc(100% - 58px); }
    .contact-inbox-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; width: 100%; }
    .contact-inbox-arrow { display: none; }
    .contact-message-sender > div { grid-template-columns: 1fr; gap: 3px; }
}
@media (prefers-reduced-motion: reduce) { .contact-inbox-row { transition: none; } }

/* 11. Dashboard ------------------------------------------------------------ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.kpi {
    position: relative;
    display: grid;
    align-content: start;
    gap: 2px;
    min-width: 0;
    padding: 16px 18px;
    border: 0.5px solid var(--separator);
    border-radius: var(--r-lg);
    background: var(--surface);
    -webkit-backdrop-filter: var(--material-blur);
    backdrop-filter: var(--material-blur);
    box-shadow: var(--shadow-card);
}

.kpi-icon {
    display: grid;
    width: 34px;
    height: 34px;
    margin-bottom: 10px;
    place-items: center;
    border-radius: 9px;
    background: linear-gradient(180deg, var(--glyph-top), var(--glyph-bottom));
    box-shadow: inset 0 0.5px 0 rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.35);
    color: #fff;
}

.kpi-icon--blue { --glyph-top: #3d9bff; --glyph-bottom: #0a6fe0; }
.kpi-icon--purple { --glyph-top: #c97cf5; --glyph-bottom: #9a3fd6; }
.kpi-icon--orange { --glyph-top: #ffb340; --glyph-bottom: #f08400; }
.kpi-icon--green { --glyph-top: #4bd96f; --glyph-bottom: #1fae47; }

.kpi-label {
    color: var(--label-secondary);
    font-size: 13px;
}

.kpi-value {
    overflow: hidden;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpi-meta {
    color: var(--label-secondary);
    font-size: 12.5px;
}

.delta { display: block; font-weight: 600; }
.delta-up { color: var(--green); }
.delta-down { color: var(--red); }

.sparkline {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 96px;
    height: 32px;
    overflow: visible;
}

.sparkline polyline {
    fill: none;
    stroke: var(--label-tertiary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.sparkline circle { fill: var(--accent); }

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    align-items: start;
}

.dashboard-wide { grid-column: span 2; }
.dashboard-full { grid-column: 1 / -1; }

/* Column chart: one baseline, recessive hairline grid, bars capped at 24px. */
.column-chart {
    position: relative;
    height: 230px;
    padding: 8px 0 28px 34px;
}

.column-chart__grid {
    position: absolute;
    inset: 8px 0 28px 34px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    pointer-events: none;
}

.column-chart__grid span {
    position: relative;
    border-top: 1px solid var(--separator);
}

.column-chart__grid em {
    position: absolute;
    top: -9px;
    left: -34px;
    width: 26px;
    color: var(--label-tertiary);
    font-size: 11px;
    font-style: normal;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.column-chart__plot {
    position: relative;
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    height: 100%;
}

.column-chart__slot {
    position: relative;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 100%;
    border-radius: var(--r-sm);
    outline: none;
    transition: background 0.15s ease;
}

.column-chart__slot:hover,
.column-chart__slot:focus-visible { background: var(--fill); }
.column-chart__slot:focus-visible { box-shadow: 0 0 0 2px var(--accent-ring); }

.column-chart__bar {
    width: min(24px, 58%);
    height: var(--value);
    border-radius: 4px 4px 0 0;
    background: var(--accent);
}

.column-chart__label {
    position: absolute;
    bottom: -24px;
    color: var(--label-secondary);
    font-size: 11.5px;
    white-space: nowrap;
}

.column-chart__slot.is-current .column-chart__label { color: var(--label); font-weight: 700; }

.column-chart__slot::after {
    position: absolute;
    z-index: 2;
    bottom: calc(var(--value) + 10px);
    left: 50%;
    padding: 5px 10px;
    border: 0.5px solid var(--border);
    border-radius: var(--r-sm);
    background: rgba(44, 44, 48, 0.96);
    box-shadow: var(--shadow-popover);
    color: var(--label);
    content: attr(data-tip);
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.column-chart__slot:hover::after,
.column-chart__slot:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.column-chart__slot:first-child::after { left: 0; transform: translate(0, 4px); }
.column-chart__slot:first-child:hover::after,
.column-chart__slot:first-child:focus-visible::after { transform: translate(0, 0); }
.column-chart__slot:last-child::after { right: 0; left: auto; transform: translate(0, 4px); }
.column-chart__slot:last-child:hover::after,
.column-chart__slot:last-child:focus-visible::after { transform: translate(0, 0); }

.chart-table { margin-top: 14px; }

.chart-table summary {
    width: max-content;
    color: var(--accent);
    font-size: 12.5px;
    cursor: pointer;
}

.chart-table table {
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    font-size: 13px;
}

.chart-table th,
.chart-table td {
    padding: 6px 4px;
    border-bottom: 0.5px solid var(--separator);
    text-align: left;
}

.chart-table th { color: var(--label-secondary); font-weight: 600; }
.chart-table td:last-child,
.chart-table th:last-child { text-align: right; font-variant-numeric: tabular-nums; }

/* Stacked status meter: 2px gaps separate the parts; the legend names them. */
.meter-stack {
    display: flex;
    gap: 2px;
    height: 12px;
    margin: 4px 0 16px;
    overflow: hidden;
    border-radius: 6px;
    background: var(--fill);
}

.meter-stack__part { flex-basis: 0; min-width: 4px; }
.meter-stack__part--published,
.legend-swatch--published { background: var(--green); }
.meter-stack__part--scheduled,
.legend-swatch--scheduled { background: var(--orange); }
.meter-stack__part--draft,
.legend-swatch--draft { background: var(--label-tertiary); }

.legend-list {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.legend-list li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto 44px;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
}

.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-list__value { font-weight: 700; font-variant-numeric: tabular-nums; }
.legend-list__share { color: var(--label-tertiary); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; }

.mini-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 0.5px solid var(--separator);
}

.mini-stats > div { display: grid; }
.mini-stats__label { color: var(--label-secondary); font-size: 12px; }
.mini-stats__value { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Horizontal bar rows: label and value as text, the bar only shows scale. */
.bar-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
}

.bar-row + .bar-row { border-top: 0.5px solid var(--separator); }

.bar-row__rank {
    display: grid;
    flex: none;
    width: 24px;
    height: 24px;
    place-items: center;
    border-radius: 50%;
    background: var(--fill-strong);
    color: var(--label-secondary);
    font-size: 12px;
    font-weight: 700;
}

.bar-row__body { flex: 1; min-width: 0; }

.bar-row__text {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.bar-row__label {
    overflow: hidden;
    color: var(--label);
    font-size: 13.5px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-row__value {
    flex: none;
    color: var(--label-secondary);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
}

.bar-row__track {
    display: block;
    height: 6px;
    overflow: hidden;
    border-radius: 3px;
    background: var(--fill);
}

.bar-row__fill {
    display: block;
    width: var(--value);
    height: 100%;
    border-radius: 3px;
    background: var(--accent);
}

.bar-row__fill--teal { background: var(--teal); }

/* Album preview on the announcement form. */
.album-status { margin: 10px 0 0; }

.album-preview { margin-top: 10px; }
.album-preview__count { color: var(--label-secondary); font-size: 13px; }

.album-preview__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 8px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}

.album-preview__grid img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--r-sm);
    background: var(--fill);
    object-fit: cover;
}

@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .dashboard-wide,
    .dashboard-full { grid-column: auto; }
}

@media (max-width: 560px) {
    .kpi-grid { grid-template-columns: minmax(0, 1fr); }
    .column-chart__label { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .column-chart__slot,
    .column-chart__slot::after { transition: none; }
}
