:root {
  --navy: #173653;
  --blue: #2d6f9f;
  --sky: #dcecf7;
  --gold: #b8953a;
  --green: #2f7d46;
  --amber: #d97706;
  --red: #bd2f2f;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --line: #dfe5eb;
  --muted: #667085;
  --text: #17212b;
  --soft: #eef2f5;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  min-height: 100%;
}
body {
  margin: 0;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}
a { color: inherit; }
.app-layout {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 100vh;
  margin: 0;
}
.sidebar {
  width: 232px;
  min-width: 232px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
}
.sidebar-logo { padding: 16px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-brand-logo {
  display: block;
  width: 148px;
  max-width: 100%;
  height: auto;
  max-height: 76px;
  object-fit: contain;
  object-position: left center;
  background: #fff;
  border-radius: 6px;
  padding: 6px;
  margin: 0 0 10px;
}
.sidebar-logo h1 { margin: 0 0 5px; font-size: 15px; line-height: 1.25; color: #fff !important; }
.sidebar-logo span { color: #a8c5da; font-size: 12px; }
.sidebar-nav { padding: 12px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 16px;
  border-left: 3px solid transparent;
  color: rgba(255,255,255,.78);
  text-decoration: none;
}
.nav-item:hover, .nav-item.active {
  color: #fff;
  background: rgba(255,255,255,.1);
  border-left-color: var(--gold);
}
.nav-item span:first-child { width: 18px; text-align: center; }
.nav-badge {
  margin-left: auto;
  min-width: 22px;
  text-align: center;
  border-radius: 99px;
  padding: 2px 7px;
  background: var(--gold);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.main-content {
  grid-column: 2;
  min-width: 0;
  width: 100%;
  max-width: none;
  display: flex;
  flex-direction: column;
}
.topbar {
  width: 100%;
  max-width: none;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-subtitle { margin-top: 2px; font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-pill {
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 10px;
  color: var(--muted);
  background: #fff;
}
.page-content {
  padding: 24px 32px 32px 24px;
  flex: 1;
  width: 100%;
  max-width: none;
}
.page-grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: minmax(0, 1fr) 360px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
h2, h3 { margin: 0; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { line-height: 1.5; }
.muted { color: var(--muted); }
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.metric-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}
.metric-label { color: var(--muted); font-size: 12px; margin-bottom: 6px; }
.metric-value { color: var(--navy); font-size: 28px; font-weight: 800; }
.metric-delta { color: var(--green); font-size: 12px; margin-top: 5px; }
.toolbar {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.field { display: grid; gap: 6px; min-width: 160px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 9px 10px;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 14px;
  background: #fff;
  color: var(--text);
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--soft); }
.btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--blue); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-lg { min-height: 44px; padding: 11px 20px; font-size: 15px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.badge-blue { background: var(--sky); color: #174c75; }
.badge-green { background: #e4f4e9; color: var(--green); }
.badge-amber { background: #fff2d8; color: var(--amber); }
.badge-red { background: #fde7e7; color: var(--red); }
.badge-gray { background: #eef1f4; color: var(--muted); }
.bando-list { display: grid; gap: 10px; }
.bando-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.bando-card:hover { border-color: var(--blue); }
.score-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #9aa5b1;
  color: #667085;
  background: #f5f6f7;
  font-weight: 800;
}
.score-alto { border-color: var(--green); color: var(--green); background: #e9f7ee; }
.score-medio { border-color: var(--amber); color: var(--amber); background: #fff6e8; }
.bando-title { font-weight: 750; margin-bottom: 6px; }
.meta-row { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin: 8px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.kanban-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(180px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-col {
  background: #eef2f5;
  border-radius: 8px;
  padding: 10px;
  min-height: 420px;
}
.kanban-col-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 10px;
}
.kanban-card {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 10px;
  margin-bottom: 8px;
  cursor: grab;
}
.kanban-card-title { font-weight: 700; font-size: 12px; margin-bottom: 6px; }
.kanban-card-sub { color: var(--muted); font-size: 11px; }
.document-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  min-height: 360px;
  overflow-wrap: break-word;
  line-height: 1.55;
}
.document-preview h1, .document-preview h2 { color: var(--navy); }
.briefing-page { align-items: start; }
.briefing-toolbar {
  align-items: center;
  margin-bottom: 16px;
}
.briefing-preview {
  width: 100%;
  margin: 0;
  color: var(--text);
}
.briefing-preview h1 {
  display: none;
}
.briefing-preview h2 {
  font-size: 16px;
  line-height: 1.25;
  margin: 20px 0 10px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
  color: var(--navy);
}
.briefing-preview h2:first-child {
  margin-top: 0;
}
.briefing-preview h3 {
  font-size: 14px;
  margin: 16px 0 6px;
  color: var(--text);
}
.briefing-preview p,
.briefing-preview li {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.briefing-preview ul {
  margin: 8px 0 14px;
  padding-left: 20px;
}
.briefing-preview table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 18px;
  background: #fff;
}
.briefing-preview th,
.briefing-preview td {
  border: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}
.briefing-preview th {
  background: #f7f9fb;
  color: var(--muted);
}
.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: #f7f9fb; color: var(--muted); font-size: 12px; }
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid #d4dbe2;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state {
  border: 1px dashed #c6d0d9;
  background: #fff;
  border-radius: 8px;
  padding: 26px;
  text-align: center;
  color: var(--muted);
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 12px 34px rgba(0,0,0,.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: .2s ease;
  z-index: 20;
}
.toast.show { opacity: 1; transform: translateY(0); }
.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15,25,35,.48);
  z-index: 30;
}
.modal-backdrop.hidden { display: none; }
.modal {
  position: relative;
  width: min(840px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 24px;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 28px;
  cursor: pointer;
}
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #173653 0%, #2d6f9f 100%);
  padding: 20px;
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
.login-logo {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  margin: 0 auto 18px;
}
.login-card h1 { margin: 0 0 6px; color: var(--navy); font-size: 24px; }
.login-card p { margin: 0 0 20px; color: var(--muted); }
.alert {
  border-radius: 7px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.alert-error { background: #fde7e7; color: var(--red); }
.alert-ok { background: #e4f4e9; color: var(--green); }
@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { min-width: 0; }
  .app-layout { display: block; }
  .sidebar { width: 100%; }
  .sidebar-nav { display: grid; grid-template-columns: repeat(2, 1fr); }
  .topbar { height: auto; padding: 14px; align-items: flex-start; }
  .page-content { padding: 14px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .bando-card { grid-template-columns: 1fr; }
}
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .toolbar, .actions, .btn, .toast { display: none !important; }
  .page-content { padding: 0; }
  .document-preview { border: 0; padding: 0; }
}
