/* ═══════════════════════════════════════════════════════════════════════════════
   Dashboard CMS — style-light.css
   Theme: Terminal Elegance · Light
   Palette: Warm paper · Copper accent · Deep ink type
   Fonts: Fraunces (brand) · Outfit (UI) · DM Mono (data)
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    /* Base colors */
    --bg-base: #fefdf9;
    --bg-surface: #f9eff4;
    --bg-elevated: #ffffff;
    --bg-hover: #d0faff;
    --bg-approved: #dcfce7;
    --bg-rejected: #fef3c7;
    --bg-pending: #fff4e5;

    --border: #ddd9d2;
    --border-subtle: #e8e4de;

    /* Text */
    --text-primary: #1a1814;
    --text-secondary: #6b6760;
    --text-muted: #aaa69f;
    --text-inverse: #faf9f7;
    --text-on-accent: #fff8f4;
    /* for buttons */

    --accent: #9ee6e0;
    --accent-color: #9ee6e0;

    --accent-dim: rgba(202, 158, 230, 0.10);
    --accent-glow: rgba(202, 158, 230, 0.06);
    --accent-hover: #b383d3;

    --success: #a6d189;
    --success-dark: #8cb86f;
    --warning: #efd353;
    --warning-dark: #d1b637;
    --danger: #e78284;
    --danger-dark: #cc6a6c;
    --danger-medium: #dea2a6;
    --info: #8caaee;
    --reject: #ea994d;


    /* --accent: #b8703e;
    --accent-dim: rgba(184, 112, 62, 0.10);
    --accent-glow: rgba(184, 112, 62, 0.06);
    --accent-hover: #a05e34;
    --success: #2d8a5e;
    --success-dark: #1e6e47;
    --warning: #b8892a;
    --warning-dark: #8a6318;
    --danger: #b84040;
    --danger-dark: #a83030;
    --danger-medium: #b45309;
    --info: #3a7fb8;
    --reject: #d97706; */


    /* RGB versions */
    --accent-rgb: 158, 230, 224;
    --success-rgb: 45, 138, 94;
    --warning-rgb: 184, 137, 42;
    --danger-rgb: 184, 64, 64;
    --info-rgb: 58, 127, 184;
    --shadow-rgb: 0, 0, 0;
    --overlay-rgb: 26, 24, 20;
    --text-muted-rgb: 170, 166, 159;
    --blue-rgb: 58, 127, 184;


    /* Layout */
    --sidebar-w: 240px;
    --topbar-h: 56px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --transition: 180ms ease;
    --transition-md: 260ms ease;

    /* Typography */
    --font-ui: 'Outfit', system-ui, sans-serif;
    --font-brand: 'Fraunces', Georgia, serif;
    --font-mono: 'DM Mono', 'Courier New', monospace;

    /* Scrollbar */
    --scrollbar-thumb: #ddd9d2;
    --scrollbar-thumb-hover: #c9c4bc;


    --kj: #F54927;
    --kn: #FF00FF;
    --p: #0000FF;
    --ok: #808080;


}


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

a {
    color: var(--accent-hover);
    text-decoration: none;
}

html {
    font-size: 15px;
}

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-weight: 400;
    line-height: 1.6;
    min-height: 100vh;
    margin: 0;
}

.cms-body {
    display: flex;
}

.cms-main {
    flex: 1;
    min-width: 0;
    min-height: 100vh;
    padding-top: var(--topbar-h);
}



/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.cms-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition-md);
}

@media (max-width: 991.98px) {
    .cms-sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.12);
    }

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

/* ── Sidebar brand ─────────────────────────────────────────────────────────── */
.sidebar-brand {
    padding: 28px 22px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-shrink: 0;
}

.brand-wordmark {
    font-family: var(--font-brand);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.brand-version {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* ── Sidebar nav ───────────────────────────────────────────────────────────── */
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 12px 10px;
    flex: 1;
}

.sidebar-nav .nav-item {
    margin-bottom: 2px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 400;
    transition: background var(--transition), color var(--transition);
    position: relative;
}

.sidebar-nav .nav-link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-nav .nav-link.active {
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 500;
}

.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 2px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.nav-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    opacity: 0.6;
}

.sidebar-nav .nav-link.active .nav-icon,
.sidebar-nav .nav-link:hover .nav-icon {
    opacity: 1;
}

/* ── Sidebar footer ────────────────────────────────────────────────────────── */
.sidebar-footer {
    padding: 14px 14px 18px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--accent-dim);
    border: 1px solid rgba(184, 112, 62, 0.35);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0;
}

