/* Super Admin Panel styles. Loaded only by layouts/platform.blade.php. No external fonts or icon files. */

:root {
    /* Emerald theme. The main colour can still be changed under Settings (theme colour), which sets --pf-primary on each page. */
    --pf-primary: #087D49;
    --pf-primary-soft: #DDF5E4;
    --pf-secondary: #0E9A5B;
    --pf-accent: #138D24;
    --pf-success: #15803D;
    --pf-success-soft: #DCFCE7;
    --pf-warning: #F59E0B;
    --pf-warning-soft: #FEF3C7;
    --pf-danger: #DC2626;
    --pf-danger-soft: #FEE2E2;
    --pf-bg: #EFF8F2;
    --pf-surface: #FFFFFF;
    --pf-surface-2: #F4FBF6;
    --pf-text: #073D35;
    --pf-muted: #64748B;
    --pf-border: #D5EBDD;
    --pf-shadow: 0 1px 2px rgba(7, 61, 53, 0.04), 0 6px 22px rgba(7, 61, 53, 0.06);
    --pf-radius: 20px;
    --pf-field-radius: 12px;
    --pf-sidebar: 248px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --pf-primary-soft: rgba(8, 125, 73, 0.24);
    --pf-success-soft: rgba(21, 128, 61, 0.2);
    --pf-warning-soft: rgba(245, 158, 11, 0.18);
    --pf-danger-soft: rgba(220, 38, 38, 0.18);
    --pf-bg: #061A16;
    --pf-surface: #0B2A24;
    --pf-surface-2: #113830;
    --pf-text: #E6F7EF;
    --pf-muted: #9CC5B3;
    --pf-border: #1B4A40;
    --pf-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--pf-text);
    background: var(--pf-bg);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--pf-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; color: var(--pf-text); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--pf-surface-2); padding: 2px 6px; border-radius: 6px; }

/* ---------- Shell ---------- */

.pf-shell {
    display: flex; min-height: 100vh;
    /* The sidebar column is painted the full height of the page, not only the first screen. */
    --pf-column: var(--pf-sidebar);
    background: linear-gradient(to right,
        var(--pf-surface) calc(var(--pf-column) - 1px),
        var(--pf-border) calc(var(--pf-column) - 1px),
        var(--pf-border) var(--pf-column),
        transparent var(--pf-column));
}
.pf-shell.is-collapsed { --pf-column: 76px; }

.pf-sidebar {
    width: var(--pf-sidebar);
    flex-shrink: 0;
    background: var(--pf-surface);
    border-right: 1px solid var(--pf-border);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    transition: width 0.2s ease, transform 0.2s ease;
}

.pf-shell.is-collapsed .pf-sidebar { width: 76px; }
.pf-shell.is-collapsed .pf-brand div,
.pf-shell.is-collapsed .pf-role,
.pf-shell.is-collapsed .pf-nav-link span,
.pf-shell.is-collapsed .pf-nav-badge { display: none; }
.pf-shell.is-collapsed .pf-nav-link { justify-content: center; }

.pf-brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; }
.pf-brand strong { display: block; font-size: 16px; color: var(--pf-primary); }
.pf-brand small { display: block; color: var(--pf-muted); font-size: 12px; }
.pf-logo {
    width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(135deg, var(--pf-primary), var(--pf-accent));
}

.pf-role {
    margin: 0 4px 14px; padding: 10px 12px; border-radius: 10px;
    background: var(--pf-primary-soft); color: var(--pf-primary);
    font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}

.pf-sidebar nav { display: flex; flex-direction: column; gap: 4px; }

