/* ===========================================================================
   superadmin.strastic.com — self-contained styles.

   Brand accents flow from --site-primary-color / --site-secondary-color so
   the panel inherits the platform's brand colours when the host page sets
   them. Defaults match the platform default orange/purple from new-go-pro
   so the panel still looks branded if those vars aren't present.
   =========================================================================== */
:root {
    --site-primary-color:   #ED5600;
    --site-secondary-color: #a855f7;

    --sa-bg:        #f4f6fb;
    --sa-surface:   #ffffff;
    --sa-border:    #e2e8f0;
    --sa-text:      #0f172a;
    --sa-text-2:    #475569;
    --sa-muted:     #94a3b8;
    --sa-success:   #16a34a;
    --sa-warning:   #d97706;
    --sa-danger:    #dc2626;
    --sa-info:      #2563eb;

    --sa-radius:    10px;
    --sa-radius-sm: 6px;
    --sa-shadow:    0 1px 3px rgba(15, 23, 42, 0.06);
    --sa-shadow-lg: 0 8px 24px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--sa-text);
    background: var(--sa-bg);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
}

a { color: var(--site-primary-color); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 12.5px;
}
code { background: #f1f5f9; padding: 1px 6px; border-radius: 4px; }

/* ── Layout shells ────────────────────────────────────────────────────── */
.sa-body-app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}
.sa-body-bare {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}
.sa-main {
    padding: 28px 36px 60px;
    max-width: 1280px;
    width: 100%;
}
.sa-main-bare {
    width: 100%;
    max-width: 440px;
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sa-sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #e2e8f0;
    padding: 22px 14px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sa-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    padding: 0 8px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 14px;
}
.sa-brand .material-icons {
    background: linear-gradient(135deg, var(--site-primary-color), var(--site-secondary-color));
    color: #fff;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 18px;
}
.sa-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sa-nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--sa-radius-sm);
    color: #cbd5e1;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.sa-nav-item:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #fff;
    text-decoration: none;
}
.sa-nav-item .material-icons { font-size: 18px; opacity: 0.85; }
.sa-nav-active {
    background: rgba(237, 86, 0, 0.18);
    background: color-mix(in srgb, var(--site-primary-color) 22%, transparent);
    color: #fff;
}
.sa-nav-active .material-icons { color: var(--site-primary-color); opacity: 1; }

.sa-sidebar-foot {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sa-user { flex: 1; min-width: 0; }
.sa-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-user-role { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: 0.4px; }
.sa-logout {
    color: #cbd5e1;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}
.sa-logout:hover { background: rgba(220, 38, 38, 0.18); color: #fff; }
.sa-logout .material-icons { font-size: 18px; }

/* ── Auth shells (login + setup) ──────────────────────────────────────── */
.sa-auth-shell { width: 100%; max-width: 440px; }
.sa-auth-card {
    background: var(--sa-surface);
    border-radius: 14px;
    padding: 32px 30px;
    box-shadow: var(--sa-shadow-lg);
    border-top: 4px solid var(--site-primary-color);
}
.sa-auth-title {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: var(--sa-text);
}
.sa-auth-sub {
    color: var(--sa-text-2);
    margin: 0 0 22px;
    font-size: 13px;
}

/* ── Form primitives ──────────────────────────────────────────────────── */
.sa-field { display: block; margin-bottom: 14px; }
.sa-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--sa-text-2);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 4px;
}
.sa-input,
.sa-textarea,
.sa-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius-sm);
    background: var(--sa-surface);
    font-size: 14px;
    color: var(--sa-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.sa-input:focus,
.sa-textarea:focus,
.sa-select:focus {
    border-color: var(--site-primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-primary-color) 18%, transparent);
}
.sa-textarea { resize: vertical; min-height: 90px; font-family: inherit; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.sa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--sa-radius-sm);
    border: 1px solid var(--sa-border);
    background: var(--sa-surface);
    color: var(--sa-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
    text-decoration: none;
}
.sa-btn:hover { border-color: var(--site-primary-color); color: var(--site-primary-color); }
.sa-btn:active { transform: translateY(1px); }
.sa-btn .material-icons { font-size: 16px; }

.sa-btn-primary {
    background: var(--site-primary-color);
    border-color: var(--site-primary-color);
    color: #fff;
}
.sa-btn-primary:hover {
    background: color-mix(in srgb, var(--site-primary-color) 88%, black);
    border-color: color-mix(in srgb, var(--site-primary-color) 88%, black);
    color: #fff;
}

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

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