.user-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--font-mono);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.btn-logout:hover {
    background: rgba(184, 64, 64, 0.08);
    color: var(--danger);
}

/* ── Mobile topbar ─────────────────────────────────────────────────────────── */
.cms-topbar {
    position: fixed;
    top: 0;
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 14px;
    z-index: 190;
    width: 100%;
}

.topbar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    display: flex;
    transition: background var(--transition), color var(--transition);
}

.topbar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.topbar-title {
    font-family: var(--font-brand);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Sidebar overlay (mobile) ──────────────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.25);
    z-index: 199;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.is-visible {
    display: block;
}

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
    padding-top: 3rem;
}

.page-title {
    font-family: var(--font-brand);
    font-size: 1.8rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.page-title .accent {
    color: var(--accent);
    font-style: italic;
}

.page-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.cms-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-card);
}

.placeholder-card {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-style: dashed;
    border-color: var(--border);
    box-shadow: none;
}

.placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    text-align: center;
}

.placeholder-inner svg {
    opacity: 0.35;
}

.placeholder-inner p {
    font-size: 0.875rem;
    margin: 0;
}

/* ── Toast notifications ───────────────────────────────────────────────────── */
.cms-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    max-width: 360px;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    z-index: 9999;
    animation: toastIn 0.25s ease forwards;
    border: 1px solid;
}

.cms-toast--warn {
    background: rgba(184, 137, 42, 0.08);
    border-color: rgba(184, 137, 42, 0.25);
    color: var(--warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ══════════════════════════════════════════════════════════════════════════════
   AUTH / LOGIN PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

.auth-body {
    background: var(--bg-base);
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
    position: relative;
    overflow: hidden;
}

/* Subtle background pattern */
.auth-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(var(--border-subtle) 1px, transparent 1px),
        linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.6;
    pointer-events: none;
}

/* Soft radial glow centred behind the card */
.auth-body::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    pointer-events: none;
}

/* ── Auth card ─────────────────────────────────────────────────────────────── */
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px 36px 36px;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.06),
        0 12px 40px rgba(0, 0, 0, 0.08),
        0 0 0 1px var(--border-subtle);
    animation: cardReveal 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cardReveal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Auth header ───────────────────────────────────────────────────────────── */
.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand-name {
    display: block;
    font-family: var(--font-brand);
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 6px;
}

.auth-brand-tagline {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

/* ── Form elements ─────────────────────────────────────────────────────────── */
.auth-form .form-group {
    margin-bottom: 18px;
}

.auth-form label {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-family: var(--font-mono);
}

.auth-form .form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    -webkit-appearance: none;
}

.auth-form .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    background: var(--bg-elevated);
}

.auth-form .form-control::placeholder {
    color: var(--text-muted);
    font-style: italic;
}

.auth-form .form-control--token {
    letter-spacing: 0.06em;
    font-size: 0.92rem;
}

/* ── Submit button ─────────────────────────────────────────────────────────── */
.btn-auth {
    display: block;
    width: 100%;
    padding: 11px 20px;
    background: var(--accent);
    color: var(--text-on-accent);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: opacity var(--transition), box-shadow var(--transition), transform 80ms ease;
    margin-top: 24px;
}

.btn-auth:hover {
    opacity: 0.88;
    box-shadow: 0 4px 20px rgba(184, 112, 62, 0.22);
}

.btn-auth:active {
    transform: scale(0.99);
}

.btn-auth:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Alert / error banner ──────────────────────────────────────────────────── */
.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    margin-bottom: 22px;
    animation: slideDown 0.2s ease;
}

.auth-alert--error {
    background: rgba(184, 64, 64, 0.07);
    border: 1px solid rgba(184, 64, 64, 0.2);
    color: #a83030;
}

.auth-alert--success {
    background: rgba(45, 138, 94, 0.07);
    border: 1px solid rgba(45, 138, 94, 0.2);
    color: #1e6e47;
}

