/* ============================================================
   MASH TRADE ENTERPRISE PORTAL v3.0 — GLOBAL STYLESHEET
   Rule:
   portal.css → global variables, layout, typography, common utilities
   components/ → reusable UI (buttons, forms, tables, modals, alerts)
   modules/ → module-specific CSS (loaded on demand via @push)
   ============================================================ */

/* REUSABLE CORE UI COMPONENTS */
@import url('components/buttons.css');
@import url('components/forms.css');
@import url('components/tables.css');
@import url('components/modals.css');
@import url('components/alerts.css');

:root {
    --bg-primary:    #0a0f1e;
    --bg-secondary:  #0d1529;
    --bg-card:       #111827;
    --bg-card-hover: #161f35;
    --border-color:  #1e2d47;
    --border-light:  #253553;

    --accent-orange: #f97316;
    --accent-blue:   #3b82f6;
    --accent-green:  #10b981;
    --accent-purple: #8b5cf6;
    --accent-red:    #ef4444;
    --accent-cyan:   #06b6d4;

    --text-primary:  #e2e8f0;
    --text-secondary:#94a3b8;
    --text-muted:    #475569;

    --sidebar-w:     250px;
    --header-h:      62px;
    --radius:        10px;
    --radius-sm:     6px;
    --shadow:        0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg:     0 12px 48px rgba(0,0,0,0.6);
    --transition:    0.2s ease;

    --font-base:     'Inter', system-ui, sans-serif;
    --font-mono:     'JetBrains Mono', monospace;
}

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

body.portal-body {
    font-family: var(--font-base);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
}

/* ============================================================ */
/* SIDEBAR */
/* ============================================================ */
.portal-sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
    transition: transform var(--transition);
    scrollbar-width: thin;
    scrollbar-color: var(--border-light) transparent;
}

.portal-sidebar::-webkit-scrollbar { width: 4px; }
.portal-sidebar::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

.portal-sidebar.collapsed { transform: translateX(-100%); }

/* BRAND */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky; top: 0;
    background: var(--bg-secondary);
    z-index: 10;
}
.brand-mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent-orange), #dc6a09);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; color: #fff;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    box-shadow: 0 0 16px rgba(249,115,22,0.4);
}
.brand-name {
    font-size: 13px; font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}