.sa-btn-block { width: 100%; justify-content: center; }
.sa-btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Cards / panels ───────────────────────────────────────────────────── */
.sa-card {
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius);
    padding: 22px 24px;
    box-shadow: var(--sa-shadow);
    margin-bottom: 20px;
}
.sa-card h1, .sa-card h2 { margin-top: 0; }

/* Two-column grid for paired info cards (used by user-detail). The cards
   stack on narrow screens so the page stays readable on tablets. */
.sa-grid {
    display: grid;
    gap: 18px;
}
.sa-grid-2 { grid-template-columns: 1fr 1fr; }
.sa-grid-2 > .sa-card { margin-bottom: 0; }
@media (max-width: 900px) {
    .sa-grid-2 { grid-template-columns: 1fr; }
}

/* Definition list used on detail pages — left column is the label, right
   is the value. dt/dd alternate down the same two-column track. */
.sa-dl {
    display: grid;
    grid-template-columns: 150px 1fr;
    gap: 10px 16px;
    margin: 0;
}
.sa-dl dt {
    color: var(--sa-text-2);
    font-size: 12.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    align-self: center;
}
.sa-dl dd {
    margin: 0;
    color: var(--sa-text);
    font-size: 14px;
    word-break: break-word;
}

.sa-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}
.sa-card-title h2 { margin: 0; font-size: 18px; font-weight: 700; }

.sa-page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    gap: 14px;
    flex-wrap: wrap;
}
.sa-page-head h1 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--sa-text);
}
.sa-page-head .sa-page-sub {
    font-size: 13px;
    color: var(--sa-text-2);
    margin-top: 3px;
}

/* ── Stat grid ────────────────────────────────────────────────────────── */
.sa-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.sa-stat {
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius);
    padding: 18px 20px;
    box-shadow: var(--sa-shadow);
    position: relative;
    overflow: hidden;
}
.sa-stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--site-primary-color), var(--site-secondary-color));
}
.sa-stat-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--sa-muted);
    margin-bottom: 6px;
}
.sa-stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--sa-text);
    line-height: 1.1;
}
.sa-stat-sub {
    font-size: 12px;
    color: var(--sa-text-2);
    margin-top: 6px;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.sa-table-wrap {
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius);
    /* overflow-x:auto so a plain (non-DataTables) wide table scrolls
       sideways inside the card rather than overflowing the page.
       overflow-y stays hidden so the rounded corners aren't clipped
       by the scrollbar gutter. */
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: var(--sa-shadow);
}
/* Make sure the inner table can grow past the wrapper width when the
   columns demand it. min-content lets each column ask for the space it
   needs, then horizontal scrolling kicks in via the wrapper. */
.sa-table-wrap > .sa-table { min-width: max-content; }

/* DataTables' own horizontal-scroll container (scrollX:true).
   We undo the inner table's min-width here so DT can manage column
   widths itself, and ensure the header + body scroll in lockstep. */
