/* =============================================================================
   A2UI Sovereign Design System Core (PLG-OSF-UIS)
   Estate Standard: C:/OSF-UIS/a2ui_core.css
   Compatible with: A2UI Standard + CopilotKit + Sovereign Web Components
   ============================================================================= */

:root {
  /* Surface & Background */
  --bg-app: #080c14;
  --bg-sidebar: #0d131f;
  --bg-surface: #111827;
  --bg-surface-hover: #172033;
  --bg-surface-active: #1e293b;
  --bg-card: #0f172a;
  --bg-card-hover: #162035;
  --bg-drawer: #0a0f1d;
  --bg-modal: #0d1424;
  
  /* Borders */
  --border-subtle: #1e293b;
  --border-default: #334155;
  --border-focus: #38bdf8;
  --border-glow: rgba(56, 189, 248, 0.4);

  /* Typography Colors */
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-highlight: #ffffff;

  /* Accent Accents */
  --accent-cyan: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-blue: #3b82f6;
  --accent-amber: #fbbf24;
  --accent-emerald: #34d399;
  --accent-rose: #fb7185;
  --accent-purple: #c084fc;

  /* Sovereign Tiers Color Scheme */
  --tier-1-color: #38bdf8;
  --tier-1-bg: rgba(56, 189, 248, 0.12);
  --tier-1-border: rgba(56, 189, 248, 0.35);

  --tier-2-color: #818cf8;
  --tier-2-bg: rgba(129, 140, 248, 0.12);
  --tier-2-border: rgba(129, 140, 248, 0.35);

  --tier-3-color: #fbbf24;
  --tier-3-bg: rgba(251, 191, 36, 0.12);
  --tier-3-border: rgba(251, 191, 36, 0.35);

  --tier-r-color: #34d399;
  --tier-r-bg: rgba(52, 211, 153, 0.12);
  --tier-r-border: rgba(52, 211, 153, 0.35);

  --tier-s-color: #f472b6;
  --tier-s-bg: rgba(244, 114, 182, 0.14);
  --tier-s-border: rgba(244, 114, 182, 0.4);

  /* Recommended Additional Tiers */
  --tier-ui-color: #38bdf8;
  --tier-ui-bg: rgba(56, 189, 248, 0.15);
  --tier-x-color: #a78bfa;
  --tier-x-bg: rgba(167, 139, 250, 0.15);
  --tier-e-color: #f59e0b;
  --tier-e-bg: rgba(245, 158, 11, 0.15);
  --tier-misfit-color: #fb7185;
  --tier-misfit-bg: rgba(251, 113, 133, 0.12);

  /* Layout Tokens */
  --sidebar-width: 330px;
  --topbar-height: 60px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Fonts */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 0 15px rgba(56, 189, 248, 0.25);
}

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

body {
  background-color: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
}

/* App Layout */
.app-layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* -----------------------------------------------------------------------------
   Left Panel Sidebar
   ----------------------------------------------------------------------------- */
.left-panel {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 20;
}

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #0f172a;
  font-weight: 800;
  font-size: 0.725rem;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.05em;
}

.brand-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.01em;
}

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

.sidebar-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrapper {
  position: relative;
}

.search-input {
  width: 100%;
  background: #090d16;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 32px;
  font-size: 0.8rem;
  color: #fff;
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-content::-webkit-scrollbar { width: 5px; }
.sidebar-content::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

.nav-group-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.825rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-surface);
  color: #fff;
}

.nav-item.active {
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.3);
  font-weight: 600;
}

.nav-item.misfit-active {
  background: var(--tier-misfit-bg);
  color: var(--tier-misfit-color);
  border-color: rgba(251, 113, 133, 0.4);
  font-weight: 600;
}

.nav-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: #1e293b;
  color: #cbd5e1;
}

/* Quick Jump */
.quick-jump-box {
  max-height: 180px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: #090e19;
}

.quick-jump-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.quick-jump-item:hover {
  background: #1e293b;
  color: #fff;
}

