/* ═══════════════════════════════════════════════════════════════
   BlueWhale Stack — Shared Layout Styles
   Used across all app mockups (02-…, 03-…, etc.)
   ═══════════════════════════════════════════════════════════════ */

body { overflow-x: hidden; font-family: var(--font-sans); }
.app { display: flex; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

/* ─── Sidebar ────────────────────────────────────── */
.sidebar { width: 240px; background: var(--bg-surface); border-right: 1px solid var(--border-default); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; z-index: 5; }
.sidebar-header { padding: var(--space-5) var(--space-4); border-bottom: 1px solid var(--border-default); display: flex; align-items: center; gap: var(--space-3); }
.sidebar-logo { width: 36px; height: 36px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; overflow: hidden; flex-shrink: 0; }
.sidebar-logo img { width: 100%; height: 100%; display: block; }
.sidebar-brand { font-weight: 700; font-size: var(--text-base); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: var(--space-3); }
.nav-section { margin-bottom: var(--space-4); }
.nav-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--text-tertiary); padding: var(--space-2) var(--space-3); }
.nav-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); color: var(--text-secondary); font-size: var(--text-sm); font-weight: 500; border-radius: var(--radius-md); cursor: pointer; transition: all var(--duration-fast); }
.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active { background: var(--bg-active); color: var(--text-accent); }
.nav-icon { width: 18px; display: inline-flex; justify-content: center; }
.nav-badge { margin-left: auto; background: var(--sev-critical); color: white; font-size: 10px; padding: 1px 6px; border-radius: var(--radius-full); font-weight: 600; }

/* ─── Top bar ────────────────────────────────────── */
.main { flex: 1; min-width: 0; }
.topbar { height: 56px; background: var(--bg-surface); border-bottom: 1px solid var(--border-default); display: flex; align-items: center; padding: 0 var(--space-6); gap: var(--space-4); position: sticky; top: 0; z-index: 4; }
.breadcrumb { font-size: var(--text-sm); color: var(--text-secondary); display: flex; align-items: center; gap: var(--space-2); }
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--text-accent); }
.breadcrumb .sep { color: var(--text-tertiary); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }
.search { flex: 1; max-width: 480px; position: relative; }
.search input { width: 100%; height: 36px; padding-left: 36px; padding-right: var(--space-3); border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-sunken); font-family: inherit; font-size: var(--text-sm); color: var(--text-primary); }
.search input:focus { outline: none; border-color: var(--border-accent); background: var(--bg-surface); box-shadow: var(--shadow-focus); }
.search-icon { position: absolute; left: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }
.search-hint { position: absolute; right: var(--space-3); top: 50%; transform: translateY(-50%); color: var(--text-tertiary); font-family: var(--font-mono); font-size: 11px; padding: 2px 6px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-sm); }
.topbar-right { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.icon-btn { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: var(--radius-md); background: transparent; color: var(--text-secondary); font-size: var(--text-lg); transition: all var(--duration-fast); position: relative; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-btn-dot::after { content: ''; position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--sev-critical); border-radius: 50%; border: 2px solid var(--bg-surface); }
.org-switch { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); height: 36px; border: 1px solid var(--border-default); border-radius: var(--radius-md); background: var(--bg-surface); font-size: var(--text-sm); font-weight: 500; }
.org-switch:hover { background: var(--bg-hover); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-blue); color: white; display: inline-flex; align-items: center; justify-content: center; font-size: var(--text-sm); font-weight: 600; }
.ask-btn { height: 36px; padding: 0 var(--space-4); background: linear-gradient(135deg, #1E6FDB 0%, #5EA1F2 100%); color: white; border: none; border-radius: var(--radius-md); font-size: var(--text-sm); font-weight: 600; display: inline-flex; align-items: center; gap: var(--space-2); }
.ask-btn:hover { filter: brightness(1.05); }

/* ─── Content ────────────────────────────────────── */
.content { padding: var(--space-6); max-width: 1440px; margin: 0 auto; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: var(--space-6); }
.page-title { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.02em; }
.page-subtitle { color: var(--text-secondary); margin-top: var(--space-1); font-size: var(--text-sm); }
.page-actions { display: flex; gap: var(--space-3); }

/* ─── Buttons ────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: var(--space-2); border: 1px solid transparent; border-radius: var(--radius-md); font-weight: 500; transition: all var(--duration-fast); white-space: nowrap; }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-focus); }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-xs); height: 32px; }
.btn-md { padding: var(--space-2) var(--space-4); font-size: var(--text-sm); height: 40px; }
.btn-lg { padding: var(--space-3) var(--space-5); font-size: var(--text-base); height: 48px; }
.btn-primary { background: var(--primary-bg); color: var(--primary-fg); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg-sunken); color: var(--text-primary); border-color: var(--border-default); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-outline { background: transparent; color: var(--text-primary); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--bg-hover); }
.btn-ghost { background: transparent; color: var(--text-primary); }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-danger { background: var(--sev-critical); color: white; }

/* ─── Cards / panels ─────────────────────────────── */
.card, .panel { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); }
.card { padding: var(--space-5); }
.panel-header { padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--border-default); display: flex; align-items: center; justify-content: space-between; }
.panel-title { font-weight: 600; font-size: var(--text-base); }
.panel-body { padding: var(--space-5); }

