:root {
  --ov-bg: #0b1220;
  --ov-bg-elevated: #121a2b;
  --ov-bg-sidebar: #0a101c;
  --ov-border: rgba(148, 163, 184, 0.14);
  --ov-text: #e5eefc;
  --ov-muted: #93a4bd;
  --ov-accent: #2dd4a8;
  --ov-accent-2: #38bdf8;
  --ov-danger: #f87171;
  --ov-warning: #fbbf24;
  --ov-radius: 10px;
  --ov-sidebar-w: 232px;
  --ov-font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --ov-space: .65rem;
  --ov-control-h: 1.9rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--ov-font);
  font-size: .875rem;
  line-height: 1.4;
  background: radial-gradient(1000px 520px at 8% -8%, rgba(45, 212, 168, 0.1), transparent 50%),
              radial-gradient(800px 420px at 100% 0%, rgba(56, 189, 248, 0.08), transparent 45%),
              var(--ov-bg);
  color: var(--ov-text);
  min-height: 100vh;
}

a { color: var(--ov-accent-2); text-decoration: none; }
a:hover { color: #7dd3fc; }

.ov-shell {
  display: flex;
  min-height: 100vh;
}

/* ——— Sidebar ——— */
.ov-sidebar {
  width: var(--ov-sidebar-w);
  background: linear-gradient(180deg, #0d1524 0%, var(--ov-bg-sidebar) 100%);
  border-right: 1px solid var(--ov-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  transition: margin-left .2s ease, transform .2s ease;
  z-index: 1040;
  scrollbar-width: thin;
}

.ov-sidebar.collapsed {
  margin-left: calc(var(--ov-sidebar-w) * -1);
}

.ov-sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .75rem .8rem;
  border-bottom: 1px solid var(--ov-border);
  position: sticky;
  top: 0;
  background: #0d1524;
  z-index: 1;
}

.ov-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .8rem;
  letter-spacing: .02em;
  background: linear-gradient(135deg, var(--ov-accent), var(--ov-accent-2));
  color: #041018;
  flex-shrink: 0;
}

.ov-brand-name {
  font-weight: 700;
  font-size: .88rem;
  line-height: 1.15;
}

.ov-brand-sub {
  font-size: .65rem;
  color: var(--ov-muted);
  line-height: 1.2;
}

.ov-nav {
  padding: .35rem .45rem 1rem;
}

.ov-nav-section {
  font-size: .62rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ov-muted);
  padding: .55rem .55rem .2rem;
}

.ov-nav-group > summary {
  list-style: none;
  cursor: pointer;
  font-size: .62rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ov-muted);
  padding: .55rem .55rem .2rem;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ov-nav-group > summary::-webkit-details-marker { display: none; }

.ov-nav-group > summary::after {
  content: "▾";
  font-size: .65rem;
  opacity: .55;
  transition: transform .15s ease;
}

.ov-nav-group:not([open]) > summary::after {
  transform: rotate(-90deg);
}

.ov-nav-group.has-active > summary {
  color: var(--ov-accent);
}

.ov-nav a {
  display: flex;
  align-items: center;
  gap: .45rem;
  padding: .32rem .55rem;
  border-radius: 6px;
  color: #c7d4ea;
  margin-bottom: 1px;
  font-size: .78rem;
  line-height: 1.25;
}

.ov-nav a:hover {
  background: rgba(148, 163, 184, 0.08);
  color: #fff;
}

.ov-nav a.active {
  background: rgba(45, 212, 168, 0.14);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--ov-accent);
}

.ov-nav-icon {
  width: .7rem;
  opacity: .55;
  text-align: center;
  font-size: .55rem;
  flex-shrink: 0;
}

/* ——— Main / topbar ——— */
.ov-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.ov-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .5rem .9rem;
  border-bottom: 1px solid var(--ov-border);
  background: rgba(11, 18, 32, 0.85);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 1030;
  min-height: 48px;
}

.ov-topbar .fw-semibold {
  font-size: .95rem;
  line-height: 1.2;
}

.ov-content {
  padding: .85rem 1rem 1.25rem;
  max-width: 1480px;
}

/* ——— Cards / page chrome ——— */
.ov-card {
  background: rgba(18, 26, 43, 0.92);
  border: 1px solid var(--ov-border);
  border-radius: var(--ov-radius);
  padding: .7rem .85rem;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
  margin-bottom: .65rem;
}

.ov-card.mb-3 { margin-bottom: .65rem !important; }
.ov-card.mb-4 { margin-bottom: .85rem !important; }

.ov-stat {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .55rem .7rem;
}

