/* Tokens tomados de la maqueta: tinta azulada y un solo acento verde azulado. */
@font-face { font-family: 'Space Grotesk'; src: url('/brand/SpaceGrotesk.ttf') format('truetype'); font-weight: 300 700; font-display: swap; }

/* Identidad tomada de emeige.cl: rojo de acción, azul oscuro de las franjas y Space Grotesk. */
:root {
  --bg: #F4F5F7; --surface: #FFFFFF; --surface-2: #EAECF0; --line: #D9DCE3;
  --fg: #1A2238; --muted: #5B6475; --accent: #EA0029; --accent-ink: #FFFFFF; --accent-soft: #FDE3E7;
  --side: #1A2238; --side-fg: #FFFFFF; --side-muted: #B4BBCB; --side-active: rgba(255,255,255,.12);
  --ok: #2B7A4B; --ok-soft: #DAEEE1; --warn: #7F5200; --warn-soft: #F7E6BF; --info: #2F57B8; --info-soft: #DCE6FA;
  --err: #A32A2A; --err-soft: #F6DADA;
  --font-ui: 'Space Grotesk', 'Segoe UI', Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1424; --surface: #171E33; --surface-2: #212A44; --line: #2D3856;
    --fg: #EEF0F6; --muted: #A3ADC4; --accent: #FF4D62; --accent-ink: #14081A; --accent-soft: #3A1B2A;
    --side: #0B0F1C;
    --ok: #6CCB8F; --ok-soft: #173326; --warn: #E8B64D; --warn-soft: #3A2D10; --info: #8FADF2; --info-soft: #1B2745;
    --err: #F19A9A; --err-soft: #3A1A1A;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.5 var(--font-ui);
  padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
h1, h2 { margin: 0; text-wrap: balance; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { font-size: 14px; color: var(--muted); }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-bg { background: var(--side); margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.login-logo { width: 190px; max-width: 70%; display: block; }
.login form { width: min(380px, 100%); background: var(--surface); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login h1 { font-size: 24px; }

.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); gap: 32px; max-width: 1240px; margin: 0 auto; padding-block: 24px 48px; }
.side { position: sticky; top: 24px; align-self: start; display: flex; flex-direction: column; gap: 24px; min-width: 0; background: var(--side); color: var(--side-fg); border-radius: 14px; padding: 20px 12px; }
.brand { padding-inline: 8px; }
.brand img { width: 150px; max-width: 100%; display: block; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav button { text-align: left; background: none; border: 0; color: var(--side-muted); padding: 9px 12px; border-radius: 8px; cursor: pointer; }
.nav button:hover:not(:disabled) { background: var(--side-active); color: var(--side-fg); }
.nav button[aria-current="page"] { background: var(--side-active); color: var(--side-fg); font-weight: 700; box-shadow: inset 3px 0 0 #EA0029; }
.nav button:disabled { opacity: .5; cursor: not-allowed; }
.me { font-size: 14px; color: var(--side-muted); display: flex; flex-direction: column; gap: 8px; padding-inline: 8px; }
.me .btn { background: transparent; color: var(--side-fg); border-color: rgba(255,255,255,.3); }
.me .btn:hover:not(:disabled) { background: var(--side-active); }

.top { margin-bottom: 20px; }
.top h1 { font-size: clamp(26px, 3vw, 36px); line-height: 1.12; letter-spacing: -0.02em; font-weight: 700; }
.top p { color: var(--muted); max-width: 62ch; margin-top: 6px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.split { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

.pill { display: inline-block; font-size: 13px; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.mute { background: var(--surface-2); color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--surface); padding: 9px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.small { padding: 5px 10px; font-size: 14px; }

.progress { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.bar { flex: 1 1 220px; height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.sec-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sec { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sec[aria-current="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.sec small { display: block; color: var(--muted); font-size: 13px; }
.form-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.form-head h2 { font-size: 22px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 16px; }
.field.tight { margin-top: 0; }
.lbl { font-size: 14px; font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], textarea, select { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; width: 100%; min-width: 0; }
textarea { resize: vertical; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-self: flex-start; flex-wrap: wrap; }
.seg button { background: var(--surface); border: 0; padding: 8px 14px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent-soft); font-weight: 500; }
.seg button:disabled { cursor: not-allowed; opacity: .6; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { background: var(--surface-2); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 14px; display: inline-flex; gap: 4px; align-items: center; }
.tag button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 6px; font-size: 16px; line-height: 1; }
.tag-in { width: 160px; flex: 0 1 160px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th, .tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.tbl th { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.tbl select { width: auto; }
.error { background: var(--err-soft); color: var(--err); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; max-width: min(92vw, 460px); font-size: 14px; z-index: 20; }
.toast[hidden] { display: none; }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .side { position: static; gap: 12px; }
  .brand img { width: 120px; }
  .nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .nav button { white-space: nowrap; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.panel.narrow { max-width: 460px; }

/* Archivos subidos (logos, layouts) */
.files { display: flex; flex-direction: column; gap: 10px; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.file { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-width: 0; }
.thumb { width: 56px; height: 40px; flex: none; object-fit: contain; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 12px 12px; border-radius: 6px; }
.thumb.ext { display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); }
.file-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-name a { color: inherit; overflow-wrap: anywhere; }
.file-name small { color: var(--muted); font-size: 13px; }
.file-btn { cursor: pointer; display: inline-block; }
.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
