/* =====================================================================
 *  SAPROSOFT BACK OFFICE — BRAND STYLESHEET
 *  Design system: red (#e31e1e), white, ink-black
 *  Fonts: DM Serif Display (headlines) + Manrope (UI)
 * ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=DM+Serif+Display&display=swap');

/* ---------- DESIGN TOKENS ---------- */
:root {
    --brand: #e31e1e;
    --brand-deep: #b81616;
    --brand-bright: #ff3838;
    --brand-soft: rgba(227, 30, 30, 0.08);
    --brand-softer: rgba(227, 30, 30, 0.04);

    --ink: #0a0a0a;
    --ink-2: #2b2b2b;

    --gray-700: #555;
    --gray-500: #8a8a8a;
    --gray-400: #a8a8a8;
    --gray-300: #d4d4d4;
    --gray-200: #e8e8e8;
    --gray-100: #f4f4f4;
    --gray-50: #fafafa;

    --white: #fff;
    --line: rgba(10, 10, 10, 0.08);

    --success: #16a34a;
    --warning: #ea580c;
    --info: #2563eb;
    --success-soft: rgba(22, 163, 74, 0.1);
    --warning-soft: rgba(234, 88, 12, 0.1);
    --info-soft: rgba(37, 99, 235, 0.1);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;

    --shadow-sm: 0 1px 0 rgba(10,10,10,0.04);
    --shadow: 0 1px 0 rgba(10,10,10,0.04), 0 8px 24px rgba(10,10,10,0.06);
    --shadow-lg: 0 12px 32px rgba(10,10,10,0.06);
    --shadow-brand: 0 4px 12px rgba(227, 30, 30, 0.25);
    --shadow-brand-strong: 0 6px 16px rgba(227, 30, 30, 0.35);
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-weight: 500;
    color: var(--ink);
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--brand-deep); }

h1, h2, h3, h4, h5, h6 {
    font-family: 'DM Serif Display', serif;
    font-weight: 400;
    color: var(--ink);
    letter-spacing: -0.015em;
    line-height: 1.15;
    margin: 0 0 0.5em;
}

img { max-width: 100%; }

/* ---------- LAYOUT — APP SHELL ---------- */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 64px 1fr;
    grid-template-areas:
        "sidebar topbar"
        "sidebar main";
    min-height: 100vh;
}

/* TOP BAR */
.topbar {
    grid-area: topbar;
    background: var(--white);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}
.topbar .crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.92rem;
    color: var(--gray-500);
    font-weight: 600;
}
.topbar .crumbs a { color: var(--gray-700); }
.topbar .crumbs .crumb-current { color: var(--ink); }
.topbar .crumbs .sep { color: var(--gray-300); }

.topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.user-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px 7px 10px;
    background: var(--gray-100);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    transition: all 0.15s ease;
}
.user-chip:hover { background: var(--ink); color: var(--white); }
.user-chip .avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), var(--brand-bright));
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 0.78rem;
    text-transform: uppercase;
}

/* SIDEBAR */
.sidebar {
    grid-area: sidebar;
    background: var(--white);
    border-right: 1px solid var(--line);
    padding: 22px 16px;
    overflow-y: auto;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 22px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--line);
}
.sidebar .brand .ring {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--brand), var(--brand-bright));
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    font-family: 'DM Serif Display', serif;
    font-size: 1.2rem;
    box-shadow: var(--shadow-brand);
}
.sidebar .brand .name {
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
}
.sidebar .brand .name .red { color: var(--brand); }
.sidebar .brand .name small {
    display: block;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--gray-500);
    text-transform: uppercase;
    margin-top: 2px;
}

.nav-section {
    margin-bottom: 18px;
}
.nav-section .nav-heading {
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 700;
    padding: 6px 12px;
    margin-bottom: 4px;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--gray-700);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    margin-bottom: 2px;
    transition: all 0.12s ease;
}
.nav-link svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
    color: var(--gray-500);
    transition: color 0.12s ease;
}
.nav-link:hover {
    background: var(--brand-soft);
    color: var(--brand);
}
.nav-link:hover svg { color: var(--brand); }
.nav-link.active {
    background: var(--ink);
    color: var(--white);
}
.nav-link.active svg { color: var(--white); }

.sidebar-foot {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--line);
    font-size: 11px;
    color: var(--gray-500);
    padding-left: 8px;
}

