:root {
    --red:        #E8445A;
    --red-light:  #FEF0F2;
    --red-dark:   #C7303F;

    --ink-900: #111118;
    --ink-700: #28272F;
    --ink-500: #6B6875;
    --ink-400: #9E9CA8;
    --ink-300: #CCCAD4;
    --ink-200: #E6E4EC;
    --ink-100: #F1F0F5;
    --ink-50:  #F7F6F9;

    --success:    #1A9E5C;
    --success-bg: #EDFAF4;
    --warning:    #B07D00;
    --warning-bg: #FFF8E1;
    --danger:     #E8445A;
    --danger-bg:  #FEF0F2;

    --surface: #FFFFFF;
    --bg:      #F5F7FB;
    --border:  #E9EBF2;

    /* Light sidebar */
    --side-bg:     #FFFFFF;
    --side-fg:     #6B6875;
    --side-fg-dim: #A9A7B4;
    --side-active: var(--red);
    --side-line:   #EFEEF5;

    /* Soft pastel icon-chip colors */
    --chip-blue-bg:   #EAF1FE;  --chip-blue-fg:   #3E7BFA;
    --chip-red-bg:    #FDEBEE;  --chip-red-fg:    #E8445A;
    --chip-violet-bg: #F0ECFE;  --chip-violet-fg: #7C5CF0;
    --chip-green-bg:  #E8F7EF;  --chip-green-fg:  #1A9E5C;

    --radius: 14px;
    --shadow: 0 1px 3px rgba(23, 26, 60, 0.05);

    --sidebar-w: 230px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink-700);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--red-dark); }
button { font-family: inherit; }
.ico { display: inline-block; vertical-align: -3px; flex-shrink: 0; }

/* ── Layout ─────────────────────────────── */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

/* ── Sidebar (light, Hyper-Kit-style) ────── */
.sidebar {
    background: var(--side-bg);
    padding: 0 14px 20px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--side-line);
    box-shadow: 2px 0 12px rgba(23, 26, 60, 0.03);
}

.sidebar .brand {
    padding: 22px 8px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--side-line);
    margin-bottom: 10px;
}

.sidebar .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--red);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar .brand-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink-900);
    letter-spacing: -0.01em;
}

.sidebar .brand-sub {
    font-size: 10px;
    color: var(--side-fg-dim);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
}

.nav-section {
    padding: 18px 10px 6px;
    font-size: 10px;
    color: var(--side-fg-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
}

.nav-section:first-of-type { padding-top: 8px; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    color: var(--side-fg);
    font-size: 13px;
    font-weight: 480;
    border-radius: 10px;
    transition: color 0.1s, background 0.1s;
    margin: 1px 0;
}

.sidebar nav a .ico { color: var(--side-fg-dim); transition: color 0.1s; }

.sidebar nav a:hover {
    color: var(--ink-900);
    background: var(--ink-50);
    text-decoration: none;
}

.sidebar nav a:hover .ico { color: var(--ink-500); }

.sidebar nav a.active {
    color: var(--red);
    background: transparent;
    font-weight: 650;
}

.sidebar nav a.active .ico { color: var(--red); }

.sidebar .nav-foot {
    margin-top: auto;
    padding: 14px 10px 0;
    border-top: 1px solid var(--side-line);
}

.sidebar .nav-foot a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--side-fg);
    font-size: 12.5px;
    padding: 6px 0;
}

.sidebar .nav-foot a:hover { color: var(--red); text-decoration: none; }

.side-logout {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--red);
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
    font-family: inherit;
    width: 100%;
    transition: color 0.1s;
}

.side-logout:hover { color: var(--red-dark); }
.side-logout .ico { color: var(--red); }

/* ── Round avatars (photo w/ initial fallback) ── */
.avi, .avi-sm {
    position: relative;
    overflow: hidden;
    border-radius: 999px;
    background-color: var(--red);
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(23, 26, 60, 0.15);
}

.avi img, .avi-sm img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.avi    { width: 38px; height: 38px; font-size: 14px; }
.avi-sm { width: 30px; height: 30px; font-size: 12px; }