.sa-table-wrap .dataTables_scroll {
    width: 100%;
}
.sa-table-wrap .dataTables_scrollBody,
.sa-table-wrap .dataTables_scrollHead {
    overflow-x: auto !important;
}
.sa-table-wrap .dataTables_wrapper > .dataTables_scroll table.sa-table.dataTable { min-width: 0; }
.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.sa-table th {
    background: #f8fafc;
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--sa-text-2);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--sa-border);
}
.sa-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--sa-border);
    vertical-align: middle;
}
.sa-table tr:last-child td { border-bottom: 0; }
.sa-table tbody tr:hover { background: #fafbfd; }
.sa-table-empty {
    padding: 50px 20px;
    text-align: center;
    color: var(--sa-muted);
}

/* ── Pills / status badges ───────────────────────────────────────────── */
.sa-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background: #f1f5f9;
    color: var(--sa-text-2);
}
.sa-pill-success { background: #dcfce7; color: #15803d; }
.sa-pill-warning { background: #fef3c7; color: #92400e; }
.sa-pill-danger  { background: #fee2e2; color: #991b1b; }
.sa-pill-info    { background: #dbeafe; color: #1e40af; }
.sa-pill-brand {
    background: color-mix(in srgb, var(--site-primary-color) 14%, transparent);
    color: var(--site-primary-color);
}

/* ── Flash messages ───────────────────────────────────────────────────── */
.sa-flash {
    padding: 11px 14px;
    border-radius: var(--sa-radius-sm);
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid transparent;
}
.sa-flash-success { background: #f0fdf4; border-color: #bbf7d0; color: #166534; }
.sa-flash-error,
.sa-flash-danger  { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.sa-flash-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.sa-flash-info    { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

/* ── Misc ─────────────────────────────────────────────────────────────── */
.sa-muted { color: var(--sa-muted); }
.sa-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }
.sa-row { display: flex; gap: 10px; align-items: center; }
.sa-grow { flex: 1; }

.sa-tabs {
    display: flex;
    border-bottom: 1px solid var(--sa-border);
    margin-bottom: 18px;
    gap: 4px;
}
.sa-tab {
    padding: 10px 18px;
    font-size: 13px;
    font-weight: 600;
    color: var(--sa-text-2);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
}
.sa-tab:hover { color: var(--sa-text); }
.sa-tab.sa-tab-active {
    color: var(--site-primary-color);
    border-bottom-color: var(--site-primary-color);
}

.sa-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.sa-toolbar .sa-input { max-width: 320px; }

/* ── Embedded admin-cp iframe (Editor tabs, legacy iframe path) ───────── */
.sa-embed-frame {
    background: var(--sa-surface);
    border: 1px solid var(--sa-border);
    border-radius: var(--sa-radius);
    overflow: hidden;
    box-shadow: var(--sa-shadow);
    /* 100vh minus rough chrome above (hero ~180px + tabs ~46px + paddings) */
    height: calc(100vh - 280px);
    min-height: 600px;
}
.sa-embed-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: var(--sa-bg);
}

/* ── Inline admin-cp embed (Editor tabs, native render) ───────────────── */
/* Hosts the actual admin-cp content.phtml — no iframe.  We render inside
   the panel chrome but want the editor's own internal layout to drive its
   height (it sets .on-root { height: calc(100vh - 100px) } etc.). The
   wrapper resets a few panel constraints that would otherwise pinch the
   editor:
     • full-width: panel's max-width (1280px) would crop wide editors
     • no top/side padding: the page hero already provides breathing room
     • normalized background so the editor's surface colours win */
.sa-embed-inline {
    margin: 0 -36px;            /* counter .sa-main horizontal padding   */
    padding: 0 12px;
    background: transparent;
}
@media (max-width: 900px) {
    .sa-embed-inline { margin: 0 -16px; padding: 0 8px; }
}
/* Some content.phtml files emit a .on-root / .ss-wrap that already does
   internal scrolling — make sure the parent doesn't introduce a second
   scroll context that fights with it. */
.sa-embed-inline .on-root,
.sa-embed-inline .ss-wrap { max-width: none; }

@media (max-width: 900px) {
    .sa-body-app { grid-template-columns: 1fr; }
    .sa-sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 12px; }
    .sa-brand { border: none; padding: 0; margin: 0 12px 0 0; }
    .sa-nav { flex-direction: row; overflow-x: auto; flex: 1; }
    .sa-nav-item { padding: 6px 10px; }
    .sa-nav-item span:not(.material-icons) { display: none; }
    .sa-sidebar-foot { border: none; padding: 0; margin-left: 12px; }
    .sa-main { padding: 18px 16px 40px; }
}

/* Global font swap — Inter is loaded by layout-start.php / login.php. */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ══════════════════════════════════════════════════════════════════════
   DataTables theming — keep the native DT plugin but make its chrome
   match the rest of the panel. All accents flow through site CSS vars.
   ══════════════════════════════════════════════════════════════════════ */
.dataTables_wrapper { font-size: 13px; color: var(--sa-text); }
.dataTables_wrapper .sa-dt-top,
.dataTables_wrapper .sa-dt-bot {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border-bottom: 1px solid var(--sa-border);
    flex-wrap: wrap;
}
.dataTables_wrapper .sa-dt-bot {
    border-bottom: 0;
    border-top: 1px solid var(--sa-border);
}
.dataTables_wrapper .dt-length,
.dataTables_wrapper .dt-search { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--sa-text-2); }
.dataTables_wrapper .dt-search { margin-left: auto; }
.dataTables_wrapper .dt-length label,
.dataTables_wrapper .dt-search label { font-weight: 600; color: var(--sa-text-2); }
.dataTables_wrapper .dt-length select,
.dataTables_wrapper .dt-search input {
    padding: 7px 11px;
    border: 1px solid var(--sa-border);
    border-radius: 7px;
    font-size: 13px;
    background: #fff;
    color: var(--sa-text);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.dataTables_wrapper .dt-length select { padding-right: 24px; }
.dataTables_wrapper .dt-length select:focus,
.dataTables_wrapper .dt-search input:focus {
    border-color: var(--site-primary-color);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--site-primary-color) 14%, transparent);
}
.dataTables_wrapper .dt-search input { width: 240px; }

.dataTables_wrapper .dt-info { font-size: 12px; color: var(--sa-text-2); }

.dataTables_wrapper .dt-paging { margin-left: auto; display: flex; gap: 4px; align-items: center; }
.dataTables_wrapper .dt-paging .dt-paging-button {
    background: #fff;
    border: 1px solid var(--sa-border);
    color: var(--sa-text-2);
    padding: 5px 11px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
    min-width: 32px;
    text-align: center;
}
.dataTables_wrapper .dt-paging .dt-paging-button:hover {
    border-color: var(--site-primary-color);
    color: var(--site-primary-color);
}
.dataTables_wrapper .dt-paging .dt-paging-button.current,
.dataTables_wrapper .dt-paging .dt-paging-button.current:hover {
    background: var(--site-primary-color);
    border-color: var(--site-primary-color);
    color: #fff;
}
.dataTables_wrapper .dt-paging .dt-paging-button.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    color: var(--sa-muted);
}

/* DataTables sort indicators tinted to brand */
table.dataTable thead > tr > th.dt-orderable-asc,
table.dataTable thead > tr > th.dt-orderable-desc { cursor: pointer; user-select: none; }
table.dataTable thead > tr > th.dt-ordering-asc  span.dt-column-order::before,
table.dataTable thead > tr > th.dt-ordering-desc span.dt-column-order::after { color: var(--site-primary-color); opacity: 1; }

/* Wrap DataTables-generated table chrome to match our card style */
.sa-table-wrap .dataTables_wrapper {
    background: var(--sa-surface);
    border-radius: var(--sa-radius);
}
.sa-table-wrap > table.dataTable {
    margin: 0 !important;
}

/* DataTables responsive child rows */
table.dataTable > tbody > tr.dtr-expanded > td.dtr-control::before,
table.dataTable > tbody > tr.dtr-expanded > th.dtr-control::before {
    background-color: var(--site-primary-color);
    border-color: var(--site-primary-color);
}
table.dataTable > tbody > tr > td.dtr-control::before,
table.dataTable > tbody > tr > th.dtr-control::before {
    background-color: var(--sa-text-2);
    border-color: var(--sa-text-2);
}

/* ══════════════════════════════════════════════════════════════════════
   SweetAlert2 theming
   ══════════════════════════════════════════════════════════════════════ */
.swal2-popup.sa-swal-popup {
    border-radius: 14px;
    padding: 28px 28px 24px;
    box-shadow: 0 20px 60px -10px rgba(15, 23, 42, 0.25);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.swal2-popup.sa-swal-popup .swal2-title { font-size: 19px; font-weight: 700; color: var(--sa-text); }
.swal2-popup.sa-swal-popup .swal2-html-container { font-size: 14px; color: var(--sa-text-2); line-height: 1.55; }
.swal2-styled.swal2-confirm {
    background: linear-gradient(135deg, var(--site-primary-color), var(--site-secondary-color)) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 9px 22px !important;
    box-shadow: 0 6px 18px -4px color-mix(in srgb, var(--site-primary-color) 60%, transparent) !important;
}
.swal2-styled.swal2-cancel {
    background: #f1f5f9 !important;
    color: var(--sa-text) !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    padding: 9px 22px !important;
}
.swal2-styled:focus { box-shadow: 0 0 0 4px color-mix(in srgb, var(--site-primary-color) 18%, transparent) !important; }

/* Toast variant */
.swal2-popup.sa-swal-toast {
    padding: 12px 16px !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.2) !important;
    font-family: 'Inter', sans-serif !important;
}
.swal2-popup.sa-swal-toast .swal2-title { font-size: 13px; font-weight: 600; }

/* ══════════════════════════════════════════════════════════════════════
   Button states — spinner + ripple-ish hover
   ══════════════════════════════════════════════════════════════════════ */
.sa-btn,
.sa-btn-primary,
.sa-btn-danger {
    position: relative;
    overflow: hidden;
}
.sa-btn[disabled],
.sa-btn-primary[disabled],
.sa-btn-danger[disabled] {
    opacity: 0.7;
    cursor: wait;
}
.sa-btn-spin {
    animation: saSpin 0.85s linear infinite;
    vertical-align: -3px;
    font-size: 15px !important;
}
@keyframes saSpin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Subtle press feedback */
.sa-btn:active:not([disabled]),
.sa-btn-primary:active:not([disabled]),
.sa-btn-danger:active:not([disabled])  { transform: translateY(1px); }

/* ══════════════════════════════════════════════════════════════════════
   Global page-loader overlay (toggled by app.js when long-running
   internal actions kick off — e.g. migration-run, cron-run).
   ══════════════════════════════════════════════════════════════════════ */
.sa-page-loader {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
}
body.sa-page-loader-on .sa-page-loader { display: flex; }
.sa-page-loader-card {
    background: #fff;
    padding: 24px 28px;
    border-radius: 14px;
    box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 280px;
}
.sa-page-loader-msg { font-weight: 600; color: var(--sa-text); }
.sa-spinner {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 3px solid color-mix(in srgb, var(--site-primary-color) 25%, transparent);
    border-top-color: var(--site-primary-color);
    animation: saSpin 0.85s linear infinite;
    flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════════════════
   Polishing — micro-animations, hover lift, gradients
   ══════════════════════════════════════════════════════════════════════ */
.sa-card,
.sa-stat,
.sa-table-wrap {
    transition: box-shadow 0.18s, transform 0.18s;
}
.sa-card:hover { box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08); }
.sa-stat:hover { box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08); transform: translateY(-1px); }