.auth-alert--warning {
    background: rgba(184, 137, 42, 0.07);
    border: 1px solid rgba(184, 137, 42, 0.2);
    color: #8a6318;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Auth hint ─────────────────────────────────────────────────────────────── */
.auth-hint {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.7;
}

.auth-hint code {
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0 4px;
    color: var(--accent);
    font-size: 0.68rem;
}

/* ══════════════════════════════════════════════════════════════════════════════
   SETUP PAGE
   ══════════════════════════════════════════════════════════════════════════════ */

.setup-output {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.9;
    color: var(--success);
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    white-space: pre-wrap;
}

.setup-output .err {
    color: var(--danger);
}

.setup-output .warn {
    color: var(--warning);
}

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

/* ── Utilities ─────────────────────────────────────────────────────────────── */
.accent {
    color: var(--accent);
}

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

.font-mono {
    font-family: var(--font-mono);
}

.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ── Scrollbar (Webkit) ────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   shelves.css  —  additions for shelves.php
   Append to main style.css / dashboard.css
   Theme: Terminal Elegance · Light
   ═══════════════════════════════════════════════════════════════════════════════ */


/* ── Danger button variant (missing from main sheet) ──────────────────────── */
.btn--danger {
    background: rgba(184, 64, 64, 0.10);
    color: var(--danger);
    border-color: rgba(184, 64, 64, 0.25);
}

.btn--danger:hover {
    background: rgba(184, 64, 64, 0.18);
    border-color: rgba(184, 64, 64, 0.45);
}

/* ── Toast variants (success + error, extends existing --warn) ────────────── */
.cms-toast--success {
    background: rgba(45, 138, 94, 0.08);
    border-color: rgba(45, 138, 94, 0.25);
    color: var(--success);
}

.cms-toast--error {
    background: rgba(184, 64, 64, 0.08);
    border-color: rgba(184, 64, 64, 0.25);
    color: var(--danger);
}


/* ═══════════════════════════════════════════════════════════════════════════════
   SHELVES GRID
   ═══════════════════════════════════════════════════════════════════════════════ */

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

@media (max-width: 480px) {
    .shelves-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

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


/* ═══════════════════════════════════════════════════════════════════════════════
   SHELF CARD
   ═══════════════════════════════════════════════════════════════════════════════ */

.shelf-card {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-md), transform var(--transition-md);
}

.shelf-card:hover {
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.09);
    transform: translateY(-2px);
}

/* Coloured book-spine bar on the left edge */
.shelf-card__spine {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    opacity: 0.85;
}

/* Main content area (padded away from the spine) */
.shelf-card__body {
    flex: 1;
    padding: 20px 18px 14px 22px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ── Count display ── */
.shelf-card__count-wrap {
    display: flex;
    align-items: baseline;
    gap: 5px;
}

.shelf-card__count {
    font-family: var(--font-brand);
    font-size: 2.4rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--text-primary);
    min-width: 1.6ch;
    /* prevents layout jump when number loads */
    transition: color var(--transition);
}

/* Empty shelf → muted count */
.shelf-card__count--empty {
    color: var(--text-muted);
}

/* Skeleton while JS is fetching counts */
.count-skeleton {
    display: inline-block;
    font-size: 1.6rem;
    color: var(--border);
    animation: countPulse 1.1s ease-in-out infinite;
}

@keyframes countPulse {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 1;
    }
}

.shelf-card__count-unit {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* ── Shelf name ── */
.shelf-card__name {
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
    /* graceful truncation for very long names */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Action bar ── */
.shelf-card__actions {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 8px 12px 10px 18px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

/* Disabled delete button looks and feels clearly locked */
.shelf-card__actions .btn-action--danger:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.shelf-card__actions .btn-action--danger:disabled:hover {
    background: none;
    color: var(--text-muted);
}

/* Spacer pushes delete to the right */
.shelf-card__actions .btn-action:first-child {
    margin-right: auto;
}

.spacer {
    margin-top: 5rem !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 20, 0.45);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 500;
    padding: 16px;
    animation: modalFadeIn 0.18s ease;
}

.modal-overlay[hidden] {
    display: none;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-dialog {
    width: 100%;
    max-width: 440px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow:
        0 4px 24px rgba(0, 0, 0, 0.12),
        0 1px 4px rgba(0, 0, 0, 0.06);
    animation: modalSlideUp 0.22s cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
}

.modal-dialog--sm {
    max-width: 360px;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.modal-title {
    font-family: var(--font-brand);
    font-size: 1.15rem;
    font-weight: 400;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition), color var(--transition);
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Body */
.modal-body {
    padding: 22px 20px;
}

.modal-confirm-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin: 0 0 6px;
    line-height: 1.5;
}

.modal-confirm-sub {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

/* Footer */
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

/* Error highlight on required input */
.form-control--error {
    border-color: var(--danger) !important;
    box-shadow: 0 0 0 3px rgba(184, 64, 64, 0.12) !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   blog.css  —  Blog Manager additions
   Append to your main stylesheet (style.css / dashboard.css)
   ═══════════════════════════════════════════════════════════════════════════════ */


/* ── Token chip (reused from test page) ─────────────────────────────────────── */
.token-chip {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 5px;
    padding: 3px 10px;
    font-family: var(--font-mono);
    font-size: 0.73rem;
    color: #7dd3fc;
    white-space: nowrap;
}


/* ── Tag pill (inline display in tables & forms) ─────────────────────────────── */
.tag-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--accent-dim);
    border: 1px solid rgba(var(--accent-rgb), 0.25);
    border-radius: 20px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--accent);
    white-space: nowrap;
}

.tags-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}


/* ── Post slug (monospace subtitle under post title in table) ────────────────── */
.post-slug {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 2px;
}


/* ── Tag list (sidebar panel) ───────────────────────────────────────────────── */
.tag-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tag-list__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.tag-list__item:hover {
    background: var(--bg-hover);
}

.tag-list__name {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.tag-list__actions {
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity var(--transition);
}

.tag-list__item:hover .tag-list__actions {
    opacity: 1;
}


/* ── Markdown textarea ───────────────────────────────────────────────────────── */
textarea.markdown-input {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.65;
    min-height: 240px;
    resize: vertical;
}


/* ── Post form field grid (title / date / tags row) ─────────────────────────── */
.post-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 14px;
}

@media (max-width: 640px) {
    .post-form-grid {
        grid-template-columns: 1fr;
    }
}


.btn-unstyled {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    opacity: 0.8;
    transition: opacity var(--transition);
}

.btn-unstyled:hover {
    opacity: 1;
}


/* Small label above form fields */
.field-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
}