/* ── Main ─────────────────────────────── */
.main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* .main is the grid's 1fr track (see .layout above). A grid track's
       default min-width is auto, meaning it refuses to shrink below its
       content's intrinsic width — so any wide table/filter row/KPI grid
       was expanding this column past the viewport and dragging the WHOLE
       layout (sidebar included) into horizontal scroll, instead of just
       letting that one wide element scroll internally. min-width: 0 is
       what actually lets this column shrink to the viewport. */
    min-width: 0;
}

/* ── Topbar (blends into the light bg) ───── */
.topbar {
    background: var(--bg);
    padding: 22px 36px 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
}

.topbar-left { min-width: 0; }

/* Hamburger + backdrop only exist visually at tablet/mobile widths — see
   @media below. Hidden by default so desktop is unaffected. */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink-700);
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 14px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 24, 0.45);
    z-index: 40;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--ink-400);
    margin-bottom: 2px;
}

.breadcrumb a { color: var(--ink-400); }
.breadcrumb a:hover { color: var(--ink-700); }
.breadcrumb .sep { opacity: 0.5; }
.breadcrumb .current { color: var(--ink-700); }

.topbar h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink-900);
}

.topbar .crumb {
    display: none;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box .ico {
    position: absolute;
    left: 10px;
    color: var(--ink-400);
    pointer-events: none;
}

.search-box input {
    padding: 7px 12px 7px 34px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--ink-50);
    width: 200px;
    color: var(--ink-700);
    transition: border-color 0.15s, background 0.15s;
}

.search-box input:focus {
    outline: none;
    border-color: var(--red);
    background: var(--surface);
}

.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--ink-500);
    cursor: pointer;
    position: relative;
    transition: background 0.1s, color 0.1s;
}

.icon-btn:hover { background: var(--ink-50); color: var(--ink-900); }

.icon-btn .dot {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red);
    border: 2px solid var(--surface);
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 12px 5px 5px;
    background: var(--surface);
    border: none;
    border-radius: 999px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: background 0.1s;
}

.user-chip:hover { background: var(--ink-50); }

.user-chip .avatar {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    background: var(--red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 11px;
}

.user-chip .user-name { font-size: 12.5px; font-weight: 600; color: var(--ink-900); }
.user-chip .user-mail { font-size: 11px; color: var(--ink-400); }

/* ── Page content wrapper ────────────────── */
.page-content {
    padding: 18px 36px 56px;
    flex: 1;
    min-width: 0;
}

/* For pages that still use @yield('content') directly without .page-content */
.main > *:not(.topbar) { }

/* ── Section title above content ─────────── */
.page-header {
    margin-bottom: 22px;
}

.page-header h2 {
    margin: 0 0 3px;
    font-size: 16px;
    font-weight: 650;
    color: var(--ink-900);
    letter-spacing: -0.01em;
}

.page-header p {
    margin: 0;
    color: var(--ink-500);
    font-size: 13px;
}

/* ── KPI grid (dark black→color gradient cards) ── */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.kpi {
    display: block;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px 22px;
    position: relative;
    transition: transform .12s ease, box-shadow .12s ease;
}

a.kpi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(17,17,24,.10);
    border-color: var(--ink-200);
}

.kpi-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.kpi-label {
    font-size: 13px;
    font-weight: 550;
    color: var(--ink-500);
    letter-spacing: 0;
    text-transform: none;
    order: 2;
}

.kpi-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: var(--chip-blue-bg);
    color: var(--chip-blue-fg);
    flex-shrink: 0;
    order: 1;
}

.kpi.alt  .kpi-icon { background: var(--chip-red-bg);    color: var(--chip-red-fg); }
.kpi.alt2 .kpi-icon { background: var(--chip-violet-bg); color: var(--chip-violet-fg); }
.kpi.ok   .kpi-icon { background: var(--chip-green-bg);  color: var(--chip-green-fg); }

.kpi-value {
    font-size: 26px;
    font-weight: 750;
    letter-spacing: -0.03em;
    color: var(--ink-900);
    line-height: 1;
}

.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    color: var(--success);
    margin-top: 8px;
    font-weight: 550;
}

.kpi-trend a { color: var(--red); text-decoration: none; }
.kpi-trend a:hover { color: var(--red-dark); }

