/* Foxnezia refresh. Loaded last; application behaviour stays in the existing modules. */
:root {
    color-scheme: dark;
    --bg: #161826;
    --bg-elev: #1a1c29;
    --surface: #1c1f2d;
    --surface-2: #232532;
    --surface-3: #2b2e3d;
    --border: rgba(233, 233, 237, .09);
    --border-strong: rgba(233, 233, 237, .17);
    --text: #e9e9ed;
    --text-muted: #a0a4b7;
    --text-dim: #85899e;
    --accent: #ee7a2b;
    --accent-2: #ff9350;
    --accent-soft: rgba(238, 122, 43, .13);
    --accent-line: rgba(238, 122, 43, .32);
    --success: #4ec07a;
    --warning: #e0a13a;
    --danger: #f2564d;
    --info: #a497e6;
    --purple: #a497e6;
    --r-xs: 6px;
    --r-sm: 9px;
    --r-md: 12px;
    --r-lg: 14px;
    --sidebar-w: 228px;
    --topbar-h: 58px;
    --content-pad: 24px;
    --ring: inset 0 0 0 1px var(--border);
    --shadow-1: var(--ring), 0 2px 3px rgba(0, 0, 0, .04);
    --shadow-2: inset 0 0 0 1px var(--border-strong), 0 4px 12px rgba(0, 0, 0, .12);
    --shadow-3: 0 0 0 1px var(--border-strong), 0 18px 44px rgba(0, 0, 0, .45);
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
    --bs-primary-rgb: 238, 122, 43;
    --bs-info-rgb: 164, 151, 230;
}

body { font-size: 13px; font-variant-numeric: tabular-nums; }
::selection { background: rgba(238, 122, 43, .3); }
.tab-pane > * { animation: none; }
.login-cover { background: var(--bg); }
.login-card { padding: 36px; border-radius: 18px; }

/* A persistent, quiet workspace frame. */
.app-shell { grid-template-rows: var(--topbar-h) minmax(0, 1fr); align-items: start; }
.topbar {
    display: flex;
    gap: 16px;
    background: rgba(22, 24, 38, .94);
    padding: 0 24px;
    box-shadow: 0 1px 0 var(--border);
}
.topbar-brand { font-size: 13px; font-weight: 500; color: var(--text-muted); white-space: nowrap; }
.topbar-brand i { font-size: 16px; }
.topbar-search {
    display: flex; align-items: center; gap: 9px;
    min-height: 36px; max-width: 420px; flex: 1;
    padding: 0 12px; border: 1px solid var(--border); border-radius: 9px;
    color: var(--text-dim); background: var(--surface); font-size: 12px;
    text-align: left; cursor: pointer;
}
.topbar-search:hover { background: var(--surface-2); border-color: var(--border-strong); }
.topbar-search span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-search kbd { margin-left: auto; color: var(--text-muted); background: var(--surface-3); font-size: 10px; white-space: nowrap; }
.topbar-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; color: var(--text-muted); font-size: 12px; }
.topbar-avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-2); font-size: 11px; font-weight: 600; }
.preview-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; background: var(--accent-soft); color: var(--accent-2); border: 1px solid var(--accent-line); border-radius: 6px; font-size: 11px; }
.sidebar { padding: 17px 10px 12px; background: var(--bg-elev); }
.sidebar-brand { padding: 0 10px 22px; font-size: 16px; gap: 10px; min-height: 40px; }
.sidebar-brand .brand-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 16px; }
.brand-caption { color: var(--text-dim); font-size: 9px; letter-spacing: .1em; margin-left: auto; text-transform: uppercase; }
.topbar-search input { min-width: 0; width: 100%; flex: 1; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; padding: 8px 0; }
.topbar-search input::placeholder { color: var(--text-dim); }
.topbar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-meta > i { color: var(--text-dim); }
.nav-group { padding: 19px 11px 7px; font-size: 9px; letter-spacing: .1em; }
.sidebar-nav a { min-height: 40px; padding: 0 11px; font-size: 12px; gap: 10px; border-radius: 8px; }
.sidebar-nav a i { font-size: 15px; }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(238, 122, 43, .12); }
.sidebar-nav a.active::before { display: none; }
.sidebar-nav a.active i { color: var(--accent); }
.sidebar-footer { display: flex; flex-direction: column; gap: 4px; }
.sidebar-footer .btn { justify-content: flex-start; background: transparent; border-color: transparent; color: var(--text-dim); font-size: 12px; }
.sidebar-footer .sidebar-collapse:hover { color: var(--text); background: var(--surface-2); }
.sidebar-footer .btn:hover { background: rgba(242, 86, 77, .1); color: var(--danger); }
.content { max-width: 1560px; min-height: calc(100vh - var(--topbar-h)); padding-top: 24px; }

