/* ============================================================
   AGENT PORTAL SHELL — Colony MIS Top Bar
   Persistent navigation shell for all /agent/* pages.
   Colour palette matched to main site: amber (#f5c842) accent,
   white text on black, #2a2a3a borders.
   ============================================================ */

/* ── Portal body ─────────────────────────────────────────────── */
body[data-page-id^="agent"] {
    background: #512216;
    min-height: 100vh;
}

/* ── Top bar ─────────────────────────────────────────────────── */
.agent-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height, 64px);
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 1.25rem;
    background: linear-gradient(180deg, #0a0a0f 0%, #050508 100%);
    border-bottom: 1px solid #2a2a3a;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.6);
    font-family: var(--font-mono, 'Courier New', monospace);
    box-sizing: border-box;
}

/* Animated scanline across bottom edge */
.agent-topbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(245, 200, 66, 0.0) 10%,
        rgba(245, 200, 66, 0.4) 30%,
        rgba(245, 200, 66, 0.7) 50%,
        rgba(245, 200, 66, 0.4) 70%,
        rgba(245, 200, 66, 0.0) 90%,
        transparent 100%
    );
    animation: topbar-scanline 4s ease-in-out infinite;
}

@keyframes topbar-scanline {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 1; }
}

/* ── Identity strip (left) ───────────────────────────────────── */
.agent-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    min-width: 0;
}

.agent-identity-diamond {
    color: #f5c842;
    font-size: 0.85rem;
    line-height: 1;
    flex-shrink: 0;
    text-shadow: 0 0 6px rgba(245, 200, 66, 0.4);
}