.kpi-trend.down { color: var(--danger); }
.kpi-trend.neutral { color: var(--ink-400); }

/* ── Cards ───────────────────────────────── */
.card {
    background: var(--surface);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 16px;
}

.card h2 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: var(--ink-900);
}

.card .card-desc {
    color: var(--ink-500);
    font-size: 13px;
    margin-bottom: 16px;
}

/* ── Buttons ─────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    transition: background 0.1s, border-color 0.1s, color 0.1s;
    background: transparent;
    color: inherit;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; }

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

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

.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--ink-700);
    box-shadow: var(--shadow);
}
.btn-ghost:hover { background: var(--ink-50); color: var(--ink-900); }

.btn-soft {
    background: var(--red-light);
    color: var(--red);
}
.btn-soft:hover { background: #fde0e4; color: var(--red-dark); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 10px 20px; font-size: 14px; }

/* ── Tables ──────────────────────────────── */
.table-wrap {
    background: var(--surface);
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    overflow-x: auto;
}

/* Compact/minimal look (modeled on the Kiwi admin tables): small type,
   tight padding, and cells wrap at word boundaries so long values fold
   onto a second line instead of stretching the table sideways. Columns
   keep their NATURAL content-based widths — deliberately no
   table-layout: fixed, which distributes width evenly regardless of
   content and is what squished these tables in an earlier attempt. */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

thead th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    color: var(--ink-400);
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--ink-100);
    background: #FAFBFD;
    white-space: nowrap;
}

tbody td {
    padding: 9px 14px;
    border-top: 1px solid var(--ink-100);
    color: var(--ink-700);
    white-space: normal;
    vertical-align: middle;
}

tbody tr:first-child td { border-top: none; }
tbody tr:hover { background: #F8FAFD; }

/* Inside table rows, cap avatars at 30px — several views pass size 38 to
   the avatar partial, and that alone forces ~56px-tall rows no matter how
   tight the cell padding is. Scoped to td so profile headers/user chips
   elsewhere keep their full size. */
tbody td .avi { width: 30px; height: 30px; font-size: 12px; }

/* ── Badges ──────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 550;
    border: 1px solid transparent;
}

.badge-active  { background: var(--success-bg); color: var(--success); }
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-deleted { background: var(--danger-bg);  color: var(--danger);  }
.badge-pro     { background: var(--red-light); color: var(--red); }
.badge-asso    { background: #F5E8F5; color: #8B2E8B; }

/* ── Filters ─────────────────────────────── */
.filters {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.filters input, .filters select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 13px;
    background: var(--surface);
    min-width: 150px;
    color: var(--ink-700);
    box-shadow: var(--shadow);
}

.filters input:focus, .filters select:focus {
    outline: none;
    border-color: var(--red);
}

/* ── Forms ───────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--ink-700);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: inherit;
    font-size: 13px;
    background: var(--surface);
    color: var(--ink-900);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--red);
}

/* File inputs had no styling at all anywhere in the site — every upload
   field (stock media, bot avatar) rendered as the bare OS file picker
   ("Choisir un fichier" / "Aucun fichier choisi") with none of the
   rounded/bordered look every other input has. The native ::file-selector-
   button is themed to match .btn-ghost; the input itself gets the same
   border/radius as a text input so it sits flush with the rest of a form. */
.form-group input[type="file"] {
    padding: 6px;
    cursor: pointer;
}
.form-group input[type="file"]::file-selector-button {
    padding: 7px 14px;
    margin-right: 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--ink-100);
    color: var(--ink-700);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.form-group input[type="file"]::file-selector-button:hover {
    background: var(--ink-200);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── Moderation items ────────────────────── */
.mod-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    margin-bottom: 10px;
}

.mod-item.flagged { border-left: 3px solid var(--danger); }
.mod-item.queue   { border-left: 3px solid var(--red); }

.mod-head {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 16px;
}

.mod-title { font-weight: 600; font-size: 14px; color: var(--ink-900); }

.mod-meta {
    color: var(--ink-400);
    font-size: 11.5px;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.mod-meta .dot-sep {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--ink-300);
    display: inline-block;
}

.mod-body {
    background: var(--ink-50);
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 10px;
    color: var(--ink-700);
    line-height: 1.5;
}

.mod-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.mod-actions .spacer {
    margin-left: auto;
    color: var(--ink-400);
    font-size: 11.5px;
    display: inline-flex;
    gap: 5px;
    align-items: center;
}

/* ── Section header ──────────────────────── */
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin: 8px 0 16px;
    gap: 16px;
    flex-wrap: wrap;
}