.quick-jump-id {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border-subtle);
  background: #090e1a;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pits-card {
  background: #0d131f;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 0.725rem;
}

.pits-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-emerald);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
  display: inline-block;
  margin-right: 5px;
}

.pits-hash {
  font-family: var(--font-mono);
  color: #cbd5e1;
  font-size: 0.68rem;
  word-break: break-all;
}

.btn-pits {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  width: 100%;
}

.btn-pits:hover {
  background: #334155;
  border-color: var(--accent-cyan);
  color: #fff;
}

/* -----------------------------------------------------------------------------
   Main Workspace Panel
   ----------------------------------------------------------------------------- */
.main-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg-app);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-sidebar);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.topbar-stats {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

.topbar-stats strong {
  color: #cbd5e1;
}

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

/* View Mode Switcher (List vs Icon Card) */
.view-mode-toggle {
  display: flex;
  background: #090e18;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.775rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.toggle-btn:hover {
  color: #fff;
}

.toggle-btn.active {
  background: #1e293b;
  color: var(--accent-cyan);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.btn-top {
  background: #1e293b;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: var(--radius-md);
  padding: 5px 12px;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-top:hover {
  background: #334155;
  color: #fff;
}

/* -----------------------------------------------------------------------------
   User Profile Auth Widget (Top Right Standard)
   ----------------------------------------------------------------------------- */
.user-profile-capsule {
  display: flex;
  align-items: center;
  gap: 9px;
  background: #0f172a;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 4px 12px 4px 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.user-profile-capsule:hover {
  background: #162035;
  border-color: var(--tier-s-color);
  box-shadow: 0 0 10px rgba(244, 114, 182, 0.25);
}

.avatar-wrapper {
  position: relative;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f472b6, #818cf8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: #0f172a;
}

.avatar-status-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-emerald);
  border: 2px solid #0f172a;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.user-name-line {
  font-size: 0.775rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 5px;
}

.user-role-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--tier-s-color);
  font-weight: 600;
}

/* Workspace Content */
.workspace-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.workspace-content::-webkit-scrollbar { width: 6px; }
.workspace-content::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

/* Misfits Banner */
.banner-misfits {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.08), rgba(168, 85, 247, 0.08));
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  font-size: 0.8rem;
}

.banner-misfits-title {
  color: #fda4af;
  font-weight: 700;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.banner-misfits-desc {
  color: #cbd5e1;
  line-height: 1.4;
}

.rec-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.rec-badge {
  background: #111827;
  border: 1px solid #374151;
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.75rem;
}

.rec-badge strong {
  color: var(--accent-cyan);
}

/* -----------------------------------------------------------------------------
   Tier Section Headers & Containers
   ----------------------------------------------------------------------------- */
.tier-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.tier-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid #162032;
}

.tier-section-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tier-section-pill {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tier-section-pill.t1 { background: var(--tier-1-bg); color: var(--tier-1-color); border: 1px solid var(--tier-1-border); }
.tier-section-pill.t2 { background: var(--tier-2-bg); color: var(--tier-2-color); border: 1px solid var(--tier-2-border); }
.tier-section-pill.t3 { background: var(--tier-3-bg); color: var(--tier-3-color); border: 1px solid var(--tier-3-border); }
.tier-section-pill.tr { background: var(--tier-r-bg); color: var(--tier-r-color); border: 1px solid var(--tier-r-border); }
.tier-section-pill.ts { background: var(--tier-s-bg); color: var(--tier-s-color); border: 1px solid var(--tier-s-border); }

.tier-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
}

.tier-section-desc {
  font-size: 0.775rem;
  color: var(--text-muted);
}

.tier-section-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.tier-section-stat-badge {
  background: #111827;
  border: 1px solid #1e293b;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  color: #cbd5e1;
  font-family: var(--font-mono);
}

/* -----------------------------------------------------------------------------
   List View Components
   ----------------------------------------------------------------------------- */