.agent-identity-codename {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    color: #fff;
    text-transform: uppercase;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.agent-identity-dept {
    display: inline-block;
    padding: 0.12rem 0.4rem;
    font-size: 0.55rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border: 1px solid currentColor;
    border-radius: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Department colors */
.agent-identity-dept--farming        { color: #6dbf7a; border-color: rgba(109, 191, 122, 0.5); }
.agent-identity-dept--engine-labs    { color: #f5a623; border-color: rgba(245, 166, 35, 0.5); }
.agent-identity-dept--security       { color: #e05555; border-color: rgba(224, 85, 85, 0.5); }
.agent-identity-dept--genetics       { color: #c47fff; border-color: rgba(196, 127, 255, 0.5); }
.agent-identity-dept--administration { color: #7ab8f5; border-color: rgba(122, 184, 245, 0.5); }

.agent-identity-credits {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    color: #f5c842;
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
}

.agent-identity-credits-icon {
    font-size: 0.7rem;
    line-height: 1;
}

/* Dual-currency: bank balance + avatar credits */
.agent-identity-bank {
    color: #f5c842;
}

.agent-identity-avatarcr {
    color: #c47fff;
}

/* ── Clearance badge ─────────────────────────────────────────── */
.agent-identity-clearance {
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    padding: 2px 6px;
    border: 1px solid rgba(245, 200, 66, 0.3);
    border-radius: 2px;
    white-space: nowrap;
    flex-shrink: 0;
    color: #f5c842;
    background: rgba(245, 200, 66, 0.07);
}
.agent-identity-clearance--2 { color: #7ab8f5; border-color: rgba(122, 184, 245, 0.4); background: rgba(122, 184, 245, 0.07); }
.agent-identity-clearance--3 { color: #e05555; border-color: rgba(224, 85, 85, 0.4); background: rgba(224, 85, 85, 0.07); }
.agent-identity-clearance--4 { color: #c47fff; border-color: rgba(196, 127, 255, 0.4); background: rgba(196, 127, 255, 0.07); }

/* ── Separator ───────────────────────────────────────────────── */
.agent-topbar-sep {
    width: 1px;
    height: 28px;
    background: #2a2a3a;
    flex-shrink: 0;
    margin: 0 0.75rem;
}

/* ── Nav (center/right) ──────────────────────────────────────── */
.agent-nav {
    display: flex;
    align-items: center;
    gap: 0;
    flex: 1;
    justify-content: flex-end;
    min-width: 0;
}

.agent-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    height: var(--header-height, 64px);
    padding: 0 0.65rem;
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #888;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.agent-nav-link:hover {
    color: #ddd;
}

/* Active nav item */
.agent-nav-link--active {
    color: #f5c842;
}

.agent-nav-link--active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.65rem;
    right: 0.65rem;
    height: 2px;
    background: #f5c842;
    box-shadow: 0 0 8px rgba(245, 200, 66, 0.5);
}

/* ── MORE dropdown ───────────────────────────────────────────── */
.agent-nav-more {
    position: relative;
    display: flex;
    align-items: center;
}

.agent-nav-more-btn {
    cursor: pointer;
    background: transparent;
    border: none;
    font-family: var(--font-mono, 'Courier New', monospace);
}

.agent-nav-more-arrow {
    font-size: 0.5rem;
    opacity: 0.6;
    transition: transform 0.2s;
}

.agent-nav-more--open .agent-nav-more-arrow {
    transform: rotate(180deg);
}

.agent-nav-more-panel {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background: #0a0a0f;
    border: 1px solid #2a2a3a;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7);
    z-index: 60;
    flex-direction: column;
    padding: 0.35rem 0;
}

.agent-nav-more--open .agent-nav-more-panel {
    display: flex;
}

.agent-nav-more-item {
    display: block;
    padding: 0.5rem 1rem;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.58rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #888;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.15s, background 0.15s;
}

.agent-nav-more-item:hover {
    color: #ddd;
    background: rgba(245, 200, 66, 0.04);
}

.agent-nav-more-item--active {
    color: #f5c842;
}

/* ── Logout button ───────────────────────────────────────────── */
.agent-logout {
    flex-shrink: 0;
    margin-left: 0.5rem;
    padding: 0.3rem 0.7rem;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
    background: transparent;
    border: 1px solid #2a2a3a;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}

.agent-logout:hover {
    color: #fff;
    border-color: #555;
}

/* ── Hamburger toggle (mobile) ───────────────────────────────── */
.agent-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 32px;
    height: 32px;
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    margin-left: auto;
    flex-shrink: 0;
}

.agent-hamburger span {
    display: block;
    width: 18px;
    height: 1.5px;
    background: #888;
    transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Hamburger open state */
.agent-hamburger--open span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}
.agent-hamburger--open span:nth-child(2) {
    opacity: 0;
}
.agent-hamburger--open span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* ── Mobile nav panel ────────────────────────────────────────── */
.agent-nav-panel {
    display: none;
}

/* ── Content area ────────────────────────────────────────────── */
.agent-content {
    position: relative;
    z-index: var(--z-ui, 10);
    min-height: calc(100vh - var(--header-height, 64px));
    margin-top: var(--header-height, 64px);
    padding: 2rem 1.5rem 3rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Music: stretch content to full width */
body[data-page-id="agent-music"] .agent-content {
    align-items: stretch;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

/* Shop: full-width edge-to-edge layout */
body[data-page-id="agent-shop"] .agent-content {
    align-items: stretch;
    padding: 0;
    width: 100%;
}

/* Avatar lab: vertically center the fixed-height panel */
body[data-page-id="agent-avatar-lab"] .agent-content {
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0;
}

/* Marspedia: fill full height for chat */
body[data-page-id="agent-marspedia"] .agent-content {
    height: calc(100vh - var(--header-height, 64px));
    padding: 16px 16px 12px;
}

body[data-page-id="agent-marspedia"] .marspedia-chat-container {
    flex: 1;
    min-height: 0;
}

/* Intel: two-column layout */
body[data-page-id="agent-intel"] .agent-content {
    align-items: stretch;
    padding: 1.5rem;
}

body[data-page-id="agent-intel"] .intel-terminal {
    width: 100%;
    max-width: none;
}

/* Dossier: clip scrollable content below topbar */
body[data-page-id="agent-dossier"] .agent-content {
    overflow-y: auto;
    overflow-x: hidden;
}

body[data-page-id="agent-dossier"] .vault-main {
    min-height: auto;
    width: 100%;
    max-width: 960px;
}

/* Archive: full-width terminal inside agent shell */
body[data-page-id="agent-archive"] .agent-content {
    padding: 1rem 1.25rem 2rem;
    align-items: center;
}

body[data-page-id="agent-archive"] .archive-terminal {
    width: 100%;
    max-width: 1100px;
    margin-top: 0;
}

/* Hide archive sidebar auth section — agent shell already shows identity */
body[data-page-id="agent-archive"] .status-auth {
    display: none;
}

/* ── Status indicator (top bar right of identity) ────────────── */
.agent-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00ff00;
    box-shadow: 0 0 6px rgba(0, 255, 0, 0.4);
    flex-shrink: 0;
    animation: agent-pulse 2s ease-in-out infinite;
}

@keyframes agent-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ── Auth gate overlay (shown when not logged in) ────────────── */
.agent-gate {
    position: fixed;
    inset: 0;
    z-index: var(--z-nav-overlay, 100);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: rgba(0, 0, 0, 0.97);
    font-family: var(--font-mono, 'Courier New', monospace);
    text-align: center;
}

.agent-gate-icon {
    font-size: 2rem;
    color: #f5c842;
    line-height: 1;
}

.agent-gate-title {
    font-size: 0.85rem;
    letter-spacing: 0.18em;
    color: #fff;
    text-transform: uppercase;
}

.agent-gate-sub {
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: #888;
    text-transform: uppercase;
    max-width: 340px;
    line-height: 1.7;
}

.agent-gate-btn {
    margin-top: 0.5rem;
    padding: 0.6rem 1.8rem;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #f5c842;
    background: transparent;
    border: 1px solid rgba(245, 200, 66, 0.4);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.agent-gate-btn:hover {
    background: rgba(245, 200, 66, 0.08);
    border-color: rgba(245, 200, 66, 0.7);
    color: #fff;
}

/* ── Dashboard-specific styles ───────────────────────────────── */
.agent-dash {
    width: 100%;
    max-width: 960px;
}

.agent-dash-greeting {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.agent-dash-codename {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 1.6rem;
    letter-spacing: 0.08em;
    color: #fff;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 2rem;
}

/* Dashboard quick-links grid */
.agent-dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.agent-dash-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1.25rem;
    border: 1px solid #2a2a3a;
    background: rgba(10, 10, 16, 0.7);
    text-decoration: none;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.agent-dash-card:hover {
    border-color: rgba(245, 200, 66, 0.4);
    background: rgba(245, 200, 66, 0.03);
    box-shadow: 0 0 20px rgba(245, 200, 66, 0.05);
}

.agent-dash-card-title {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    color: #fff;
    text-transform: uppercase;
}

.agent-dash-card-desc {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    color: #888;
    line-height: 1.5;
}

.agent-dash-card-icon {
    font-size: 1.1rem;
    color: #f5c842;
    line-height: 1;
}

/* Dept mission card — highlighted variant */
.agent-dash-card--mission {
    border-color: rgba(0, 255, 157, 0.25);
    background: rgba(0, 255, 157, 0.03);
}
.agent-dash-card--mission:hover {
    border-color: rgba(0, 255, 157, 0.5);
    background: rgba(0, 255, 157, 0.07);
    box-shadow: 0 0 24px rgba(0, 255, 157, 0.1);
}
.agent-dash-card-tag {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.52rem;
    letter-spacing: 0.16em;
    color: #00ff9d;
    text-transform: uppercase;
    margin-bottom: -2px;
}
.agent-dash-card--mission .agent-dash-card-title {
    color: #00ff9d;
}

/* Dashboard stats row */
.agent-dash-stats {
    display: flex;
    gap: 2rem;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #2a2a3a;
}

.agent-dash-stat {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.agent-dash-stat-value {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 1.3rem;
    color: #f5c842;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.agent-dash-stat-label {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    color: #888;
    text-transform: uppercase;
}

/* ── XP + Clearance Bar ──────────────────────────────────────── */
.agent-dash-xp {
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    border: 1px solid #2a2a3a;
    background: rgba(10, 10, 16, 0.7);
}
.agent-dash-xp-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.4rem;
}
.agent-dash-xp-label {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.12em;
    color: #888;
    text-transform: uppercase;
}
.agent-dash-xp-title {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: #f5c842;
    font-weight: 700;
}
.agent-dash-xp-bar {
    width: 100%;
    height: 6px;
    background: #1a1a2a;
    border: 1px solid #2a2a3a;
    overflow: hidden;
    margin-bottom: 0.3rem;
}
.agent-dash-xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #f5c842, #e0a020);
    transition: width 0.6s ease;
    box-shadow: 0 0 8px rgba(245, 200, 66, 0.3);
}
.agent-dash-xp-meta {
    display: flex;
    justify-content: space-between;
}
.agent-dash-xp-current {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    color: #ccc;
}
.agent-dash-xp-next {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.08em;
    color: #666;
}

/* ── Dashboard Widgets ───────────────────────────────────────── */
.agent-dash-widgets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.agent-dash-widget {
    border: 1px solid #2a2a3a;
    background: rgba(10, 10, 16, 0.7);
    overflow: hidden;
}

.agent-dash-widget-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    border-bottom: 1px solid #2a2a3a;
    background: rgba(10, 10, 16, 0.95);
}

.agent-dash-widget-title {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.52rem;
    letter-spacing: 0.14em;
    color: #f5c842;
    text-transform: uppercase;
}

.agent-dash-widget-link {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.48rem;
    letter-spacing: 0.1em;
    color: #666;
    text-decoration: none;
    text-transform: uppercase;
    transition: color 0.15s;
}

.agent-dash-widget-link:hover {
    color: #f5c842;
}

.agent-dash-widget-list {
    padding: 0.5rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 180px;
    overflow-y: auto;
}

.agent-dash-widget-empty {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    color: #555;
    padding: 0.5rem 0;
    letter-spacing: 0.04em;
}

.agent-dash-widget-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(42, 42, 58, 0.3);
}

.agent-dash-widget-row:last-child {
    border-bottom: none;
}

.agent-dash-widget-date {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.5rem;
    color: #555;
    letter-spacing: 0.06em;
    white-space: nowrap;
    flex-shrink: 0;
}

.agent-dash-widget-text {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    color: #ccc;
    letter-spacing: 0.04em;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.agent-dash-widget-tag {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.45rem;
    letter-spacing: 0.1em;
    padding: 0.1rem 0.35rem;
    border: 1px solid currentColor;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.agent-dash-widget-tag--classified { color: #e05555; }
.agent-dash-widget-tag--restricted { color: #f5a623; }
.agent-dash-widget-tag--public     { color: #6dbf7a; }

.agent-dash-widget-delta {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
}

.agent-dash-widget-delta--pos { color: #6dbf7a; }
.agent-dash-widget-delta--neg { color: #e05555; }

/* Colony stats in widget */
.agent-dash-colony-row {
    display: flex;
    gap: 1.5rem;
    padding: 0.35rem 0;
}

.agent-dash-colony-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.agent-dash-colony-stat-val {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.9rem;
    color: #f5c842;
    font-weight: 700;
}

.agent-dash-colony-stat-lbl {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.45rem;
    letter-spacing: 0.1em;
    color: #888;
    text-transform: uppercase;
}

/* ── ARIANA halo orb (dashboard) ─────────────────────────────── */
.agent-ariana-wrap {
    margin-top: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.agent-ariana-orb {
    position: relative;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
}

.agent-ariana-core {
    position: relative;
    z-index: 2;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #f5c842 0%, #c0392b 70%, #3a0a06 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.85rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
    text-shadow: 0 0 8px rgba(245, 200, 66, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.agent-ariana-orb:hover .agent-ariana-core {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(245, 200, 66, 0.5);
}

.agent-ariana-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(245, 200, 66, 0.25);
    animation: ariana-pulse 3s ease-in-out infinite;
}

.agent-ariana-ring--1 {
    width: 52px;
    height: 52px;
    top: 6px;
    left: 6px;
    animation-delay: 0s;
}

.agent-ariana-ring--2 {
    width: 64px;
    height: 64px;
    top: 0;
    left: 0;
    border-color: rgba(245, 200, 66, 0.12);
    animation-delay: 1.5s;
}

@keyframes ariana-pulse {
    0%, 100% { transform: scale(1); opacity: 0.4; }
    50%      { transform: scale(1.15); opacity: 1; }
}

.agent-ariana-label {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.2em;
    color: #888;
    text-transform: uppercase;
}

/* ── ARIANA inline chat panel (dashboard) ────────────────────── */
.agent-ariana-panel {
    display: none;
    width: 100%;
    max-width: 960px;
    margin-top: 1.5rem;
    border: 1px solid rgba(245, 200, 66, 0.25);
    border-radius: 6px;
    background: rgba(10, 10, 16, 0.9);
    backdrop-filter: blur(8px);
    overflow: hidden;
    flex-direction: column;
    height: 420px;
    max-height: calc(100vh - 140px);
}

.agent-ariana-panel--open {
    display: flex;
}

.agent-ariana-panel-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid rgba(245, 200, 66, 0.15);
    background: rgba(245, 200, 66, 0.04);
}

.agent-ariana-panel-title {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    color: #f5c842;
    text-transform: uppercase;
}

.agent-ariana-panel-close {
    background: transparent;
    border: none;
    color: #888;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    line-height: 1;
    transition: color 0.15s;
}

.agent-ariana-panel-close:hover {
    color: #fff;
}

.agent-ariana-panel-log {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 0;
}

.agent-ariana-msg {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.65rem;
    line-height: 1.6;
    letter-spacing: 0.04em;
    max-width: 85%;
}

.agent-ariana-msg--ai {
    color: #ccc;
    align-self: flex-start;
}

.agent-ariana-msg--user {
    color: #f5c842;
    align-self: flex-end;
    text-align: right;
}

.agent-ariana-msg-label {
    display: block;
    font-size: 0.5rem;
    letter-spacing: 0.12em;
    color: #888;
    text-transform: uppercase;
    margin-bottom: 0.2rem;
}

.agent-ariana-input-row {
    display: flex;
    border-top: 1px solid rgba(245, 200, 66, 0.15);
}

.agent-ariana-input {
    flex: 1;
    padding: 0.6rem 0.85rem;
    background: transparent;
    border: none;
    color: #fff;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    outline: none;
}

.agent-ariana-input::placeholder {
    color: #555;
}

.agent-ariana-send {
    padding: 0.6rem 1rem;
    background: transparent;
    border: none;
    border-left: 1px solid rgba(245, 200, 66, 0.15);
    color: #f5c842;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s;
}

.agent-ariana-send:hover {
    background: rgba(245, 200, 66, 0.06);
}

/* Settings page layout */
body[data-page-id="agent-settings"] .agent-content {
    align-items: center;
}

/* Squad page layout */
body[data-page-id="agent-squad"] .agent-content {
    align-items: center;
}

/* ── Agent Archive Enhancements ──────────────────────────────── */
.agent-archive-panel {
    width: 100%;
    max-width: 1100px;
    border: 1px solid #2a2a3a;
    background: rgba(10, 10, 16, 0.85);
    margin-bottom: 1rem;
    overflow: hidden;
}

.agent-archive-panel-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid #2a2a3a;
    background: rgba(10, 10, 16, 0.95);
}

.agent-archive-panel-title {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.14em;
    color: #f5c842;
    text-transform: uppercase;
}

.agent-archive-panel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00ff00;
    box-shadow: 0 0 6px rgba(0, 255, 0, 0.4);
    animation: agent-pulse 2s ease-in-out infinite;
}

.agent-archive-panel-body {
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.agent-archive-info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.agent-archive-chip {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.agent-archive-chip-lbl {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.48rem;
    letter-spacing: 0.1em;
    color: #555;
    text-transform: uppercase;
}

.agent-archive-chip-val {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.06em;
    color: #ccc;
}

.agent-archive-chip-val--ok { color: #6dbf7a; }
.agent-archive-chip-val--warn { color: #f5a623; }

.agent-archive-chip-sep {
    color: #2a2a3a;
    font-size: 0.8rem;
    line-height: 1;
}

.agent-archive-notice {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.55rem;
    letter-spacing: 0.04em;
    padding: 0.4rem 0.6rem;
    line-height: 1.5;
}

.agent-archive-notice--ok {
    color: #6dbf7a;
    border-left: 2px solid #6dbf7a;
    background: rgba(109, 191, 122, 0.04);
}

.agent-archive-notice--warn {
    color: #f5a623;
    border-left: 2px solid #f5a623;
    background: rgba(245, 166, 35, 0.04);
}

/* Annotation button on file items */
.agent-annot-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    font-size: 0.6rem;
    line-height: 20px;
    text-align: center;
    background: rgba(10, 10, 16, 0.8);
    border: 1px solid #2a2a3a;
    color: #888;
    cursor: pointer;
    padding: 0;
    z-index: 5;
    transition: color 0.15s, border-color 0.15s;
}

.agent-annot-btn:hover {
    color: #f5c842;
    border-color: rgba(245, 200, 66, 0.4);
}

/* ── Responsive — tablet ─────────────────────────────────────── */
@media (max-width: 1100px) {
    .agent-nav-link {
        padding: 0 0.45rem;
        font-size: 0.55rem;
        letter-spacing: 0.06em;
    }
    .agent-identity-codename {
        max-width: 90px;
        font-size: 0.65rem;
    }
    .agent-identity-dept {
        font-size: 0.48rem;
    }
    .agent-identity-credits {
        font-size: 0.58rem;
    }
}

/* ── Responsive — mobile ─────────────────────────────────────── */
@media (max-width: 768px) {
    .agent-topbar {
        padding: 0 1rem;
    }


    /* Show hamburger, hide inline nav */
    .agent-hamburger {
        display: flex;
    }

    .agent-nav,
    .agent-topbar-sep,
    .agent-logout,
    .agent-nav-more {
        display: none;
    }

    /* Hide dept badge, clearance, credits on topbar (shown in panel) */
    .agent-identity-dept,
    .agent-identity-clearance,
    .agent-identity-credits,
    .agent-status-dot {
        display: none;
    }

    /* Mobile nav panel */
    .agent-nav-panel {
        display: none;
        position: fixed;
        top: var(--header-height, 64px);
        left: 0;
        right: 0;
        bottom: 0;
        z-index: var(--z-nav-panel, 110);
        background: rgba(0, 0, 0, 0.97);
        backdrop-filter: blur(8px);
        flex-direction: column;
        padding: 1.5rem 1.25rem;
        overflow-y: auto;
    }

    .agent-nav-panel--open {
        display: flex;
    }

    /* Mobile identity block (inside panel) */
    .agent-nav-panel-identity {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding-bottom: 1rem;
        margin-bottom: 1rem;
        border-bottom: 1px solid #2a2a3a;
        font-family: var(--font-mono, 'Courier New', monospace);
    }

    .agent-nav-panel-dept {
        display: inline-block;
        padding: 0.12rem 0.4rem;
        font-size: 0.55rem;
        letter-spacing: 0.1em;
        text-transform: uppercase;
        border: 1px solid currentColor;
        border-radius: 1px;
    }

    .agent-nav-panel-credits {
        font-size: 0.65rem;
        color: #f5c842;
        letter-spacing: 0.06em;
        margin-left: auto;
    }

    /* Mobile nav links */
    .agent-nav-panel-link {
        display: block;
        padding: 0.85rem 0;
        font-family: var(--font-mono, 'Courier New', monospace);
        font-size: 0.68rem;
        letter-spacing: 0.14em;
        text-transform: uppercase;
        color: #888;
        text-decoration: none;
        border-bottom: 1px solid rgba(42, 42, 58, 0.4);
        transition: color 0.15s;
    }

    .agent-nav-panel-link:hover {
        color: #fff;
    }

    .agent-nav-panel-link--active {
        color: #f5c842;
    }

    .agent-nav-panel-logout {
        margin-top: auto;
        padding: 0.65rem 0;
        font-family: var(--font-mono, 'Courier New', monospace);
        font-size: 0.6rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: #888;
        background: transparent;
        border: none;
        border-top: 1px solid #2a2a3a;
        cursor: pointer;
        text-align: left;
        width: 100%;
    }

    .agent-nav-panel-logout:hover {
        color: #fff;
    }

    /* Intel: stack columns on mobile */
    body[data-page-id="agent-intel"] .agent-content {
        padding: 1rem 0.75rem;
    }

    /* Dashboard responsive */
    .agent-dash-stats {
        gap: 1.25rem;
        flex-wrap: wrap;
    }
    .agent-dash-widgets {
        grid-template-columns: 1fr;
    }
    .agent-dash-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Responsive — small mobile ───────────────────────────────── */
@media (max-width: 480px) {
    .agent-topbar {
        padding: 0 0.75rem;
    }
    .agent-identity-codename {
        font-size: 0.65rem;
        max-width: 90px;
    }
    .agent-content {
        padding: 1.25rem 1rem 2rem;
    }
    .agent-dash-codename {
        font-size: 1.2rem;
    }
    .agent-dash-grid {
        grid-template-columns: 1fr;
    }
    .agent-dash-stat-value {
        font-size: 1rem;
    }
}

/* ── Level-up Toast ──────────────────────────────────────────── */
.levelup-toast {
    position: fixed;
    top: calc(var(--header-height, 64px) + 1rem);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #0a0a14, #1a1a2a);
    border: 1px solid rgba(245, 200, 66, 0.5);
    box-shadow: 0 0 30px rgba(245, 200, 66, 0.3), 0 0 60px rgba(245, 200, 66, 0.1);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.levelup-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.levelup-toast--exit {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.levelup-toast-icon {
    font-size: 1.5rem;
    color: #f5c842;
    animation: levelup-pulse 0.8s ease-in-out infinite alternate;
}
.levelup-toast-text {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    color: #888;
}
.levelup-toast-rank {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    color: #f5c842;
    font-weight: 700;
}
@keyframes levelup-pulse {
    from { text-shadow: 0 0 6px rgba(245, 200, 66, 0.3); }
    to   { text-shadow: 0 0 18px rgba(245, 200, 66, 0.8); }
}

/* ── Clearance-gated access restriction ──────────────────────────── */
.clearance-access-restricted {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    text-align: center;
    padding: 2rem;
}
.clearance-restricted-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.8;
    color: #f5a623;
}
.clearance-restricted-title {
    font-family: 'Orbitron', monospace, sans-serif;
    font-size: 1.4rem;
    color: #f5a623;
    letter-spacing: 0.15em;
    margin: 0 0 1rem;
}
.clearance-restricted-msg {
    font-family: monospace;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
    max-width: 440px;
    line-height: 1.6;
    margin: 0 0 2rem;
}
.clearance-restricted-btn {
    font-family: 'Orbitron', monospace, sans-serif;
    font-size: 0.7rem;
    color: #f5a623;
    letter-spacing: 0.1em;
    text-decoration: none;
    border: 1px solid rgba(245, 166, 35, 0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 3px;
    transition: background 0.2s;
}
.clearance-restricted-btn:hover {
    background: rgba(245, 166, 35, 0.1);
}

/* Nav lock indicators for clearance-gated items */
.agent-nav-locked {
    opacity: 0.45;
    pointer-events: auto;
}
.agent-nav-locked:hover {
    opacity: 0.65;
}
