:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --destructive: #dc2626;
  --destructive-foreground: #fef2f2;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #18181b;
  --radius: 8px;

  --bg-app: #ffffff;
  --bg-surface: #ffffff;
  --bg-subtle: #fafafa;
  --bg-muted: #f4f4f5;
  --bg-hover: #f4f4f5;
  --bg-active: #e4e4e7;
  --border-light: #e4e4e7;
  --border-focus: #18181b;
  --text-main: #09090b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --primary-hover: #27272a;
  --primary-soft: #f4f4f5;
  --accent-green: #16a34a;
  --accent-green-bg: #f0fdf4;
  --accent-amber: #d97706;
  --accent-amber-bg: #fffbeb;
  --accent-red: #dc2626;
  --accent-red-bg: #fef2f2;
  --accent-purple: #4f46e5;
  --accent-purple-bg: #eef2ff;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   1. Minimal Google-Style Top Bar
   ========================================================================== */
.top-bar {
  height: 56px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  z-index: 30;
}

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

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.02em;
}

.brand-title {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.workspace-crumb {
  font-size: 13px;
  color: var(--text-muted);
  padding-left: 12px;
  border-left: 1px solid var(--border-light);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.persona-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.persona-pill select {
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
  cursor: pointer;
}

.scope-pill {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   2. Main Shell & Left Navigation Sidebar
   ========================================================================== */
.app-shell {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.left-rail {
  width: 224px;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  flex-shrink: 0;
  justify-content: space-between;
}

.rail-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rail-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 4px 10px 8px;
}

.rail-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.rail-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.rail-btn.active {
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 500;
}

.rail-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
}

.rail-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-active);
  color: var(--text-main);
}

.rail-btn.active .rail-badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.rail-footer {
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ==========================================================================
   3. Workspace Containers, Headers & Sub-Navigation
   ========================================================================== */
.workspace-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-app);
}

.module-container {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

.module-container.active {
  display: flex;
}

.sub-nav-bar {
  min-height: 48px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 4px;
  flex-shrink: 0;
  overflow-x: auto;
}

.sub-tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sub-tab:hover {
  color: var(--text-main);
  background: var(--bg-subtle);
}

.sub-tab.active {
  color: var(--text-main);
  background: var(--bg-muted);
  font-weight: 600;
}

.cockpit-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.015em;
}

.section-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ==========================================================================
   4. Buttons, Inputs & Controls (ui.shadcn.com style)
   ========================================================================== */
.btn {
  padding: 7px 13px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border-light);
  background: var(--bg-surface);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-subtle);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

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

.btn-success:hover {
  background: #15803d;
}

.btn-danger {
  background: var(--bg-surface);
  color: var(--accent-red);
  border-color: #fecaca;
}

.btn-danger:hover {
  background: var(--accent-red-bg);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.form-control {
  width: 100%;
  padding: 7px 11px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-main);
  background: var(--bg-surface);
  outline: none;
  transition: border-color 0.12s ease;
}

.form-control:focus {
  border-color: var(--border-focus);
}

/* ==========================================================================
   5. Clean Data Tables & Semantic Status Badges
   ========================================================================== */
.table-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-surface);
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-light);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: var(--bg-subtle);
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
}

.empty-state {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.badge-priority,
.status-pill {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  line-height: 1.4;
}

.priority-URGENT,
.priority-HIGH,
.pill-red {
  background: var(--accent-red-bg);
  color: var(--accent-red);
  border-color: #fecaca;
}

.priority-MEDIUM,
.pill-amber {
  background: var(--accent-amber-bg);
  color: var(--accent-amber);
  border-color: #fde68a;
}

.priority-LOW,
.pill-green {
  background: var(--accent-green-bg);
  color: var(--accent-green);
  border-color: #bbf7d0;
}

.pill-neutral {
  background: var(--bg-muted);
  color: var(--text-secondary);
  border-color: var(--border-light);
}

.chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

/* ==========================================================================
   6. Detail Cards, Split Layouts & Clean Key-Value Grids
   ========================================================================== */
.detail-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 16px;
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 16px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.evidence-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.evidence-box h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.kv-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border-light);
}

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

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

.kv-val {
  font-weight: 500;
  color: var(--text-main);
  font-family: var(--font-mono);
  text-align: right;
}

/* ==========================================================================
   7. Modals & Slide-Over Sheets (Dialog / Sheet)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 9, 11, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  width: 520px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--border-light);
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transform: translateY(80px);
  opacity: 0;
  transition: all 0.2s ease;
  z-index: 250;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}
