/* ── CSS Variables ─────────────────────────────────────────────────────── */
:root {
    --navy: #002489;
    --navy-light: #1a4fd6;
    --sky: #00A4E1;
    --sky-pale: #e8f7fd;
    --white: #ffffff;
    --off-white: #f5f7fc;
    --gray-100: #ECECEC;
    --gray-200: #dde3ee;
    --gray-400: #a0aec0;
    --gray-600: #707070;
    --gray-800: #2d3748;
    --success: #22c55e;
    --success-bg: #f0fdf4;
    --warning: #f59e0b;
    --warning-bg: #fffbeb;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;
    --purple: #8b5cf6;
    --navy-dark: #001a6b;
    --primary: #00A4E1;
    --border: #dde3ee;
    --text-primary: #2d3748;
    --text-secondary: #707070;
    --shadow-sm: 0 1px 3px rgba(0, 36, 137, 0.08);
    --shadow: 0 4px 16px rgba(0, 36, 137, 0.10);
    --radius: 10px;
    --radius-sm: 6px;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--off-white);
    color: var(--gray-800);
    font-size: 13.5px;
    line-height: 1.6;
}

/* ── Dev Mode Banner ──────────────────────────────────────────────────── */
.dev-banner {
    background: repeating-linear-gradient(
        -45deg,
        var(--warning),
        var(--warning) 10px,
        #e08900 10px,
        #e08900 20px
    );
    color: #000;
    text-align: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 4px 0;
    position: sticky;
    top: 0;
    z-index: 201;
}

/* When dev banner is present, push header and nav below it */
.dev-banner ~ .header {
    top: 25px;
}

.dev-banner ~ .tab-nav {
    top: 89px; /* 25px banner + 64px header */
}

/* ── Header ───────────────────────────────────────────────────────────── */
.header {
    background: linear-gradient(135deg, #001a6b 0%, var(--navy) 45%, #003dbc 100%);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    position: sticky;
    top: 0;
    z-index: 200;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.25);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    width: 36px;
    height: 36px;
    background: var(--sky);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    color: white;
}

.header-logo svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.header-logo .logo-node {
    fill: currentColor;
    stroke: none;
}

.header-title {
    color: white;
    font-size: 15px;
    font-weight: 700;
}

.header-title span {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.6);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* ── Mobile Menu Button ──────────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.15s;
}

.mobile-menu-btn:hover,
.mobile-menu-btn[aria-expanded="true"] {
    background: rgba(255, 255, 255, 0.2);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: white;
    stroke-width: 2;
    stroke-linecap: round;
}

.header-clock {
    font-size: 11.5px;
    color: rgba(255, 255, 255, 0.6);
}

.header-org {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    padding: 4px 12px 4px 10px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.header-org .org-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.header-org.disconnected .org-dot {
    background: var(--gray-400);
    box-shadow: none;
}

/* ── Header User Dropdown ─────────────────────────────────────────────── */
.header-user-dropdown {
    position: relative;
    margin-left: 8px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.15);
}

.header-user-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 5px 10px;
    font-family: inherit;
    transition: background 0.15s;
}

.header-user-toggle:hover,
.header-user-dropdown.open .header-user-toggle {
    background: rgba(255, 255, 255, 0.2);
}

.header-user-toggle svg {
    width: 10px;
    height: 10px;
    fill: rgba(255, 255, 255, 0.8);
    transition: transform 0.2s;
}

.header-user-dropdown.open .header-user-toggle svg {
    transform: rotate(180deg);
}

.header-user-name {
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.header-user-role {
    font-size: 10px;
    text-transform: capitalize;
    background: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.25);
}

.header-user-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    min-width: 170px;
    z-index: 300;
    overflow: hidden;
}

.header-user-dropdown.open .header-user-menu {
    display: block;
}

.header-user-menu form {
    margin: 0;
}

.header-user-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 16px;
    font-size: 13px;
    font-family: inherit;
    color: var(--gray-800);
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s;
}

.header-user-menu-item svg {
    flex-shrink: 0;
    color: var(--gray-400);
}

.header-user-menu-item:hover {
    background: var(--off-white);
}

/* ── Tab Nav ──────────────────────────────────────────────────────────── */
.tab-nav {
    background: var(--navy);
    padding: 0 32px;
    display: flex;
    gap: 2px;
    position: sticky;
    top: 64px;
    z-index: 199;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.tab-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.55);
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 12px 18px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    text-decoration: none;
}