.section-head h2 {
    margin: 0 0 3px;
    font-size: 17px;
    font-weight: 700;
    color: var(--ink-900);
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-head h2 .ico { color: var(--red); }

.section-head .sub {
    font-size: 13px;
    color: var(--ink-400);
}

.section-head .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── Notices ─────────────────────────────── */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--warning-bg);
    border: 1px solid #E8D49A;
    color: #7A5800;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    line-height: 1.5;
}

.notice .ico { color: var(--warning); margin-top: 1px; }

.notice.info {
    background: var(--red-light);
    border-color: #F5C0C9;
    color: #7A1829;
}

.notice.info .ico { color: var(--red); }

.notice.danger {
    background: var(--danger-bg);
    border-color: #F5C0C9;
    color: #7A1829;
}

.notice.danger .ico { color: var(--danger); }

/* ── Crypto hero ─────────────────────────── */
.crypto-hero {
    background: var(--ink-900);
    color: #fff;
    border-radius: 10px;
    padding: 24px 28px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.crypto-hero .hero-label {
    font-size: 10.5px;
    opacity: 0.6;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
}

.crypto-hero .hero-price {
    font-size: 36px;
    font-weight: 700;
    margin-top: 4px;
    letter-spacing: -0.03em;
}

.crypto-hero .hero-side { text-align: right; }

/* ── Empty state ─────────────────────────── */
.empty {
    text-align: center;
    padding: 48px 20px;
    color: var(--ink-400);
    font-size: 13px;
}

.muted { color: var(--ink-400); font-size: 12px; }

/* ── Quick action cards ───────────────────── */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin-bottom: 22px;
}

.quick-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 18px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.1s, background 0.1s;
}

.quick-card:hover {
    border-color: var(--red);
    background: var(--red-light);
    text-decoration: none;
}