.brand-tagline {
    font-size: 10px; color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* SECTION LABELS */
.sidebar-section-label {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    padding: 16px 16px 6px;
    text-transform: uppercase;
}

/* NAV ITEMS */
.sidebar-nav { padding: 2px 10px; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 1px;
    position: relative;
}
.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(249,115,22,0.12);
    color: var(--accent-orange);
    font-weight: 600;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: -10px; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 70%;
    background: var(--accent-orange);
    border-radius: 0 3px 3px 0;
}
.nav-icon {
    width: 20px; text-align: center;
    font-size: 13px; flex-shrink: 0;
}
.nav-text { flex: 1; }
.nav-badge {
    font-size: 10px; font-weight: 700;
    padding: 2px 7px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    color: var(--text-muted);
    min-width: 22px; text-align: center;
}
.nav-badge.new {
    background: rgba(16,185,129,0.15);
    color: var(--accent-green);
}
.nav-badge.pulse {
    background: rgba(249,115,22,0.2);
    color: var(--accent-orange);
    animation: badgePulse 2s infinite;
}
@keyframes badgePulse {
    0%,100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* SIDEBAR FOOTER */
.sidebar-footer-area {
    margin-top: auto;
    padding: 14px 16px;
    border-top: 1px solid var(--border-color);
}
.system-pulse {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 6px;
}
.pulse-ring {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    box-shadow: 0 0 0 0 rgba(16,185,129,0.6);
    animation: ripple 2s infinite;
    flex-shrink: 0;
}
@keyframes ripple {
    0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.6); }
    70% { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.pulse-core { display: none; }
.system-pulse span { font-size: 11px; color: var(--accent-green); font-weight: 600; }
.sidebar-version { font-size: 10px; color: var(--text-muted); }

/* Overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 190;
}
.sidebar-overlay.active { display: block; }

/* ============================================================ */
/* MAIN LAYOUT */
/* ============================================================ */
.portal-layout {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left var(--transition);
}

/* ============================================================ */
/* TOP HEADER */
/* ============================================================ */
.portal-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    background: rgba(10,15,30,0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center;
    gap: 16px;
    padding: 0 24px;
}
.header-left { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.hamburger-btn {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 16px; padding: 6px; border-radius: 6px;
    transition: color var(--transition);
}
.hamburger-btn:hover { color: var(--text-primary); }
.breadcrumb-trail { display: flex; align-items: center; gap: 6px; }
.breadcrumb-root { color: var(--text-muted); font-size: 13px; }
.breadcrumb-sep { color: var(--text-muted); }
.breadcrumb-current { font-size: 14px; font-weight: 600; color: var(--text-primary); }

.header-center { flex: 1; max-width: 480px; margin: 0 auto; }
.global-search-wrap {
    display: flex; align-items: center;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0 12px; gap: 8px;
    transition: border-color var(--transition);
}
.global-search-wrap:focus-within { border-color: var(--accent-orange); }
.global-search-wrap i { color: var(--text-muted); font-size: 12px; }
.global-search {
    flex: 1; background: none; border: none; outline: none;
    color: var(--text-primary); font-size: 13px;
    padding: 9px 0; font-family: var(--font-base);
}
.global-search::placeholder { color: var(--text-muted); }
.search-kbd {
    font-family: var(--font-mono); font-size: 10px;
    color: var(--text-muted); background: rgba(255,255,255,0.06);
    padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border-color);
    white-space: nowrap;
}

.header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.header-icon-btn {
    position: relative; background: none; border: none;
    color: var(--text-secondary); cursor: pointer;
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; transition: all var(--transition);
    text-decoration: none;
}
.header-icon-btn:hover { background: rgba(255,255,255,0.07); color: var(--text-primary); }
.status-dot {
    position: absolute; bottom: 6px; right: 6px;
    width: 7px; height: 7px; border-radius: 50%;
    border: 1.5px solid var(--bg-primary);
}
.status-dot.online { background: var(--accent-green); }
.notif-badge {
    position: absolute; top: 4px; right: 4px;
    background: var(--accent-red); color: #fff;
    font-size: 9px; font-weight: 700; padding: 1px 4px;
    border-radius: 10px; min-width: 16px; text-align: center;
}
.header-profile {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 10px; border-radius: var(--radius-sm);
    cursor: pointer; transition: background var(--transition);
    margin-left: 6px;
}
.header-profile:hover { background: rgba(255,255,255,0.06); }
.profile-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-orange), #c2440f);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.profile-name { font-size: 12px; font-weight: 600; }
.profile-role { font-size: 10px; color: var(--text-muted); }

/* FLOATING HEADER MENUS & SEARCH AUTOCOMPLETE */
.header-relative-wrap {
    position: relative;
}

.global-search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #0f172a;
    border: 1px solid rgba(56, 189, 248, 0.3);
    border-radius: 10px;
    box-shadow: 0 20px 35px -10px rgba(0, 0, 0, 0.8), 0 0 15px rgba(56, 189, 248, 0.15);
    z-index: 1000;
    max-height: 420px;
    overflow-y: auto;
    padding: 8px;
    backdrop-filter: blur(12px);
}

.search-result-group-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    padding: 6px 10px 4px;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    text-decoration: none;
    color: #cbd5e1;
    transition: all 0.15s ease;
    cursor: pointer;
}

.search-result-item:hover,
.search-result-item.selected {
    background: rgba(56, 189, 248, 0.1);
    color: #f8fafc;
    transform: translateX(4px);
}

.search-result-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    font-size: 12px;
    flex-shrink: 0;
}

.search-result-title {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
}

.search-result-sub {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}

.header-flyout-card {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    background: #0f172a;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.85);
    z-index: 1000;
    overflow: hidden;
    animation: flyoutSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes flyoutSlide {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.flyout-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.flyout-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flyout-body {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
}

.flyout-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: #cbd5e1;
    text-decoration: none;
    transition: background 0.15s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.flyout-item:last-child {
    border-bottom: none;
}

.flyout-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}

.flyout-footer {
    padding: 10px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 23, 42, 0.5);
    text-align: center;
}

.flyout-link-btn {
    font-size: 12px;
    color: #38bdf8;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.flyout-link-btn:hover {
    text-decoration: underline;
}

