/**
 * Ocellus Platform — App-Specific Overrides
 * Loaded after platform.min.css (DS bundle).
 * Contains: dashboard cards, policy editor,
 *           inventory tables, MCP servers page, login page.
 *
 * NOTE: Sidebar, layout shell, search components, card components,
 *       stat/metadata, risk badges, and tab-content are provided
 *       by the DS bundle (platform.min.css). Do NOT re-declare them here.
 */

/* ----------------------------------------------------------------
   Tab-content cascade fix — DS findings.css re-declares
   .tab-content{display:none} AFTER the tabs.css active rule,
   overriding it at equal specificity. Two-class selector wins.
   ---------------------------------------------------------------- */
.tab-content.tab-content__active {
    display: block;
}

/* ----------------------------------------------------------------
   Platform Body — uppercase military aesthetic
   (font-family, color, background, min-height handled by DS)
   ---------------------------------------------------------------- */
body.platform-body {
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: var(--font-weight-medium);
    display: flex;
    flex-direction: column;
}

/* ----------------------------------------------------------------
   Sidebar Rail — 56px collapsed, 220px on hover
   Visually matches the registry sidebar. Content shifts on expand.
   ---------------------------------------------------------------- */
:root {
    --sidebar-width-collapsed: 56px;
    --sidebar-width-expanded: 220px;
}

.app-sidebar {
    width: var(--sidebar-width-collapsed);
    transition: width 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    background: var(--bg-primary, #0d1117);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    z-index: 50;
}

.app-sidebar:hover {
    width: var(--sidebar-width-expanded);
}

/* Content shifts when sidebar expands (adjacent sibling) */
.app-main {
    margin-left: var(--sidebar-width-collapsed);
    transition: margin-left 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-sidebar:hover + .app-main {
    margin-left: var(--sidebar-width-expanded);
}

/* Accent line at top of sidebar */
.sidebar-accent-line {
    height: 2px;
    background: var(--gradient-primary);
    flex-shrink: 0;
}

/* Sidebar header — brand area (matches registry/blog navbar-brand) */
.sidebar-header {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.app-sidebar:hover .sidebar-header {
    justify-content: center;
    padding-left: 14px;
    padding-right: 14px;
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sidebar-brand-logo {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Adjust logo vertical position when sidebar is collapsed to align with search bar */
.app-sidebar:not(:hover) .sidebar-brand-logo {
    transform: translateY(16px);
}

/* Brand text — Rajdhani "OCELLUS PLATFORM" matching registry/blog pattern */
.sidebar-brand-text {
    font-family: 'Rajdhani', 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary, #f0f6fc);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.15s ease;
    position: relative;
    top: 1px;
}

.app-sidebar:hover .sidebar-brand-text {
    opacity: 1;
}

/* "Platform" word in gradient — matches .navbar-brand-accent */
.sidebar-brand-accent {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Sidebar nav — flat, no section wrappers */
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.app-sidebar:hover .sidebar-nav {
    padding: 12px 6px;
}

/* Sidebar items — registry-matching style
   Colors: #8a8a9a default, #c8c8d8 hover, #ff7a3d active
   Sizing: 12px font, 8px 10px padding, 6px radius */
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    padding: 8px 0;
    margin: 0 0 1px;
    justify-content: center;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 400;
    font-family: var(--font-family-sans, Inter, sans-serif);
    background: transparent;
    color: #8a8a9a;
    transition: all 0.15s ease;
    position: relative;
    text-align: left;
    overflow: hidden;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.app-sidebar:hover .sidebar-item {
    padding: 8px 10px;
    margin: 0 8px 1px;
    gap: 8px;
    justify-content: flex-start;
}

.sidebar-item:hover {
    color: #ff7a3d;
    background: transparent;
}

.sidebar-item.active {
    background: transparent;
    color: #ff7a3d;
    font-weight: 600;
    border-left: none;
}

.app-sidebar:hover .sidebar-item.active {
    background: rgba(232, 99, 43, 0.15);
}

/* Active gradient accent bar — only when expanded */
.sidebar-item.active::after {
    content: '';
    position: absolute;
    left: 0;
    top: 15%;
    bottom: 15%;
    width: 2px;
    border-radius: 1px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.app-sidebar:hover .sidebar-item.active::after {
    opacity: 1;
}

.sidebar-item i {
    color: #8a8a9a;
    transition: color 0.15s;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
}

.sidebar-item:hover i {
    color: #ff7a3d;
}

.sidebar-item.active i {
    color: #ff7a3d;
}

/* Label text — hidden when collapsed, revealed on hover */
.sidebar-item span {
    width: 0;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
}

.app-sidebar:hover .sidebar-item span {
    width: auto;
    opacity: 1;
}

/* Badge on sidebar items (e.g. MCP server count) */
.sidebar-item-badge {
    margin-left: auto;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--font-family-mono, 'JetBrains Mono', monospace);
    color: #ff7a3d;
    opacity: 0;
    transition: opacity 0.15s ease;
    flex-shrink: 0;
}

.sidebar-item-badge:empty {
    display: none;
}

.app-sidebar:hover .sidebar-item-badge {
    opacity: 0.7;
}

/* Separator between nav groups */
.sidebar-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 8px 12px;
}

.app-sidebar:hover .sidebar-separator {
    margin: 8px 8px;
}

/* Sidebar footer — avatar + user info + logout */
.sidebar-footer {
    padding: 10px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: transparent;
}

.app-sidebar:hover .sidebar-footer {
    padding: 10px;
    align-items: stretch;
}

/* Avatar — 28px initials square */
.sidebar-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: rgba(232, 99, 43, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #ff7a3d;
    border: 1px solid rgba(232, 99, 43, 0.3);
    flex-shrink: 0;
}

/* Tenant switcher adjustments for rail */
.tenant-switcher-btn {
    display: flex;
    align-items: center;
    gap: 0;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 100%;
    color: inherit;
    font: inherit;
    text-align: left;
}

.app-sidebar:hover .tenant-switcher-btn {
    justify-content: flex-start;
    gap: 10px;
}

.sidebar-user-info {
    width: 0;
    opacity: 0;
    transition: width 0.2s ease, opacity 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    flex: none;
    min-width: 0;
}

.app-sidebar:hover .sidebar-user-info {
    width: auto;
    flex: 1;
    opacity: 1;
}

.sidebar-user-org {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary, #f0f6fc);
}

.sidebar-user-email {
    font-size: 10px;
    color: #8a8a9a;
    text-transform: none;
    letter-spacing: normal;
}

.tenant-switcher-icon {
    width: 0;
    opacity: 0;
    overflow: hidden;
    transition: width 0.2s ease, opacity 0.15s ease;
    font-size: 10px;
    color: #8a8a9a;
}

.app-sidebar:hover .tenant-switcher-icon {
    width: auto;
    opacity: 1;
}

/* Footer separator between tenant switcher and logout */
.sidebar-footer-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.06);
    margin: 8px 10px;
}

/* Logout button — icon only when collapsed, icon + text when expanded */
.sidebar-logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: #8a8a9a;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
    font-size: 12px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 0;
}

.sidebar-logout-btn span {
    width: 0;
    opacity: 0;
    overflow: hidden;
    white-space: nowrap;
    transition: width 0.2s ease, opacity 0.15s ease;
}

.app-sidebar:hover .sidebar-logout-btn {
    justify-content: flex-start;
    gap: 8px;
    padding: 6px 10px;
}

.app-sidebar:hover .sidebar-logout-btn span {
    width: auto;
    opacity: 1;
}

.sidebar-logout-btn:hover {
    color: #f85149;
    background: rgba(248, 81, 73, 0.1);
}

/* Tooltips — shown on item hover when sidebar is collapsed */
.sidebar-item[data-tooltip] {
    position: relative;
}

.sidebar-item[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-width-collapsed) + 4px);
    top: 50%;
    transform: translateY(-50%);
    background: #30363d;
    color: #f0f6fc;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    text-transform: none;
    letter-spacing: normal;
}