.pf-nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--pf-text); font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
}
.pf-nav-link:hover { background: var(--pf-surface-2); text-decoration: none; }
.pf-nav-link.is-active { background: var(--pf-primary); color: #fff; }
.pf-nav-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.pf-group > summary { list-style: none; cursor: pointer; }
.pf-group > summary::-webkit-details-marker { display: none; }
.pf-group > summary::after {
    content: ""; margin-left: auto; width: 8px; height: 8px; flex-shrink: 0;
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(45deg); transition: transform 0.15s ease; margin-top: -4px;
}
.pf-group[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.pf-subnav { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 6px 44px; }
.pf-sub-link {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 10px; border-radius: 8px; color: var(--pf-muted); font-size: 14px;
}
.pf-sub-link:hover { background: var(--pf-surface-2); color: var(--pf-text); text-decoration: none; }
.pf-sub-link.is-active { color: var(--pf-primary); background: var(--pf-primary-soft); font-weight: 600; }
.pf-sub-link .pf-nav-badge { margin-left: auto; }
.pf-shell.is-collapsed .pf-subnav { display: none; }
.pf-shell.is-collapsed .pf-group > summary::after { display: none; }

.pf-nav-badge {
    margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px;
    background: var(--pf-danger); color: #fff; font-size: 12px; font-weight: 700; text-align: center;
}

.pf-overlay { display: none; }

.pf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.pf-topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    padding: 12px 24px;
    background: var(--pf-surface); border-bottom: 1px solid var(--pf-border);
}

.pf-crumbs { flex: 1; min-width: 0; color: var(--pf-muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-crumbs a { color: var(--pf-muted); }
.pf-crumbs .sep { margin: 0 6px; }

.pf-top-actions { display: flex; align-items: center; gap: 10px; }

.pf-icon-btn {
    position: relative;
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center;
    background: transparent; border: 1px solid var(--pf-border); color: var(--pf-text);
    cursor: pointer; text-decoration: none;
}
.pf-icon-btn:hover { background: var(--pf-surface-2); text-decoration: none; }
.pf-icon-btn svg { width: 19px; height: 19px; }
.pf-dot {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
    background: var(--pf-danger); color: #fff; font-size: 11px; font-weight: 700;
    display: grid; place-items: center;
}

.pf-profile { position: relative; }
.pf-profile > summary {
    list-style: none; cursor: pointer;
    display: flex; align-items: center; gap: 10px;
    padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--pf-border);
}
.pf-profile > summary::-webkit-details-marker { display: none; }
.pf-avatar {
    width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
    display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff;
    background: linear-gradient(135deg, var(--pf-secondary), var(--pf-accent));
}
.pf-who-name { font-size: 14px; font-weight: 600; line-height: 1.2; }
.pf-who-role { font-size: 12px; color: var(--pf-muted); line-height: 1.2; }
.pf-profile-menu {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 30;
    background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: var(--pf-radius);
    box-shadow: var(--pf-shadow); padding: 8px;
}
.pf-profile-menu .pf-who { padding: 8px 10px 10px; border-bottom: 1px solid var(--pf-border); margin-bottom: 6px; }
.pf-profile-menu .pf-who strong { display: block; }
.pf-profile-menu .pf-who small { color: var(--pf-muted); font-size: 12px; }
.pf-menu-item {
    display: flex; width: 100%; align-items: center; gap: 10px;
    padding: 9px 10px; border: 0; border-radius: 8px; background: transparent;
    color: var(--pf-text); font: inherit; text-align: left; cursor: pointer;
}
.pf-menu-item:hover { background: var(--pf-surface-2); }
.pf-menu-item svg { width: 17px; height: 17px; }

.pf-content { padding: 24px; width: 100%; max-width: 1400px; }

/* ---------- Components ---------- */

.pf-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.pf-page-head p { color: var(--pf-muted); margin-top: 4px; }

.pf-card {
    background: var(--pf-surface); border: 1px solid var(--pf-border); border-radius: var(--pf-radius);
    box-shadow: var(--pf-shadow); padding: 20px; min-width: 0;
}
.pf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pf-card-head a { font-size: 14px; font-weight: 600; }

.pf-grid { display: grid; gap: 16px; }
.pf-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pf-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pf-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pf-gap-top { margin-top: 16px; }
/* Blocks stacked directly in the page content are spaced evenly. The utilities below still win where they are used. */
.pf-content > * + * { margin-top: 16px; }
/* Content inside a card sits clear of its heading and paragraph. */
.pf-card > * + * { margin-top: 12px; }
.pf-gap { margin-top: 12px; }
.pf-grid-charts { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1.4fr); }
.pf-grid-auto { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.pf-grid-recent { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.pf-inline { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; margin: 0; }
.pf-stack { display: flex; flex-direction: column; gap: 16px; }

.pf-stat { transition: transform 0.18s ease, box-shadow 0.18s ease; }
.pf-stat:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1); }
.pf-stat-top { display: flex; align-items: center; justify-content: space-between; }
.pf-stat-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.pf-stat-icon svg { width: 22px; height: 22px; }
.pf-stat-value { font-size: 30px; font-weight: 700; margin-top: 16px; line-height: 1.1; }
.pf-stat-label { color: var(--pf-muted); font-size: 14px; margin-top: 4px; }
.pf-growth { font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; }
.pf-growth.up { color: var(--pf-success); }
.pf-growth.down { color: var(--pf-danger); }

.tone-primary { background: var(--pf-primary-soft); color: var(--pf-primary); }
.tone-secondary { background: rgba(99, 102, 241, 0.15); color: var(--pf-secondary); }
.tone-success { background: var(--pf-success-soft); color: var(--pf-success); }
.tone-warning { background: var(--pf-warning-soft); color: var(--pf-warning); }
.tone-muted { background: var(--pf-surface-2); color: var(--pf-muted); }
.tone-danger { background: var(--pf-danger-soft); color: var(--pf-danger); }

.pf-chart-box { position: relative; height: 260px; }

.pf-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pf-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.pf-table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.pf-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pf-table th {
    text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
    color: var(--pf-muted); padding: 10px 12px; border-bottom: 1px solid var(--pf-border); white-space: nowrap;
}
.pf-table td { padding: 12px; border-bottom: 1px solid var(--pf-border); vertical-align: top; }
.pf-table tbody tr:hover { background: var(--pf-surface-2); }
.pf-table .muted { color: var(--pf-muted); font-size: 13px; }
.pf-table .num { text-align: right; }

.pf-empty { padding: 28px 12px; text-align: center; color: var(--pf-muted); }

.pf-btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--pf-field-radius); border: 1px solid transparent;
    background: linear-gradient(135deg, var(--pf-primary), var(--pf-secondary)); color: #fff; font: inherit; font-weight: 600;
    cursor: pointer; text-decoration: none; transition: filter 0.15s ease;
}
.pf-btn:hover { filter: brightness(1.06); text-decoration: none; color: #fff; }
.pf-btn.secondary { background: transparent; color: var(--pf-text); border-color: var(--pf-border); }
.pf-btn.secondary:hover { background: var(--pf-surface-2); }
.pf-btn.small { padding: 6px 12px; font-size: 13px; }
.pf-btn.danger { background: var(--pf-danger); color: #fff; }
.pf-btn svg { width: 16px; height: 16px; }

.pf-link-btn { color: var(--pf-primary); font-weight: 600; font-size: 14px; }

.pf-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }

input, select, textarea {
    font: inherit; color: var(--pf-text); background: var(--pf-surface);
    border: 1px solid var(--pf-border); border-radius: var(--pf-field-radius); padding: 9px 12px; min-width: 0;
}
input:not([type="checkbox"]):not([type="radio"]), select { min-height: 46px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--pf-primary); outline-offset: 1px; }
input[type="checkbox"] { width: 16px; height: 16px; padding: 0; min-width: 0; margin: 0; accent-color: var(--pf-primary); flex-shrink: 0; }
.pf-check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--pf-text); cursor: pointer; }
.pf-check input { margin-top: 3px; }
.pf-check .muted { font-size: 12px; }
.pf-search { position: relative; flex: 1 1 260px; }
.pf-search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--pf-muted); }
.pf-search input { width: 100%; padding-left: 38px; }