/* MAIN AREA */
.main {
    grid-area: main;
    padding: 28px 32px 60px;
    overflow-x: hidden;
}

/* ---------- COMMON: MASTHEAD ---------- */
.masthead { margin-bottom: 24px; }
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--brand);
    font-weight: 700;
    padding: 6px 12px;
    background: var(--brand-soft);
    border-radius: 100px;
    margin-bottom: 14px;
}
.eyebrow::before {
    content: "";
    width: 6px; height: 6px;
    background: var(--brand);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(227, 30, 30, 0.5);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(227, 30, 30, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(227, 30, 30, 0); }
    100% { box-shadow: 0 0 0 0 rgba(227, 30, 30, 0); }
}

.masthead h1 {
    font-size: 2.2rem;
    margin: 0 0 6px;
}
.masthead h1 em { font-style: italic; color: var(--brand); }
.masthead .sub {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin: 0;
    max-width: 700px;
}

/* ---------- BUTTONS ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    white-space: nowrap;
}
.btn-primary {
    background: var(--brand);
    color: var(--white);
    box-shadow: var(--shadow-brand);
}
.btn-primary:hover {
    background: var(--brand-deep);
    color: var(--white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-brand-strong);
}
.btn-ink {
    background: var(--ink);
    color: var(--white);
}
.btn-ink:hover { background: var(--brand); color: var(--white); transform: translateY(-1px); }

.btn-ghost {
    background: var(--white);
    color: var(--ink);
    border: 1.5px solid var(--gray-300);
}
.btn-ghost:hover {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
}
.btn-danger {
    background: var(--brand);
    color: var(--white);
    box-shadow: var(--shadow-brand);
}
.btn-danger:hover { background: var(--brand-deep); transform: translateY(-1px); }

.btn-sm { padding: 7px 12px; font-size: 0.78rem; }
.btn-lg { padding: 13px 22px; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- CARDS ---------- */
.card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-header .title {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 700;
    margin: 0;
}
.card-header .title b { color: var(--ink); }
.card-body { padding: 20px; }

/* ---------- STAT CARDS ---------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-card .ribbon {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.r-brand .ribbon { background: var(--brand); }
.stat-card.r-ink .ribbon { background: var(--ink); }
.stat-card.r-warning .ribbon { background: var(--warning); }
.stat-card.r-info .ribbon { background: var(--info); }
.stat-card.r-success .ribbon { background: var(--success); }

.stat-card .top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-top: 4px;
}
.stat-card .label {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 700;
}
.stat-card .icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    background: var(--gray-100);
    color: var(--ink);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.stat-card.r-brand:hover .icon { background: var(--brand); color: var(--white); }
.stat-card.r-ink:hover .icon { background: var(--ink); color: var(--white); }
.stat-card.r-warning:hover .icon { background: var(--warning); color: var(--white); }
.stat-card.r-info:hover .icon { background: var(--info); color: var(--white); }
.stat-card.r-success:hover .icon { background: var(--success); color: var(--white); }

.stat-card .value {
    font-family: 'DM Serif Display', serif;
    font-size: 1.9rem;
    line-height: 1.1;
    color: var(--ink);
    margin-bottom: 4px;
    word-break: break-word;
}
.stat-card .meta {
    font-size: 0.78rem;
    color: var(--gray-500);
    font-weight: 500;
}
.stat-card .meta b { color: var(--ink); font-weight: 700; }

/* ---------- MODULE TILES (home page launchers) ---------- */
.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.module-tile {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px;
    text-decoration: none;
    color: var(--ink);
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 130px;
}
.module-tile:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
    box-shadow: 0 1px 0 rgba(10,10,10,0.04), 0 8px 24px rgba(227, 30, 30, 0.12);
    color: var(--ink);
}
.module-tile .tile-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.module-tile:hover .tile-icon {
    background: var(--brand);
    color: var(--white);
}
.module-tile .tile-name {
    font-weight: 800;
    font-size: 0.95rem;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.module-tile .tile-desc {
    font-size: 0.82rem;
    color: var(--gray-500);
    line-height: 1.45;
    flex: 1;
}
.module-tile .tile-arrow {
    color: var(--gray-300);
    transition: all 0.2s ease;
}
.module-tile:hover .tile-arrow {
    color: var(--brand);
    transform: translateX(3px);
}

/* ---------- FORMS ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-700);
    font-weight: 700;
    margin-bottom: 8px;
}
.form-label .req { color: var(--brand); }

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: 'Manrope', sans-serif;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--white);
    transition: all 0.18s ease;
    outline: none;
}
.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--brand-soft);
}
.form-control::placeholder { color: var(--gray-400); font-weight: 400; }
textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { cursor: pointer; }

.form-help {
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-top: 6px;
}

/* ---------- TABLES ---------- */
.table-card {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.table-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--white);
    gap: 14px;
    flex-wrap: wrap;
}
.table-toolbar .title {
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 700;
}
.table-toolbar .title b { color: var(--ink); }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th {
    background: var(--gray-50);
    color: var(--gray-700);
    font-weight: 700;
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 13px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.data-table th.num { text-align: right; }
.data-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--ink);
    vertical-align: middle;
}
.data-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.data-table tr:hover td { background: var(--brand-soft); }
.data-table tr:last-child td { border-bottom: none; }