.sidebar-item[data-tooltip]:hover::before {
    opacity: 1;
}

/* Hide tooltips when sidebar is expanded */
.app-sidebar:hover .sidebar-item[data-tooltip]::before {
    opacity: 0 !important;
    display: none;
}

.sidebar-logout-btn[data-tooltip] {
    position: relative;
}

.sidebar-logout-btn[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(var(--sidebar-width-collapsed) + 4px);
    top: 50%;
    transform: translateY(-50%);
    background: #30363d;
    color: #f0f6fc;
    font-size: 12px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    text-transform: none;
    letter-spacing: normal;
}

.sidebar-logout-btn[data-tooltip]:hover::before {
    opacity: 1;
}

.app-sidebar:hover .sidebar-logout-btn[data-tooltip]::before {
    opacity: 0 !important;
    display: none;
}

/* ----------------------------------------------------------------
   App Layout — container constraint (DS handles .app-layout/sidebar/main)
   ---------------------------------------------------------------- */
.app-main > .container {
    flex: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: var(--spacing-6);
}

/* ----------------------------------------------------------------
   Tenant Switcher
   ---------------------------------------------------------------- */
.tenant-switcher {
    position: relative;
    width: 100%;
}

.tenant-switcher.open .tenant-switcher-icon {
    transform: rotate(180deg);
}

.tenant-switcher.single .tenant-switcher-btn {
    cursor: default;
}

.tenant-switcher.single .tenant-switcher-icon {
    display: none;
}

.tenant-dropdown {
    display: none;
    position: absolute;
    bottom: calc(100% + var(--spacing-2));
    left: var(--spacing-2);
    right: var(--spacing-2);
    background: var(--bg-secondary);
    border: var(--border-width-thin) solid var(--border-primary);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-dropdown);
    overflow: hidden;
}

.tenant-switcher.open .tenant-dropdown {
    display: block;
}

.tenant-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-2-5) var(--spacing-3);
    color: var(--text-primary);
    cursor: pointer;
    transition: background var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: var(--font-size-sm);
}

.tenant-dropdown-item:hover {
    background: var(--bg-tertiary);
}

.tenant-dropdown-item.active {
    background: var(--accent-primary-subtle);
    color: var(--accent-primary);
}

.tenant-dropdown-item .tenant-name {
    font-weight: var(--font-weight-medium);
}

.tenant-dropdown-item .tenant-role {
    font-size: var(--font-size-xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.tenant-dropdown-item.active .tenant-role {
    color: var(--accent-primary);
}

/* (logout-btn replaced by .sidebar-logout-btn in rail design) */

/* ----------------------------------------------------------------
   Page Header
   ---------------------------------------------------------------- */
.page-header {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-6) var(--spacing-8);
    margin-bottom: var(--spacing-8);
    border: var(--border-width-thin) solid var(--border-primary);
}

.page-header h2 {
    color: var(--text-primary);
    margin: 0 0 var(--spacing-1) 0;
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    letter-spacing: var(--font-letter-spacing-wider);
    font-family: var(--font-family-brand);
}

.page-header p {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--font-letter-spacing-wide);
    margin: 0;
}

/* ----------------------------------------------------------------
   Browse Toolbar — search bar + filter pills + sort + results count
   ---------------------------------------------------------------- */
