/* ═══════════════════════════════════════════════════════════════════
   sentinel-components.css — Shared component classes for Sentinel journeys
   ═══════════════════════════════════════════════════════════════════ */

/* ── Page shell ── */
.page-wrapper {
  display: flex;
  height: 100vh;
  background: var(--bg-root);
}

.page-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.page-content {
  flex: 1;
  padding: var(--sp-8) var(--sp-9) var(--sp-12);
  overflow-y: auto;
}

.page-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  animation: fade-up 0.4s var(--ease-out-expo);
}

/* ── Topbar ── */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--bg-surface-1);
  border-bottom: 1px solid var(--line-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--sp-8);
  z-index: 40;
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-breadcrumb {
  font-size: 12px;
  color: var(--text-tertiary);
}

.topbar-search {
  width: 280px;
  height: 36px;
  padding: 0 var(--sp-5) 0 34px;
  background: var(--bg-surface-2);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A766E' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  transition: border-color var(--dur-fast);
}

.topbar-search:focus { border-color: var(--brass); }
.topbar-search::placeholder { color: var(--text-tertiary); }

.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid var(--line-default);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast);
  position: relative;
}

.topbar-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--line-strong); }
.topbar-btn svg { width: 16px; height: 16px; }

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: var(--neg);
  border-radius: 50%;
  border: 2px solid var(--bg-surface-1);
}

.persona-switcher {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 4px;
  background: var(--bg-surface-2);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-pill);
}

.persona-option {
  height: 28px;
  padding: 0 var(--sp-5);
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  transition: all var(--dur-fast);
}

.persona-option:hover { color: var(--text-primary); }
.persona-option.active {
  background: var(--brass);
  color: var(--text-on-accent);
  font-weight: 600;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-surface-1);
  border-right: 1px solid var(--line-default);
  display: flex;
  flex-direction: column;
  z-index: 50;
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding: 0 var(--sp-7);
  border-bottom: 1px solid var(--line-default);
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--brass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  color: var(--text-on-accent);
}

.sidebar-brand-text {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-brand-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-5) var(--sp-5) var(--sp-6);
}

.nav-section { margin-bottom: var(--sp-6); }
.nav-section-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-quaternary);
  padding: 0 var(--sp-5);
  margin-bottom: var(--sp-4);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  height: 38px;
  padding: 0 var(--sp-5);
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--dur-fast);
  cursor: pointer;
  border: none;
  background: transparent;
  width: 100%;
}

.nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-item.active {
  background: var(--brass-tint);
  color: var(--brass-bright);
  font-weight: 600;
  border-right: 2px solid var(--brass);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  height: 18px;
  padding: 0 6px;
  background: var(--neg);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
}

.sidebar-footer {
  padding: var(--sp-5);
  border-top: 1px solid var(--line-default);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  background: var(--bg-surface-2);
  border: 1px solid var(--line-default);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--brass-tint);
  border: 1px solid var(--line-brass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  color: var(--brass);
}

.user-chip-info { flex: 1; min-width: 0; }
.user-chip-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-chip-role { font-size: 11px; color: var(--text-tertiary); }

/* ── Page header ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-6);
  flex-wrap: wrap;
  padding-top: var(--topbar-height);
}

.page-header-left { max-width: 720px; }
.page-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--brass);
  margin-bottom: var(--sp-4);
}
.page-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: var(--sp-4);
}
.page-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.55;
  max-width: 65ch;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

/* ── Cards ── */
.card {
  background: var(--bg-surface-1);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-6) var(--sp-7);
  border-bottom: 1px solid var(--line-default);
  gap: var(--sp-5);
}

.card-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.card-body { padding: var(--sp-6) var(--sp-7); }
.card-footer {
  padding: var(--sp-5) var(--sp-7);
  border-top: 1px solid var(--line-default);
  background: var(--bg-surface-2);
}

.card--accent { border-color: var(--line-brass); }
.card--accent .card-header { border-bottom-color: var(--line-brass); }

