:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --ink: #1a2332;
  --muted: #5c6b7a;
  --line: #d8dee6;
  --brand: #0b3d5c;
  --brand-2: #1a6b9a;
  --accent: #c45c26;
  --success: #1f7a4c;
  --warning: #b86e00;
  --danger: #b42318;
  --info: #1a6b9a;
  --shadow: 0 1px 2px rgba(26, 35, 50, 0.06), 0 8px 24px rgba(26, 35, 50, 0.06);
  --radius: 10px;
  --font: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --ok: var(--success);
  --warn: var(--warning);
  --bad: var(--danger);
  --idle: var(--muted);
  --navy: var(--brand);
  --copper: var(--accent);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(26, 107, 154, 0.12), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(196, 92, 38, 0.08), transparent 55%),
    var(--bg);
  min-height: 100vh;
  font-size: 15px;
}

a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, .serif { font-family: var(--font); letter-spacing: 0; font-weight: 700; }

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

.sidebar {
  width: 250px;
  background: linear-gradient(180deg, #0b1222 0%, #006575 100%);
  color: #e8eef3;
  padding: 1.25rem 1rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.brand,
.brand-title {
  font-family: var(--font);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0 0 0.25rem;
  line-height: 1.25;
}
.brand-sub,
.brand-kicker {
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
  color: #d7e4ee;
  opacity: 0.7;
  margin: 0 0 1.5rem;
}
.sidebar .nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #d7e4ee;
  opacity: 0.55;
  margin: 1rem 0.75rem 0.4rem;
}
.sidebar nav a,
.sidebar a {
  display: block;
  color: #d7e4ee;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.2rem;
  text-decoration: none;
  font-size: 0.92rem;
}
.sidebar nav a:hover,
.sidebar nav a.active,
.sidebar a:hover,
.sidebar a.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  box-shadow: none;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1.5rem;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .user-meta { text-align: right; font-size: 0.9rem; }
.topbar .user-meta strong { font-weight: 700; }
.topbar .user-meta .muted { color: var(--muted); font-size: 0.8rem; }
.topbar .user-meta a { color: var(--brand-2); }

.content {
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.content > .d-flex.justify-content-between {
  align-items: flex-start;
  gap: 1rem;
}

.page-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 0.3rem;
  font-weight: 600;
}
.page-title {
  margin: 0 0 0.35rem;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
}
.lede,
.page-sub {
  margin: 0 0 1.25rem;
  color: var(--muted);
  max-width: 46rem;
}

.card-vat,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}
.kpi,
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  border-left: none;
}
.kpi .label,
.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.kpi .value,
.stat .value {
  font-family: var(--font);
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 0.2rem;
  color: var(--brand);
}

.btn,
.btn-copper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  flex: 0 0 auto;
  width: auto;
  max-width: max-content;
  height: auto;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.5rem 0.9rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}
