/* ==========================================================================
   PINCODEZ DESIGN SYSTEM — DATA INFRASTRUCTURE & SEARCH PLATFORM
   Precision typography, restrained color, 1px crisp geometry, zero AI fluff.
   ========================================================================== */

:root {
    --bg-page: #080c14;
    --bg-surface: #0e1422;
    --bg-surface-elevated: #141c2e;
    --bg-surface-subtle: #111827;
    
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);
    --border-focus: #3b82f6;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;
    
    /* Semantic Brand & State Colors */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-subtle: rgba(59, 130, 246, 0.08);
    --accent-border: rgba(59, 130, 246, 0.25);
    
    --success: #10b981;
    --success-subtle: rgba(16, 185, 129, 0.08);
    --success-border: rgba(16, 185, 129, 0.25);
    
    --warning: #f59e0b;
    --warning-subtle: rgba(245, 158, 11, 0.08);
    --warning-border: rgba(245, 158, 11, 0.25);
    
    --danger: #ef4444;
    --danger-subtle: rgba(239, 68, 68, 0.08);
    --danger-border: rgba(239, 68, 68, 0.25);
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", Helvetica, Arial, sans-serif;
    --font-heading: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
    
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-dropdown: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
    
    --transition: 0.12s cubic-bezier(0.16, 1, 0.3, 1);
    --bg-surface-2: #0b101d;
}

[data-theme="light"] {
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-subtle: #f8fafc;
    --bg-surface-2: #f1f5f9;
    
    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.16);
    --border-focus: #2563eb;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-subtle: rgba(37, 99, 235, 0.08);
    --accent-border: rgba(37, 99, 235, 0.25);
    
    --success: #059669;
    --success-subtle: rgba(5, 150, 105, 0.08);
    --success-border: rgba(5, 150, 105, 0.25);
    
    --warning: #d97706;
    --warning-subtle: rgba(217, 119, 6, 0.08);
    --warning-border: rgba(217, 119, 6, 0.25);
    
    --danger: #dc2626;
    --danger-subtle: rgba(220, 38, 38, 0.08);
    --danger-border: rgba(220, 38, 38, 0.25);
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-dropdown: 0 10px 25px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .navbar {
    background-color: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] .search-box {
    background-color: #ffffff;
    border-color: var(--border-subtle);
}

[data-theme="light"] .search-dropdown {
    background-color: #ffffff;
    border-color: var(--border-subtle);
}

[data-theme="light"] .search-kbd {
    background-color: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
}

[data-theme="light"] .footer {
    background-color: #f1f5f9;
    border-top: 1px solid var(--border-subtle);
}

[data-theme="light"] .code-box {
    background-color: #0b101d;
    color: #f8fafc;
}


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

html {
    font-size: 15px;
    scroll-behavior: smooth;
    background-color: var(--bg-page);
    overflow-x: hidden;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    max-width: 100vw;
}

/* --------------------------------------------------------------------------
   Layout & Container
   -------------------------------------------------------------------------- */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-narrow {
    max-width: 860px;
}

main {
    flex: 1;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

h1 { font-size: 2.1rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 0.95rem; }

p {
    color: var(--text-secondary);
}

a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--accent);
}

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Navigation Bar
   -------------------------------------------------------------------------- */
.navbar {
    height: 58px;
    background-color: rgba(8, 12, 20, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 90;
}

.nav-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    gap: 1rem;
}

.brand-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    text-decoration: none;
    flex-shrink: 0;
}

.brand-logo:hover {
    color: var(--text-primary);
}

.brand-mark-img {
    display: block;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
}

.brand-name {
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-primary);
}

.brand-tld {
    color: var(--accent);
    font-weight: 700;
    margin-left: -1px;
}

.brand-tag {
    font-size: 0.65rem;
    font-weight: 600;
    font-family: var(--font-mono);
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    white-space: nowrap;
}

.desktop-nav {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    align-items: center;
    list-style: none;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    font-size: 0.88rem;
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-cta {
    font-family: var(--font-mono);
    font-size: 0.8rem !important;
    background-color: var(--accent-subtle) !important;
    color: var(--accent) !important;
    border: 1px solid var(--accent-border);
}

.nav-cta:hover {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* Quick 1-Tap Mobile & Tablet Theme Toggle */
.mobile-theme-toggle {
    display: none;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: all var(--transition);
    padding: 0;
    flex-shrink: 0;
}

.mobile-theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
    color: var(--accent);
}

/* Mobile Hamburger Button */
.mobile-menu-btn {
    display: none;
    width: 42px;
    height: 42px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    color: var(--text-primary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: var(--border-strong);
    color: var(--accent);
}

.hamburger-bar {
    display: block;
    width: 20px;
    height: 2px;
    background-color: currentColor;
    border-radius: 1px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Mobile Navigation Drawer & Backdrop */
.mobile-nav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.mobile-nav-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(340px, 86vw);
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-strong);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.6);
    z-index: 999;
    transform: translateX(100%);
    visibility: hidden;
    pointer-events: none;
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0) 0;
}

.mobile-nav-drawer.open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface-subtle);
}

.mobile-nav-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
}

.mobile-nav-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.mobile-nav-close:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.06);
}

.mobile-nav-search {
    padding: 1rem 1.25rem 0.5rem;
}

.mobile-search-form {
    display: flex;
    align-items: center;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px 4px 2px 10px;
    gap: 8px;
}

.mobile-search-icon {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.mobile-search-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 0.88rem;
    padding: 0.65rem 0;
    outline: none;
    min-width: 0;
}

.mobile-search-submit {
    background-color: var(--accent);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-xs);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    min-height: 36px;
}

.mobile-nav-body {
    flex: 1;
    padding: 0.75rem 1.25rem 1.5rem;
}

.mobile-nav-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.mobile-nav-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    min-height: 48px;
    transition: all var(--transition);
}

.mobile-nav-item:hover,
.mobile-nav-item:active {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

.mobile-nav-item-icon {
    color: var(--accent);
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.mobile-nav-item-text {
    flex: 1;
}

.mobile-nav-footer {
    padding: 1.25rem;
    border-top: 1px solid var(--border-subtle);
    background-color: var(--bg-surface-subtle);
}

.mobile-theme-switcher {
    width: 100%;
    display: flex;
}

.mobile-theme-switcher .theme-btn {
    flex: 1;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.8rem;
    min-height: 38px;
}

.mobile-nav-meta {
    margin-top: 0.75rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    text-align: center;
}

/* --------------------------------------------------------------------------
   Breadcrumb
   -------------------------------------------------------------------------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

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

.breadcrumb a:hover {
    color: var(--text-secondary);
}

.breadcrumb-sep {
    color: var(--border-strong);
    user-select: none;
}

.breadcrumb-current {
    color: var(--text-secondary);
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   Buttons & Inputs
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    color: #ffffff;
}

.btn-secondary {
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-sm {
    font-size: 0.78rem;
    padding: 0.35rem 0.65rem;
}

.btn-mono {
    font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   Search Component (Spotlight / Command Palette Style)
   -------------------------------------------------------------------------- */
.search-wrapper {
    position: relative;
    width: 100%;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.search-box:focus-within {
    border-color: var(--border-focus);
    background-color: var(--bg-surface-elevated);
    box-shadow: 0 0 0 1px var(--border-focus), 0 8px 24px rgba(0, 0, 0, 0.4);
}

.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 1rem;
    color: var(--text-muted);
}

.search-input {
    width: 100%;
    background: transparent;
    border: none;
    padding: 0.85rem 1rem 0.85rem 0.75rem;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
    font-family: var(--font-sans);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-kbd {
    margin-right: 0.75rem;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background-color: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    padding: 0.15rem 0.45rem;
    border-radius: var(--radius-xs);
    user-select: none;
}

.search-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    max-height: 420px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--transition);
}

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

.search-item:hover,
.search-item.selected {
    background-color: rgba(59, 130, 246, 0.08);
}

.search-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    overflow: hidden;
}

.search-item-title {
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--text-primary);
}

.search-item-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --------------------------------------------------------------------------
   Badges & Tags
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-xs);
    letter-spacing: 0.02em;
    text-transform: uppercase;
    line-height: 1.3;
}

.badge-pin {
    background-color: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.badge-po {
    background-color: var(--success-subtle);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.badge-dist {
    background-color: rgba(139, 92, 246, 0.08);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.25);
}

.badge-state {
    background-color: var(--warning-subtle);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

.badge-neutral {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* --------------------------------------------------------------------------
   Data Tables
   -------------------------------------------------------------------------- */
.table-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 100%;
}

.table-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface-subtle);
}

.table-panel-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.table-filter-wrapper {
    position: relative;
    width: 220px;
    max-width: 100%;
}

.table-responsive {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-surface-subtle);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}


.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.data-table th {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.65rem 1rem;
    background-color: var(--bg-surface-subtle);
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.data-table td.primary-cell {
    color: var(--text-primary);
    font-weight: 500;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.data-table td.numeric-cell,
.data-table th.numeric-cell {
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Editorial Split Layout (Main + Metadata Sidebar)
   -------------------------------------------------------------------------- */
.layout-split {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
    margin-top: 1.5rem;
}

.layout-split > * {
    min-width: 0;
    max-width: 100%;
}

.meta-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.meta-panel-header {
    padding: 0.85rem 1.15rem;
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-surface-subtle);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1.15rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
}

.meta-row:last-child {
    border-bottom: none;
}

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

.meta-value {
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
}

/* --------------------------------------------------------------------------
   Data Cards & Grids
   -------------------------------------------------------------------------- */
.entity-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.entity-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all var(--transition);
}

.entity-card:hover {
    border-color: var(--border-strong);
    background-color: var(--bg-surface-elevated);
}

.entity-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.entity-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

/* --------------------------------------------------------------------------
   Verification Tool UI
   -------------------------------------------------------------------------- */
.verifier-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem;
    margin-top: 1.5rem;
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

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

.check-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.check-pass {
    background-color: var(--success-subtle);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.check-fail {
    background-color: var(--danger-subtle);
    color: var(--danger);
    border: 1px solid var(--danger-border);
}

.check-warn {
    background-color: var(--warning-subtle);
    color: var(--warning);
    border: 1px solid var(--warning-border);
}

/* --------------------------------------------------------------------------
   Forms & Controls
   -------------------------------------------------------------------------- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.form-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-label .required {
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--border-focus);
    background-color: var(--bg-surface-elevated);
    box-shadow: 0 0 0 1px var(--border-focus);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
}

.form-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.85rem center;
    padding-right: 2.2rem;
}

/* --------------------------------------------------------------------------
   Tabs Navigation
   -------------------------------------------------------------------------- */
.tabs-nav {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.65rem 1rem;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent);
}

.tab-pill {
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: all var(--transition);
}

.tab-pill:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.tab-pill.active {
    background-color: var(--bg-surface-elevated);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Search Result Stream Items
   -------------------------------------------------------------------------- */
.search-stream {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    overflow: hidden;
}

.stream-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    color: inherit;
    transition: background-color var(--transition);
    gap: 1rem;
}

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

.stream-item:hover {
    background-color: var(--bg-surface-elevated);
}

.stream-main {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
}

.stream-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.stream-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stream-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stream-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.stream-arrow {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: transform var(--transition), color var(--transition);
}

.stream-item:hover .stream-arrow {
    color: var(--accent);
    transform: translateX(3px);
}

/* --------------------------------------------------------------------------
   Workflow Steps & Dataset Explorer
   -------------------------------------------------------------------------- */
.workflow-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background-color: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.workflow-step {
    background-color: var(--bg-surface);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-xs);
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.workflow-step.active .step-number {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
}

.step-details {
    display: flex;
    flex-direction: column;
}

.step-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
}

.step-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.dataset-summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.dataset-badge-chain {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Code Blocks & Developer Specs
   -------------------------------------------------------------------------- */
.code-box {
    background-color: #060910;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: 0.75rem;
}

.code-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background-color: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.code-box pre {
    padding: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1.5;
    color: #cbd5e1;
}

.code-box code {
    font-family: inherit;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
}

.copy-btn:hover {
    color: var(--text-primary);
    border-color: var(--border-strong);
    background-color: rgba(255, 255, 255, 0.05);
}

.copy-btn.copied {
    color: var(--success);
    border-color: var(--success-border);
}

/* --------------------------------------------------------------------------
   Telemetry & Status Metrics
   -------------------------------------------------------------------------- */
.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background-color: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2rem;
}

.telemetry-cell {
    background-color: var(--bg-surface);
    padding: 1.15rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.telemetry-label {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-muted);
}

.telemetry-val {
    font-size: 1.35rem;
    font-weight: 700;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.footer {
    border-top: 1px solid var(--border-subtle);
    padding: 3rem 0 2rem;
    background-color: var(--bg-page);
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 2.5rem;
    margin-bottom: 2.5rem;
}

.footer-brand p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    max-width: 320px;
}

.footer-col h4 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.85rem;
}

.footer-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.footer-col a {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-col a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-subtle);
    padding-top: 1.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 0.75rem;
}

/* --------------------------------------------------------------------------
   Comprehensive Responsive System & Breakpoint Directives
   Targeting: 320, 360, 375, 390, 414, 430, 768, 820, 1024, 1280, 1440, 1920, Ultrawide
   -------------------------------------------------------------------------- */

/* Responsive Table & Card Transformation System
   Transforms multi-column tabular data into high-density touch cards on screens <= 820px
   or whenever the browser window is resized to compact width. Zero forced horizontal scrolling.
   -------------------------------------------------------------------------- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: var(--bg-surface);
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}

.table-scroll-hint {
    display: none;
    font-size: 0.72rem;
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    background: var(--bg-surface-subtle);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-xs);
    margin-bottom: 0.6rem;
    align-items: center;
    gap: 0.4rem;
}

.table-responsive table {
    width: 100%;
}

/* On tablets and mobile screens (<= 820px), transform data tables into structured cards */
@media (max-width: 820px) {
    /* Hide horizontal scroll hint since cards fit 100% of the screen */
    .table-scroll-hint {
        display: none !important;
    }

    .table-panel {
        background-color: transparent;
        border: none;
        border-radius: 0;
        margin-bottom: 1.5rem;
    }

    .table-panel-header {
        background-color: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        margin-bottom: 0.75rem;
        padding: 0.85rem 1rem;
    }

    .table-responsive {
        overflow-x: visible !important;
        padding: 0 !important;
        margin-bottom: 1rem;
        border-radius: 0;
    }

    .table-responsive table.data-table,
    .data-table.table-cards {
        display: block;
        width: 100% !important;
        min-width: 0 !important;
        border: none;
    }

    /* Hide standard desktop header rows */
    .data-table thead,
    .data-table.table-cards thead {
        display: none !important;
    }

    /* Stack tbody rows as a vertical card deck */
    .data-table tbody,
    .data-table.table-cards tbody {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    /* Each row becomes a standalone card */
    .data-table tbody tr,
    .data-table.table-cards tbody tr {
        display: flex;
        flex-direction: column;
        background: var(--bg-surface);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        padding: 0.85rem 1rem;
        box-shadow: var(--shadow-sm);
        transition: border-color var(--transition-fast), transform var(--transition-fast);
        width: 100%;
        box-sizing: border-box;
    }

    .data-table tbody tr:hover,
    .data-table.table-cards tbody tr:hover {
        border-color: var(--accent);
        background: var(--bg-surface-elevated);
    }

    /* Each cell becomes a key-value row inside the card */
    .data-table tbody tr td,
    .data-table.table-cards tbody tr td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 0.4rem 0;
        border-bottom: 1px dashed var(--border-subtle);
        width: 100%;
        box-sizing: border-box;
        font-size: 0.82rem;
        text-align: right;
    }

    .data-table tbody tr td:last-child,
    .data-table.table-cards tbody tr td:last-child {
        border-bottom: none;
    }

    /* Self-describing data-label on the left */
    .data-table tbody tr td::before,
    .data-table.table-cards tbody tr td::before {
        content: attr(data-label);
        font-size: 0.7rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        color: var(--text-muted);
        text-align: left;
        flex-shrink: 0;
        margin-right: auto;
    }

    /* When data-label is missing or blank, do not render empty pseudo-element space */
    .data-table tbody tr td:not([data-label])::before,
    .data-table tbody tr td[data-label=""]::before {
        content: none;
    }

    /* Primary entity cell (card title) */
    .data-table tbody tr td.primary-cell,
    .data-table.table-cards tbody tr td.primary-cell {
        padding: 0 0 0.55rem 0;
        margin-bottom: 0.2rem;
        border-bottom: 1px solid var(--border-subtle);
        font-size: 0.95rem;
        font-weight: 600;
    }

    .data-table tbody tr td.primary-cell a,
    .data-table.table-cards tbody tr td.primary-cell a {
        color: var(--accent);
        text-decoration: none;
        word-break: break-word;
    }

    /* Action button cell at card bottom */
    .data-table tbody tr td.action-cell,
    .data-table tbody tr td[data-label="Action"],
    .data-table.table-cards tbody tr td.action-cell,
    .data-table.table-cards tbody tr td[data-label="Action"] {
        border-bottom: none;
        padding-top: 0.55rem;
        margin-top: 0.2rem;
        border-top: 1px dashed var(--border-subtle);
        justify-content: flex-end;
    }

    .data-table tbody tr td.action-cell::before,
    .data-table tbody tr td[data-label="Action"]::before,
    .data-table.table-cards tbody tr td.action-cell::before,
    .data-table.table-cards tbody tr td[data-label="Action"]::before {
        display: none !important;
    }

    .data-table tbody tr td.action-cell .btn,
    .data-table tbody tr td[data-label="Action"] .btn,
    .data-table.table-cards tbody tr td.action-cell .btn,
    .data-table.table-cards tbody tr td[data-label="Action"] .btn {
        width: 100%;
        min-height: 40px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.82rem;
        font-weight: 600;
    }

    /* Numeric cells */
    .data-table tbody tr td.numeric-cell,
    .data-table.table-cards tbody tr td.numeric-cell {
        text-align: right;
    }

    /* 2-column key-value definition tables (e.g. post_office_view.php with <tr><th>...</th><td>...</td></tr>) */
    .key-value-table,
    .data-table tbody tr:has(> th) {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        padding: 0.6rem 0.85rem;
        border-bottom: 1px dashed var(--border-subtle);
        border-radius: 0;
        background: transparent;
        box-shadow: none;
    }
    .data-table tbody tr:has(> th):last-child {
        border-bottom: none;
    }
    .data-table tbody tr:has(> th) th {
        display: block;
        width: 100%;
        border: none;
        background: transparent;
        padding: 0;
        font-size: 0.72rem;
        text-transform: uppercase;
        color: var(--text-muted);
        text-align: left;
    }
    .data-table tbody tr:has(> th) td {
        display: block;
        width: 100%;
        border: none;
        padding: 0;
        font-size: 0.88rem;
        text-align: left;
    }
}

/* Touch targets: min 42-44px for primary interactions on touch devices */
@media (pointer: coarse), (max-width: 820px) {
    .btn {
        min-height: 42px;
    }
    .nav-links a,
    .mobile-nav-item,
    .theme-btn {
        min-height: 44px;
    }
    input[type="text"],
    input[type="search"],
    select {
        min-height: 44px;
        font-size: 16px !important; /* Prevents auto-zoom on iOS Safari */
    }
}

/* Fluid Typography */
h1 {
    font-size: clamp(1.6rem, 4.5vw, 2.3rem);
}
h2 {
    font-size: clamp(1.25rem, 3.5vw, 1.65rem);
}
h3 {
    font-size: clamp(1.05rem, 2.5vw, 1.25rem);
}

/* Tab Labels for Responsive Segmented Control */
.tab-label-short {
    display: none;
}

/* Large Displays / Ultrawide (> 1440px) */
@media (min-width: 1920px) {
    .container {
        max-width: 1440px;
    }
}

/* Tablet Landscape, Tablet Portrait & Mobile Navigation Trigger (<= 1120px) */
@media (max-width: 1120px) {
    .container {
        padding: 0 1.25rem;
    }
    .layout-split {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .verifier-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr;
        gap: 2rem;
    }

    /* Navbar: Switch to clean compact header with 1-tap theme toggle & slide drawer */
    .navbar {
        height: 58px !important;
        padding: 0 !important;
    }
    .nav-wrapper {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        height: 100% !important;
        gap: 0.5rem !important;
    }
    .desktop-nav {
        display: none !important;
    }
    .header-theme-switcher {
        display: none !important;
    }
    .mobile-theme-toggle {
        display: inline-flex !important;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
}

/* Medium Tablets & Below (<= 820px) */
@media (max-width: 820px) {
    .workflow-steps {
        grid-template-columns: 1fr;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    .modules-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Spatial Canvas adjustments */
    .spatial-canvas {
        height: clamp(220px, 35vh, 290px);
    }
}

/* Mobile Phones (<= 640px) */
@media (max-width: 640px) {
    .container {
        padding: 0 1rem;
    }

    /* Telemetry grid: compact 2x2 layout on mobile */
    .telemetry-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        margin-bottom: 1.25rem !important;
    }
    .telemetry-cell {
        padding: 0.75rem 0.85rem !important;
    }
    .telemetry-val {
        font-size: 1.15rem !important;
    }
    .telemetry-label {
        font-size: 0.68rem !important;
    }

    /* Search Bar on Mobile */
    .search-kbd {
        display: none !important;
    }
    .search-box {
        padding: 3px 4px 3px 10px;
    }
    .search-input {
        padding: 0.75rem 0.5rem 0.75rem 0.5rem;
        font-size: 16px !important;
        min-width: 0;
        flex: 1;
    }
    .search-icon {
        padding-left: 0.5rem;
    }

    /* Segmented Tab Pill Nav */
    .tabs-nav {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.35rem;
        border-bottom: none;
        background: var(--bg-surface-elevated);
        padding: 4px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border-subtle);
        margin-bottom: 1.25rem;
    }
    .tab-btn {
        border-bottom: none !important;
        border-radius: var(--radius-xs);
        padding: 0.5rem 0.25rem !important;
        text-align: center;
        font-size: 0.78rem !important;
        white-space: normal !important;
    }
    .tab-btn.active {
        background: var(--bg-surface);
        box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    }
    .tab-label-full {
        display: none;
    }
    .tab-label-short {
        display: inline;
    }

    /* Spatial container */
    .spatial-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.65rem 1rem;
        font-size: 0.72rem;
    }
    .spatial-toolbar {
        bottom: 8px;
        right: 8px;
    }
    .spatial-canvas {
        height: clamp(180px, 32vh, 230px) !important;
        touch-action: pan-y !important;
    }

    /* Footer on mobile */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    /* Table mobile presentation - 100% data access */
    .table-panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.65rem;
    }
    .table-filter-wrapper {
        width: 100%;
    }

    /* Form actions */
    .form-actions-stack {
        flex-direction: column;
        width: 100%;
    }
    .form-actions-stack .btn {
        width: 100%;
    }
}