/* Tag selector bubble strip */
.tag-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 44px;
    align-items: center;
}

/* Individual selectable tag */
.tag-toggle {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    user-select: none;
}

.tag-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: rgba(var(--accent-rgb), 0.3);
}

.tag-toggle--active {
    background: var(--accent-dim);
    border-color: rgba(var(--accent-rgb), 0.35);
    color: var(--accent);
    font-weight: 500;
}

/* Small + button beside tag label */
.btn-tag-add {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid rgba(var(--accent-rgb), 0.35);
    background: var(--accent-dim);
    color: var(--accent);
    font-size: 0.65rem;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition);
    flex-shrink: 0;
}

.btn-tag-add:hover {
    background: rgba(var(--accent-rgb), 0.18);
    box-shadow: var(--shadow-accent-sm);
}

/* Label row with add button inline */
.field-label-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

/* Editor action bar */
.editor-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Base editor button */
.btn-editor {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: 1px solid;
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), box-shadow var(--transition), opacity var(--transition);
    white-space: nowrap;
}

.btn-editor--draft {
    background: var(--bg-elevated);
    border-color: var(--border);
    color: var(--text-secondary);
}

.btn-editor--draft:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-editor--publish {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

.btn-editor--publish:hover {
    opacity: 0.88;
    box-shadow: var(--shadow-accent-sm);
}

/* Autosave status indicator */
.autosave-status {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Photo upload row */
.photo-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.photo-row .form-control {
    flex: 1;
    min-width: 0;
}

/* Photo file name previews */
.photo-preview-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.photo-preview-chip {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    padding: 3px 9px;
    border-radius: 20px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

/* Uploaded path buttons */
.uploaded-paths {
    margin-top: 14px;
}

.path-insert-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-base);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-secondary);
    cursor: pointer;
    margin: 0 6px 6px 0;
    transition: background var(--transition), color var(--transition);
}

.path-insert-btn:hover {
    background: var(--accent-dim);
    color: var(--accent);
    border-color: rgba(var(--accent-rgb), 0.3);
}