/* Clear type hierarchy and consistent spacing across every current section. */
.page-header { margin-bottom: 20px; align-items: center; }
.page-title { font-size: 23px; letter-spacing: -.035em; line-height: 1.3; }
.page-subtitle { margin-top: 5px; font-size: 12px; color: var(--text-dim); }
.page-actions { gap: 8px; }
.section { border-radius: 14px; margin-bottom: 16px; }
.section-header { padding: 15px 18px; min-height: 53px; }
.section-title { font-size: 13px; letter-spacing: -.01em; }
.section-title i { color: var(--text-muted); }
.section-body { padding: 18px; }
.section-hint { font-size: 11px; color: var(--text-dim); }
.stat-grid { gap: 12px; margin-bottom: 12px; }
.stat-tile { padding: 18px; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-1); }
.stat-tile:hover { box-shadow: var(--shadow-1); }
.stat-tile-label { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-bottom: 11px; display: flex; align-items: center; gap: 7px; }
.stat-tile-label i { font-size: 13px; color: var(--text-dim); }
.stat-tile-value { font-size: 30px; line-height: 1.1; letter-spacing: -.045em; font-weight: 600; }
.stat-tile-caption { font-size: 10.5px; line-height: 1.65; color: var(--text-dim); }
.stat-tile > .stat-tile-caption { padding-top: 13px; }
.stat-tile-caption b { font-weight: 500; }
#tab-dashboard > .stat-grid:first-of-type > .stat-tile:first-child { background: linear-gradient(160deg, #242331, #1c1f2d); box-shadow: inset 0 0 0 1px var(--border-strong); }
.metric-list { gap: 7px; margin-top: 0; }
.metric-row { font-size: 11px; }
.metric-row dt { color: var(--text-dim); }
.metric-row dd { font-size: 12px; font-weight: 500; }
.chart-box { height: 250px; }
.chart-box-lg { height: 290px; }
#bar-conn { background: rgba(238, 122, 43, .35) !important; }