.ov-stat .label {
  color: var(--ov-muted);
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.ov-stat .value {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
}

.ov-page-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}

.ov-page-sub {
  color: var(--ov-muted);
  margin: .15rem 0 0;
  font-size: .8rem;
}

.ov-page-head {
  margin-bottom: .75rem !important;
  gap: .5rem !important;
}

.ov-content .h5,
.ov-card .h5 {
  font-size: .95rem;
  margin-bottom: .5rem !important;
}

.ov-content .h6,
.ov-card .h6 {
  font-size: .85rem;
  margin-bottom: .4rem !important;
}

.ov-content .row.g-3 {
  --bs-gutter-x: .65rem;
  --bs-gutter-y: .65rem;
}

.ov-content .row.g-2 {
  --bs-gutter-x: .45rem;
  --bs-gutter-y: .45rem;
}

.ov-content .mb-4 { margin-bottom: .85rem !important; }
.ov-content .mb-3 { margin-bottom: .65rem !important; }
.ov-content .py-3 { padding-top: .55rem !important; padding-bottom: .55rem !important; }
.ov-content .py-2 { padding-top: .35rem !important; padding-bottom: .35rem !important; }

/* ——— Compact controls (global in app) ——— */
.btn-primary {
  --bs-btn-bg: #149a78;
  --bs-btn-border-color: #149a78;
  --bs-btn-hover-bg: #0f7e62;
  --bs-btn-hover-border-color: #0f7e62;
}

.ov-content .form-control,
.ov-content .form-select,
.ov-auth-card .form-control,
.ov-auth-card .form-select {
  background: #0d1524;
  border-color: var(--ov-border);
  color: var(--ov-text);
  min-height: var(--ov-control-h);
  padding: .2rem .5rem;
  font-size: .8125rem;
  line-height: 1.3;
  border-radius: 6px;
}

.ov-content textarea.form-control {
  min-height: 0;
  padding: .35rem .5rem;
}

.ov-content .form-control:focus,
.ov-content .form-select:focus {
  background: #0d1524;
  color: var(--ov-text);
  border-color: var(--ov-accent);
  box-shadow: 0 0 0 .15rem rgba(45, 212, 168, .12);
}

.ov-content .form-label,
.ov-field-label {
  display: block;
  font-size: .68rem;
  font-weight: 600;
  color: var(--ov-muted);
  margin-bottom: .15rem;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.ov-content .form-check {
  min-height: auto;
  margin-bottom: 0;
  padding-top: .15rem;
}

.ov-content .btn:not(.btn-lg) {
  --bs-btn-padding-y: .28rem;
  --bs-btn-padding-x: .65rem;
  --bs-btn-font-size: .78rem;
  --bs-btn-border-radius: 6px;
  line-height: 1.3;
}

.ov-content .btn-sm {
  --bs-btn-padding-y: .2rem;
  --bs-btn-padding-x: .5rem;
  --bs-btn-font-size: .74rem;
}

.ov-content .alert {
  padding: .45rem .7rem;
  font-size: .8rem;
  margin-bottom: .65rem;
  border-radius: 8px;
}

.ov-content .badge {
  font-weight: 600;
  font-size: .65rem;
  padding: .25em .45em;
}

.ov-content .breadcrumb {
  margin-bottom: .5rem;
  font-size: .75rem;
}

.ov-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  padding-top: .35rem;
  margin-top: .15rem;
  border-top: 1px solid var(--ov-border);
}

.ov-form-grid .col-md-12 textarea {
  min-height: 3.2rem;
}

.ov-content details > summary {
  list-style: none;
}
.ov-content details > summary::-webkit-details-marker { display: none; }
.ov-content details > summary::before {
  content: "▸ ";
  opacity: .6;
}
.ov-content details[open] > summary::before {
  content: "▾ ";
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--ov-text);
  --bs-table-border-color: var(--ov-border);
  --bs-table-striped-bg: rgba(255,255,255,.02);
  font-size: .8rem;
}

.table > :not(caption) > * > * {
  padding: .4rem .5rem;
}

.table thead th {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--ov-muted);
  font-weight: 600;
  white-space: nowrap;
}

.ov-list-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .75rem;
  padding: .45rem 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.ov-list-row:last-child { border-bottom: 0; }

.ov-auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

.ov-auth-wrap { width: 100%; max-width: 440px; }