.filter-tabs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-tab {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted, #64748b);
    background: var(--surface, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.filter-tab:hover {
    color: var(--primary, #3b82f6);
    border-color: var(--primary, #3b82f6);
    background: #eff6ff;
}

.filter-tab--active {
    color: #fff;
    background: var(--primary, #3b82f6);
    border-color: var(--primary, #3b82f6);
}

.filter-tab--active:hover {
    color: #fff;
    background: var(--primary-hover, #2563eb);
    border-color: var(--primary-hover, #2563eb);
}

/* ── Comments feed ───────────────────────────────────────────────────── */
.comments-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Comment card ────────────────────────────────────────────────────── */
.comment-card {
    background: var(--surface, #f8fafc);
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px;
    padding: 14px 16px;
    transition: border-color 0.12s ease;
}

.comment-card:hover {
    border-color: var(--border-hover, #cbd5e1);
}

.comment-card--reply {
    margin-left: 32px;
    border-left: 3px solid var(--primary-light, #bfdbfe);
    background: var(--bg-rejected, #fafcff);
}

.comment-card--pending {
    border-left: 3px solid var(--border-pending, #f59e0b);
    background: var(--bg-pending, #fffded);
}

.comment-card__header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.comment-card__meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    font-size: 0.78rem;
    color: var(--text-muted, #64748b);
}

.comment-card__author {
    font-weight: 600;
    color: var(--text-primary, #1e293b);
}

.comment-card__author a {
    color: var(--primary, #3b82f6);
    text-decoration: none;
}

.comment-card__author a:hover {
    text-decoration: underline;
}

.comment-card__time,
.comment-card__post {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comment-card__badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.comment-card__badge--approved {
    background: var(--bg-approved, #dcfce7);
    color: var(--success, #166534);
}

.comment-card__badge--pending {
    background: var(--bg-pending, #fef3c7);
    color: var(--danger-medium, #92400e);
}

.comment-card__actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.comment-card__body {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-primary, #334155);
    padding: 8px 0;
}

.comment-card__replies-info {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Reply indicator ─────────────────────────────────────────────────── */
.reply-indicator {
    font-size: 0.72rem;
    color: var(--primary, #3b82f6);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ── Action buttons ──────────────────────────────────────────────────── */
.btn-action-approve {
    color: var(--success, #16a34a) !important;
}

.btn-action-approve:hover {
    color: var(--success-rgb, #15803d) !important;
    text-decoration: underline;
}

.btn-action-reject {
    color: var(--reject, #d97706) !important;
}

.btn-action-reject:hover {
    color: var(--danger-medium, #b45309) !important;
    text-decoration: underline;
}

.btn-action-reply {
    color: var(--primary, #3b82f6) !important;
}

.btn-action-reply:hover {
    color: var(--primary-hover, #2563eb) !important;
    text-decoration: underline;
}

.btn-action-delete {
    color: var(--danger, #dc2626) !important;
}

.btn-action-delete:hover {
    color: var(--danger-dark, #b91c1c) !important;
    text-decoration: underline;
}

/* ── Inline reply form ───────────────────────────────────────────────── */
.reply-form-inline {
    margin-top: 12px;
    padding: 14px;
    background: #f8fafc;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px;
}

/* ── Unstyled button (reuse from tags) ───────────────────────────────── */
.btn-unstyled {
    background: none;
    border: none;
    padding: 0;
    font-size: 0.78rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted, #64748b);
}

.btn-unstyled:hover {
    color: var(--text-primary, #1e293b);
}


/* Reading Progress Widget */

.rpw-widget, .immersion-widget {
    display: flex;
    flex-direction: column;
    gap: .5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.rpw-form,
.immersion-form {
    display: flex;
    flex-direction: column;
    /* always stack vertically */
    gap: .5rem;
    width: 100%;
}

.rpw-select,
.immersion-select {
    width: 100%;
    min-width: 0;
    padding: .4rem .6rem;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 4px;
    background: var(--input-bg, #fff);
    color: var(--text-color, inherit);
    font-size: .9rem;
    max-height: 30px;
    box-sizing: border-box;
}

.rpw-input-group,
.immersion-input-group {
    display: flex;
    gap: .5rem;
    width: 100%;
}

.rpw-input,
.immersion-input {
    flex: 1;
    /* fills remaining space next to button */
    min-width: 0;
    padding: .4rem .6rem;
    border: 1px solid var(--border-color, #ccc);
    border-radius: 4px;
    background: var(--input-bg, #fff);
    color: var(--text-color, inherit);
    font-size: .9rem;
    text-align: center;
    box-sizing: border-box;
}

.rpw-btn,
.immersion-btn {
    padding: .4rem 1rem;
    border: none;
    border-radius: 4px;
    background: var(--accent-color, #0077cc);
    color: #fff;
    font-size: .9rem;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.rpw-btn:hover,
.immersion-btn:hover {
    opacity: .85;
}

.rhw-panel {
    width: 100%;
}

.rhw-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.rhw-form {
    flex: 1 1 calc(14.28% - .5rem);
    /* 7 across on wide screens */
    min-width: 110px;
}

.rhw-day {
    width: 100%;
    align-items: center;
    gap: .25rem;
    padding: .6rem .4rem;
    border: 2px solid var(--border-color, #ccc);
    border-radius: 8px;
    background: var(--input-bg, #f8f9fa);
    color: var(--text-color, #333);
    font-size: .8rem;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
    line-height: 1.2;
}

.rhw-day:hover:not(:disabled) {
    border-color: var(--accent-color, #0077cc);
    transform: translateY(-1px);
}

.rhw-day--read {
    background: var(--accent-color, #0077cc);
    border-color: var(--accent-color, #0077cc);
    color: #fff;
}

.rhw-day--today {
    border-color: var(--accent-color, #0077cc);
    font-weight: 700;
}

.rhw-day--today.rhw-day--read {
    outline: 3px solid var(--accent-color, #0077cc);
    outline-offset: 2px;
}

.rhw-day--future {
    opacity: .4;
    cursor: not-allowed;
}

.rhw-day__icon {
    font-size: 1.1rem;
    line-height: 1;
}

.rhw-day__label {
    text-align: center;
}

/* Mobile: stack as list */
@media (max-width: 480px) {
    .rhw-form {
        flex: 1 1 100%;
        min-width: 0;
    }

    .rhw-day {
        flex-direction: row;
        justify-content: flex-start;
        gap: .75rem;
        padding: .6rem .75rem;
    }

    .rhw-day__icon {
        font-size: 1.2rem;
        width: 1.5rem;
        text-align: center;
    }
}



/* empty navigation bar */

.empty-subnav {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem !important;
    display: grid;
    grid-template-columns: auto auto auto  ;
    width: 100%;
    max-height: 50px !important;
    gap: 0.25rem;
    list-style: none;
    padding: 4rem !important;
}

.empty-subnav .rpw-btn {
    width: 100px;
}


@media (max-width: 991.98px) {
    .cms-sidebar {
        transform: translateX(-100%);
        box-shadow: 4px 0 40px rgba(0, 0, 0, 0.12);
    }

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




/* ═══════════════════════════════════════════════════════════════════════════════
   dashboard
   Dashboard flex layout — Terminal Elegance · Light
   All flex knobs are grouped at the top of each section so you can tweak
   without hunting through the file.
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ── COLOR VARIABLES (add at top – all colors you can play with) ────────────── */
:root {
    /* Existing layout tokens (kept as is) */
    --db-gap-row:      20px;
    --db-gap-col:      20px;
    --db-gap-stats:    16px;
    --db-primary-w:    1;
    --db-sidebar-w:    300px;
    --db-panel-pad:    22px;
    --db-stat-min-w:   140px;
    --db-break-stack:  860px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   COLUMNS  — vertical slices inside .db-row--main
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Primary column grows to fill remaining space */
.db-col--primary {
    flex: var(--db-primary-w);   /* grows */
    min-width: 0;                /* prevents flex blowout */
    display: flex;
    flex-direction: column;
    gap: var(--db-gap-row);
}

/* Sidebar column has a fixed or min width */
.db-col--sidebar {
    flex: 0 0 var(--db-sidebar-w);
    width: var(--db-sidebar-w);
    display: flex;
    flex-direction: column;
    gap: var(--db-gap-row);
}

@media (max-width: 860px) {
    .db-col--sidebar {
        flex: 1 1 auto;
        width: 100%;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════════════════════════════════════════════ */
.db-stat-card {
    /* ── Flex knobs ── */
    flex: 1 1 var(--db-stat-min-w); /* grow + shrink, but never below min */

    /* Layout */
    display: flex;
    flex-direction: column;
    gap: 4px;

    /* Visual */
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.db-stat-card:hover {
    box-shadow: var(--shadow-md);
}

.db-stat-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.db-stat-value {
    font-family: var(--font-brand);
    font-size: 2rem;
    font-weight: 400;
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -0.03em;
}

.db-stat-delta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.db-stat-delta--up   { color: var(--success); }
.db-stat-delta--warn { color: var(--warning); }
.db-stat-delta--err  { color: var(--danger);  }


/* ═══════════════════════════════════════════════════════════════════════════════
   PANELS  — content cards used throughout the dashboard
   ═══════════════════════════════════════════════════════════════════════════════ */
.db-panel {
    /* ── Flex knobs ── */
    flex: 1;          /* fills its column / row slot */

    /* Visual */
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

/* Panel header ---------------------------------------------------------------- */
.db-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between; /* title left, action right */
    gap: 12px;

    padding: 14px var(--db-panel-pad);
    border-bottom: 1px solid var(--border-subtle);
}

.db-panel__title {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0;
}

.db-panel__action {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity var(--transition);
    white-space: nowrap;
}

.db-panel__action:hover { opacity: 1; }

/* Panel body ------------------------------------------------------------------ */
.db-panel__body {
    padding: var(--db-panel-pad);
}

/* Placeholder variant — dashed + centred hint text */
.db-panel__body--placeholder {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    margin: var(--db-panel-pad);
    padding: 24px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-style: italic;
}


/* ═══════════════════════════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════════════════════════ */
.db-link {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent);
    text-decoration: none;
    padding: 6px 0;
    border-bottom: 1px solid var(--accent-dim);
    transition: border-color var(--transition), color var(--transition);
}

.db-link:hover {
    color: var(--text-primary);
    border-color: var(--border);
}

/* dashboard-reading.css
   Reading dashboard components – fits the Terminal Elegance Light theme
   Uses CSS variables defined in style.css
*/

/* ==========================================================================
   Cards (cms-card)
   ========================================================================== */
.cms-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.cms-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-surface);
}

.cms-card__title {
    font-family: var(--font-brand);
    font-size: 1.1rem;
    font-weight: 500;
    margin: 0;
    color: var(--text-primary);
}

.cms-card__badge {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    background: var(--bg-base);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.cms-card__body {
    padding: 1.25rem;
}

.cms-card__close {
    background: none;
    border: none;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.cms-card__close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.card-placeholder {
    padding: 3rem;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.875rem;
}

/* ==========================================================================
   Filter toolbar
   ========================================================================== */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.filter-toolbar .form-control,
.filter-toolbar .form-select {
    min-width: 200px;
    flex: 1;
}

@media (max-width: 640px) {
    .filter-toolbar {
        flex-direction: column;
    }
    .filter-toolbar .form-control,
    .filter-toolbar .form-select {
        width: 100%;
    }
}

/* ==========================================================================
   Buttons (btn system)
   ========================================================================== */
.rpw-btn,
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition);
    border: 1px solid transparent;
}

.btn--primary {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
}

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

.btn--ghost {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

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

/* ==========================================================================
   Data table
   ========================================================================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.data-table th {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    background: var(--bg-surface);
}

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

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

/* Table columns */
.col-cover { width: 60px; text-align: center; }
.col-title { min-width: 180px; }
.col-actions { white-space: nowrap; }

.table-cover {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
}

.table-cover--placeholder {
    width: 40px;
    height: 56px;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.book-title-link {
    font-weight: 500;
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition);
}

.book-title-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

.book-year {
    display: inline-block;
    margin-left: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
}

.text-mono {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Action links inside table */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    font-size: 0.7rem;
    font-family: var(--font-ui);
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    cursor: pointer;
}

.btn-action:hover {
    background: var(--bg-base);
    color: var(--accent);
}

.btn-action--danger:hover {
    background: rgba(var(--danger-rgb), 0.1);
    color: var(--danger);
}

/* ==========================================================================
   Status badges
   ========================================================================== */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 500;
    border-radius: 20px;
    letter-spacing: 0.02em;
}

.badge--reading {
    background: rgba(var(--accent-rgb), 0.12);
    color: var(--accent);
    border: 1px solid rgba(var(--accent-rgb), 0.3);
}

.badge--finished {
    background: rgba(var(--success-rgb), 0.12);
    color: var(--success);
    border: 1px solid rgba(var(--success-rgb), 0.3);
}

.badge--paused {
    background: rgba(var(--warning-rgb), 0.12);
    color: var(--warning);
    border: 1px solid rgba(var(--warning-rgb), 0.3);
}

.badge--wishlist {
    background: rgba(var(--info-rgb), 0.12);
    color: var(--info);
    border: 1px solid rgba(var(--info-rgb), 0.3);
}

.badge--abandoned {
    background: rgba(var(--text-muted-rgb), 0.12);
    color: rgba(var(--text-muted-rgb), 0.3);
    border: 1px solid rgba(var(--text-muted-rgb), 0.3);
}

.badge--none {
    background: var(--bg-base);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ==========================================================================
   Progress bars
   ========================================================================== */
.progress-track {
    background: var(--border-subtle);
    border-radius: 20px;
    height: 6px;
    width: 100%;
    overflow: hidden;
}

.progress-track--sm {
    height: 4px;
}

.progress-fill {
    background: var(--accent);
    height: 100%;
    width: 0%;
    border-radius: 20px;
}

.inline-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.inline-progress .progress-track {
    flex: 1;
}

/* ==========================================================================
   Currently reading strip
   ========================================================================== */
.currently-reading-strip {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.currently-reading-item {
    flex: 0 0 120px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.currently-reading-item:hover {
    transform: translateY(-4px);
}

.currently-reading-cover {
    width: 120px;
    height: 168px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    background: var(--bg-base);
}

.currently-reading-cover--placeholder {
    width: 120px;
    height: 168px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
}

.currently-reading-progress {
    margin-top: 0.5rem;
}

.currently-reading-progress .progress-track {
    height: 4px;
}

.progress-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 4px;
    text-align: center;
}

/* ==========================================================================
   Pagination
   ========================================================================== */
.pagination-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pagination-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
}

.pagination-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    color: var(--accent);
}

.pagination-info {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Flash alerts (extending your auth-alert style)
   ========================================================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: 1.5rem;
    animation: slideDown 0.2s ease;
}

.alert--success {
    background: rgba(var(--success-rgb), 0.08);
    border: 1px solid rgba(var(--success-rgb), 0.2);
    color: var(--success);
}

.alert--error {
    background: rgba(var(--danger-rgb), 0.08);
    border: 1px solid rgba(var(--danger-rgb), 0.2);
    color: var(--danger);
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Form components (add book panel)
   ========================================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

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

.form-control,
.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

textarea.form-control {
    resize: vertical;
}

/* Floating add button */
.floating-add-btn {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    color: var(--text-inverse);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-accent);
    transition: all 0.2s ease;
    z-index: 100;
}

.floating-add-btn:hover {
    transform: scale(1.05);
    background: var(--accent-hover);
}





/* ==========================================================================
   Sub-navigation (from reading_header.php)
   ========================================================================== */
.reading-subnav {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0 1rem;
}

.reading-subnav__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.reading-subnav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    transition: all var(--transition);
}

.reading-subnav__link:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.reading-subnav__link.is-active {
    background: var(--bg-elevated);
    color: var(--accent);
    border-bottom: 2px solid var(--accent);
}


.book-layout {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.book-cover-col {
    flex: 0 0 220px;
    width: 220px;
}

.book-fields-col {
    flex: 1;
    min-width: 0;
}

@media (max-width: 720px) {
    .book-layout { flex-direction: column; }
    .book-cover-col { width: 100%; flex: none; }
}

/* ── Page header row ────────────────────────────────────────────── */
.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

/* ── Cover preview ──────────────────────────────────────────────── */
.cover-preview {
    width: 100%;
    max-width: 160px;
    height: 220px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-cover);
    display: block;
    margin: 0 auto;
}

.cover-preview--empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--bg-hover);
    color: var(--text-muted);
    font-size: 0.8rem;
}

.cover-preview--empty i { font-size: 2rem; opacity: 0.4; }

/* ── Form layout helpers ────────────────────────────────────────── */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-row--triple {
    grid-template-columns: repeat(3, 1fr);
}

.form-row--quad {
    grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 640px) {
    .form-row,
    .form-row--triple,
    .form-row--quad { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 440px) {
    .form-row,
    .form-row--triple,
    .form-row--quad { grid-template-columns: 1fr; }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

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

.form-control {
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-ui);
    font-size: 0.875rem;
    outline: none;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
    background: var(--bg-elevated);
}

textarea.form-control { resize: vertical; }

.form-control--mono {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

/* static / read-only display (for ISBN in edit mode) */
.form-static {
    padding: 8px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-hover);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Section label (external IDs group) */
.form-section-label {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 4px 0 8px;
    border-top: 1px solid var(--border-subtle);
    margin-top: 6px;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn-cms {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background var(--transition), color var(--transition), opacity var(--transition);
    white-space: nowrap;
    background: none;
}

.btn-cms--primary {
    background: var(--accent);
    color: var(--text-inverse);
}
.btn-cms--primary:hover { opacity: 0.88; }

.btn-cms--ghost {
    border-color: var(--border);
    color: var(--text-secondary);
}
.btn-cms--ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm { padding: 6px 11px; font-size: 0.78rem; }

.w-100 { width: 100%; justify-content: center; }

/* ── Flash alerts ────────────────────────────────────────────────── */
.reading-alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-bottom: 18px;
    border: 1px solid;
}
.reading-alert--success {
    background: rgba(var(--success-rgb), 0.07);
    border-color: rgba(var(--success-rgb), 0.22);
    color: var(--success);
}
.reading-alert--error {
    background: rgba(var(--danger-rgb), 0.07);
    border-color: rgba(var(--danger-rgb), 0.22);
    color: var(--danger);
}

/* ── d-block / mt-* micro-utilities ────────────────────────────── */
.d-block { display: block; }
.mb-1  { margin-bottom: 4px; }
.mb-2  { margin-bottom: 8px; }
.mb-3  { margin-bottom: 14px; }
.mt-2  { margin-top: 8px; }
.mt-3  { margin-top: 14px; }
.mt-4  { margin-top: 20px; }
.mb-5  { margin-bottom: 40px; }
.me-2  { margin-right: 8px; }