/* Controls: orange signals the main action, neutral controls stay quiet. */
.btn { font-size: 12px; min-height: 40px; padding: 7px 12px; border-radius: 9px; }
.btn-sm { font-size: 12px; min-height: 40px; padding: 6px 11px; }
.btn-icon { width: 40px; height: 40px; padding: 0; }
.btn-icon::after { display: none; }
.btn-primary {
    --bs-btn-active-bg: #ce641f; --bs-btn-active-border-color: #ce641f;
    --bs-btn-disabled-bg: #ee7a2b; --bs-btn-disabled-border-color: #ee7a2b;
    background: var(--accent); border-color: var(--accent); color: #21170f;
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus-visible { background: var(--accent-2); border-color: var(--accent-2); color: #21170f; }
.btn-outline-secondary { background: var(--surface-2); border-color: transparent; color: var(--text-muted); }
.btn-outline-secondary:hover { background: var(--surface-3); border-color: var(--border); color: var(--text); }
.btn-outline-info { color: var(--info); border-color: rgba(164, 151, 230, .25); }
.btn-outline-info:hover { color: #c0b5f7; background: rgba(164, 151, 230, .13); border-color: rgba(164, 151, 230, .4); }
.btn-outline-primary { color: var(--accent-2); border-color: var(--accent-line); }
.btn-outline-primary:hover { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent); }
.form-control, .form-select { background-color: var(--bg-elev); border-color: var(--border-strong); border-radius: 9px; color: var(--text); font-size: 12px; min-height: 40px; }
.form-control-sm, .form-select-sm { min-height: 40px; font-size: 12px; }
.form-control:focus, .form-select:focus { background-color: var(--bg-elev); color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-control::placeholder { color: var(--text-dim); }
.form-control:disabled, .form-select:disabled { background: var(--surface-2); color: var(--text-dim); }
.form-label { font-size: 12px; color: var(--text-muted); }
.form-text { color: var(--text-dim); font-size: 11px; line-height: 1.6; }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); color: var(--text-muted); }
.badge { padding: 4px 7px; border-radius: 5px; font-size: 10px; line-height: 1.3; }
.badge.subtle-success { color: #69d391; background: rgba(78, 192, 122, .13); }
.badge.subtle-info { color: var(--info); background: rgba(164, 151, 230, .13); }
.badge.subtle-warning { color: #edb858; background: rgba(224, 161, 58, .13); }
.badge.subtle-muted { background: var(--surface-3); color: var(--text-muted); }

/* Data surfaces, drawers and dialogs share the same material. */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: var(--border); --bs-table-hover-bg: rgba(233, 233, 237, .025); --bs-table-hover-color: var(--text); font-size: 12px; }
.table > thead > tr > th { padding: 12px 16px; background: rgba(22, 24, 38, .35); color: var(--text-dim); font-size: 10px; font-weight: 500; text-transform: none; letter-spacing: .015em; border-bottom-color: var(--border); }
.table > tbody > tr > td { padding: 13px 16px; border-bottom-color: var(--border); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td .btn { min-height: 40px; }
.table td .small, .table td small { font-size: 10.5px; }
.pager { font-size: 11px; margin-top: 14px; }
.modal-title, .offcanvas-title { font-size: 15px; letter-spacing: -.02em; }
.modal-header, .offcanvas-header { padding: 18px 22px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 14px 22px; background: rgba(22, 24, 38, .2); }
.modal-content, .offcanvas { color: var(--text); }
.modal-backdrop.show { opacity: .65; }
.dropdown-menu { background: var(--surface); color: var(--text); border-color: var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-3); padding: 6px; }
.dropdown-item { color: var(--text-muted); border-radius: 6px; font-size: 12px; min-height: 36px; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-item.active { background: var(--accent-soft); color: var(--accent-2); }
.alert { border-radius: 10px; font-size: 12px; }
.alert-info { color: #c1b7ef; border-color: rgba(164, 151, 230, .2); background: rgba(164, 151, 230, .09); }
.alert-warning { color: #edc077; border-color: rgba(224, 161, 58, .2); background: rgba(224, 161, 58, .09); }
.alert-danger { color: #fa9b95; border-color: rgba(242, 86, 77, .2); background: rgba(242, 86, 77, .09); }
.alert-success { color: #8bdda9; border-color: rgba(78, 192, 122, .2); background: rgba(78, 192, 122, .09); }
.m-card, .mini-pay, .log-item, .funnel-step { background: var(--bg-elev); }
.empty { color: var(--text-dim); font-size: 12px; padding: 48px 20px; }
.empty i { color: var(--text-muted); }

/* Current modules, including those absent from the original visual reference. */
.app-subnav { padding: 4px; margin-bottom: 18px; border-radius: 11px; background: var(--bg-elev); }
.app-subnav button { font-size: 12px; min-height: 40px; padding: 7px 13px; }
.app-subnav button.active { background: var(--surface-3); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); color: var(--text); }
.app-range button { min-height: 36px; color: var(--text-muted); }
.app-range button.active { color: var(--accent-2); background: var(--accent-soft); }
.awg-stat-card { border-radius: 14px; padding: 18px; }
.awg-stat-card:hover { box-shadow: var(--shadow-1); }
.awg-stat-value { font-size: 27px; letter-spacing: -.035em; }
.awg-stat-label { font-size: 11px; }
.awg-stat-caption { font-size: 10.5px; }
.awg-icon-btn { min-height: 40px; min-width: 40px; }
.awg-dev-tile { background: var(--surface-2); box-shadow: none; border-radius: 10px; }
.network-monitor .nm-heading h2 { font-size: 23px; letter-spacing: -.035em; }
.network-monitor .nm-summary { gap: 12px; background: transparent; border: 0; overflow: visible; }
.network-monitor .nm-summary-item { border-radius: 14px; box-shadow: var(--shadow-1); }
.network-monitor .nm-summary-item strong { font-size: 27px; }
.network-monitor .nm-server { border-radius: 12px; }
.network-monitor .nm-server.is-selected { border-color: var(--accent-line); box-shadow: inset 3px 0 0 var(--accent); background: var(--surface-2); }
.network-monitor .nm-server-heading strong { font-size: 13px; }
.network-monitor .nm-toolbar { margin-top: 20px; }
.network-monitor .nm-status { padding: 2px 6px; border-radius: 5px; background: var(--surface-3); }
.network-monitor .nm-online { background: rgba(78, 192, 122, .12); }
.network-monitor .nm-offline { background: rgba(242, 86, 77, .12); }
.network-monitor .nm-stale { background: rgba(224, 161, 58, .12); }
.faq-tree-pane { border: 0; box-shadow: var(--shadow-1); border-radius: 14px; }
.faq-node { min-height: 40px; }
.faq-node.active { background: var(--accent-soft); border-color: var(--accent-line); }
.faq-tree-filter { border-radius: 0; }
.partner-filters { justify-content: flex-start; }
.bottom-nav { background: rgba(26, 28, 41, .96); }
.bn-item.active { background: var(--accent-soft); color: var(--accent-2); }
.more-sheet { max-height: 85dvh; overflow-y: auto; }
.more-item { font-size: 11px; }

@media (min-width: 992px) {
    .topbar { grid-column: 2; grid-row: 1; }
    .sidebar { grid-column: 1; grid-row: 1 / 3; }
    .content { grid-column: 2; grid-row: 2; padding-bottom: 40px; }
    #tab-dashboard > .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    #tab-dashboard > .stat-grid + .row { margin-top: 4px; }
    .admin-sidebar-collapsed { --sidebar-w: 66px; }
    .admin-sidebar-collapsed .sidebar { padding-inline: 10px; }
    .admin-sidebar-collapsed .brand-name,
    .admin-sidebar-collapsed .brand-caption,
    .admin-sidebar-collapsed .sidebar .nav-label,
    .admin-sidebar-collapsed .sidebar-footer .btn span { display: none; }
    .admin-sidebar-collapsed .sidebar-brand { padding-inline: 0; justify-content: center; }
    .admin-sidebar-collapsed .sidebar-nav a { justify-content: center; padding-inline: 0; }
    .admin-sidebar-collapsed .nav-group { font-size: 0; height: 20px; padding: 0; margin: 0 8px; position: relative; }
    .admin-sidebar-collapsed .nav-group::after { content: ''; position: absolute; left: 0; right: 0; top: 9px; border-top: 1px solid var(--border); }
    .admin-sidebar-collapsed .sidebar-footer .btn { justify-content: center; padding-inline: 0; }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    :root { --sidebar-w: 208px; --content-pad: 18px; }
    .stat-tile { padding: 15px; }
    .stat-tile-value { font-size: 26px; }
    .sidebar-nav a { font-size: 11px; }
}
@media (max-width: 991.98px) {
    :root { --content-pad: 16px; }
    .topbar { padding: 0 16px; gap: 12px; }
    .topbar-search { max-width: none; }
    .topbar-search kbd { display: none; }
    .topbar-meta { gap: 8px; }
    .content { padding-top: 20px; }
    .page-title { font-size: 22px; }
    .btn, .btn-sm { min-height: 44px; }
    .btn-icon { width: 44px; height: 44px; }
    .form-control, .form-select, .form-control-sm, .form-select-sm { min-height: 44px; }
    .app-subnav button, .app-range button, .awg-icon-btn { min-height: 44px; }
}
@media (max-width: 767.98px) {
    .page-header { align-items: stretch; gap: 14px; }
    .page-header > .btn { align-self: flex-start; }
    .page-title { font-size: 21px; }
    .page-subtitle { font-size: 11px; }
    .stat-grid { gap: 10px; }
    .stat-tile { padding: 14px; border-radius: 12px; }
    .stat-tile-value { font-size: 26px; }
    .stat-tile-label { font-size: 10.5px; margin-bottom: 9px; }
    .stat-tile-caption { font-size: 10px; }
    .metric-row { font-size: 10.5px; gap: 8px; }
    .section-header { padding: 14px; }
    .section-body { padding: 14px; }
    .section-body.flush { padding: 0; }
    .chart-box { height: 220px; }
    .modal-body { padding: 18px; }
    .topbar-search { flex: 1; min-width: 0; min-height: 40px; padding: 0 9px; margin-left: auto; }
    .topbar-search input { font-size: 16px; }
    .topbar-search span { display: none; }
    .topbar-meta { margin-left: 0; }
    .topbar-meta span { display: none; }
    .preview-badge { font-size: 9px; padding: 4px 6px; }
    .network-monitor .nm-summary { gap: 10px; }
    .network-monitor .nm-summary-item strong { font-size: 24px; }
}
@media (max-width: 359.98px) {
    .stat-grid { grid-template-columns: minmax(0, 1fr); }
    .topbar-brand { font-size: 12px; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