.browse-toolbar {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Search row: input + results count */
.browse-toolbar-search {
    display: flex;
    align-items: center;
    gap: 16px;
}

.browse-toolbar-search .search-box {
    flex: 1;
}

.browse-toolbar-search .search-icon {
    position: absolute;
    left: var(--spacing-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.browse-results-count {
    font-size: 13px;
    color: #6b6b80;
    white-space: nowrap;
    flex-shrink: 0;
    text-transform: none;
    letter-spacing: normal;
    font-weight: 400;
}

.browse-toolbar-search .search-input {
    text-transform: none;
    letter-spacing: normal;
}

.browse-results-num {
    color: #e8632b;
    font-weight: 700;
    font-family: var(--font-family-mono, 'JetBrains Mono', monospace);
}

/* Filter row */
.browse-toolbar-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding-top: 12px;
}

.browse-filters-label {
    font-size: 11px;
    font-weight: 600;
    color: #6b6b80;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-right: 4px;
}

/* Filter pills */
.filter-pill {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #8a8a9a;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: normal;
    width: auto;
    flex: none;
}

.filter-pill:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: #c0c0cc;
}

.filter-pill.active {
    border-color: rgba(232, 99, 43, 0.5);
    background: rgba(232, 99, 43, 0.08);
    color: #f0f0f4;
}

/* Colored dots */
.filter-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.filter-dot--all       { background: #e8632b; }
.filter-dot--critical  { background: #f85149; }
.filter-dot--high      { background: #f85149; }
.filter-dot--medium    { background: #e8632b; }
.filter-dot--low       { background: #3fb950; }

.filter-count {
    font-family: var(--font-family-mono, 'JetBrains Mono', monospace);
    font-size: 11px;
    opacity: 0.7;
}

/* Sort control */
.browse-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: #8a8a9a;
    font-size: 12px;
    margin-left: 4px;
    white-space: nowrap;
    text-transform: none;
    letter-spacing: normal;
}

.browse-sort i {
    font-size: 11px;
    color: #6b6b80;
}

.browse-sort span {
    font-weight: 500;
    color: #6b6b80;
}

.browse-sort select {
    background: transparent;
    border: none;
    color: #f0f0f4;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 0;
    text-transform: none;
    letter-spacing: normal;
    -webkit-appearance: none;
    appearance: none;
    padding-right: 14px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='%238a8a9a'%3E%3Cpath d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right center;
}

.browse-sort select:focus {
    outline: none;
}

.browse-sort select option {
    background: #1c2128;
    color: #f0f0f4;
}

/* Reset button */
.browse-reset {
    margin-left: auto;
    background: none;
    border: none;
    color: #6b6b80;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    padding: 5px 8px;
    transition: color 0.15s;
    text-transform: none;
    letter-spacing: normal;
}

.browse-reset:hover {
    color: #f0f0f4;
}

/* ----------------------------------------------------------------
   Tools Grid
   ---------------------------------------------------------------- */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* ----------------------------------------------------------------
   Hash Cards — registry-style compact cards
   Builds on DS .hash-card base (bg, border, corner brackets, glow)
   ---------------------------------------------------------------- */
.hash-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-5);
    border: var(--border-width-thin) solid var(--border-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: visible;
    display: flex;
    flex-direction: column;
}

/* Let the DS ::before corner chevrons through — don't override */

.hash-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-primary);
    box-shadow: none;
}

/* Top row: severity badge + risk score */
.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

/* Forge row — source badge + release count (matches registry) */
.card-forge-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.forge-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--color-text-tertiary, #6b6b80);
    background: rgba(255, 255, 255, 0.03);
    padding: 2px 7px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.forge-badge i {
    font-size: 11px;
}

.release-count-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--color-text-tertiary, #6b6b80);
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.release-count-badge i {
    font-size: 9px;
    opacity: 0.7;
}

/* Risk badge — compact severity indicator */
.risk-badge {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    border-width: 1px;
    border-style: solid;
    white-space: nowrap;
    line-height: 1.4;
}

.risk-critical, .risk-high {
    background: var(--risk-high-subtle, rgba(248, 81, 73, 0.1));
    color: var(--risk-high, #f85149);
    border-color: var(--risk-high-border, rgba(248, 81, 73, 0.3));
}

.risk-medium {
    background: var(--risk-medium-subtle, rgba(210, 153, 34, 0.1));
    color: var(--risk-medium, #d29922);
    border-color: var(--risk-medium-border, rgba(210, 153, 34, 0.3));
}

.risk-low {
    background: var(--risk-low-subtle, rgba(63, 185, 80, 0.1));
    color: var(--risk-low, #3fb950);
    border-color: var(--risk-low-border, rgba(63, 185, 80, 0.3));
}

.risk-unknown {
    background: rgba(139, 148, 158, 0.1);
    color: #8b949e;
    border-color: rgba(139, 148, 158, 0.3);
}

/* Risk score — monospace colored number */
.risk-score {
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-family-mono, 'JetBrains Mono', monospace);
}

.risk-score--high    { color: var(--risk-high, #f85149); }
.risk-score--medium  { color: var(--risk-medium, #d29922); }
.risk-score--low     { color: var(--risk-low, #3fb950); }
.risk-score--unknown { color: #8b949e; }

/* Card name — muted at rest, bright on hover */
.card-name {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 700;
    color: #6b6b80;
    letter-spacing: -0.2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
    text-transform: none;
}

.hash-card:hover .card-name {
    color: #f0f0f4;
}

/* Card description */
.card-desc {
    margin: 0 0 14px;
    font-size: 12px;
    color: #6b6b80;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-transform: none;
    letter-spacing: normal;
}

/* Progress bars */
.card-bars {
    display: flex;
    flex-direction: column;
    gap: 7px;
    margin-bottom: 14px;
}

.bar-row {
    display: flex;
    flex-direction: column;
}

.bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    margin-bottom: 3px;
}

.bar-label {
    color: #6b6b80;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bar-value {
    font-weight: 700;
    color: #c8c8d8;
    font-family: var(--font-family-mono, 'JetBrains Mono', monospace);
}

.bar-track {
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.10);
    transition: width 0.6s ease, background 0.3s ease;
}

.hash-card:hover .bar-fill--findings { background: #e8632b; }
.hash-card:hover .bar-fill--sca      { background: #fbbf24; }
.hash-card:hover .bar-fill--commands  { background: #60a5fa; }

/* Tag pills */
.card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.card-tag {
    font-size: 10px;
    color: #6b6b80;
    background: rgba(255, 255, 255, 0.03);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    text-transform: none;
    letter-spacing: normal;
}

/* Card actions — import button / status badge at card bottom */
.card-actions {
    display: flex;
    align-items: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.card-import-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    color: #8a8a9a;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border-primary, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    text-transform: none;
    letter-spacing: normal;
}

.card-import-btn:hover {
    color: var(--accent-primary, #e8632b);
    border-color: var(--accent-primary, #e8632b);
    background: rgba(232, 99, 43, 0.08);
}

.card-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    border-radius: 4px;
    border: 1px solid;
}

.card-status-badge--pending {
    color: #d29922;
    background: rgba(210, 153, 34, 0.1);
    border-color: rgba(210, 153, 34, 0.3);
}

.card-status-badge--approved {
    color: #3fb950;
    background: rgba(63, 185, 80, 0.1);
    border-color: rgba(63, 185, 80, 0.3);
}

.card-status-badge--denied {
    color: #f85149;
    background: rgba(248, 81, 73, 0.1);
    border-color: rgba(248, 81, 73, 0.3);
}

/* ----------------------------------------------------------------
   Loading / Empty / No Results
   ---------------------------------------------------------------- */
.loading, .empty-state, .no-results {
    text-align: center;
    padding: var(--spacing-16);
    color: var(--text-secondary);
    grid-column: 1 / -1;
}

.loading i, .empty-state i, .no-results i {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-4);
    color: var(--text-tertiary);
}

.empty-state h3, .no-results h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: var(--spacing-2);
}

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

/* ----------------------------------------------------------------
   Inventory
   ---------------------------------------------------------------- */
.inventory-container {
    padding: var(--spacing-5);
}

.inventory-header {
    margin-bottom: 30px;
}

.inventory-header h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 1.8em;
    font-weight: var(--font-weight-semibold);
}

.inventory-stats {
    display: flex;
    gap: 30px;
    padding: 15px 20px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: var(--border-width-thin) solid var(--border-primary);
}

.inventory-stats .stat-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-2);
    color: var(--text-secondary);
    font-size: 0.95em;
}

.inventory-stats .stat-item i {
    font-size: 1.1em;
}

.inventory-stats .stat-item span {
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
}

.inventory-sections {
    display: grid;
    gap: 30px;
    margin-top: 30px;
}

.inventory-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-5);
    border: var(--border-width-thin) solid var(--border-primary);
}

.section-header {
    margin-bottom: var(--spacing-5);
    padding-bottom: 15px;
    border-bottom: var(--border-width-thin) solid var(--border-primary);
}

.section-header h3 {
    color: var(--text-primary);
    font-size: 1.3em;
    font-weight: var(--font-weight-semibold);
    display: flex;
    align-items: center;
    gap: var(--spacing-2-5);
}

.pending-section .section-header h3 { color: #ffc107; }
.approved-section .section-header h3 { color: #3fb950; }
.denied-section .section-header h3 { color: #ff6b35; }

.inventory-list {
    display: grid;
    gap: var(--spacing-3);
}

.inventory-item {
    background: var(--bg-primary);
    border: var(--border-width-thin) solid var(--border-secondary);
    border-radius: var(--border-radius-lg);
    padding: 15px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 15px;
    align-items: center;
    transition: all 0.2s ease;
}

.inventory-item:hover {
    border-color: var(--accent-secondary);
    transform: translateY(-1px);
}

.inventory-item-info {
    display: grid;
    gap: var(--spacing-2);
}

.inventory-item-name {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    font-size: 1.1em;
    display: flex;
    align-items: center;
    gap: var(--spacing-2-5);
}

.inventory-item-details {
    display: flex;
    gap: var(--spacing-5);
    color: var(--text-secondary);
    font-size: 0.9em;
}

.inventory-item-detail {
    display: flex;
    align-items: center;
    gap: 5px;
}

.risk-indicator {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
}

.risk-CRITICAL, .risk-HIGH {
    background: var(--accent-primary-muted);
    color: #ff6b35;
    border: var(--border-width-thin) solid var(--accent-primary-border);
}

.risk-MEDIUM {
    background: var(--accent-warning-muted);
    color: #ffc107;
    border: var(--border-width-thin) solid var(--accent-warning-border);
}

.risk-LOW, .risk-MINIMAL {
    background: var(--risk-low-subtle);
    color: #3fb950;
    border: var(--border-width-thin) solid var(--risk-low-border);
}

.inventory-item-actions {
    display: flex;
    gap: var(--spacing-2);
}

.inventory-action-btn {
    padding: var(--spacing-1-5) var(--spacing-3);
    border-radius: var(--border-radius-md);
    border: none;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.btn-approve {
    background: var(--risk-low-subtle);
    color: #3fb950;
    border: var(--border-width-thin) solid var(--risk-low-border);
}
.btn-approve:hover { background: var(--accent-success-hover); }

.btn-deny {
    background: var(--accent-primary-muted);
    color: #ff6b35;
    border: var(--border-width-thin) solid var(--accent-primary-border);
}
.btn-deny:hover { background: var(--accent-primary-hover); }

.btn-delete {
    background: var(--accent-destructive-subtle);
    color: #dc3545;
    border: var(--border-width-thin) solid var(--accent-destructive-border);
}
.btn-delete:hover { background: var(--accent-destructive-hover); }

.btn-view {
    background: var(--accent-info-subtle);
    color: #007bff;
    border: var(--border-width-thin) solid var(--accent-info-border);
}
.btn-view:hover { background: var(--accent-info-hover); }

.empty-section {
    text-align: center;
    padding: var(--spacing-10) var(--spacing-5);
    color: var(--text-secondary);
}

.empty-section i {
    font-size: 3em;
    opacity: 0.3;
    margin-bottom: 15px;
}

.empty-section p {
    margin: 0;
    font-size: 0.95em;
}

.loading-message {
    text-align: center;
    padding: var(--spacing-10);
    color: var(--text-secondary);
}

.loading-message i {
    font-size: var(--font-size-3xl);
    margin-bottom: var(--spacing-2-5);
}

/* Mobile menu toggle — hidden by default, shown on mobile */
.mobile-menu-toggle {
    display: none;
}

/* Tenant dropdown — position above the footer */
.tenant-dropdown {
    bottom: calc(100% + var(--spacing-2));
    left: 0;
    right: 0;
}

/* ----------------------------------------------------------------
   Login Page
   ---------------------------------------------------------------- */
body.login-body {
    font-family: var(--font-family-sans, Inter, sans-serif);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
}

.login-container {
    text-align: center;
    max-width: 420px;
    width: 90%;
}

.login-card {
    background: var(--bg-secondary);
    border: var(--border-width-thin) solid var(--border-primary);
    border-radius: var(--border-radius-2xl);
    padding: var(--spacing-12) var(--spacing-10);
    box-shadow: var(--shadow-2xl);
}

.login-card .logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-bottom: var(--spacing-2);
}

.login-card .logo-wordmark {
    font-family: 'Rajdhani', 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-text-primary, #e6edf3);
    text-transform: uppercase;
}

.login-card .logo-wordmark-accent {
    color: #ff6b35;
}

.login-card .subtitle {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-medium);
    letter-spacing: var(--font-letter-spacing-wider);
    text-transform: uppercase;
    margin-bottom: var(--spacing-10);
}

.sign-in-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2-5);
    width: 100%;
    padding: var(--spacing-3-5) var(--spacing-7);
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--border-radius-lg);
    font-family: var(--font-family-sans, Inter, sans-serif);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    text-transform: uppercase;
    letter-spacing: var(--font-letter-spacing-wider);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.sign-in-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-primary-lg);
}

.sign-in-btn:active {
    transform: translateY(0);
}

.sign-in-btn svg {
    width: 20px;
    height: 20px;
}

.footer-text {
    margin-top: var(--spacing-6);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    letter-spacing: 0.03em;
}

/* ----------------------------------------------------------------
   Details Page — False Positive Styling
   ---------------------------------------------------------------- */
.severity-false-positive {
    background: rgba(63, 185, 80, 0.15);
    color: #3fb950;
    border: 1px solid rgba(63, 185, 80, 0.3);
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.false-positive-row {
    opacity: 0.5;
}

.false-positive-row:hover {
    opacity: 0.8;
}

/* ----------------------------------------------------------------
   API Docs Page
   ---------------------------------------------------------------- */
body.api-docs-body {
    font-family: var(--font-family-sans, Inter, sans-serif);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    min-height: 100vh;
}

.api-docs-body .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.api-docs-body .header {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    padding: 32px;
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: var(--border-width-thin) solid var(--border-primary);
}

.api-docs-body .header-content h1 {
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.api-docs-body .header-content p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    font-weight: 400;
}

.api-docs-body .back-link {
    background: var(--gradient-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--border-radius-lg);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.api-docs-body .back-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow-primary-lg);
}

.api-docs-body .content-card {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-xl);
    padding: 32px;
    border: var(--border-width-thin) solid var(--border-primary);
    margin-bottom: 24px;
}

.api-docs-body .nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.api-docs-body .nav-card {
    background: var(--bg-tertiary);
    border: var(--border-width-thin) solid var(--border-primary);
    border-radius: var(--border-radius-lg);
    padding: 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.api-docs-body .nav-card:hover {
    background: var(--bg-secondary);
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.api-docs-body .nav-card i {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--accent-primary);
}

.api-docs-body .section h2 {
    color: var(--text-primary);
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.api-docs-body .section h3 {
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-weight: 600;
    margin: 24px 0 12px 0;
}

.api-docs-body .endpoint {
    background: var(--bg-tertiary);
    border: var(--border-width-thin) solid var(--border-primary);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.api-docs-body .endpoint-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.api-docs-body .method {
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    font-family: var(--font-family-mono, monospace);
    text-transform: uppercase;
}

.api-docs-body .method.get {
    background: var(--risk-low-subtle);
    color: var(--risk-low);
    border: 1px solid var(--risk-low-border);
}

.api-docs-body .method.post {
    background: var(--accent-info-subtle);
    color: var(--accent-info);
    border: 1px solid var(--accent-info-border);
}

.api-docs-body .method.delete {
    background: var(--risk-high-subtle);
    color: var(--risk-high);
    border: 1px solid var(--risk-high-border);
}

.api-docs-body .endpoint-path {
    font-family: var(--font-family-mono, monospace);
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 500;
}

.api-docs-body .endpoint-description {
    color: var(--text-secondary);
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.api-docs-body .params-table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 0.9rem;
}

.api-docs-body .params-table th,
.api-docs-body .params-table td {
    text-align: left;
    padding: 12px;
    border-bottom: var(--border-width-thin) solid var(--border-primary);
}

.api-docs-body .params-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.api-docs-body .params-table td {
    color: var(--text-tertiary);
}

.api-docs-body .code-block {
    background: var(--bg-primary);
    color: var(--text-primary);
    padding: 20px;
    border-radius: var(--border-radius-lg);
    font-family: var(--font-family-mono, monospace);
    font-size: 0.875rem;
    overflow-x: auto;
    margin: 16px 0;
    line-height: 1.4;
    border: var(--border-width-thin) solid var(--border-primary);
}

.api-docs-body .info-box {
    border-radius: var(--border-radius-lg);
    padding: 16px;
    margin: 16px 0;
    border-left: 4px solid;
}

.api-docs-body .info-box.warning {
    background: var(--risk-medium-subtle);
    border-color: var(--risk-medium);
}

.api-docs-body .info-box.warning h4 {
    color: var(--risk-medium);
}

.api-docs-body .info-box.info {
    background: var(--accent-info-subtle);
    border-color: var(--accent-info);
}

.api-docs-body .info-box.info h4 {
    color: var(--accent-info);
}

.api-docs-body .info-box h4 {
    font-weight: 600;
    margin-bottom: 8px;
}

.api-docs-body .grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.api-docs-body .card {
    background: var(--bg-tertiary);
    border: var(--border-width-thin) solid var(--border-primary);
    border-radius: var(--border-radius-lg);
    padding: 24px;
}

.api-docs-body .card h3 {
    margin: 0 0 16px 0;
}

.api-docs-body .status-list {
    list-style: none;
    padding: 0;
}

.api-docs-body .status-list li {
    padding: 8px 0;
    border-bottom: var(--border-width-thin) solid var(--border-primary);
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
}

.api-docs-body .status-list li:last-child {
    border-bottom: none;
}

.api-docs-body .status-code {
    font-family: var(--font-family-mono, monospace);
    font-weight: 600;
}

.api-docs-body .highlight {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-family-mono, monospace);
    font-size: 0.875rem;
    color: var(--accent-primary);
}

.api-docs-body .section {
    margin-bottom: 48px;
}

/* ----------------------------------------------------------------
   Responsive
   ---------------------------------------------------------------- */
@media (max-width: 1400px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: flex;
        position: fixed;
        top: var(--spacing-4);
        left: var(--spacing-4);
        z-index: 60;
        align-items: center;
        justify-content: center;
        width: var(--spacing-10);
        height: var(--spacing-10);
        background: var(--bg-secondary);
        border: var(--border-width-thin) solid var(--border-primary);
        border-radius: var(--border-radius-md);
        color: var(--text-primary);
        cursor: pointer;
        box-shadow: var(--shadow-lg);
    }

    .mobile-menu-toggle:hover {
        background: var(--bg-tertiary);
    }

    /* Sidebar: off-screen by default, slides in as drawer */
    .app-sidebar {
        width: var(--sidebar-width-expanded);
        transform: translateX(-100%);
        transition: transform 0.2s ease, width 0.2s ease;
    }

    .app-sidebar:hover {
        width: var(--sidebar-width-expanded);
    }

    .app-sidebar.mobile-open {
        transform: translateX(0);
    }

    /* When mobile-open, show all labels/info immediately */
    .app-sidebar.mobile-open .sidebar-brand-text,
    .app-sidebar.mobile-open .sidebar-user-info,
    .app-sidebar.mobile-open .sidebar-logout-btn span,
    .app-sidebar.mobile-open .sidebar-item-badge,
    .app-sidebar.mobile-open .sidebar-item span {
        opacity: 1;
    }

    .app-sidebar.mobile-open .sidebar-header {
        justify-content: flex-start;
        padding-left: 14px;
        padding-right: 14px;
    }

    .app-sidebar.mobile-open .sidebar-item {
        padding: 8px 10px;
        justify-content: flex-start;
    }

    .app-sidebar.mobile-open .sidebar-footer {
        padding: 10px;
        align-items: stretch;
    }

    .app-sidebar.mobile-open .tenant-switcher-btn {
        justify-content: flex-start;
    }

    .app-sidebar.mobile-open .tenant-switcher-icon {
        opacity: 1;
    }

    .app-sidebar.mobile-open .sidebar-logout-btn {
        justify-content: flex-start;
        gap: 8px;
        padding: 6px 10px;
    }

    /* Hide tooltips on mobile */
    .app-sidebar.mobile-open .sidebar-item[data-tooltip]::before {
        display: none;
    }

    .app-main {
        margin-left: 0;
    }

    .app-sidebar:hover + .app-main {
        margin-left: 0;
    }

    .search-row {
        flex-direction: column;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .app-main > .container {
        padding: var(--spacing-4);
    }

    .page-header {
        padding: var(--spacing-4) var(--spacing-5);
        margin-top: var(--spacing-14);
    }

    .api-docs-body .header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .api-docs-body .grid-2 {
        grid-template-columns: 1fr;
    }

    .api-docs-body .nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* ----------------------------------------------------------------
   API Keys Section — Card-based Design
   ---------------------------------------------------------------- */
.api-key-stat-card {
    flex: 1;
    background: var(--color-bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--color-border-subtle);
    padding: 14px 18px;
}

.api-key-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-text-primary);
    font-family: var(--font-family-mono);
}

.api-key-stat-label {
    font-size: 10px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

.api-key-create-card {
    margin-bottom: 20px;
    background: var(--color-bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--color-border-subtle);
    overflow: hidden;
    transition: border-color 0.2s;
}

.api-key-create-card.expanded {
    border-color: var(--color-accent-primary-subtle);
}

.api-key-create-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    background: transparent;
    border: none;
    color: var(--color-text-primary);
    cursor: pointer;
    font-family: inherit;
}

.api-key-create-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.api-key-chevron {
    font-size: 14px;
    color: var(--color-text-tertiary);
    transition: transform 0.2s;
}

.api-key-chevron.rotated {
    transform: rotate(180deg);
}

.api-key-create-body {
    padding: 0 18px 18px;
}

.api-key-form-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-tertiary);
    letter-spacing: 0.5px;
    margin-bottom: 5px;
    text-transform: uppercase;
}

.api-key-form-input {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border-subtle);
    border-radius: 6px;
    padding: 9px 12px;
    color: var(--color-text-primary);
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.api-key-form-input:focus {
    border-color: var(--color-accent-primary-base);
}

.api-key-form-input::placeholder {
    color: var(--color-text-tertiary);
    opacity: 0.5;
}

.api-key-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--color-accent-primary-base);
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.1s;
}

.api-key-btn-primary:hover {
    transform: translateY(-1px);
}

.api-key-btn-primary:active {
    transform: translateY(0);
}

.api-key-btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-subtle);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.api-key-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.api-key-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 6px;
    background: transparent;
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.15);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.api-key-btn-danger:hover {
    opacity: 1;
}

.api-key-success-message {
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--color-border-subtle);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-secondary);
    font-size: 13px;
}

.api-key-card {
    background: var(--color-bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--color-border-subtle);
    overflow: hidden;
    margin-bottom: 6px;
    transition: border-color 0.2s;
}

.api-key-card.expanded {
    border-color: rgba(255, 255, 255, 0.1);
}

.api-key-card-header {
    padding: 14px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: background 0.2s;
}

.api-key-card-header:hover {
    background: rgba(255, 255, 255, 0.02);
}

.api-key-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.api-key-status-dot.active {
    background: #22c55e;
    opacity: 0.6;
}

.api-key-status-dot.inactive {
    background: var(--color-text-tertiary);
    opacity: 0.3;
}

.api-key-card-info {
    flex: 1;
    min-width: 0;
}

.api-key-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.api-key-card-desc {
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.api-key-card-prefix {
    font-family: var(--font-family-mono);
    font-size: 11px;
    color: var(--color-text-tertiary);
    margin-right: 8px;
}

.api-key-card-usage {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-secondary);
    font-family: var(--font-family-mono);
    min-width: 48px;
    text-align: right;
}

