/* Tema «menta» de Portal Autónomo: mismos colores, tipografías y componentes
   (panel, botón primario/secundario, badge, tabla). Las fuentes se sirven
   desde /fonts para no depender de terceros. */
@font-face { font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url('/fonts/manrope-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-display: swap; font-weight: 200 800;
  src: url('/fonts/manrope-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 300 700;
  src: url('/fonts/space-grotesk-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-display: swap; font-weight: 300 700;
  src: url('/fonts/space-grotesk-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  --bg: #090e0d; --ink: #edf7f3; --ink-secondary: #c1d2ca; --muted: #a2b5ae; --placeholder: #90a89e;
  --line: #293a38; --accent-border: #456764;
  --surface: #121c1b; --surface-raised: #1a2625; --surface-hover: #233533; --panel-start: #182321;
  --field: #0c1412; --field-border: #3d5650; --head: #101e15;
  --mint: #73e8cc; --mint-top: #7bead2; --mint-bottom: #63d8bf; --mint-hover: #9ff7dc; --mint-soft: #1c2928; --on-accent: #121c1b;
  --feature-start: #22362a; --feature-end: #141f18;
  --warn: #f0c77a; --warn-bg: #342a1b; --warn-border: #76603e; --warn-ink: #f3d59a;
  --danger: #ffada8;
  --shadow: inset 0 1px #edfff509, 0 8px 24px #00000018;
  --display: 'Space Grotesk', 'Manrope', system-ui, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink); background: var(--bg); color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-size: 16px; line-height: 1.6; -webkit-font-smoothing: antialiased;
  background: radial-gradient(ellipse at 65% 0%, #45686414, transparent 65%), var(--bg); min-height: 100dvh; }
button, input, select, textarea { font: inherit; }
button, a, summary { transition: background .15s, border-color .15s, color .15s; }
a { color: var(--mint); text-decoration: none; }
a:hover { text-decoration: underline; }
p { color: var(--ink-secondary); margin: 10px 0 18px; }
strong, b { font-weight: 600; }
code, pre, .mono, kbd { font-family: var(--mono); }
:is(button, a, summary, input, select, textarea):focus-visible { outline: 2px solid var(--mint); outline-offset: 3px; }
h1, h2, h3, .brand strong, .stat b { font-family: var(--display); font-weight: 500; line-height: 1.2; }
h1 { font-size: 1.65rem; letter-spacing: -.7px; margin: 0; }
h2 { font-size: 1.25rem; margin: 0 0 14px; }

/* ---------------------------------------------------------------- marca */
.brand { display: flex; gap: 10px; align-items: center; color: var(--ink); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark { flex-shrink: 0; width: 40px; height: 40px; display: grid; place-items: center; line-height: 0;
  color: var(--mint); border: 1px solid var(--line); border-radius: 12px;
  background: linear-gradient(150deg, #2a4337, #101714); box-shadow: inset 0 1px 0 #ffffff08; }
.brand-mark svg { display: block; width: 26px; height: 26px; }
.brand strong { display: block; font-size: 18px; white-space: nowrap; }
.brand small { display: block; font: 700 9px 'Manrope', sans-serif; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

/* ------------------------------------------------------------ estructura */
.topbar { position: sticky; top: 0; z-index: 10; background: #0e1414ed; backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); }
.topbar-row { max-width: 1100px; margin: 0 auto; min-height: 64px; padding: 10px 24px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.spacer { flex: 1; }
.userbox { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); min-width: 0; }
.userbox > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 26px 24px 12px; }
.heading { margin-bottom: 19px; }
.heading p { margin: 6px 0 0; font-size: 14px; color: var(--muted); max-width: 70ch; }

.card { background: linear-gradient(135deg, var(--panel-start), var(--surface)); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 23px; margin-bottom: 18px; }
.lead { color: var(--ink-secondary); font-size: 14px; margin: 0 0 14px; max-width: 70ch; }
.small, small { font-size: 13px; color: var(--muted); }
.eyebrow { display: block; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 8px; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row + .row { margin-top: 12px; }

/* ------------------------------------------------------------- controles */
input[type="url"], input[type="text"], input[type="email"], textarea, select {
  background: var(--field); border: 1px solid var(--field-border); color: inherit; border-radius: 8px; padding: 10px 12px; min-width: 0; font-size: 14px; }
input::placeholder, textarea::placeholder { color: var(--placeholder); }
input[type="url"], textarea { width: 100%; font-family: var(--mono); font-size: 13px; }
textarea { min-height: 104px; resize: vertical; }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--mint); vertical-align: middle; }
select { min-height: 43px; max-width: 100%; }

button { cursor: pointer; display: inline-flex; justify-content: center; align-items: center; gap: 8px; border-radius: 8px;
  padding: 10px 15px; font-size: 14px; font-weight: 600; white-space: nowrap; border: 1px solid var(--accent-border);
  background: linear-gradient(180deg, #253230, #1a2725); color: var(--ink-secondary); }
button:hover { background: var(--surface-hover); color: var(--ink); }
button.primary { color: var(--on-accent); border-color: #acffdf55; background: linear-gradient(180deg, var(--mint-top), var(--mint-bottom));
  box-shadow: inset 0 1px #ffffff30, 0 4px 12px #00000020; }
button.primary:hover { background: var(--mint-hover); color: var(--on-accent); }
button.sm { padding: 6px 10px; font-size: 12px; }
button.link { background: none; border: 0; color: var(--mint); padding: 4px; font-weight: 500; }
button.link:hover { background: none; text-decoration: underline; color: var(--mint); }
button:disabled { opacity: .5; cursor: wait; }

.status { font-size: 14px; color: var(--muted); min-height: 22px; margin: 0; }
.status.err { color: var(--danger); }
.status.ok { color: var(--mint); }

.pill { display: inline-flex; align-items: center; padding: 3px 9px; border: 1px solid #3b524a; border-radius: 6px;
  font-size: 12px; white-space: nowrap; color: var(--ink-secondary); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pill.ok { background: #203c2c; color: #a1e7bd; border-color: #426b50; }
.pill.warn { background: #332b1d; color: var(--warn); border-color: #655535; }

.steps { margin: 10px 0 14px; padding-left: 22px; color: var(--ink-secondary); font-size: 14px; }
.steps li { margin: 5px 0; }
kbd { background: var(--surface-raised); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; font-size: 12px; color: var(--ink); }
.warnbox { border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--warn-ink); border-radius: 9px; padding: 13px 17px; margin-top: 14px; font-size: 14px; }
.warnbox .steps { color: var(--warn-ink); }
.warnbox ul { margin: 6px 0 0; padding-left: 18px; }
.warnbox a { color: inherit; text-decoration: underline; }
.help { padding: 13px 15px; background: var(--mint-soft); border-left: 2px solid var(--accent-border); border-radius: 0 8px 8px 0; color: var(--ink-secondary); font-size: 14px; }

/* ----------------------------------------------------------------- tabla */
.toolbar { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.toolbar label { font-size: 13px; color: var(--muted); }
.tablewrap { overflow-x: auto; margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--head); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-hover); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.grow { white-space: normal; width: 100%; }
td.actions { text-align: right; }
td.actions button { margin-left: 4px; }
tr.focus td { background: var(--mint-soft); box-shadow: inset 0 1px var(--accent-border), inset 0 -1px var(--accent-border); }
/* max-width:0 evita que las líneas largas del HH ensanchen la tabla */
tr.preview td, tbody tr.preview:hover td { background: var(--field); white-space: normal; padding: 0; max-width: 0; }
tr.preview pre { margin: 0; padding: 14px 16px; font-size: 12.5px; line-height: 1.55; color: var(--ink-secondary); white-space: pre-wrap; overflow-wrap: anywhere; }
.dim { color: var(--muted); }

/* ---------------------------------------------------------------- acceso */
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at top, #14362c 0, transparent 65%); }
.login-card { width: min(100%, 440px); padding: 36px; margin: 0; text-align: center; }
.login-card .brand { justify-content: center; margin-bottom: 36px; text-align: left; }
.login-card .brand strong { font-size: 22px; }
.login-card h1 { font-size: 30px; line-height: 1.2; letter-spacing: -1px; margin-bottom: 12px; display: flex; flex-direction: column; align-items: center; }
.login-card > p { color: var(--muted); margin: 0 0 24px; text-wrap: balance; }
/* El botón es de Google (iframe): se centra y se evita que herede el modo oscuro. */
#gbtn { display: flex; justify-content: center; min-height: 44px; color-scheme: light; }
.login-card .status { margin-top: 14px; }
.login-card .status:empty { display: none; }
.login-card .row { justify-content: center; margin-top: 14px; }
.login-card .row input { flex: 1; }
.login-foot { display: block; margin-top: 18px; font-size: 12px; color: var(--muted); }

/* ----------------------------------------------------------------- panel */
.tabs { display: flex; gap: 6px; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 20px; flex-wrap: wrap; }
.tabs > button:not(.sm) { padding: 12px 19px; border: 0; border-bottom: 2px solid transparent; border-radius: 8px 8px 0 0; background: none; color: var(--muted); font-weight: 500; }
.tabs > button:not(.sm):hover { background: var(--surface-hover); color: var(--ink); }
.tabs > button.on:not(.sm) { background: var(--mint-soft); border-color: var(--mint); color: var(--mint); }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.stat { background: linear-gradient(135deg, var(--panel-start), var(--surface)); border: 1px solid var(--line); border-radius: 11px;
  box-shadow: var(--shadow); padding: 17px 20px; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.stat span { color: var(--muted); font-size: 14px; order: -1; }
.stat b { font-size: 1.8rem; letter-spacing: -.6px; font-variant-numeric: tabular-nums; }

footer { font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding: 20px 0; margin-top: 30px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 800px) {
  .topbar-row { padding: 8px 16px; min-height: 56px; gap: 8px; }
  .brand small { display: none; }
  .brand strong { font-size: 16px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-mark svg { width: 22px; height: 22px; }
  .userbox > span { max-width: 130px; }
  .wrap { padding: 22px 16px 12px; }
  h1 { font-size: 1.5rem; }
  .card { padding: 18px 12px; }
  table { font-size: 13px; }
  th, td { padding: 9px 6px; }
  th:first-child, td:first-child { padding-left: 10px; }
  .hide-sm { display: none; }
  td.actions { padding-right: 8px; }
  td.actions button { margin-left: 2px; padding: 5px 8px; }
  td.grow { overflow-wrap: anywhere; min-width: 92px; }
  .toolbar select { flex: 1 1 100%; }
  .toolbar .spacer { display: none; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats .stat:last-child { grid-column: 1 / -1; }
  .stat { padding: 14px; }
  .stat b { font-size: 1.6rem; }
}
@media (max-width: 480px) {
  .wrap { padding: 18px 10px 12px; }
  .card { padding: 16px 10px; }
  th, td { padding: 9px 5px; }
  td.grow { min-width: 74px; }
  td.actions { padding-right: 6px; }
  td.actions button { padding: 5px 7px; }
  .login-card { padding: 28px 20px; }
  .login-card h1 { font-size: 28px; }
  .userbox > span { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
.tablewrap.flush { margin-top: 0; }
p.help { margin: 14px 0 0; }
p.small { margin: 12px 0 0; }
#gbtn { max-width: 100%; overflow: hidden; }
.login-card .row > * { flex: 1 1 100%; }
.login-page { grid-template-columns: minmax(0, 440px); justify-content: center; }
.login-card { width: 100%; min-width: 0; }

/* ------------------------------------------------- versión minimalista */
.narrow { max-width: 820px; }
.brand strong { margin: 0; }
.hero { text-align: center; padding: 34px 0 26px; }
.hero h1 { font-size: clamp(1.7rem, 4.2vw, 2.2rem); letter-spacing: -.8px; }
.hero > p { color: var(--muted); margin: 8px 0 22px; }
.linkbox { display: flex; gap: 10px; }
.linkbox input { flex: 1; padding: 14px 16px; font-size: 14px; border-radius: 10px; }
.linkbox button { padding: 12px 22px; border-radius: 10px; font-size: 15px; }
.hero .status { margin-top: 12px; text-align: center; }
.hero .status:empty { display: none; }
.hero .warnbox { text-align: left; margin-top: 18px; }

.result h2 { font-size: 1.6rem; letter-spacing: -.5px; margin: 0; }
.result .meta { margin: 6px 0 18px; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.result .warnbox { margin: 0 0 16px; }
.result > .small { margin: 12px 0 0; }

details > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--mint); }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: '+'; margin-left: auto; font-size: 20px; font-weight: 400; line-height: 1; }
details[open] > summary::after { content: '−'; }
#more { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
#more .toolbar { border-top: 0; padding-top: 0; }

/* Paneles plegables (historial): cerrados ocupan solo su cabecera. */
.fold { padding: 0; overflow: hidden; }
.fold > summary { padding: 17px 23px; font-size: 15px; color: var(--ink); }
.fold > summary:hover, .fold[open] > summary { background: var(--mint-soft); }
.fold[open] > summary { color: var(--mint); border-bottom: 1px solid var(--line); }
.fold[open] { border-color: var(--accent-border); }
.fold-body { padding: 18px 23px 20px; }
.count { font-size: 12px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; }
.count:empty { display: none; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; align-items: center; }
.filters input { grid-column: 1 / -1; }
.filters select, .filters input { width: 100%; min-height: 40px; padding: 8px 10px; font-size: 13px; }
.filters .link { justify-self: start; }
.fold-body .status { margin-top: 12px; font-size: 13px; }
.fold-body .status:empty { display: none; }
.hlist { list-style: none; margin: 8px 0 0; padding: 0; }
.hitem { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.hitem:last-child { border-bottom: 0; padding-bottom: 0; }
button.hname { padding: 0; font-size: 15px; font-weight: 600; color: var(--ink); text-align: left; white-space: normal; overflow-wrap: anywhere; justify-content: flex-start; }
button.hname:hover { color: var(--mint); text-decoration: none; }
.hmeta { font-size: 13px; color: var(--ink-secondary); line-height: 1.5; overflow-wrap: anywhere; }
.hmeta.dim { color: var(--muted); }
.hevents { grid-column: 1 / -1; list-style: none; margin: 8px 0 0; padding: 10px 14px; background: var(--field); border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--ink-secondary); display: grid; gap: 4px; }

.login-card h1 { display: block; text-wrap: balance; }
.login-card .brand { margin-bottom: 30px; }
.login-foot { margin-top: 22px; }

@media (max-width: 800px) {
  .linkbox { flex-direction: column; }
  .hero { padding: 22px 0 18px; }
  .fold > summary { padding: 15px 14px; }
  .fold-body { padding: 14px 12px 16px; }
  .filters { grid-template-columns: 1fr 1fr; }
}