.id-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px; height: 24px;
    border-radius: 6px;
    background: var(--gray-100);
    color: var(--gray-700);
    font-weight: 700;
    font-size: 11px;
    padding: 0 6px;
}
.code-chip {
    display: inline-block;
    padding: 3px 10px;
    background: var(--ink);
    color: var(--white);
    border-radius: 6px;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
}
.row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 6px;
    color: var(--gray-500);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}
.row-action:hover {
    background: var(--brand-soft);
    color: var(--brand);
}
.row-action.danger:hover {
    background: var(--brand);
    color: var(--white);
}

/* ---------- BADGES ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-error,
.badge-danger { background: var(--brand-soft); color: var(--brand); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-ink { background: var(--ink); color: var(--white); }
.badge-gray { background: var(--gray-100); color: var(--gray-700); }
.badge-purple { background: #f3e8ff; color: #7c3aed; }

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

/* ---------- FLASH BANNERS ---------- */
.flash-banner {
    padding: 14px 18px;
    border-radius: var(--radius);
    border-left: 3px solid;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 16px;
    animation: flashSlide 0.3s ease-out;
}
@keyframes flashSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}
.flash-success { background: var(--success-soft); color: #14532d; border-left-color: var(--success); }
.flash-error   { background: var(--brand-soft); color: var(--brand-deep); border-left-color: var(--brand); }
.flash-warning { background: var(--warning-soft); color: #7c2d12; border-left-color: var(--warning); }
.flash-info    { background: var(--info-soft); color: #1e3a8a; border-left-color: var(--info); }

/* ---------- SEARCH BOX ---------- */
.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.search-wrap .search-icon {
    position: absolute;
    left: 12px;
    color: var(--gray-500);
    pointer-events: none;
    display: flex;
    align-items: center;
}
.search-wrap input {
    width: 280px;
    padding: 9px 36px 9px 36px;
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    font-family: 'Manrope', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink);
    background: var(--white);
    outline: none;
    transition: all 0.18s ease;
}
.search-wrap input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-soft);
}
.search-wrap input::placeholder { color: var(--gray-500); font-weight: 400; }

/* ---------- PAGINATION ---------- */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
}
.pagination a, .pagination span {
    padding: 6px 11px;
    border-radius: 6px;
    color: var(--ink);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    border: 1px solid var(--gray-300);
}
.pagination a:hover { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.pagination .active {
    background: var(--ink);
    color: var(--white);
    border-color: var(--ink);
}
.pagination .page-info {
    margin-left: auto;
    color: var(--gray-700);
    font-size: 0.82rem;
    border: none;
    padding: 0;
}

/* ---------- SCROLLBARS ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 10px;
    border: 2px solid var(--gray-50);
}
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas: "topbar" "main";
    }
    .sidebar {
        position: fixed;
        top: 0; left: -280px;
        width: 280px;
        height: 100vh;
        z-index: 50;
        transition: left 0.25s ease;
        box-shadow: 8px 0 24px rgba(0,0,0,0.1);
    }
    .sidebar.is-open { left: 0; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(10,10,10,0.5);
        z-index: 40;
    }
    .sidebar-overlay.is-open { display: block; }
    .menu-toggle {
        display: flex !important;
        background: transparent;
        border: none;
        padding: 6px;
        margin-right: 8px;
        cursor: pointer;
        color: var(--ink);
    }
}
.menu-toggle { display: none; }

@media (max-width: 600px) {
    .main { padding: 20px 16px 40px; }
    .topbar { padding: 0 16px; }
    .masthead h1 { font-size: 1.6rem; }
    .stats { grid-template-columns: 1fr; }
    .module-grid { grid-template-columns: 1fr; }
    .search-wrap input { width: 100%; }
    .topbar .crumbs { font-size: 0.78rem; gap: 4px; }
}

/* ---------- ACTION TOOLBAR (above tables/forms) ---------- */
.action-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.action-toolbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- FORM LAYOUT (edit/add pages) ---------- */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}
.form-grid.cols-1 { grid-template-columns: 1fr; }
.form-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.form-grid .full {
    grid-column: 1 / -1;
}
.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 18px 22px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    margin-top: 18px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}
.form-actions .help {
    margin-right: auto;
    font-size: 0.85rem;
    color: var(--gray-700);
}