.api-key-card-body {
    padding: 0 18px 16px;
    border-top: 1px solid var(--color-border-subtle);
    padding-top: 14px;
}

.api-key-details {
    display: flex;
    gap: 32px;
    margin-bottom: 16px;
    font-size: 12px;
    flex-wrap: wrap;
}

.api-key-detail-item {
    min-width: 100px;
}

.api-key-detail-label {
    color: var(--color-text-tertiary);
    font-size: 10px;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.api-key-detail-value {
    color: var(--color-text-secondary);
}

.api-key-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--color-text-secondary);
    font-weight: 500;
}

.api-key-reveal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 5px;
    padding: 3px 8px;
    font-family: var(--font-family-mono);
    font-size: 11px;
}

.api-key-reveal-btn {
    background: none;
    border: none;
    color: var(--color-text-tertiary);
    cursor: pointer;
    padding: 2px;
    display: flex;
}

.api-key-usage-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.api-key-usage-bar-track {
    width: 50px;
    height: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.06);
}

.api-key-usage-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--color-text-secondary);
}

.api-key-usage-bar-text {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-family: var(--font-family-mono);
}

.api-key-actions {
    display: flex;
    gap: 6px;
}

.api-key-empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--color-text-tertiary);
}

.api-key-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.api-key-empty-state h4 {
    font-size: 16px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.api-key-empty-state p {
    font-size: 13px;
}

/* Override uppercase for Agent Keys section */
#agent-keys-content {
    text-transform: none;
}