.btn.w-100,
.btn-copper.w-100 {
  width: 100%;
  max-width: none;
}
.btn:hover,
.btn-copper:hover {
  filter: brightness(1.08);
  text-decoration: none;
  color: #fff;
  background: var(--brand);
}
.btn-ghost,
.btn-secondary {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover,
.btn-secondary:hover {
  color: var(--ink);
  background: #f7f9fb;
  filter: none;
}
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

.table-vat,
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.table-vat th,
.table-vat td,
table.data th,
table.data td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table-vat th,
table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.table-vat tr:hover td,
table.data tr:hover td { background: #f8fafc; }

.badge-stage,
.badge-status,
.pill {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #e8eef3;
  color: var(--brand);
}
.st-green, .status-green, .pill-success { background: #e8f6ee; color: var(--success); }
.st-amber, .status-amber, .pill-warning { background: #fff6e5; color: var(--warning); }
.st-red, .status-red, .pill-danger { background: #fdeceb; color: var(--danger); }
.st-grey, .status-grey { background: #e8eef3; color: var(--brand); }
.q-quick_wins { background: #e8f6ee; color: var(--success); }
.q-big_bets { background: #e8f3fa; color: var(--brand); }
.q-fill_ins { background: #fff6e5; color: var(--warning); }
.q-money_pits { background: #fdeceb; color: var(--danger); }

.kanban { display: grid; grid-template-columns: repeat(6, minmax(180px, 1fr)); gap: 0.7rem; overflow-x: auto; }
.kanban-col {
  background: #eef2f6;
  border-radius: var(--radius);
  padding: 0.7rem;
  min-height: 220px;
  border: 1px solid var(--line);
}
.kanban-col h3 { font-size: 0.85rem; margin: 0 0 0.6rem; font-weight: 700; }
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
  margin-bottom: 0.5rem;
  display: block;
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow);
}
.kanban-card:hover { border-color: var(--brand-2); text-decoration: none; color: inherit; }
.kanban-card.is-selected { border-color: var(--accent); }

.pipeline-board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 1rem;
  align-items: start;
}
.pipeline-panel { position: sticky; top: 1rem; }
.pipeline-meta { margin: 0 0 1rem; }
.pipeline-meta dt { font-size: 0.75rem; color: var(--muted); margin-top: 0.5rem; }
.pipeline-meta dd { margin: 0; }

@media (max-width: 1100px) {
  .pipeline-board-layout { grid-template-columns: 1fr; }
  .pipeline-panel { position: static; }
}

.matrix { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 0.8rem; min-height: 420px; }
.quad {
  border-radius: var(--radius);
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.quad h3 { margin-top: 0; font-size: 1.05rem; }
.bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  margin: 0.25rem;
  padding: 0.35rem 0.55rem;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
}
.opportunity-chart {
  position: relative;
  height: 420px;
}

.login-page,
.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(26, 107, 154, 0.12), transparent 60%),
    radial-gradient(900px 400px at 100% 0%, rgba(196, 92, 38, 0.08), transparent 55%),
    var(--bg);
}
.auth-left { display: none; }
.auth-right { width: 100%; display: flex; justify-content: center; }
.login-card,
.auth-card {
  width: min(440px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
.login-card h1,
.auth-card h2 {
  margin: 0 0 0.25rem;
  color: var(--brand);
  font-size: 1.5rem;
  font-weight: 700;
}
.login-card .tagline { color: var(--muted); margin: 0 0 1.25rem; font-size: 0.95rem; }

.form-label { font-weight: 600; font-size: 0.85rem; color: var(--ink); }
.form-control,
.form-select,
.form-control:focus,
.form-select:focus {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
  box-shadow: none;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 0.2rem rgba(26, 107, 154, 0.15);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
}
.alert-success { background: #e8f6ee; color: var(--success); border-color: #b7e0c7; }
.alert-danger { background: #fdeceb; color: var(--danger); border-color: #f3c1bd; }
.alert-warning { background: #fff6e5; color: var(--warning); border-color: #f0d4a0; }
.alert-info { background: #e8f3fa; color: var(--info); border-color: #b7d7ea; }

.pagination .page-link { color: var(--brand); border-color: var(--line); }
.pagination .active .page-link,
.pagination .page-item.active .page-link {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.headline {
  font-family: var(--font);
  font-style: normal;
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 0.9rem;
  margin: 0.4rem 0 1.2rem;
}

.nav-tabs { border-bottom-color: var(--line); }
.nav-tabs .nav-link { color: var(--muted); }
.nav-tabs .nav-link.active {
  color: var(--brand);
  border-color: var(--line) var(--line) #fff;
  font-weight: 600;
}

.topbar .form-select-sm {
  min-width: 220px;
  width: auto;
  font-size: 0.85rem;
}

@media (max-width: 900px) {
  .shell, .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .content { padding: 1rem; }
  .kanban { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
}

.suggest { position: relative; }
.suggest .form-control {
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235c6b7a' d='M1.4.8 6 5.4 10.6.8 12 2.2 6 8.2 0 2.2z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.7rem center;
  background-size: 10px 7px;
}
.suggest-list {
  position: absolute;
  z-index: 30;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  margin: 0;
  padding: 0.3rem 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.suggest-list[hidden] { display: none; }
.suggest-option {
  display: block;
  width: 100%;
  padding: 0.4rem 0.75rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.suggest-option:hover,
.suggest-option.is-active {
  background: #e8f3fa;
  color: var(--brand);
}
.suggest-option.is-new {
  color: var(--muted);
  font-style: italic;
}
.suggest-empty {
  padding: 0.45rem 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