/* ---------- SEARCH HIGHLIGHT ---------- */
mark.search-hl {
    background: rgba(255, 209, 102, 0.5);
    color: var(--ink);
    padding: 1px 2px;
    border-radius: 3px;
    font-weight: 700;
}

/* ---------- EMPTY STATES ---------- */
.empty-state {
    text-align: center;
    padding: 60px 24px;
}
.empty-state .empty-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--gray-100);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}
.empty-state .empty-title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.5rem;
    color: var(--ink);
    margin-bottom: 6px;
}
.empty-state .empty-sub {
    color: var(--gray-700);
    font-size: 0.9rem;
    margin-bottom: 18px;
}

/* ---------- BRANDED SWEETALERT2 ---------- */
.swal2-popup {
    border-radius: var(--radius-xl) !important;
    padding: 28px 24px 24px !important;
    font-family: 'Manrope', sans-serif !important;
}
.swal2-popup .swal2-title {
    font-family: 'DM Serif Display', serif !important;
    font-weight: 400 !important;
    font-size: 1.6rem !important;
    color: var(--ink) !important;
}
.swal2-popup .swal2-html-container {
    font-family: 'Manrope', sans-serif !important;
    font-size: 0.92rem !important;
    color: var(--gray-700) !important;
}
.swal2-popup .swal2-styled {
    border-radius: var(--radius) !important;
    padding: 11px 22px !important;
    font-weight: 700 !important;
    letter-spacing: 0.05em !important;
    text-transform: uppercase !important;
    font-size: 12px !important;
}