.list-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.list-table th {
  background: #0f172a;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 5;
}

.list-table td {
  padding: 8px 12px;
  font-size: 0.825rem;
  border-bottom: 1px solid #162032;
  vertical-align: middle;
  color: var(--text-secondary);
}

.mrl-row { cursor: pointer; transition: background 0.12s ease; }
.mrl-row:hover td { background: var(--bg-surface-hover); color: #fff; }
.mrl-row.selected td { background: rgba(56, 189, 248, 0.08); border-bottom-color: rgba(56, 189, 248, 0.2); }

.rid-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  color: #fff;
  background: #1e293b;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid #334155;
  display: inline-block;
}

.mrl-title-line {
  font-weight: 600;
  color: #f8fafc;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.prefix-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #64748b;
  background: #090e19;
  padding: 1px 6px;
  border-radius: 3px;
}

.misfit-pill {
  background: rgba(251, 113, 133, 0.15);
  color: var(--tier-misfit-color);
  border: 1px solid rgba(251, 113, 133, 0.35);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
}

.tier-chip {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  display: inline-block;
  white-space: nowrap;
}

.tier-chip.tier-1 { background: var(--tier-1-bg); color: var(--tier-1-color); border: 1px solid var(--tier-1-border); }
.tier-chip.tier-2 { background: var(--tier-2-bg); color: var(--tier-2-color); border: 1px solid var(--tier-2-border); }
.tier-chip.tier-3 { background: var(--tier-3-bg); color: var(--tier-3-color); border: 1px solid var(--tier-3-border); }
.tier-chip.tier-r { background: var(--tier-r-bg); color: var(--tier-r-color); border: 1px solid var(--tier-r-border); }
.tier-chip.tier-s { background: var(--tier-s-bg); color: var(--tier-s-color); border: 1px solid var(--tier-s-border); }

.count-cell {
  font-family: var(--font-mono);
  font-weight: 600;
  color: #e2e8f0;
}

.edge-cell-tag {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  color: var(--accent-cyan);
}

/* Expandable Row Details */
.details-row { display: none; background: #090e1a; }
.details-row.expanded { display: table-row; }
.details-cell { padding: 14px 16px !important; border-bottom: 1px solid var(--border-default) !important; }

.details-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #0d131f;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}

.details-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.meta-item { font-size: 0.775rem; }
.meta-label { color: var(--text-muted); font-size: 0.68rem; text-transform: uppercase; font-weight: 700; margin-bottom: 2px; }
.meta-val { color: #e2e8f0; font-family: var(--font-mono); }
.meta-val a { color: var(--accent-cyan); text-decoration: none; }
.meta-val a:hover { text-decoration: underline; }

.conn-header {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.conn-cards-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.conn-card {
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 0.8rem;
}

.conn-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.conn-target-id { font-family: var(--font-mono); font-weight: 700; color: var(--accent-cyan); }
.conn-target-name { color: #f1f5f9; font-weight: 600; }
.conn-relation {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 1px 6px;
  border-radius: 3px;
}

.conn-action { font-family: var(--font-mono); font-size: 0.725rem; color: var(--text-muted); }
.conn-count { font-size: 0.7rem; background: #1e293b; color: #cbd5e1; padding: 1px 6px; border-radius: 3px; margin-left: auto; }
.conn-reason { font-size: 0.775rem; color: var(--text-secondary); line-height: 1.4; }

/* -----------------------------------------------------------------------------
   Icon / Tile View Components (A2UI Compact Pretext Grid Standard)
   Specification: PRT-A2UI-PRETEXT / Directive 1 & 2 & 3
   ----------------------------------------------------------------------------- */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}

.mrl-tile-compact {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  height: 148px;
  min-height: 148px;
  max-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.18s ease;
  position: relative;
  box-sizing: border-box;
  overflow: hidden;
}

.mrl-tile-compact:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-focus);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5), 0 0 10px rgba(56, 189, 248, 0.25);
}

.mrl-tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mrl-tile-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.mrl-tile-compact:hover .mrl-tile-icon-box {
  transform: scale(1.08);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.35);
}