.sa-page-head h1 {
    background: linear-gradient(135deg, var(--sa-text) 0%, color-mix(in srgb, var(--site-primary-color) 30%, var(--sa-text)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Stat number — pop the gradient on the value */
.sa-stat-value {
    background: linear-gradient(135deg, var(--site-primary-color) 0%, var(--site-secondary-color) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Nicer pill borders */
.sa-pill {
    border: 1px solid transparent;
}
.sa-pill-success { border-color: #bbf7d0; }
.sa-pill-warning { border-color: #fde68a; }
.sa-pill-danger  { border-color: #fecaca; }
.sa-pill-info    { border-color: #bfdbfe; }
.sa-pill-brand   { border-color: color-mix(in srgb, var(--site-primary-color) 28%, transparent); }

/* Sidebar — softer, slightly more contrast */
.sa-sidebar { box-shadow: 4px 0 16px rgba(15, 23, 42, 0.04); }

/* Tabs underline animation */
.sa-tab {
    position: relative;
    transition: color 0.15s;
}
.sa-tab::after {
    content: '';
    position: absolute;
    left: 14px; right: 14px; bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, var(--site-primary-color), var(--site-secondary-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.25s ease;
}
.sa-tab.sa-tab-active { border-bottom-color: transparent; }
.sa-tab.sa-tab-active::after { transform: scaleX(1); }

/* Flash banner slide-in */
.sa-flash {
    animation: saFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes saFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Page fade-in for the main pane */
.sa-main {
    animation: saFadeIn 0.25s ease-out;
}

/* ══════════════════════════════════════════════════════════════════════
   PROFESSIONAL PAGE HERO — used at the top of every page via
   sa_page_header(). Gradient backdrop (site primary → secondary),
   glassmorphism icon tile, title + description + optional badges, and
   a right-side actions slot. Matches the admin-cp hub-boosts hero feel.
   ══════════════════════════════════════════════════════════════════════ */
.sa-page-hero {
    position: relative;
    background: linear-gradient(135deg, var(--site-primary-color, #ED5600) 0%, var(--site-secondary-color, #a855f7) 100%);
    color: #fff;
    border-radius: 16px;
    padding: 26px 32px;
    margin-bottom: 24px;
    overflow: hidden;
    box-shadow: 0 14px 34px -10px color-mix(in srgb, var(--site-primary-color, #ED5600) 50%, transparent);
    animation: saHeroIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes saHeroIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Decorative soft glow blob on the right — adds depth without a big image. */
.sa-page-hero-glow {
    position: absolute;
    top: -60%;
    right: -8%;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    filter: blur(80px);
    pointer-events: none;
}

.sa-page-hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 22px;
    flex-wrap: wrap;
}

.sa-page-hero-icon {
    width: 58px;
    height: 58px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow:
        0 8px 24px -6px rgba(0, 0, 0, 0.25),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.sa-page-hero-icon .material-icons {
    color: #fff;
    font-size: 28px;
}

.sa-page-hero-text {
    flex: 1;
    min-width: 240px;
}

.sa-page-hero-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    margin-bottom: 6px;
    padding: 3px 9px 3px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: background 0.15s, color 0.15s;
}
.sa-page-hero-back:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    text-decoration: none;
}
.sa-page-hero-back .material-icons { font-size: 15px; }

.sa-page-hero-title {
    margin: 0 0 4px;
    font-size: 23px;
    font-weight: 800;
    color: #fff !important;
    letter-spacing: -0.4px;
    line-height: 1.15;
    /* Override the dashboard-style gradient text fill applied by .sa-page-head h1 — hero already lives on a gradient. */
    -webkit-text-fill-color: #fff;
    background: none;
}

.sa-page-hero-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.sa-page-hero-desc {
    margin: 0;
    font-size: 13.5px;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.55;
    max-width: 640px;
}
.sa-page-hero-desc code {
    background: rgba(0, 0, 0, 0.18);
    color: rgba(255, 255, 255, 0.95);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 12px;
}

/* Slot wrapper for caller-provided badges/pills — repaints any pill to
   a glassmorphism look so contrast on the gradient surface stays high. */
.sa-page-hero-badge-slot .sa-pill {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
    backdrop-filter: blur(4px);
}
.sa-page-hero-badge-slot .sa-pill-success { background: rgba(34, 197, 94, 0.32); border-color: rgba(187, 247, 208, 0.55); }
.sa-page-hero-badge-slot .sa-pill-warning { background: rgba(245, 158, 11, 0.32); border-color: rgba(253, 230, 138, 0.55); }
.sa-page-hero-badge-slot .sa-pill-danger  { background: rgba(220, 38, 38, 0.36);  border-color: rgba(254, 202, 202, 0.55); }
.sa-page-hero-badge-slot .sa-pill-info    { background: rgba(37, 99, 235, 0.32);  border-color: rgba(191, 219, 254, 0.55); }

.sa-page-hero-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
    margin-left: auto;
    flex-wrap: wrap;
}

/* Hero action button — glass-style by default; the .primary variant is
   solid white for the strongest CTA on the page. */
.sa-btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.32);
    color: #fff;
    padding: 9px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    backdrop-filter: blur(8px);
    transition: background 0.15s, transform 0.12s, box-shadow 0.18s;
    font-family: inherit;
}
.sa-btn-hero:hover {
    background: rgba(255, 255, 255, 0.28);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.18);
}
.sa-btn-hero:active { transform: translateY(0); }
.sa-btn-hero[disabled] { opacity: 0.65; cursor: wait; transform: none; }
.sa-btn-hero .material-icons { font-size: 17px; }

.sa-btn-hero-primary {
    background: #fff;
    color: var(--site-primary-color, #ED5600) !important;
    border-color: #fff;
    box-shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.22);
}
.sa-btn-hero-primary:hover {
    background: #fff;
    color: var(--site-primary-color, #ED5600) !important;
    filter: brightness(1.02);
    box-shadow: 0 10px 22px -4px rgba(0, 0, 0, 0.28);
}

.sa-btn-hero-danger {
    background: rgba(220, 38, 38, 0.85);
    border-color: rgba(254, 202, 202, 0.4);
}
.sa-btn-hero-danger:hover {
    background: rgba(220, 38, 38, 1);
}

/* Mobile — actions drop below the title, icon shrinks. */
@media (max-width: 720px) {
    .sa-page-hero { padding: 22px 22px; }
    .sa-page-hero-inner { gap: 16px; }
    .sa-page-hero-icon { width: 46px; height: 46px; border-radius: 12px; }
    .sa-page-hero-icon .material-icons { font-size: 22px; }
    .sa-page-hero-title { font-size: 19px; }
    .sa-page-hero-actions {
        flex-basis: 100%;
        margin-left: 0;
    }
}

