:root {
  --navy: #05294b;
  --navy-2: #0a3a66;
  --yellow: #fec001;
  --ink: #0e1a24;
  --muted: #5b6b7a;
  --bg: #f4f6f8;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

.app-sidebar {
  width: 250px;
  background: linear-gradient(180deg, var(--navy) 0%, #03172c 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.9rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  z-index: 20;
}

.app-sidebar nav {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}

.brand:hover { color: var(--yellow); }

.app-sidebar .nav-link {
  color: rgba(255,255,255,0.78);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
}

.app-sidebar .nav-link i {
  margin-right: 0.4rem;
}

html { scroll-behavior: smooth; }

.manual-toc {
  top: 1rem;
  z-index: 8;
}
.manual-toc-link {
  display: block;
  color: var(--navy);
  text-decoration: none;
  padding: 0.4rem 0.55rem;
  border-radius: 0.45rem;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}
.manual-toc-link:hover,
.manual-toc-link:focus {
  background: rgba(254, 192, 1, 0.18);
  color: var(--navy);
  border-left-color: var(--yellow);
}
.manual-section {
  scroll-margin-top: 1rem;
}
.manual-section h2 {
  font-weight: 700;
}

.sidebar-user {
  margin-top: auto;
  padding: 0.9rem 0.4rem 0.2rem;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.app-main {
  flex: 1;
  padding: 1.5rem 1.75rem 2.5rem;
  position: relative;
  min-width: 0;
}

.page-title {
  font-weight: 700;
  color: var(--navy);
}

.kpi {
  background: #fff;
  border: 0;
  border-radius: 0.9rem;
  box-shadow: 0 8px 24px rgba(5, 41, 75, 0.06);
}

.kpi .kpi-label {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi .kpi-value {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy);
}

.card-soft {
  background: #fff;
  border: 0;
  border-radius: 0.9rem;
  box-shadow: 0 8px 24px rgba(5, 41, 75, 0.06);
}

.badge-folio {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.78rem;
  background: var(--yellow);
  color: var(--navy);
}

.table-landed th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  white-space: nowrap;
}

.delta-up { color: #b02a37; font-weight: 600; }
.delta-down { color: #146c43; font-weight: 600; }

.btn-navy {
  background: var(--navy);
  color: #fff;
  border: 0;
}

.btn-navy:hover { background: var(--navy-2); color: #fff; }

.btn-yellow {
  background: var(--yellow);
  color: var(--navy);
  font-weight: 600;
  border: 0;
}

.page-login {
  min-height: 100vh;
  margin: 0;
  background: linear-gradient(160deg, #05294b 0%, #03172c 55%, #0a3a66 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}
.page-login #crmToast { z-index: 50; }
.login-shell { width: 100%; max-width: 420px; }
.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: #fff;
  margin-bottom: 1.25rem;
}
.login-kicker {
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  opacity: 0.75;
}
.login-card {
  border: 0;
  border-radius: 1rem;
  padding: 1.35rem 1.4rem 1.25rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.btn-nav-toggle {
  position: fixed;
  top: 0.7rem;
  left: 0.7rem;
  z-index: 30;
  background: var(--navy);
  color: var(--yellow);
}

#crmToast {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 40;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }
  .app-sidebar.open { transform: none; }
  .app-main { padding: 3.4rem 1rem 2rem; }
}

.table-responsive { -webkit-overflow-scrolling: touch; }

.pipeline-wrap { display: flex; flex-direction: column; gap: 1.25rem; }
.fase-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 0.5rem;
}
.fase-title span { color: var(--muted); font-weight: 500; font-size: 0.8rem; }
.kanban-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}
.kanban-col {
  flex: 0 0 230px;
  background: #e8eef4;
  border-radius: 0.85rem;
  padding: 0.65rem;
  min-height: 180px;
}
.kanban-col-h {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 0.25rem;
}
.kanban-col-h .count {
  background: var(--navy);
  color: #fff;
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.72rem;
}
.kanban-col-b { display: flex; flex-direction: column; gap: 0.45rem; }
.kanban-card {
  display: block;
  position: relative;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.65rem 0.7rem;
  box-shadow: 0 4px 12px rgba(5, 41, 75, 0.06);
  color: inherit;
  text-decoration: none;
}
.kanban-card-link {
  display: block;
  color: inherit;
  text-decoration: none;
}
.kanban-card-menu {
  position: absolute;
  top: 0.35rem;
  right: 0.3rem;
  z-index: 6;
}
.op-row-actions .btn {
  font-size: 0.75rem;
}
.btn-card-more {
  border: 0;
  background: transparent;
  color: var(--navy);
  line-height: 1;
  padding: 0.1rem 0.25rem;
}
.btn-card-more:hover, .btn-card-more:focus {
  background: #e8eef4;
  color: var(--navy);
}
.kanban-card:hover { outline: 2px solid var(--yellow); }
.kanban-card.is-overdue {
  border-left: 4px solid #b02a37;
  background: #fff5f5;
}
.kanban-card.is-blocked {
  border-left: 4px solid #c9a227;
  background: #fff8e1;
}
.badge-alert {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  white-space: nowrap;
}
.badge-alert.overdue { background: #b02a37; color: #fff; }
.badge-alert.blocked { background: var(--yellow); color: var(--navy); }
.badge-eval {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  background: #fff3cd;
  color: #664d03;
  white-space: nowrap;
}
.badge-cat {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  background: #d9e2ec;
  color: var(--navy);
  white-space: nowrap;
}
.col-alert {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  font-size: 0.68rem;
  color: #b02a37;
  margin-bottom: 0.4rem;
  line-height: 1.2;
}
.empty-col { font-size: 0.78rem; color: var(--muted); padding: 0.4rem; }
.row-overdue { background: #fff5f5; }
.row-blocked { background: #fff8e1; }
.kpi-alert { outline: 2px solid #b02a37; }
.kpi-warn { outline: 2px solid var(--yellow); }
.st-badge {
  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
}
.st-pending { background: #d9e2ec; color: var(--navy); }
.st-in_progress { background: var(--navy); color: #fff; }
.st-completed { background: #146c43; color: #fff; }
.st-blocked { background: var(--yellow); color: var(--navy); }
.progress { height: 6px; background: #d9e2ec; }
.progress-bar { background: var(--navy); }
.sheet-table input, .sheet-table select {
  min-width: 4.5rem;
  font-variant-numeric: tabular-nums;
}
.sheet-table td { white-space: nowrap; }
.delta-cell { font-variant-numeric: tabular-nums; }

.doc-list { display: flex; flex-direction: column; gap: 0.45rem; }
.doc-item {
  display: block;
  width: 100%;
  text-align: left;
  background: #f4f6f8;
  border: 0;
  border-radius: 0.65rem;
  padding: 0.7rem 0.8rem;
  color: inherit;
}
.doc-item:hover { outline: 2px solid var(--yellow); }
.doc-item.is-active {
  background: #fff;
  outline: 2px solid var(--navy);
}
.doc-preview {
  width: 100%;
  min-height: 480px;
  border: 0;
  background: #e8eef4;
  border-radius: 0.5rem;
}
.doc-preview-img {
  max-width: 100%;
  max-height: 520px;
  display: block;
  margin: 0 auto;
  border-radius: 0.5rem;
}
.dash-chart { position: relative; min-height: 280px; }
.dash-tooltip {
  position: absolute;
  top: 8px;
  right: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: 0.4rem;
}