.mrl-tile-rid {
  font-family: var(--font-mono);
  font-size: 0.725rem;
  font-weight: 700;
  color: var(--accent-cyan);
  background: #090e18;
  border: 1px solid #1e293b;
  padding: 2px 6px;
  border-radius: 4px;
}

/* A2UI Pretext Standard (PRT-A2UI-PRETEXT) - Guaranteed Deterministic Sizing */
.pretext-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  height: 34px;
  line-height: 17px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #f1f5f9;
  word-break: break-word;
  margin-top: 4px;
  margin-bottom: 2px;
}

.mrl-tile-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 6px;
  border-top: 1px solid #182335;
}

.pretext-metric {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
}

.pretext-metric-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-left: 4px;
}

/* -----------------------------------------------------------------------------
   User Profile & Tier S Security Enclave Modal
   ----------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(4, 7, 13, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

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

.modal-card {
  width: 90%;
  max-width: 680px;
  max-height: 90vh;
  background: var(--bg-modal);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8), 0 0 20px rgba(244, 114, 182, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-subtle);
  background: #0f182b;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover { color: #fff; }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-body::-webkit-scrollbar { width: 5px; }
.modal-body::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; }

.auth-badge-box {
  background: #090e18;
  border: 1px solid var(--tier-s-border);
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-hook-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.775rem;
}

.oauth-provider-btn {
  background: #1e293b;
  color: #fff;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  font-size: 0.775rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.oauth-provider-btn:hover {
  background: #334155;
  border-color: var(--accent-cyan);
}

.tier-s-form-box {
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.form-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 600;
}

.form-input, .form-select {
  background: #0c1220;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: #fff;
  font-size: 0.775rem;
  outline: none;
}

.form-input:focus, .form-select:focus {
  border-color: var(--border-focus);
}

.btn-tier-s-save {
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.15s ease;
}

.btn-tier-s-save:hover {
  opacity: 0.9;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.4);
}

.tier-s-saved-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.775rem;
}

.tier-s-saved-table th {
  background: #090e18;
  color: var(--text-muted);
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.tier-s-saved-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #162032;
  color: #cbd5e1;
}

/* Relational Edge Modal */
.edge-modal-card {
  width: 90%;
  max-width: 760px;
  max-height: 85vh;
  background: var(--bg-modal);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 40px rgba(0,0,0,0.8);
}

/* =============================================================================
   Agentic Business Corporate Identity & Topbar Header Standard
   Governing Authority: CEO-SIGN-0200 Series / CEO-SIGN-0469 / PLG-OSF-UIS
   ============================================================================= */
.brand-header-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-animated {
  height: 38px;
  width: auto;
  filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.5));
  transition: transform 0.2s ease;
}

.brand-logo-animated:hover {
  transform: scale(1.05);
}

.brand-company-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.brand-header-divider {
  width: 1px;
  height: 24px;
  background: #334155;
  margin: 0 4px;
}

.brand-context-title {
  font-size: 0.925rem;
  font-weight: 600;
  color: #94a3b8;
}

/* 3-Way View Switcher */
.view-mode-toggle .toggle-btn.btn-index.active {
  background: var(--accent-indigo);
  color: #ffffff;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 10px rgba(129, 140, 248, 0.4);
}

/* 2-Color Hero Outlined Icon Tokens on Compact Tiles */
.mrl-hero-icon-plate {
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 10px;
  background: var(--tile-shade, rgba(2, 6, 23, 0.85));
  background-image: var(--tile-texture, radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.12) 0%, transparent 65%));
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.15);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.mrl-tile-compact:hover .mrl-hero-icon-plate {
  transform: translateY(-2px) scale(1.05);
  border-color: var(--tile-c1, var(--accent-cyan));
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.6), 0 0 12px var(--tile-c1, rgba(56, 189, 248, 0.4));
}