#agent-keys-content .api-key-stat-label {
    text-transform: uppercase;
}

#agent-keys-content .api-key-form-label {
    text-transform: uppercase;
}

#agent-keys-content .api-key-detail-label {
    text-transform: uppercase;
}

/* Update API Keys card backgrounds and borders for better visibility */
.api-key-stat-card {
    background: #131922;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-create-card {
    background: #131922;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-create-card.expanded {
    border-color: rgba(232, 93, 38, 0.2);
}

.api-key-create-header:hover {
    background: rgba(255, 255, 255, 0.03);
}

.api-key-form-input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-form-input:focus {
    border-color: var(--color-accent-primary-base);
}

.api-key-btn-ghost {
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
}

.api-key-success-message {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-card {
    background: #131922;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-card.expanded {
    border-color: rgba(255, 255, 255, 0.1);
}

.api-key-card-header:hover {
    background: #171f2b;
}

.api-key-card-body {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-reveal {
    background: rgba(255, 255, 255, 0.03);
}

.api-key-usage-bar-track {
    background: rgba(255, 255, 255, 0.06);
}

/* API Key Modal */
.api-key-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.api-key-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.api-key-modal-content {
    position: relative;
    background: #131922;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.api-key-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--color-text-primary);
}

.api-key-modal-body {
    padding: 24px;
}

.api-key-modal-warning {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: 8px;
    margin-bottom: 20px;
    color: #fbbf24;
    font-size: 13px;
}

.api-key-modal-warning i {
    font-size: 16px;
}

.api-key-modal-key-display {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    word-break: break-all;
}

.api-key-modal-key-display code {
    font-family: var(--font-family-mono);
    font-size: 13px;
    color: var(--color-text-primary);
    line-height: 1.6;
}

.api-key-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: flex-end;
}

/* Two-column layout for expanded card body */
.api-key-body-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    margin-bottom: 16px;
}