/* ============================================================ */
/* PAGE CONTENT */
/* ============================================================ */
.portal-page-content { flex: 1; padding: 28px; overflow-x: hidden; }

/* Flash Alerts */
.flash-alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm);
    margin-bottom: 20px; font-size: 13px; font-weight: 500;
    transition: opacity 0.4s;
}
.flash-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: var(--accent-green); }
.flash-error   { background: rgba(239,68,68,0.12);  border: 1px solid rgba(239,68,68,0.3);  color: var(--accent-red); }
.flash-close {
    margin-left: auto; background: none; border: none;
    color: inherit; cursor: pointer; opacity: 0.7; font-size: 13px;
}

/* ============================================================ */
/* PAGE HEADER (for inner pages) */
/* ============================================================ */
.page-hero {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.page-hero-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.page-hero-sub { font-size: 13px; color: var(--text-secondary); }
.page-hero-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }

/* ============================================================ */
/* STAT CARDS */
/* ============================================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px; margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex; gap: 14px; align-items: flex-start;
    transition: all var(--transition);
    cursor: default;
}
.stat-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
    width: 42px; height: 42px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.stat-icon.orange { background: rgba(249,115,22,0.12); color: var(--accent-orange); }
.stat-icon.blue   { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.stat-icon.green  { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.stat-icon.purple { background: rgba(139,92,246,0.12); color: var(--accent-purple); }
.stat-icon.red    { background: rgba(239,68,68,0.12);  color: var(--accent-red); }
.stat-icon.cyan   { background: rgba(6,182,212,0.12);  color: var(--accent-cyan); }
.stat-body { flex: 1; }
.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.stat-trend { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }
.stat-trend.up   { color: var(--accent-green); }
.stat-trend.down { color: var(--accent-red); }

/* ============================================================ */
/* CARDS */
/* ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}
.card-title {
    display: flex; align-items: center; gap: 8px;
    font-size: 14px; font-weight: 700;
}
.card-actions { display: flex; gap: 8px; }
.card-body { padding: 20px; }

/* ============================================================ */
/* BUTTONS */
/* ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: none; transition: all var(--transition);
    white-space: nowrap; text-decoration: none;
    font-family: var(--font-base);
}
.btn-primary {
    background: var(--accent-orange); color: #fff;
    box-shadow: 0 0 20px rgba(249,115,22,0.25);
}
.btn-primary:hover { background: #ea6b0e; transform: translateY(-1px); box-shadow: 0 0 28px rgba(249,115,22,0.4); }
.btn-secondary {
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-secondary:hover { background: rgba(255,255,255,0.1); color: var(--text-primary); }
.btn-danger { background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.3); color: var(--accent-red); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: rgba(16,185,129,0.12); border: 1px solid rgba(16,185,129,0.3); color: var(--accent-green); }
.btn-success:hover { background: rgba(16,185,129,0.2); }
.btn-icon {
    padding: 7px; width: 32px; height: 32px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color); border-radius: var(--radius-sm);
    color: var(--text-secondary); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; transition: all var(--transition);
}
.btn-icon:hover { background: rgba(255,255,255,0.12); color: var(--text-primary); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ============================================================ */
/* FILTER BAR */
/* ============================================================ */
.filter-bar {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 20px;
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}
.filter-pill {
    padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-color);
    color: var(--text-secondary); cursor: pointer;
    transition: all var(--transition);
}
.filter-pill:hover { border-color: var(--accent-orange); color: var(--accent-orange); }
.filter-pill.active { background: rgba(249,115,22,0.15); border-color: var(--accent-orange); color: var(--accent-orange); }
.filter-input {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary); padding: 6px 12px;
    font-size: 13px; font-family: var(--font-base);
    outline: none; transition: border-color var(--transition);
}
.filter-input:focus { border-color: var(--accent-orange); }