.hero-icon-svg {
  width: 26px;
  height: 26px;
}

/* =============================================================================
   Index / Hierarchy View Standard (Directive 1)
   Topological Hierarchy & Connected Tiers DAG Visualizer
   ============================================================================= */
.index-view-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
}

.hierarchy-dag-banner {
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.95), rgba(30, 41, 59, 0.85));
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-md);
}

.dag-flow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.dag-flow-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dag-flow-nodes-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.dag-node-box {
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 140px;
  position: relative;
  transition: all 0.15s ease;
}

.dag-node-box.t1 { border-left: 3px solid var(--tier-1-color); }
.dag-node-box.t2 { border-left: 3px solid var(--tier-2-color); }
.dag-node-box.t3 { border-left: 3px solid var(--tier-3-color); }
.dag-node-box.tr { border-left: 3px solid var(--tier-r-color); }
.dag-node-box.ts { border-left: 3px solid var(--tier-s-color); }

.dag-node-name {
  font-weight: 700;
  font-size: 0.775rem;
  color: #fff;
}

.dag-node-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.dag-arrow-flow {
  font-size: 1.1rem;
  color: #64748b;
  display: flex;
  align-items: center;
}

.index-tier-card {
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.index-tier-header {
  padding: 12px 16px;
  background: #0d131f;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.index-mrl-grid {
  display: flex;
  flex-direction: column;
  divide-y: 1px solid #162032;
}

.index-mrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #141c2c;
  background: #090e18;
  cursor: pointer;
  transition: background 0.12s ease;
  gap: 14px;
}

.index-mrl-row:hover {
  background: #111a2e;
}

.index-mrl-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 320px;
  flex: 1;
}

.index-mrl-title {
  font-weight: 600;
  color: #f1f5f9;
  font-size: 0.825rem;
}

.index-conns-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 2;
  justify-content: flex-end;
}

.intra-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.cross-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.cross-badge.t1 { background: var(--tier-1-bg); color: var(--tier-1-color); border: 1px solid var(--tier-1-border); }
.cross-badge.t2 { background: var(--tier-2-bg); color: var(--tier-2-color); border: 1px solid var(--tier-2-border); }
.cross-badge.t3 { background: var(--tier-3-bg); color: var(--tier-3-color); border: 1px solid var(--tier-3-border); }
.cross-badge.tr { background: var(--tier-r-bg); color: var(--tier-r-color); border: 1px solid var(--tier-r-border); }
.cross-badge.ts { background: var(--tier-s-bg); color: var(--tier-s-color); border: 1px solid var(--tier-s-border); }

.index-drawer {
  display: none;
  background: #0d1424;
  border-bottom: 2px solid var(--border-focus);
  padding: 14px 18px;
}

.index-drawer.open {
  display: block;
}

.index-drawer-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.index-drawer-block {
  background: #090e18;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
}

.index-drawer-title {
  font-size: 0.725rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* =============================================================================
   Ratified 8-Tier Architecture Extensions (Tier U, Tier X, Tier E)
   ============================================================================= */
.tier-section-pill.tu { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.tier-section-pill.tx { background: rgba(167, 139, 250, 0.15); color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.35); }
.tier-section-pill.te { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.35); }

.tier-chip.tier-u { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.tier-chip.tier-x { background: rgba(167, 139, 250, 0.15); color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.35); }
.tier-chip.tier-e { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.35); }

.cross-badge.tu { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.35); }
.cross-badge.tx { background: rgba(167, 139, 250, 0.15); color: #a78bfa; border: 1px solid rgba(167, 139, 250, 0.35); }
.cross-badge.te { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.35); }

.dag-node-box.tu { border-left: 3px solid #38bdf8; }
.dag-node-box.tx { border-left: 3px solid #a78bfa; }
.dag-node-box.te { border-left: 3px solid #f59e0b; }

.consolidated-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(14, 165, 233, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(14, 165, 233, 0.3);
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}