.pf-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.pf-form-grid .full { grid-column: 1 / -1; }
.pf-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--pf-muted); }
.pf-field input, .pf-field select, .pf-field textarea { width: 100%; color: var(--pf-text); }
.pf-field input[type="checkbox"], .pf-field input[type="radio"] { width: 16px; height: 16px; flex-shrink: 0; }

.pf-kv { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; font-size: 14px; }
.pf-kv dt { color: var(--pf-muted); }
.pf-kv dd { margin: 0; }

.pf-note { font-size: 13px; color: var(--pf-muted); margin-top: 10px; }

details.pf-add > summary { list-style: none; cursor: pointer; }
details.pf-add > summary::-webkit-details-marker { display: none; }
details.pf-add[open] > summary { margin-bottom: 16px; }

/* Flash messages from the shared partial. */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.flash.ok { background: var(--pf-success-soft); color: var(--pf-success); }
.flash.bad { background: var(--pf-danger-soft); color: var(--pf-danger); }
.flash ul { margin: 0; padding-left: 18px; }

.pager { display: flex; align-items: center; gap: 14px; justify-content: flex-end; margin-top: 14px; color: var(--pf-muted); font-size: 14px; }

/* ---------- Responsive ---------- */

@media (max-width: 1200px) {
    .pf-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pf-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .pf-grid-charts { grid-template-columns: minmax(0, 1fr); }
    .pf-grid-recent { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
    .pf-shell { background: none; }
    .pf-sidebar {
        position: fixed; left: 0; top: 0; z-index: 50;
        width: 260px !important;
        transform: translateX(-100%);
        box-shadow: var(--pf-shadow);
    }
    .pf-shell.is-open .pf-sidebar { transform: translateX(0); }
    .pf-shell.is-open .pf-overlay { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.4); z-index: 40; }
    .pf-shell.is-collapsed .pf-brand div,
    .pf-shell.is-collapsed .pf-role,
    .pf-shell.is-collapsed .pf-nav-link span,
    .pf-shell.is-collapsed .pf-nav-badge { display: revert; }
    .pf-topbar { padding: 12px 16px; }
    .pf-content { padding: 16px; }
    .pf-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .pf-who-text { display: none; }
}

@media (max-width: 600px) {
    .pf-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .pf-form-grid { grid-template-columns: minmax(0, 1fr); }
    .pf-crumbs { display: none; }
    h1 { font-size: 21px; }
}

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