/* ── KPI grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-6);
}

.kpi-card {
  background: var(--bg-surface-1);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  padding: var(--sp-6) var(--sp-7);
  box-shadow: var(--shadow-card);
  transition: all var(--dur-fast);
}

.kpi-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card-hover);
}

.kpi-label {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-4);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.kpi-change {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: var(--sp-3);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.kpi-change--up { color: var(--pos); }
.kpi-change--down { color: var(--neg); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-3);
  height: 36px;
  padding: 0 var(--sp-6);
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--dur-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--brass);
  color: var(--text-on-accent);
  border-color: var(--brass);
}

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

.btn-secondary {
  background: var(--bg-surface-2);
  color: var(--text-primary);
  border-color: var(--line-strong);
}

.btn-secondary:hover { background: var(--bg-hover); border-color: var(--brass); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--line-default);
}

.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.nav-item, .btn, .journey-card {
  text-decoration: none;
}
.nav-item:hover, .nav-item:focus, .nav-item:active,
.btn:hover, .btn:focus, .btn:active,
.journey-card:hover, .journey-card:focus, .journey-card:active {
  text-decoration: none;
}

.btn-sm { height: 30px; padding: 0 var(--sp-5); font-size: 12px; }
.btn-lg { height: 44px; padding: 0 var(--sp-8); font-size: 14px; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: var(--sp-5) var(--sp-6);
  text-align: left;
  border-bottom: 1px solid var(--line-subtle);
}

th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  background: var(--bg-surface-2);
}

tr:hover td { background: var(--bg-hover); }

.num, td.num, th.num {
  font-family: var(--font-mono);
  text-align: right;
}

/* ── Pills / badges ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 22px;
  padding: 0 var(--sp-4);
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-brass { background: var(--brass-tint); color: var(--brass); border: 1px solid var(--line-brass); }
.pill-pos { background: rgba(111, 181, 147, 0.12); color: var(--pos); border: 1px solid rgba(111, 181, 147, 0.25); }
.pill-neg { background: rgba(217, 104, 92, 0.12); color: var(--neg); border: 1px solid rgba(217, 104, 92, 0.25); }
.pill-warn { background: rgba(224, 148, 74, 0.12); color: var(--warn); border: 1px solid rgba(224, 148, 74, 0.25); }
.pill-info { background: rgba(126, 147, 194, 0.12); color: var(--info); border: 1px solid rgba(126, 147, 194, 0.25); }
.pill-neutral { background: var(--bg-surface-2); color: var(--text-secondary); border: 1px solid var(--line-default); }

/* ── Alerts / insight cards ── */
.insight-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-6);
  background: var(--bg-surface-2);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
}

.insight-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--brass-tint);
  color: var(--brass);
}

.insight-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.insight-desc { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.insight-meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-tertiary); margin-top: var(--sp-3); }

/* ── Layout grids ── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-6); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-6); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-6); }

.split-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: var(--sp-6); }
.split-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--sp-6); }
.split-1-1 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); }

/* ── Tabs ── */
.tab-bar {
  display: flex;
  gap: var(--sp-5);
  border-bottom: 1px solid var(--line-default);
  margin-bottom: var(--sp-6);
}

.tab {
  height: 40px;
  padding: 0 var(--sp-2);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--dur-fast);
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--brass); border-bottom-color: var(--brass); font-weight: 600; }

/* ── Forms ── */
.input, .select, .textarea {
  width: 100%;
  height: 40px;
  padding: 0 var(--sp-5);
  background: var(--bg-input);
  border: 1px solid var(--line-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: all var(--dur-fast);
}

.input:focus, .select:focus, .textarea:focus { border-color: var(--brass); box-shadow: 0 0 0 3px var(--brass-glow); }
.input::placeholder { color: var(--text-tertiary); }
.textarea { height: auto; padding: var(--sp-5); min-height: 100px; }

/* ── Dividers ── */
.divider { height: 1px; background: var(--line-default); margin: var(--sp-6) 0; }

/* ── Empty state ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-12) var(--sp-8);
  text-align: center;
  color: var(--text-tertiary);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: var(--sp-6);
  opacity: 0.5;
}

/* ── Responsive ── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .split-2-1, .split-1-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-brand-text, .sidebar-brand-sub, .nav-section-title, .nav-item span, .user-chip-info { display: none; }
  .sidebar-brand { justify-content: center; padding: 0; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-badge { position: absolute; margin: 0; }
  .page-main { margin-left: 60px; }
  .topbar { left: 60px; padding: 0 var(--sp-5); }
  .topbar-search { width: 160px; }
  .persona-switcher { display: none; }
}

@media (max-width: 768px) {
  .page-content { padding: var(--sp-6) var(--sp-5) var(--sp-10); }
  .page-title { font-size: 22px; }
  .kpi-grid, .grid-2, .grid-3, .grid-4, .split-1-1 { grid-template-columns: 1fr; }
  .page-header-actions { width: 100%; }
  .topbar-search { display: none; }
}
