/* La Oficina: colores y medidas del diseño aprobado (diseno/oficina/Main.dc.html). */
:root {
  --teal: #0B4F5C;
  --teal-dark: #073741;
  --orange: #E25A0E;
  --bg: #F3F7F7;
  --surface: #FFFFFF;
  --text: #10272C;
  --muted: #4E6267;
  --line: #E3EAEB;
  --line-soft: #EEF2F3;
  --green: #146B43;
  --red: #B42318;
  --amber: #8A5A00;
  --amber-bg: #FFF9E8;
  --amber-line: #F2DE9E;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.4;
}
[hidden] { display: none !important; }
a { color: var(--teal); }
button, select { font: inherit; }
button:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.error { color: var(--red); font-weight: 600; }

/* Marca */
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: #fff url('favicon.svg') center / 26px no-repeat;
}
.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 17px; }
.brand-text span { font-size: 12px; color: #CFE6E9; }
.brand-dark .brand-icon { background-color: var(--teal); background-image: none; position: relative; }
.brand-dark .brand-icon::after { content: ''; position: absolute; inset: 5px; background: url('favicon.svg') center / contain no-repeat; }
.brand-dark .brand-text span { color: var(--muted); }

/* Ingreso */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 28px 24px; display: flex; flex-direction: column; gap: 12px;
}
.login-card h1 { margin: 8px 0 0; font-size: 22px; }
.login-card p { margin: 0; }
.google-button { min-height: 44px; margin-top: 8px; }

/* Estructura */
.app { display: flex; min-height: 100vh; }
.sidebar {
  flex: 0 0 240px; background: var(--teal); color: #fff; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh;
}
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  min-height: 44px; padding: 0 12px; border: none; border-radius: 10px; background: transparent;
  color: #fff; font-size: 15px; font-weight: 700; text-align: left; cursor: pointer;
}
.nav button:hover { background: rgba(255, 255, 255, 0.08); }
.nav button[aria-current='page'] { background: #fff; color: var(--teal); }
.badge { background: var(--orange); color: var(--text); font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 10px; }
.sidebar-foot { margin-top: auto; padding: 16px 8px 0; font-size: 12px; color: #CFE6E9; display: flex; flex-direction: column; gap: 6px; }
.env-badge { align-self: flex-start; background: rgba(255, 255, 255, 0.14); color: #fff; padding: 3px 8px; border-radius: 8px; font-weight: 700; }
.link-button { align-self: flex-start; background: none; border: none; color: #fff; padding: 8px 0; min-height: 44px; text-decoration: underline; cursor: pointer; }

.main { flex: 1; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; }
.header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.header h1 { margin: 0; font-size: 28px; letter-spacing: -0.5px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; }
.filters select {
  min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid #C9D6D8;
  background: var(--surface); font-size: 14px; color: var(--text);
}
.status { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--amber-bg); border: 1px solid var(--amber-line); color: #5B4A1F; }
.status.error-box { background: #FDECEA; border-color: #F5C2BD; color: var(--red); }
.content { display: flex; flex-direction: column; gap: 16px; }

/* Botones */
.button, .button-outline {
  min-height: 44px; padding: 0 16px; border-radius: 12px; font-weight: 800; cursor: pointer;
}
.button { border: none; background: var(--teal); color: #fff; }
.button-outline { border: 1px solid #C9D6D8; background: var(--surface); color: var(--text); font-weight: 700; }
.button:disabled, .button-outline:disabled { opacity: 0.5; cursor: default; }
.button-danger { border: 1px solid #F5C2BD; background: #FDECEA; color: var(--red); }

/* Tarjetas e indicadores */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.kpi-note { font-size: 12px; font-weight: 700; color: var(--muted); }
.row { display: flex; flex-wrap: wrap; gap: 16px; }
.card {
  flex: 1 1 340px; min-width: 0; background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 12px;
}
.card.wide { flex-basis: 460px; flex-grow: 2; }
.card h2 { margin: 0; font-size: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.card-note { font-size: 13px; color: var(--muted); }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.green { color: var(--green); }
.red { color: var(--red); }
.amber { color: var(--amber); }

/* Gráfico de barras por mes */
.chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; border-bottom: 1px solid var(--line); }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.chart-col span { font-size: 11px; color: var(--muted); }
.chart-bar { width: 100%; max-width: 34px; background: var(--teal); border-radius: 6px 6px 0 0; min-height: 2px; }
.chart-bar.last { background: var(--orange); }
.chart-labels { display: flex; gap: 8px; }
.chart-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }

/* Barras horizontales */
.hbar { display: flex; align-items: center; gap: 10px; }
.hbar-name { flex: 0 0 150px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { flex: 1; height: 10px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--teal); }
.hbar-value { flex: 0 0 64px; text-align: right; font-size: 14px; font-weight: 800; }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 620px; }
th { text-align: left; padding: 10px 12px; color: var(--muted); font-size: 12px; font-weight: 700; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
td.strong { font-weight: 700; }

/* Bandeja */
.inbox-item {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
}
.inbox-item.compact { border-color: var(--amber-line); background: var(--amber-bg); }
.inbox-text { flex: 1 1 320px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.inbox-text strong { font-size: 15px; }
.inbox-meta { font-size: 13px; color: var(--muted); }
.inbox-detail { font-size: 14px; overflow-wrap: anywhere; }
.inbox-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-block; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 8px; background: var(--line-soft); color: var(--muted); }

/* Secciones sin conectar */
.pending { border: 1px dashed #C9D6D8; background: var(--surface); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 8px; }
.pending h2 { margin: 0; font-size: 18px; }
.pending ul { margin: 0; padding-left: 20px; }

/* Celular: el menú pasa arriba y se desliza de costado */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { position: static; height: auto; flex: none; padding: 14px 16px; }
  .brand { padding-bottom: 10px; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .nav button { flex: none; width: auto; }
  .sidebar-foot { flex-direction: row; align-items: center; flex-wrap: wrap; padding-top: 8px; gap: 10px; }
  .main { padding: 16px; }
  .header h1 { font-size: 24px; }
  .hbar-name { flex-basis: 110px; }
}