/* ─── Tables ─────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
thead { background: var(--bg-sunken); }
th { text-align: left; padding: var(--space-3); font-weight: 500; color: var(--text-secondary); font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
td { padding: var(--space-3); border-bottom: 1px solid var(--border-default); vertical-align: middle; }
tbody tr { cursor: pointer; transition: background var(--duration-fast); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }
.row-link { font-weight: 500; color: var(--text-primary); }
.row-link:hover { color: var(--text-accent); }

/* ─── Badges, severity, status ───────────────────── */
.badge { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 500; }
.badge-success { background: var(--success-bg); color: var(--success-fg); }
.badge-warning { background: var(--warning-bg); color: var(--warning-fg); }
.badge-danger { background: var(--danger-bg); color: var(--danger-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-neutral { background: var(--bg-sunken); color: var(--text-secondary); }

.sev { display: inline-flex; align-items: center; gap: var(--space-1); padding: 2px var(--space-2); border-radius: var(--radius-sm); font-size: var(--text-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.sev-critical { background: var(--danger-bg); color: var(--sev-critical); }
.sev-high { background: #FDF1F0; color: var(--sev-high); }
.sev-medium { background: var(--warning-bg); color: var(--sev-medium); }
.sev-low { background: var(--bg-sunken); color: var(--sev-low); }
[data-theme='dark'] .sev-high { background: #2E1311; }

/* Cloud badges */
.cloud-badge { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); border-radius: var(--radius-full); background: var(--bg-surface); border: 1px solid var(--border-default); font-size: var(--text-xs); font-weight: 500; }
.cloud-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ─── Form elements ──────────────────────────────── */
.input, .select { width: 100%; border: 1px solid var(--border-strong); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); font-family: inherit; font-size: var(--text-sm); background: var(--bg-surface); color: var(--text-primary); transition: border-color var(--duration-fast); height: 40px; }
.input:focus, .select:focus { outline: none; border-color: var(--border-accent); box-shadow: var(--shadow-focus); }
.input::placeholder { color: var(--text-tertiary); }
textarea.input { height: auto; min-height: 80px; resize: vertical; }
.form-group { margin-bottom: var(--space-4); }
.form-label { display: block; font-size: var(--text-sm); font-weight: 500; margin-bottom: var(--space-2); }
.form-helper { font-size: var(--text-xs); color: var(--text-tertiary); margin-top: var(--space-1); }

/* ─── Utility ────────────────────────────────────── */
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }
.muted { color: var(--text-secondary); }
.tiny { font-size: var(--text-xs); }
.flex { display: flex; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.row-2col { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); }
.row-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-4); }
.row-4col { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }

/* ─── Filter bar ─────────────────────────────────── */
.filter-bar { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-4); }
.filter-chip { display: inline-flex; align-items: center; gap: var(--space-2); padding: var(--space-1) var(--space-3); background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-md); font-size: var(--text-sm); color: var(--text-secondary); height: 32px; }
.filter-chip.active { color: var(--text-accent); border-color: var(--border-accent); background: var(--bg-active); }
.filter-chip:hover { border-color: var(--border-strong); }

/* ─── Tabs ───────────────────────────────────────── */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--border-default); margin-bottom: var(--space-4); }
.tab { padding: var(--space-3) var(--space-4); font-size: var(--text-sm); font-weight: 500; color: var(--text-secondary); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; }
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-accent); border-bottom-color: var(--text-accent); }

/* ─── Empty state ────────────────────────────────── */
.empty { text-align: center; padding: var(--space-16) var(--space-6); color: var(--text-secondary); }
.empty-icon { font-size: 48px; margin-bottom: var(--space-4); opacity: 0.5; }
.empty-title { font-size: var(--text-lg); font-weight: 600; color: var(--text-primary); margin-bottom: var(--space-2); }
.empty-desc { margin-bottom: var(--space-4); max-width: 400px; margin-left: auto; margin-right: auto; font-size: var(--text-sm); }

/* ─── Progress ───────────────────────────────────── */
.progress { height: 6px; background: var(--bg-sunken); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary-bg); border-radius: var(--radius-full); transition: width var(--duration-slow) var(--ease-out); }
.progress-fill.success { background: var(--success-fg); }
.progress-fill.warning { background: var(--warning-fg); }

/* ─── Stat cards ─────────────────────────────────── */
.stat-card { background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: var(--space-5); transition: all var(--duration-fast); }
.stat-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.stat-label { font-size: var(--text-xs); color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.stat-value { font-size: var(--text-3xl); font-weight: 700; margin-top: var(--space-2); letter-spacing: -0.02em; }
.stat-trend { font-size: var(--text-xs); margin-top: var(--space-2); font-weight: 500; }