/* ============================================================ */
/* TABLE */
/* ============================================================ */
.table-wrap { overflow-x: auto; width: 100%; }
.portal-table,
.table,
table.table,
table.data-table,
table.pm-table,
table.fm-table,
table.matrix-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}
.portal-table thead tr,
.table thead tr,
table.table thead tr,
table.data-table thead tr {
    background: rgba(255,255,255,0.03);
    border-bottom: 1px solid var(--border-color);
}
.portal-table th,
.table th,
table.table th,
table.data-table th {
    padding: 12px 18px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
}
.portal-table tbody tr,
.table tbody tr,
table.table tbody tr,
table.data-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition);
}
.portal-table tbody tr:hover,
.table tbody tr:hover,
table.table tbody tr:hover,
table.data-table tbody tr:hover {
    background: rgba(255,255,255,0.025);
}
.portal-table tbody tr:last-child,
.table tbody tr:last-child,
table.table tbody tr:last-child {
    border-bottom: none;
}
.portal-table td,
.table td,
table.table td,
table.data-table td {
    padding: 14px 18px;
    font-size: 13px;
    vertical-align: middle;
}

/* Table cell helpers */
.td-mono {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--accent-cyan);
    white-space: nowrap;
}
.td-domain { font-weight: 600; }
.td-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.td-actions { display: flex; gap: 6px; align-items: center; }

/* Copy button */
.copy-btn {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 11px;
    transition: color var(--transition);
    padding: 2px 4px;
}
.copy-btn:hover { color: var(--accent-orange); }

/* ============================================================ */
/* BADGES */
/* ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 8px; border-radius: 20px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
}
.badge-active   { background: rgba(16,185,129,0.12); color: var(--accent-green);  border: 1px solid rgba(16,185,129,0.3); }
.badge-suspended{ background: rgba(239,68,68,0.12);  color: var(--accent-red);    border: 1px solid rgba(239,68,68,0.3); }
.badge-expired  { background: rgba(148,163,184,0.1); color: var(--text-muted);    border: 1px solid var(--border-color); }
.badge-warning  { background: rgba(234,179,8,0.12);  color: #eab308;              border: 1px solid rgba(234,179,8,0.3); }
.badge-info     { background: rgba(59,130,246,0.12); color: var(--accent-blue);   border: 1px solid rgba(59,130,246,0.3); }
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============================================================ */
/* MODULE CHIPS */
/* ============================================================ */
.module-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.module-chip {
    padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600;
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-color);
    color: var(--text-muted); cursor: pointer; transition: all var(--transition);
}
.module-chip.enabled {
    background: rgba(16,185,129,0.1); border-color: rgba(16,185,129,0.3);
    color: var(--accent-green);
}
.module-chip:hover { border-color: var(--accent-orange); color: var(--accent-orange); }

/* ============================================================ */
/* KILL SWITCH BUTTON */
/* ============================================================ */
.kill-btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; border-radius: var(--radius-sm);
    font-size: 11px; font-weight: 700; cursor: pointer;
    border: 1px solid rgba(239,68,68,0.4);
    background: rgba(239,68,68,0.08); color: var(--accent-red);
    transition: all var(--transition); white-space: nowrap;
    font-family: var(--font-base);
}
.kill-btn:hover { background: rgba(239,68,68,0.2); border-color: var(--accent-red); box-shadow: 0 0 16px rgba(239,68,68,0.25); }
.kill-btn.restore {
    background: rgba(16,185,129,0.08); color: var(--accent-green);
    border-color: rgba(16,185,129,0.4);
}
.kill-btn.restore:hover { background: rgba(16,185,129,0.2); box-shadow: 0 0 16px rgba(16,185,129,0.25); }

/* ============================================================ */
/* MODAL */
/* ============================================================ */
.modal-overlay {
    display: none; position: fixed; inset: 0; z-index: 500;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
    align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    width: 100%; max-width: 520px;
    max-height: 90vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(-8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border-color);
}
.modal-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 18px;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    border-radius: 4px; transition: all var(--transition);
}
.modal-close:hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================ */
/* FORM CONTROLS */
/* ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 12px; font-weight: 600;
    color: var(--text-secondary); margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.05em;
}
.form-control {
    width: 100%; padding: 9px 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); outline: none;
    color: var(--text-primary); font-size: 13px;
    font-family: var(--font-base);
    transition: border-color var(--transition);
}
.form-control:focus { border-color: var(--accent-orange); background: rgba(249,115,22,0.03); }
.form-control option { background: var(--bg-card); color: var(--text-primary); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================ */
/* PAGINATION */
/* ============================================================ */
.pagination-wrap { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border-color); }
.pagination-wrap .pagination { display: flex; gap: 4px; }
.pagination-wrap .pagination a,
.pagination-wrap .pagination span {
    padding: 5px 10px; border-radius: var(--radius-sm);
    font-size: 12px; font-weight: 600;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary); text-decoration: none;
    transition: all var(--transition);
}
.pagination-wrap .pagination a:hover { border-color: var(--accent-orange); color: var(--accent-orange); }
.pagination-wrap .pagination .active span {
    background: rgba(249,115,22,0.15);
    border-color: var(--accent-orange);
    color: var(--accent-orange);
}
.pagination-info { font-size: 12px; color: var(--text-muted); }