/* Toast variant — small, top-right, less padding */
.swal2-popup.sapro-toast {
    border-radius: 12px !important;
    padding: 14px 18px !important;
    font-family: 'Manrope', sans-serif !important;
    box-shadow: 0 10px 30px rgba(10, 10, 10, 0.15) !important;
    border-left: 4px solid var(--brand) !important;
}
.swal2-popup.sapro-toast .swal2-title {
    font-family: 'Manrope', sans-serif !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    color: var(--ink) !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
}
.swal2-popup.sapro-toast .swal2-icon {
    margin: 0 12px 0 0 !important;
    width: 24px !important;
    height: 24px !important;
}
.swal2-popup.sapro-toast .swal2-icon .swal2-icon-content {
    font-size: 14px !important;
}
.swal2-popup.sapro-toast.swal2-icon-success { border-left-color: #16a34a !important; }
.swal2-popup.sapro-toast.swal2-icon-error   { border-left-color: #e31e1e !important; }
.swal2-popup.sapro-toast.swal2-icon-warning { border-left-color: #ea580c !important; }
.swal2-popup.sapro-toast.swal2-icon-info    { border-left-color: #2563eb !important; }
.swal2-timer-progress-bar {
    background: linear-gradient(90deg, #e31e1e, #ea580c) !important;
}

/* ---------- VIEW PAGE: detail rows ---------- */
.detail-list {
    display: flex;
    flex-direction: column;
}
.detail-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    padding: 14px 0;
    border-bottom: 1px solid var(--gray-100);
    align-items: baseline;
    gap: 16px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .detail-label {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-500);
    font-weight: 700;
}
.detail-row .detail-value {
    color: var(--ink);
    font-weight: 600;
    word-break: break-word;
}
.detail-row .detail-value.code {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.9rem;
}
@media (max-width: 600px) {
    .detail-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   REVAMPED LIST PAGES — shared styles for cards + beefed tables
   ============================================================ */

/* ---------- Gradient stat cards (mini variant for list pages) ---------- */
.gstats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.gstat {
    position: relative;
    border-radius: 14px;
    padding: 18px 20px;
    overflow: hidden;
    color: var(--white);
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    box-shadow: 0 4px 14px rgba(10, 10, 10, 0.08);
    text-decoration: none;
    display: block;
    cursor: pointer;
}
.gstat:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(10, 10, 10, 0.14);
    color: var(--white);
}
.gstat::after {
    content: "";
    position: absolute;
    top: -30px; right: -30px;
    width: 110px; height: 110px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.13);
    transition: transform 0.4s ease;
}
.gstat:hover::after { transform: scale(1.6); }
.gstat .g-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    margin-bottom: 12px;
    position: relative; z-index: 2;
}
.gstat .g-label {
    font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85); font-weight: 700;
    margin-bottom: 4px; position: relative; z-index: 2;
}
.gstat .g-value {
    font-family: 'DM Serif Display', serif;
    font-size: 1.7rem; line-height: 1.1; color: var(--white);
    margin-bottom: 2px; position: relative; z-index: 2;
}
.gstat .g-meta {
    font-size: 0.72rem; color: rgba(255, 255, 255, 0.75);
    font-weight: 500; position: relative; z-index: 2;
}
.gstat-red    { background: linear-gradient(135deg, #e31e1e 0%, #ff6b35 100%); }
.gstat-ink    { background: linear-gradient(135deg, #1f2937 0%, #4b5563 100%); }
.gstat-blue   { background: linear-gradient(135deg, #2563eb 0%, #06b6d4 100%); }
.gstat-orange { background: linear-gradient(135deg, #ea580c 0%, #f59e0b 100%); }
.gstat-green  { background: linear-gradient(135deg, #16a34a 0%, #65a30d 100%); }
.gstat-purple { background: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%); }
.gstat-teal   { background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%); }

/* ---------- Colored toolbar wrapper (above tables/cards) ---------- */
.tb-wrap {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.tb-wrap::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, #e31e1e 0%, #ea580c 30%, #2563eb 60%, #16a34a 100%);
}
.tb-row {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
}
.tb-row .tb-search { flex: 1; min-width: 240px; }
.tb-row .tb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- BEEFED-UP TABLE STYLE ---------- */
.table-card.fancy {
    border-radius: 16px;
    overflow: hidden;
}
.table-card.fancy .table-toolbar {
    background: linear-gradient(180deg, var(--gray-50) 0%, var(--white) 100%);
    border-bottom: 2px solid var(--gray-100);
    padding: 14px 22px;
}
.table-card.fancy .table-toolbar .title {
    font-family: 'DM Serif Display', serif;
    font-size: 1.05rem;
    color: var(--ink);
}
.table-card.fancy .data-table thead th {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    color: rgba(255, 255, 255, 0.92);
    border-bottom: none;
    font-size: 11px;
    letter-spacing: 0.12em;
    font-weight: 700;
    padding: 14px 16px;
}
.table-card.fancy .data-table tbody tr {
    transition: background 0.15s ease, transform 0.15s ease;
}
.table-card.fancy .data-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(227, 30, 30, 0.04) 0%, rgba(245, 158, 11, 0.04) 100%);
}
.table-card.fancy .data-table tbody tr.row-status-warn {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.06) 0%, transparent 80%);
}
.table-card.fancy .data-table tbody tr.row-status-bad {
    background: linear-gradient(90deg, rgba(227, 30, 30, 0.05) 0%, transparent 80%);
}
.table-card.fancy .data-table tbody tr.row-status-good {
    background: linear-gradient(90deg, rgba(22, 163, 74, 0.04) 0%, transparent 80%);
}
.table-card.fancy .data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--gray-50);
}
.table-card.fancy .id-pill {
    background: linear-gradient(135deg, #1f2937, #4b5563);
    color: var(--white);
    font-weight: 700;
}

/* Pretty action buttons in fancy tables */
.table-card.fancy .row-action {
    border-radius: 10px;
    transition: all 0.18s ease;
    width: 32px; height: 32px;
}
.table-card.fancy .row-action:hover {
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.table-card.fancy .row-action.view  { background: rgba(37, 99, 235, 0.08); color: #2563eb; }
.table-card.fancy .row-action.edit  { background: rgba(234, 88, 12, 0.08); color: #ea580c; }
.table-card.fancy .row-action.danger{ background: rgba(227, 30, 30, 0.08); color: var(--brand); }
.table-card.fancy .row-action.activity { background: rgba(124, 58, 237, 0.10); color: #7c3aed; border: none; cursor: pointer; }
.table-card.fancy .row-action.activity:hover { background: #7c3aed; color: var(--white); }

/* Activity modal — wider, left-aligned content */
.swal2-popup.sapro-activity-modal {
    text-align: left !important;
    padding: 24px !important;
}
.swal2-popup.sapro-activity-modal .swal2-title {
    text-align: left !important;
    padding-left: 0 !important;
    margin: 0 0 18px !important;
}
.swal2-popup.sapro-activity-modal .swal2-html-container {
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ---------- CARD GRID for browsable lists (Schools / Users / LastUpdated) ---------- */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}
.entity-card {
    position: relative;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 22px;
    overflow: hidden;
    transition: all 0.25s cubic-bezier(.4,0,.2,1);
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}
.entity-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; height: 4px;
    background: var(--card-color, var(--brand));
    transition: height 0.25s ease;
}
.entity-card::after {
    content: "";
    position: absolute;
    top: -50px; right: -50px;
    width: 130px; height: 130px;
    border-radius: 50%;
    background: var(--card-color, var(--brand));
    opacity: 0.05;
    transition: all 0.4s ease;
}
.entity-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 36px rgba(10, 10, 10, 0.10);
    border-color: var(--card-color);
    color: var(--ink);
}
.entity-card:hover::before { height: 6px; }
.entity-card:hover::after  { transform: scale(2); opacity: 0.09; }

.entity-card .e-head {
    display: flex; align-items: flex-start; gap: 12px;
    position: relative; z-index: 2;
}
.entity-card .e-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: var(--card-color, var(--brand));
    color: var(--white);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.entity-card .e-titlebox { flex: 1; min-width: 0; }
.entity-card .e-name {
    font-weight: 800; font-size: 1rem; color: var(--ink);
    letter-spacing: -0.01em; line-height: 1.3;
    margin: 0 0 4px;
    word-wrap: break-word;
}
.entity-card .e-sub {
    font-size: 0.78rem; color: var(--gray-500);
    font-family: ui-monospace, Menlo, monospace;
}
.entity-card .e-id {
    background: var(--gray-100);
    color: var(--gray-700);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
    align-self: flex-start;
}

.entity-card .e-body {
    display: flex; flex-direction: column; gap: 8px;
    position: relative; z-index: 2;
}
.entity-card .e-row {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: 0.82rem; gap: 12px;
}
.entity-card .e-row .lbl {
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 10px;
}
.entity-card .e-row .val {
    color: var(--ink);
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.entity-card .e-badges {
    display: flex; gap: 6px; flex-wrap: wrap;
    position: relative; z-index: 2;
    margin-top: 4px;
}

.entity-card .e-foot {
    display: flex; gap: 6px;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
    position: relative; z-index: 2;
}
.entity-card .e-foot a {
    flex: 1;
    text-align: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}
.entity-card .e-foot .e-view {
    background: rgba(37, 99, 235, 0.08); color: #2563eb;
    border-color: rgba(37, 99, 235, 0.15);
}
.entity-card .e-foot .e-view:hover {
    background: #2563eb; color: var(--white);
}
.entity-card .e-foot .e-edit {
    background: var(--card-color, var(--brand)); color: var(--white);
    flex: 1.2;
}
.entity-card .e-foot .e-edit:hover { filter: brightness(1.1); }
.entity-card .e-foot .e-del {
    background: rgba(227, 30, 30, 0.06); color: var(--brand);
    flex: 0 0 42px;
    border-color: rgba(227, 30, 30, 0.12);
    display: flex; align-items: center; justify-content: center;
}
.entity-card .e-foot .e-del:hover {
    background: var(--brand); color: var(--white);
}

/* card color themes */
.ec-red    { --card-color: #e31e1e; }
.ec-ink    { --card-color: #0a0a0a; }
.ec-blue   { --card-color: #2563eb; }
.ec-orange { --card-color: #ea580c; }
.ec-green  { --card-color: #16a34a; }
.ec-purple { --card-color: #7c3aed; }
.ec-teal   { --card-color: #14b8a6; }
.ec-pink   { --card-color: #ec4899; }

/* ---------- Colored masthead variant (optional) ---------- */
.masthead.colorful {
    background: linear-gradient(135deg, #fff7f7 0%, #fff 50%, #fef3c7 100%);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 24px 28px;
    margin-bottom: 22px;
}
.masthead.colorful .eyebrow { color: var(--brand); }

/* Login activity dot (used in revenue accounts list) */
.login-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    cursor: help;
    flex-shrink: 0;
}
.login-dot.pulse {
    box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6);
    animation: dotPulse 2s ease-in-out infinite;
}
@keyframes dotPulse {
    0%   { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.55); }
    70%  { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
    100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}

/* ---------- LOGIN PAGE LAYOUT (overrides app-shell when on login) ---------- */
body.login-body {
    background: var(--gray-50);
}
body.login-body .login-layout {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
}
body.login-body .login-brand {
    position: relative;
    background: var(--ink);
    color: var(--white);
    padding: 56px 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}
body.login-body .login-brand::before,
body.login-body .login-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    pointer-events: none;
}
body.login-body .login-brand::before {
    width: 520px; height: 520px;
    background: var(--brand);
    top: -160px; right: -160px;
    animation: blob1 18s ease-in-out infinite;
}
body.login-body .login-brand::after {
    width: 380px; height: 380px;
    background: var(--brand-deep);
    bottom: -120px; left: -120px;
    animation: blob2 22s ease-in-out infinite;
}
@keyframes blob1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-30px, 40px) scale(1.08); }
}
@keyframes blob2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(0.95); }
}
body.login-body .login-brand-content {
    position: relative;
    z-index: 2;
    max-width: 520px;
}
body.login-body .login-brand-content .eyebrow {
    background: rgba(227, 30, 30, 0.18);
    border: 1px solid rgba(227, 30, 30, 0.3);
    color: var(--white);
    margin-bottom: 32px;
}
body.login-body .login-brand-content h1 {
    font-size: 3rem;
    color: var(--white);
    margin: 0 0 24px;
}
body.login-body .login-brand-content h1 em {
    font-style: italic;
    color: var(--brand-bright);
}
body.login-body .login-brand-content p {
    font-size: 1.05rem;
    color: rgba(255, 255, 255, 0.72);
    line-height: 1.6;
    margin: 0 0 40px;
    max-width: 460px;
}
body.login-body .login-brand-foot {
    position: relative;
    z-index: 2;
    font-size: 12px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 700;
}
body.login-body .login-brand-foot .red { color: var(--brand-bright); }

body.login-body .login-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--gray-50);
}
body.login-body .login-card {
    width: 100%;
    max-width: 440px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    box-shadow: var(--shadow-lg), 0 1px 0 rgba(10,10,10,0.04);
}
@media (max-width: 900px) {
    body.login-body .login-layout { grid-template-columns: 1fr; }
    body.login-body .login-brand { padding: 40px 28px 32px; min-height: auto; }
    body.login-body .login-brand-content h1 { font-size: 2rem; }
    body.login-body .login-card { padding: 32px 26px; }
}

/* =====================================================================
 * MOBILE — convert .data-table rows to cards on phones (<= 920px)
 * Applies globally to every fancy table in the back office.
 * Each <td> needs a data-label="…" attribute for labeling.
 * Bumped from 720px to 920px to cover larger Android phones.
 * ===================================================================== */
@media (max-width: 920px) {

    /* Tighten container + masthead */
    .main { padding: 18px 14px 32px; }
    .masthead h1 { font-size: 1.4rem; }
    .masthead .sub { font-size: 0.85rem; }

    /* Gradient stat cards stack into 1 column */
    .gstats { grid-template-columns: 1fr !important; gap: 12px; }
    .gstat { padding: 14px 16px; }
    .gstat .g-value { font-size: 1.6rem; }

    /* Toolbar with search + actions reflows */
    .tb-wrap .tb-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .tb-wrap .tb-search { width: 100%; }
    .tb-wrap .tb-search input { width: 100%; }
    .tb-wrap .tb-actions {
        margin-left: 0 !important;
        width: 100%;
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
    }
    .tb-wrap .tb-actions .btn { flex: 1; justify-content: center; }

    /* Table-toolbar (count + search) stacks vertically */
    .table-card.fancy .table-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    /* ======================================================
     * The core transform: data-table → card layout
     * Using !important to win over any existing selectors
     * ====================================================== */
    .table-card.fancy .data-table { display: block !important; }
    .table-card.fancy .data-table thead { display: none !important; }
    .table-card.fancy .data-table tbody { display: block !important; }

    .table-card.fancy .data-table tbody tr {
        display: block !important;
        padding: 14px 14px 12px;
        border-bottom: 1px solid var(--line);
        background: var(--white);
        position: relative;
    }
    .table-card.fancy .data-table tbody tr:hover {
        background: var(--white);
        transform: none;
        box-shadow: none;
    }
    .table-card.fancy .data-table tbody tr:last-child { border-bottom: none; }

    /* Status row tints — keep the left-edge accent band */
    .table-card.fancy .data-table tbody tr.row-status-bad,
    .table-card.fancy .data-table tbody tr.row-status-warn,
    .table-card.fancy .data-table tbody tr.row-status-good {
        padding-left: 18px;
    }

    .table-card.fancy .data-table tbody td {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 6px 0 !important;
        border-bottom: none !important;
        text-align: right;
        gap: 12px;
        width: 100% !important;
    }

    /* Auto-generated label on the left side of each td */
    .table-card.fancy .data-table tbody td::before {
        content: attr(data-label);
        font-size: 10px;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: var(--gray-500);
        font-weight: 700;
        flex-shrink: 0;
    }

    /* The "primary" cell (typically School/Name) gets promoted to a card header */
    .table-card.fancy .data-table tbody td[data-label="School"],
    .table-card.fancy .data-table tbody td[data-label="Name"],
    .table-card.fancy .data-table tbody td[data-label="Title"],
    .table-card.fancy .data-table tbody td[data-label="Username"],
    .table-card.fancy .data-table tbody td[data-label="Description"] {
        padding: 4px 0 10px;
        margin-bottom: 6px;
        border-bottom: 1px dashed var(--gray-200);
        align-items: flex-start;
        text-align: left;
        flex-direction: column;
        gap: 4px;
    }
    .table-card.fancy .data-table tbody td[data-label="School"]::before,
    .table-card.fancy .data-table tbody td[data-label="Name"]::before,
    .table-card.fancy .data-table tbody td[data-label="Title"]::before,
    .table-card.fancy .data-table tbody td[data-label="Username"]::before,
    .table-card.fancy .data-table tbody td[data-label="Description"]::before {
        font-size: 9px;
        margin-bottom: 0;
    }
    .table-card.fancy .data-table tbody td[data-label="School"] > span:first-child,
    .table-card.fancy .data-table tbody td[data-label="Name"] > span:first-child,
    .table-card.fancy .data-table tbody td[data-label="Title"] > span:first-child {
        font-size: 1rem !important;
        line-height: 1.25;
    }

    /* ID pill floats top-right of the card */
    .table-card.fancy .data-table tbody td[data-label="ID"] {
        position: absolute !important;
        top: 12px !important;
        right: 14px !important;
        padding: 0 !important;
        background: none !important;
        width: auto !important;
        display: block !important;
        z-index: 2;
    }
    .table-card.fancy .data-table tbody td[data-label="ID"]::before { display: none !important; }
    .table-card.fancy .data-table tbody td[data-label="ID"] .id-pill {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    /* Make space at the top of each card so the ID pill doesn't overlap the school name */
    .table-card.fancy .data-table tbody tr {
        padding-top: 36px;
    }

    /* Actions row goes full-width at the bottom of the card */
    .table-card.fancy .data-table tbody td[data-label="Actions"] {
        flex-direction: row;
        justify-content: flex-end;
        gap: 8px;
        padding: 10px 0 4px;
        margin-top: 6px;
        border-top: 1px dashed var(--gray-200);
    }
    .table-card.fancy .data-table tbody td[data-label="Actions"]::before {
        margin-right: auto;
        text-align: left;
    }

    /* Pagination on mobile — keep horizontal, allow wrapping, smaller buttons */
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 4px;
        padding: 14px 12px;
    }
    .pagination a, .pagination span {
        padding: 5px 9px;
        font-size: 0.78rem;
    }
    .pagination .page-info {
        margin-left: 0;
        flex-basis: 100%;
        text-align: center;
        padding-top: 8px;
        font-size: 0.78rem;
    }
}

/* Tiny phones */
@media (max-width: 380px) {
    .masthead h1 { font-size: 1.2rem; }
    .gstat .g-value { font-size: 1.4rem; }
    .tb-wrap .tb-actions { flex-direction: column; }
    .tb-wrap .tb-actions .btn { width: 100%; }
}