/* Coordinate input rows on mobile */
.coords-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
@media (max-width: 480px) {
    .coords-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .stream-item {
        padding: 0.75rem 0.85rem;
        gap: 0.65rem;
    }
    .stream-main {
        gap: 0.65rem;
    }
    .stream-main .badge {
        min-width: auto !important;
        font-size: 0.65rem !important;
        padding: 2px 6px !important;
    }
    .stream-title {
        font-size: 0.88rem;
    }
    .stream-sub {
        font-size: 0.75rem;
    }
}

/* Ultra-Narrow Mobile Screens (<= 330px, e.g. 320px iPhone SE 1st gen) */
@media (max-width: 330px) {
    .container {
        padding: 0 0.75rem;
    }
    .brand-tag {
        display: none;
    }
    .brand-logo {
        gap: 0.35rem;
        font-size: 0.98rem;
    }
    .stats-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    .telemetry-grid {
        grid-template-columns: 1fr !important;
    }
    .spatial-canvas {
        height: 180px !important;
    }
    .btn {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }
}

/* Mobile Landscape (max-height: 500px and landscape orientation) */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        height: 48px !important;
    }
    .spatial-canvas {
        height: 200px !important;
    }
    .mobile-nav-drawer {
        width: min(320px, 90vw);
    }
}

/* --------------------------------------------------------------------------
   Theme Switcher Component
   -------------------------------------------------------------------------- */
.theme-switcher {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.theme-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 3px 7px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.theme-btn:hover {
    color: var(--text-primary);
}

.theme-btn.active {
    background-color: var(--bg-surface);
    color: var(--accent);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Spatial Containers & Controls
   -------------------------------------------------------------------------- */
.spatial-container {
    position: relative;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 2rem;
}

.spatial-canvas {
    display: block;
    width: 100%;
    height: 380px;
    cursor: grab;
    touch-action: none;
}

.spatial-canvas:active {
    cursor: grabbing;
}

.spatial-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background-color: var(--bg-surface-subtle);
}

.spatial-toolbar {
    position: absolute;
    bottom: 12px;
    right: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    background-color: rgba(14, 20, 34, 0.85);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 3px;
    z-index: 10;
}

[data-theme="light"] .spatial-toolbar {
    background-color: rgba(255, 255, 255, 0.9);
}

.spatial-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.72rem;
    padding: 3px 7px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.spatial-btn:hover,
.spatial-btn.active {
    color: var(--accent);
    background-color: var(--accent-subtle);
}

.spatial-hud {
    position: absolute;
    display: none;
    width: 220px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    box-shadow: var(--shadow-dropdown);
    pointer-events: none;
    z-index: 20;
}

.hud-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.35rem;
}

.hud-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--text-primary);
}

.hud-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

.hud-action {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   View Switcher (Table | Map | Graph)
   -------------------------------------------------------------------------- */
.view-switcher {
    display: inline-flex;
    align-items: center;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 2px;
    gap: 2px;
}

.view-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}

.view-btn:hover {
    color: var(--text-primary);
}

.view-btn.active {
    background-color: var(--bg-surface);
    color: var(--accent);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

/* --------------------------------------------------------------------------
   Accessibility & Reduced Motion
   -------------------------------------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