.quick-card .qc-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--ink-100);
    color: var(--ink-500);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.quick-card:hover .qc-icon { background: var(--red); color: #fff; }

.quick-card.alt  .qc-icon { background: var(--danger-bg); color: var(--danger); }
.quick-card.alt2 .qc-icon { background: #F5E8F5; color: #8B2E8B; }
.quick-card.ok   .qc-icon { background: var(--success-bg); color: var(--success); }

.quick-card .qc-title { font-weight: 600; font-size: 13.5px; color: var(--ink-900); margin-bottom: 2px; }
.quick-card .qc-desc  { font-size: 12px; color: var(--ink-500); line-height: 1.45; }
.quick-card .qc-badge { margin-top: 6px; font-size: 11px; font-weight: 500; color: var(--red); }

/* ── Page intro ──────────────────────────── */
.page-intro {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    color: var(--ink-500);
}

.page-intro .pi-title { font-weight: 600; font-size: 13.5px; color: var(--ink-900); margin-bottom: 2px; }
.page-intro .pi-icon { display: none; }

/* ── Focus ───────────────────────────────── */
*:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Tabs ────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.tabs a, .tabs button {
    padding: 9px 14px;
    border: none;
    background: transparent;
    color: var(--ink-500);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.1s;
}

.tabs a:hover, .tabs button:hover { color: var(--ink-900); text-decoration: none; }

.tabs a.active, .tabs button.active {
    color: var(--red);
    border-bottom-color: var(--red);
}

.tabs .count {
    background: var(--ink-100);
    color: var(--ink-400);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 11px;
    font-weight: 600;
}

.tabs .active .count { background: var(--red-light); color: var(--red); }

/* ── Inbox ───────────────────────────────── */
.inbox {
    display: grid;
    grid-template-columns: 300px 1fr;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    min-height: 520px;
}

.inbox-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 680px; }

.inbox-item {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.1s;
}

.inbox-item:hover { background: var(--ink-50); }
.inbox-item.active { background: var(--red-light); border-left: 2px solid var(--red); padding-left: 12px; }
.inbox-item.unread .inbox-from { font-weight: 600; color: var(--ink-900); }
.inbox-item.unread .inbox-subject { font-weight: 600; color: var(--ink-900); }

.inbox-row { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.inbox-from { font-size: 13px; color: var(--ink-700); font-weight: 500; }
.inbox-date { font-size: 11px; color: var(--ink-400); white-space: nowrap; }
.inbox-subject { font-size: 13px; color: var(--ink-700); margin-top: 2px; }
.inbox-preview {
    font-size: 12px;
    color: var(--ink-400);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.inbox-tag {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--warning-bg);
    color: var(--warning);
    margin-top: 5px;
    font-weight: 600;
}

.inbox-tag.mod { background: var(--red-light); color: var(--red); }
.inbox-tag.report { background: var(--danger-bg); color: var(--danger); }

.inbox-view { padding: 20px 24px; overflow-y: auto; }
.inbox-view h3 { margin: 0 0 5px; font-size: 17px; font-weight: 650; color: var(--ink-900); }
.inbox-view .meta { color: var(--ink-500); font-size: 12px; margin-bottom: 14px; display: flex; gap: 8px; align-items: center; }
.inbox-view .meta .avatar {
    width: 28px; height: 28px; border-radius: 6px;
    background: var(--red); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 11px;
}
.inbox-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.inbox-body { font-size: 13.5px; line-height: 1.6; color: var(--ink-700); white-space: pre-line; }

.inbox-attachment {
    margin-top: 14px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    color: var(--ink-700);
}

/* ── Two-col layout ──────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    align-items: start;
    margin-top: 8px;
}

/* ── Toggle switch ───────────────────────── */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.toggle-row:last-child { border-bottom: none; }
.toggle-row .label { font-size: 13px; font-weight: 500; color: var(--ink-900); }
.toggle-row .label-desc { font-size: 12px; color: var(--ink-400); margin-top: 1px; }

.switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--ink-200);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}

.switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.switch.on { background: var(--red); }
.switch.on::after { transform: translateX(16px); }

/* ── Entity cards ────────────────────────── */
.entity-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 12px;
}

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

.entity-avatar {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
}

.entity-name { font-weight: 600; font-size: 14px; color: var(--ink-900); }
.entity-sub  { font-size: 12px; color: var(--ink-400); margin-top: 1px; }

.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.entity-field .k { color: var(--ink-400); text-transform: uppercase; letter-spacing: 0.05em; font-size: 10px; font-weight: 600; }
.entity-field .v { color: var(--ink-700); margin-top: 2px; font-size: 13px; font-weight: 500; }

/* ── Stat pill ───────────────────────────── */
.stat-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    background: var(--ink-50);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 11px;
    color: var(--ink-700);
    margin-right: 5px;
    margin-bottom: 5px;
}

.stat-pill strong { color: var(--ink-900); font-weight: 600; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 1100px) {
    .two-col { grid-template-columns: 1fr; }
    .inbox { grid-template-columns: 1fr; }
    .inbox-list { border-right: none; border-bottom: 1px solid var(--border); max-height: 260px; }
}

/* Filter rows use rigid min-width: 150px inputs (see .filters above) — with
   several fields that adds up to more than a small/tablet viewport well
   before the drawer breakpoint below, even though .main can now shrink.
   Let filter fields shrink and stack two-per-row instead of demanding
   their full min-width. */
@media (max-width: 960px) {
    .filters input, .filters select {
        min-width: 0;
        flex: 1 1 calc(50% - 8px);
    }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Tablet and below: the sidebar (230px fixed, ~15 links across 8 sections —
   too much content for an icon-only rail) becomes an off-canvas drawer
   instead of either permanently eating layout width or stacking above the
   content and pushing it down. Hidden off-screen by default; the topbar
   hamburger (.sidebar-toggle) toggles `.sidebar-open` on <body> to slide it
   in as an overlay with a backdrop, exactly like a typical mobile nav —
   the main content always gets the full viewport width underneath. */
@media (max-width: 1024px) {
    .layout { grid-template-columns: 1fr; }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 50;
        width: 260px;
        max-width: 82vw;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
        box-shadow: 4px 0 24px rgba(23, 26, 60, 0.15);
    }

    body.sidebar-open .sidebar { transform: translateX(0); }
    body.sidebar-open .sidebar-backdrop { display: block; }
    /* Prevent the page behind the drawer from scrolling while it's open. */
    body.sidebar-open { overflow: hidden; }

    .sidebar-toggle { display: flex; }
}