.tab-btn:hover {
    color: rgba(255, 255, 255, 0.85);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: white;
    border-bottom-color: var(--sky);
    background: rgba(0, 164, 225, 0.1);
}

.tab-btn.hidden {
    display: none;
}

/* ── Tab Dropdown ─────────────────────────────────────────────────────── */
.tab-dropdown {
    position: relative;
}

.tab-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
}

.tab-dropdown-arrow {
    opacity: 0.6;
    transition: transform 0.2s;
}

.tab-dropdown.open .tab-dropdown-arrow {
    transform: rotate(180deg);
}

.tab-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 160px;
    background: var(--navy-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 300;
    padding: 4px 0;
}

.tab-dropdown.open .tab-dropdown-menu {
    display: block;
}

.tab-dropdown-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 500;
    padding: 8px 18px;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s;
    text-decoration: none;
}

.tab-dropdown-item:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.tab-dropdown-item.active {
    color: var(--sky);
}

.tab-dropdown-item.hidden {
    display: none;
}

.tab-dropdown-hint {
    display: block;
    padding: 10px 18px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}

.tab-badge {
    background: var(--sky);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
}

/* ── Page Container ───────────────────────────────────────────────────── */
.page {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 32px 48px;
}

/* ── View Container ───────────────────────────────────────────────────── */
#view-container {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

/* ── Section Card ─────────────────────────────────────────────────────── */
.section {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-100);
    background: linear-gradient(135deg, rgba(0, 36, 137, 0.03), transparent);
}

.section-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--navy), var(--navy-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: white;
}

.section-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--navy);
    flex: 1;
}

.section-actions {
    display: flex;
    gap: 8px;
}

.section-body {
    padding: 20px;
}

/* ── Version Badge ────────────────────────────────────────────────────── */
.version-badge {
    position: fixed;
    bottom: 10px;
    right: 14px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-400);
    pointer-events: none;
    z-index: 10;
}

/* ── Utility ──────────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-400); }
.text-sm { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.gap-row { display: flex; gap: 10px; }

:root {
    --navy-soft: #e7eefc;
    --gray-300: #c6cfde;
    --surface-1: #ffffff;
    --surface-2: #f8fbff;
    --surface-3: #eef4fb;
    --text-secondary: #5d6b82;
    --shadow-sm: 0 3px 10px rgba(0, 36, 137, 0.06);
    --shadow: 0 12px 30px rgba(0, 36, 137, 0.10);
    --radius: 14px;
    --radius-sm: 10px;
}

body {
    background:
        radial-gradient(circle at top left, rgba(0, 164, 225, 0.06), transparent 22%),
        linear-gradient(180deg, #f9fbff 0%, #f4f7fc 100%);
    font-size: 14px;
}

[hidden] {
    display: none !important;
}

.header {
    padding: 0 28px;
    height: 68px;
}

.dev-banner ~ .tab-nav {
    top: 93px;
}

.header-brand {
    gap: 14px;
    min-width: 0;
}

.header-title {
    font-size: 16px;
    line-height: 1.2;
}

.header-title span {
    color: rgba(255, 255, 255, 0.72);
}

.header-right {
    gap: 10px;
    min-width: 0;
}

.header-clock {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.64);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.header-org {
    padding: 6px 12px 6px 10px;
    font-size: 11.5px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-user-dropdown {
    margin-left: 6px;
    padding-left: 12px;
}

.header-user-toggle {
    padding: 6px 10px;
}

.header-user-name {
    font-size: 11.5px;
}

.tab-nav {
    padding: 0 28px;
    top: 68px;
}

.tab-btn {
    padding: 14px 18px;
    border-radius: 10px 10px 0 0;
}

.page {
    padding: 28px 32px 56px;
}

.section {
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(249,252,255,0.98));
    border: 1px solid rgba(198, 207, 222, 0.8);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.section-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(198, 207, 222, 0.55);
    background: linear-gradient(135deg, rgba(0, 36, 137, 0.04), rgba(0, 164, 225, 0.02));
}

.section-title {
    font-size: 14px;
}

.section-actions {
    align-items: center;
    flex-wrap: wrap;
}

.section-flush {
    margin-bottom: 0;
}

.text-muted {
    color: var(--text-secondary);
}

.paragraph-compact {
    margin-bottom: 12px;
}

.panel-stack-top {
    margin-top: 16px;
}

.mobile-nav-scrim {
    display: none;
}

.mobile-account-actions {
    display: none;
}