/* ============================================================ */
/* CHART CONTAINERS */
/* ============================================================ */
.chart-wrap { position: relative; }

/* ============================================================ */
/* DASHBOARD SPECIFIC */
/* ============================================================ */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 20px;
}
.dashboard-main { display: flex; flex-direction: column; gap: 20px; }
.dashboard-side { display: flex; flex-direction: column; gap: 20px; }

.activity-list { list-style: none; }
.activity-item {
    display: flex; gap: 12px; padding: 12px 20px;
    border-bottom: 1px solid var(--border-color); align-items: flex-start;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 32px; height: 32px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; flex-shrink: 0;
}
.activity-desc { flex: 1; }
.activity-action { font-size: 12px; font-weight: 600; margin-bottom: 2px; }
.activity-target { font-size: 11px; color: var(--text-muted); }
.activity-time   { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

/* Hero welcome on dashboard */
.welcome-strip {
    background: linear-gradient(135deg, #0d1a35 0%, #111827 50%, #0f172a 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-bottom: 28px;
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    position: relative; overflow: hidden;
}
.welcome-strip::before {
    content: '';
    position: absolute; top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(to bottom, var(--accent-orange), #c2440f);
}
.welcome-eyebrow {
    font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
    text-transform: uppercase; color: var(--accent-orange); margin-bottom: 4px;
}
.welcome-name { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.welcome-sub { font-size: 13px; color: var(--text-secondary); }
.welcome-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.welcome-badge {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: 20px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    font-size: 12px; font-weight: 600;
    color: var(--text-secondary);
}

/* ============================================================ */
/* TELEMETRY / AUDIT PAGE */
/* ============================================================ */
.log-row-success td:first-child { border-left: 3px solid var(--accent-green); }
.log-row-error   td:first-child { border-left: 3px solid var(--accent-red); }
.log-row-warn    td:first-child { border-left: 3px solid #eab308; }

.code-block {
    font-family: var(--font-mono); font-size: 11px;
    background: rgba(0,0,0,0.3); padding: 10px 14px;
    border-radius: var(--radius-sm); color: var(--accent-cyan);
    word-break: break-all; white-space: pre-wrap;
}

/* ============================================================ */
/* SETTINGS PAGE */
/* ============================================================ */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.setting-item {
    display: flex; align-items: flex-start; justify-content: space-between;
    padding: 14px 0; border-bottom: 1px solid var(--border-color); gap: 16px;
}
.setting-item:last-child { border-bottom: none; }
.setting-label { font-size: 13px; font-weight: 600; margin-bottom: 3px; }
.setting-desc  { font-size: 11px; color: var(--text-muted); }
.setting-value { font-family: var(--font-mono); font-size: 12px; color: var(--accent-cyan); white-space: nowrap; }

/* ============================================================ */
/* EMPTY STATE */
/* ============================================================ */
.empty-state {
    padding: 60px 20px; text-align: center;
    color: var(--text-muted);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; opacity: 0.3; display: block; }
.empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text-secondary); }
.empty-state p { font-size: 13px; }

/* ============================================================ */
/* RESPONSIVE */
/* ============================================================ */
@media (max-width: 1200px) { .dashboard-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px)  { .settings-grid { grid-template-columns: 1fr; } .form-row { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
    .portal-sidebar { transform: translateX(-100%); }
    .portal-sidebar.open { transform: translateX(0); }
    .portal-layout { margin-left: 0; }
    .portal-page-content { padding: 16px; }
    .header-center { display: none; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
    .page-hero { flex-direction: column; }
}