.api-key-description-column {
    padding-right: 24px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.api-key-description-text {
    color: var(--color-text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin-top: 8px;
}

.api-key-details-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Responsive: stack on smaller screens */
@media (max-width: 768px) {
    .api-key-body-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .api-key-description-column {
        padding-right: 0;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
        padding-bottom: 16px;
    }
}

/* ══════════════════════════════════════════
   Policy Section - Table + Drawer Design
   ══════════════════════════════════════════ */

/* Policy Stats */
.policy-stats-grid {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.policy-stat-card {
    padding: 10px 16px;
    border-radius: 8px;
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
}

.policy-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text-primary);
    font-family: var(--font-family-mono);
}

.policy-stat-label {
    font-size: 11px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Modern Stat Cards */
.stats-grid-modern {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card-modern {
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.stat-card-modern:hover {
    background: #1c2128;
    border-color: rgba(255, 255, 255, 0.1);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.2s ease;
}

.stat-card-icon i {
    color: #6e7681 !important;
    transition: color 0.2s ease;
}

.stat-card-modern:hover .stat-card-icon i {
    color: white !important;
}

.stat-card-value {
    font-size: 36px;
    font-weight: 700;
    font-family: var(--font-family-mono);
    transition: color 0.2s ease;
    /* Muted gray by default */
    color: #6e7681 !important;
}

.stat-card-modern:hover .stat-card-value {
    /* White on hover */
    color: #ffffff !important;
}

.stat-card-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
    transition: color 0.2s ease;
    /* Muted gray by default */
    color: #6e7681 !important;
}

.stat-card-modern:hover .stat-card-label {
    /* Lighter gray on hover */
    color: #c9d1d9 !important;
}

/* Primary Button */
.policy-btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    background: var(--color-accent-primary-base);
    color: #fff;
    transition: transform 0.1s;
}

.policy-btn-primary:hover {
    transform: translateY(-1px);
}

/* Policy App Container */
#policy-app-container {
    max-width: 1600px;
    margin: 0 auto;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Table Container */
.policy-table-container {
    background: #161b22;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
    width: 100%;
}

.policy-table-header {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 140px 80px 100px 140px 60px;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: #21262d;
}

.policy-table-header span {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.policy-table-body {
    /* populated by JS */
}

.policy-table-row {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 140px 80px 100px 140px 60px;
    gap: 12px;
    padding: 14px 16px;
    width: 100%;
    text-align: left;
    border: none;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: transparent;
    font-family: inherit;
    transition: background 0.1s ease;
}

.policy-table-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.policy-table-row.selected {
    background: rgba(229, 90, 43, 0.04);
}

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

.policy-row-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    margin-bottom: 2px;
}

.policy-row-desc {
    font-size: 11px;
    color: var(--color-text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
}

.policy-row-actions {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    align-items: center;
}

.policy-row-rules {
    display: flex;
    align-items: center;
}

.policy-row-rules-count {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary);
    font-family: var(--font-family-mono);
}

.policy-row-status {
    display: flex;
    align-items: center;
}

.policy-row-updated {
    display: flex;
    align-items: center;
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.policy-row-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.policy-row-icon-btn {
    display: flex;
    padding: 4px;
    border: none;
    background: transparent;
    color: var(--color-text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s;
}

.policy-row-icon-btn:hover {
    color: var(--color-text-primary);
}

/* Action Badge */
.policy-action-badge {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--color-text-secondary);
    background: #21262d;
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Toggle Switch */
.policy-toggle {
    width: 32px;
    height: 18px;
    border-radius: 18px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.policy-toggle.enabled {
    background: var(--color-accent-primary-base);
    border-color: rgba(229, 90, 43, 0.2);
}

.policy-toggle.disabled {
    background: #30363d;
}

.policy-toggle-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    position: absolute;
    top: 2px;
    transition: left 0.15s ease, background 0.15s ease;
}

.policy-toggle.enabled .policy-toggle-dot {
    left: 16px;
    background: #fff;
}

.policy-toggle.disabled .policy-toggle-dot {
    left: 3px;
    background: var(--color-text-tertiary);
}

/* Drawer Panel */
.policy-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 480px;
    background: #161b22;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 35;
    display: flex;
    flex-direction: column;
    transform: translateX(480px);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.3);
}

.policy-drawer.open {
    transform: translateX(0);
}

.policy-drawer-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    gap: 12px;
}

.policy-drawer-close {
    display: flex;
    padding: 4px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-tertiary);
    border-radius: 4px;
}