@media (max-width: 860px) {
    .page-content { padding: 16px 18px 40px; }
    .topbar { padding: 12px 18px; }
    .form-row { grid-template-columns: 1fr; }
    .search-box input { width: 140px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 520px) {
    .filters input, .filters select {
        flex: 1 1 100%;
    }
    .kpi-grid { grid-template-columns: 1fr; }
}

/* ── Modal (native <dialog>) ─────────────────── */
.adm-modal {
    border: none;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(17, 17, 24, 0.2);
}
.adm-modal::backdrop {
    background: rgba(17, 17, 24, 0.45);
}
.adm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.adm-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* ── Toggle switch ───────────────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 38px;
    height: 22px;
    cursor: pointer;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--ink-200);
    border-radius: 999px;
    transition: background .15s;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .15s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--success);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* ── User picker (search-as-you-type multi-select) ──────────── */
.user-picker-results {
    display: none;
    position: relative;
    margin-top: 4px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--ink-200);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(17,17,24,.08);
}
.user-picker-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
}
.user-picker-row:hover { background: var(--ink-50); }
.user-picker-empty {
    padding: 10px 12px;
    font-size: 12.5px;
    color: var(--ink-400);
}

/* Multi-category picker (partials/category-multiselect.blade.php) — used on
   admin/stock-media (upload form) and admin/stories (per-story tags). A
   closed toggle button that opens a centered <dialog> modal (client
   feedback, 2026-07-31) — replaced an earlier anchored dropdown popover
   that had clipping/scroll-chaining problems inside cards using
   overflow:hidden for rounded thumbnail corners; a <dialog> renders in the
   browser's top layer regardless of DOM ancestry, sidestepping all of that.
   Reuses the shared .adm-modal chrome (see "Modal (native <dialog>)" above). */
.cat-multiselect { position: relative; }
.cat-multiselect-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    font-family: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-700); cursor: pointer;
}
.cat-multiselect-toggle:hover { border-color: var(--ink-300); }
.cat-multiselect-search {
    width: 100%; margin: 10px 0; padding: 8px 10px; box-sizing: border-box;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    font-family: inherit; font-size: 13px; color: var(--ink-900);
}
.cat-multiselect-search:focus { outline: none; border-color: var(--red); }
.cat-multiselect-options {
    max-height: 320px; overflow-y: auto;
    /* Without this, scrolling past the list's own top/bottom "escapes" and
       scrolls the page behind the modal (client-reported, 2026-07-31). */
    overscroll-behavior: contain;
}
.cat-multiselect-option {
    display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px;
    font-size: 13px; color: var(--ink-700); cursor: pointer;
}
.cat-multiselect-option:hover { background: var(--ink-50); }

/* Bulk republish on admin/stories was removed (client request, 2026-08-03)
   — republishing an expired story now lives only on admin/stock-media's
   "Stories expirées" section. */

/* ── Pagination (bug fix, 2026-08-04) ───────
   Custom view registered app-wide in AppServiceProvider — see
   resources/views/partials/pagination.blade.php for why. */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pagination-disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.pagination-pages { display: flex; align-items: center; gap: 2px; }
.pagination-link, .pagination-current, .pagination-dots {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 30px; height: 30px; padding: 0 6px;
    border-radius: 8px; font-size: 12.5px; font-weight: 500;
}
.pagination-link { color: var(--ink-700); text-decoration: none; }
.pagination-link:hover { background: var(--ink-50); color: var(--ink-900); }
.pagination-current { background: var(--red); color: #fff; font-weight: 600; }
.pagination-dots { color: var(--ink-400); }