.ov-auth-card {
  background: rgba(18, 26, 43, 0.95);
  border: 1px solid var(--ov-border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
}

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

.ov-coming {
  opacity: .55;
  font-size: .72rem;
  margin-left: auto;
}

.ov-empty {
  text-align: center;
  padding: 1.25rem .75rem;
  color: var(--ov-muted);
}

.ov-empty .h5 { font-size: .95rem; }

@media (max-width: 992px) {
  .ov-sidebar {
    position: fixed;
    left: 0;
    transform: translateX(0);
  }
  .ov-sidebar.collapsed {
    margin-left: 0;
    transform: translateX(-100%);
  }
  .ov-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1035;
  }
  .ov-sidebar-backdrop.show { display: block; }
}

.ov-code {
  background: #0d1524;
  border: 1px solid var(--ov-border);
  border-radius: 8px;
  padding: .55rem .7rem;
  overflow: auto;
  margin: .5rem 0;
}
.ov-code code {
  color: #b8f3d8;
  font-family: Consolas, "Courier New", monospace;
  font-size: .8rem;
}
.ov-doc-body .ov-prose code {
  background: rgba(45, 212, 168, 0.12);
  padding: .1rem .35rem;
  border-radius: 4px;
}
.ov-prose { line-height: 1.5; }

.ov-search-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 1050;
  background: var(--ov-panel, #121a27);
  border: 1px solid var(--ov-border, #243044);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
  max-height: 320px;
  overflow: auto;
}
.ov-search-item {
  display: block;
  padding: .45rem .7rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.ov-search-item:hover { background: rgba(61, 139, 253, 0.12); }
.ov-search-title { font-weight: 600; font-size: .82rem; }
.ov-search-meta { font-size: .7rem; color: var(--ov-muted, #8b9bb4); }
.ov-search-more { font-size: .78rem; color: var(--ov-accent, #3d8bfd); }
.ov-search-empty { padding: .65rem; font-size: .8rem; color: var(--ov-muted, #8b9bb4); }
mark { background: rgba(61,139,253,.35); color: inherit; padding: 0 .1em; border-radius: 2px; }

.ov-pagination .btn { min-width: 1.75rem; }
.breadcrumb { --bs-breadcrumb-divider-color: #6c7a91; }
.breadcrumb a { color: var(--ov-accent, #3d8bfd); text-decoration: none; }

.ov-loading {
  position: fixed; inset: 0; z-index: 2000; display: none;
  align-items: center; justify-content: center;
  background: rgba(11,18,32,.45);
}
.ov-loading.show { display: flex; }
.ov-loading-spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--ov-accent);
  animation: ovspin .7s linear infinite;
}
@keyframes ovspin { to { transform: rotate(360deg); } }

.ov-graph-canvas {
  width: 100%;
  min-height: 380px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: .5rem;
  background: radial-gradient(ellipse at center, rgba(61,139,253,.08), transparent 60%), #0b1220;
  overflow: hidden;
}
.ov-graph-canvas canvas { display: block; width: 100%; cursor: grab; }

.ov-palette {
  position: fixed; inset: 0; z-index: 2100; display: none;
  align-items: flex-start; justify-content: center; padding-top: 10vh;
}
.ov-palette.show { display: flex; }
.ov-palette-backdrop {
  position: absolute; inset: 0; background: rgba(8,12,22,.65);
}
.ov-palette-panel {
  position: relative; width: min(520px, 92vw);
  background: #121a2b; border: 1px solid rgba(255,255,255,.12);
  border-radius: .65rem; box-shadow: 0 20px 60px rgba(0,0,0,.45);
  overflow: hidden;
}
.ov-palette-panel input {
  width: 100%; border: 0; outline: 0; background: transparent;
  color: #e8eef7; padding: .75rem .9rem; font-size: .92rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.ov-palette-list { max-height: 320px; overflow: auto; }
.ov-palette-item {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .5rem .9rem; text-decoration: none; color: inherit;
  border-bottom: 1px solid rgba(255,255,255,.05);
  font-size: .85rem;
}
.ov-palette-item:hover, .ov-palette-item.active { background: rgba(45, 212, 168, .12); }
.ov-palette-label { font-weight: 600; }
.ov-palette-cat { font-size: .7rem; color: #8b9bb4; }
.ov-palette-empty { padding: .85rem .9rem; color: #8b9bb4; font-size: .85rem; }
.ov-palette-hint { padding: .45rem .9rem; font-size: .68rem; color: #6c7a91; border-top: 1px solid rgba(255,255,255,.06); }

/* Project workspace */
.ov-project-tabs .nav-link {
  white-space: nowrap;
  color: #c7d4ea;
  padding: .3rem .65rem;
  font-size: .78rem;
}
.ov-project-tabs .nav-link.active {
  background: #149a78;
  color: #fff;
}

.nav-pills .nav-link {
  padding: .3rem .65rem;
  font-size: .78rem;
}