.policy-drawer-title {
    flex: 1;
}

.policy-drawer-title-text {
    font-size: 14px;
    font-weight: 700;
    color: var(--color-text-primary);
}

.policy-drawer-title-subtitle {
    font-size: 11px;
    color: var(--color-text-tertiary);
}

.policy-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.policy-drawer-section {
    margin-bottom: 20px;
}

.policy-drawer-label {
    font-size: 10px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.policy-drawer-description {
    padding: 8px 12px;
    border-radius: 6px;
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 12px;
    color: var(--color-text-secondary);
    line-height: 1.5;
}

.policy-drawer-rules-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.policy-drawer-add-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px dashed rgba(255, 255, 255, 0.06);
    cursor: pointer;
    font-size: 10px;
    font-family: inherit;
    background: transparent;
    color: var(--color-text-tertiary);
}

.policy-rule-card {
    background: #0d1117;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    position: relative;
}

.policy-rule-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.policy-rule-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-primary);
}

.policy-rule-meta {
    display: flex;
    align-items: center;
    gap: 6px;
}

.policy-rule-priority {
    font-size: 10px;
    color: var(--color-text-tertiary);
    font-family: var(--font-family-mono);
}

.policy-rule-conditions-label {
    font-size: 9px;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 6px;
}

.policy-condition-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 5px;
    background: #161b22;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 4px;
}

.policy-condition-logic {
    text-align: center;
    padding: 2px 0;
}

.policy-condition-logic-text {
    font-size: 8px;
    font-weight: 700;
    color: var(--color-text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.policy-condition-select,
.policy-condition-input {
    background: #21262d;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 11px;
    color: var(--color-text-secondary);
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

.policy-condition-input {
    flex: 1;
    font-family: var(--font-family-mono);
    color: var(--color-text-primary);
}

.policy-condition-remove {
    display: flex;
    padding: 2px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-tertiary);
    border-radius: 3px;
}

.policy-drawer-footer {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.policy-btn-secondary {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    background: #21262d;
    color: var(--color-text-secondary);
}

.policy-btn-save {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    background: var(--color-accent-primary-base);
    color: #fff;
}

/* Corner Brackets */
.policy-corner-brackets {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.policy-corner-brackets svg {
    position: absolute;
    width: 8px;
    height: 8px;
    opacity: 0.3;
}

.policy-corner-brackets .tl { top: 0; left: 0; }
.policy-corner-brackets .tr { top: 0; right: 0; }
.policy-corner-brackets .bl { bottom: 0; left: 0; }
.policy-corner-brackets .br { bottom: 0; right: 0; }

/* Empty State */
.policy-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-text-tertiary);
}

.policy-empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.policy-empty-state h4 {
    font-size: 16px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.policy-empty-state p {
    font-size: 13px;
}
