/* ============================================================================
   IDEA — Executive Search · Sistema de diseño
   Identidad: "dossier de consultora" — tinta navy, papel frío, acento latón.
   Display: Fraunces (serif) · UI: Inter · Datos/registro: IBM Plex Mono.
   ========================================================================== */

:root {
  --ink:        #14213A;   /* tinta navy: estructura, texto principal */
  --ink-2:      #2B3A57;
  --ink-soft:   #55617A;
  --muted:      #7A8399;
  --paper:      #F4F5F7;   /* fondo frío (no cream) */
  --surface:    #FFFFFF;
  --surface-2:  #FAFBFC;
  --line:       #E4E7EC;
  --line-strong:#D3D8E0;
  --brass:      #9A7B3F;   /* acento: sello / firma / activo */
  --brass-deep: #7E6431;
  --brass-tint: #F3ECDD;
  --danger:     #9B2C2C;
  --danger-tint:#F7EBEB;
  --warn:       #8A6D1F;
  --warn-tint:  #FBF3DC;
  --ok:         #2F5D50;
  --ok-tint:    #E7F0EC;

  --radius:     10px;
  --radius-sm:  7px;
  --shadow-sm:  0 1px 2px rgba(20,33,58,.06);
  --shadow:     0 6px 24px -12px rgba(20,33,58,.28);
  --sidebar-w:  256px;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono:  "IBM Plex Mono", "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brass-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 560; color: var(--ink); margin: 0 0 .4em; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.08rem; }
p { margin: 0 0 1em; }
small { color: var(--muted); }
code, .mono { font-family: var(--mono); }

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

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink);
  color: #C9D2E3;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand .wordmark {
  font-family: var(--serif);
  font-size: 1.5rem; color: #fff; letter-spacing: .02em; font-weight: 600;
  display: flex; align-items: baseline; gap: 8px;
}
.brand .wordmark .dot { color: var(--brass); }
.brand .tagline { font-size: .72rem; color: #8A94A9; letter-spacing: .14em; text-transform: uppercase; margin-top: 4px; }

.nav { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav .group-label { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: #6B7794; margin: 16px 12px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 12px; margin: 1px 0; border-radius: var(--radius-sm);
  color: #C4CDDE; font-size: .9rem; text-decoration: none;
  transition: background .12s, color .12s;
}
.nav a .ic { width: 17px; height: 17px; opacity: .8; flex: 0 0 17px; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: rgba(154,123,63,.18); color: #fff; box-shadow: inset 2px 0 0 var(--brass); }

.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .8rem; }
.sidebar-foot .who { color: #fff; font-weight: 500; }
.sidebar-foot .role { color: var(--brass); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-foot a { color: #8A94A9; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar .crumbs { font-size: .82rem; color: var(--muted); }
.topbar .crumbs a { color: var(--ink-soft); }
.content { padding: 30px 32px 64px; max-width: 1180px; width: 100%; }

/* ---- Page header -------------------------------------------------------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { font-size: .7rem; letter-spacing: .18em; text-transform: uppercase; color: var(--brass-deep); font-weight: 600; margin-bottom: 6px; }
.page-head p.lead { color: var(--ink-soft); max-width: 62ch; margin: 4px 0 0; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  font-family: var(--sans); font-size: .88rem; font-weight: 500;
  padding: 8px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  transition: transform .04s, background .12s, box-shadow .12s; text-decoration: none;
}
.btn:hover { background: var(--ink-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn.brass { background: var(--brass); border-color: var(--brass); }
.btn.brass:hover { background: var(--brass-deep); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); }
.btn.sm { padding: 5px 11px; font-size: .8rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---- Cards & grid ------------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 22px;
}
.card + .card { margin-top: 18px; }
.card h3 { margin-bottom: 14px; }
.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.stack > * + * { margin-top: 14px; }

/* ---- Metric cards ------------------------------------------------------- */
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.metric .n { font-family: var(--serif); font-size: 2.1rem; font-weight: 600; color: var(--ink); line-height: 1; }
.metric .l { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-top: 8px; }
.metric.flag .n { color: var(--brass-deep); }

/* ---- Tables ------------------------------------------------------------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { text-align: left; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
td .mono, .id-chip { font-family: var(--mono); font-size: .8rem; color: var(--muted); }

/* ---- Badges / chips ----------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: .74rem; font-weight: 500; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-soft); background: var(--surface-2); white-space: nowrap; }
.badge.brass { background: var(--brass-tint); border-color: #E4D6B8; color: var(--brass-deep); }
.badge.ok { background: var(--ok-tint); border-color: #C9DED6; color: var(--ok); }
.badge.warn { background: var(--warn-tint); border-color: #ECDBA6; color: var(--warn); }
.badge.muted { background: var(--surface-2); }
.badge.ink { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---- Forms -------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
label { font-size: .8rem; font-weight: 500; color: var(--ink-2); }
label .req { color: var(--brass-deep); }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], select, textarea {
  font-family: var(--sans); font-size: .9rem; color: var(--ink);
  padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); width: 100%;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brass); outline-offset: 0; border-color: var(--brass); }
.hint { font-size: .76rem; color: var(--muted); }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ---- Flash -------------------------------------------------------------- */
.flashes { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.flash { padding: 11px 16px; border-radius: var(--radius-sm); font-size: .88rem; border: 1px solid; display: flex; gap: 10px; align-items: center; }
.flash.ok { background: var(--ok-tint); border-color: #C9DED6; color: var(--ok); }
.flash.error { background: var(--danger-tint); border-color: #E6C9C9; color: var(--danger); }
.flash.warn { background: var(--warn-tint); border-color: #ECDBA6; color: var(--warn); }

/* ---- Definition lists / key-value -------------------------------------- */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; font-size: .9rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); }

/* ---- 9-step spine (SIGNATURE ELEMENT) ---------------------------------- */
.spine { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 10px; }
.spine .step {
  flex: 1; min-width: 92px; position: relative; text-align: center; padding: 0 4px;
}
.spine .step .marker {
  width: 34px; height: 34px; border-radius: 50%; margin: 0 auto 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: .82rem; font-weight: 500;
  background: var(--surface); border: 1.5px solid var(--line-strong); color: var(--muted);
  position: relative; z-index: 2;
}
.spine .step::before {
  content: ""; position: absolute; top: 17px; left: -50%; width: 100%; height: 1.5px;
  background: var(--line-strong); z-index: 1;
}
.spine .step:first-child::before { display: none; }
.spine .step.done .marker { background: var(--ink); border-color: var(--ink); color: #fff; }
.spine .step.done::before { background: var(--ink); }
.spine .step.current .marker { background: var(--brass); border-color: var(--brass); color: #fff; box-shadow: 0 0 0 4px var(--brass-tint); }
.spine .step.current::before { background: var(--ink); }
.spine .step .lbl { font-size: .72rem; color: var(--ink-soft); line-height: 1.25; }
.spine .step .gate { font-size: .62rem; color: var(--brass-deep); text-transform: uppercase; letter-spacing: .06em; margin-top: 3px; }
.spine .step.current .lbl { color: var(--ink); font-weight: 600; }

/* ---- Compliance / rules callout ---------------------------------------- */
.rule-note {
  border-left: 3px solid var(--brass); background: var(--brass-tint);
  padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .84rem; color: var(--brass-deep);
}
.rule-note strong { color: var(--brass-deep); }
.seal { display:inline-flex; align-items:center; gap:6px; font-size:.76rem; color: var(--brass-deep); font-weight:500; }

/* ---- Timeline (audit) --------------------------------------------------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: .86rem; }
.timeline li .t { font-family: var(--mono); font-size: .76rem; color: var(--muted); flex: 0 0 130px; }
.timeline li .a { font-weight: 500; }

/* ---- Login -------------------------------------------------------------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-aside { background: var(--ink); color: #fff; padding: 56px 52px; display: flex; flex-direction: column; justify-content: space-between; }
.login-aside .wordmark { font-family: var(--serif); font-size: 2.2rem; font-weight: 600; }
.login-aside .wordmark .dot { color: var(--brass); }
.login-aside .pitch { font-family: var(--serif); font-size: 1.75rem; line-height: 1.3; font-weight: 400; max-width: 18ch; margin-top: auto; }
.login-aside .method { margin-top: 22px; font-size: .82rem; color: #A9B3C7; }
.login-aside .method b { color: var(--brass); font-weight: 500; }
.login-main { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--paper); }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 1.5rem; }
.demo-creds { margin-top: 22px; font-size: .78rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.demo-creds code { color: var(--ink); }

/* ---- Utilities ---------------------------------------------------------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; }
.divider { height: 1px; background: var(--line); margin: 20px 0; border: none; }
.prewrap { white-space: pre-wrap; }
.text-serif { font-family: var(--serif); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .big { font-family: var(--serif); font-size: 1.2rem; color: var(--ink-soft); margin-bottom: 6px; }
.inline-form { display: inline; }

/* ---- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex !important; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .form-grid, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 8px; }
}
.menu-toggle { display: none; align-items: center; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }
