/* zeroauno — sistema visual minimalista: neutros, un acento, bordes finos. */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --sunken: #f4f4f5;
  --text: #09090b;
  --text-2: #3f3f46;
  --muted: #71717a;
  --line: #e4e4e7;
  --line-2: #d4d4d8;
  /* Marca: negro + verde. El verde es la flecha de O → I ("zero a uno"). */
  --brand-green: #22c55e;     /* verde de marca (logo sobre fondo negro) */
  --accent: #15803d;          /* verde para texto e interfaz sobre blanco (contraste AA) */
  --accent-soft: color-mix(in srgb, #22c55e 14%, transparent);
  --logo-ink: #09090b;        /* el 0 y el 1 */
  --logo-green: #16a34a;      /* la flecha */
  --ink: #09090b;          /* botón primario */
  --ink-text: #fafafa;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 18px;
  --shadow-sm: 0 1px 2px rgb(9 9 11 / 5%);
  --shadow: 0 1px 2px rgb(9 9 11 / 4%), 0 8px 24px -8px rgb(9 9 11 / 10%);
  --shadow-lg: 0 24px 64px -16px rgb(9 9 11 / 22%);
  --font: ui-sans-serif, -apple-system, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b;
    --surface: #111113;
    --sunken: #18181b;
    --text: #fafafa;
    --text-2: #d4d4d8;
    --muted: #8b8b94;
    --line: #232328;
    --line-2: #2e2e35;
    --accent: #4ade80;
    --accent-soft: color-mix(in srgb, #22c55e 16%, transparent);
    --logo-ink: #fafafa;
    --logo-green: #22c55e;
    --ink: #fafafa;
    --ink-text: #09090b;
    --ok: #4ade80;
    --warn: #fbbf24;
    --danger: #f87171;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 40%);
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px -8px rgb(0 0 0 / 50%);
    --shadow-lg: 0 24px 64px -16px rgb(0 0 0 / 70%);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.55 var(--font); letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: inherit; }
h1, h2, h3 { letter-spacing: -0.025em; line-height: 1.15; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.sprite { position: absolute; }
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--muted); }
.muted-ink { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 8px 2px; }
.pad-x { padding: 0 10px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.info { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.error { color: var(--danger); font-size: 13.5px; margin: 0 0 12px; }
.hint { font-size: 12.5px; color: var(--muted); margin: -2px 0 14px; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* Marca */
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 650; font-size: 16px; letter-spacing: -0.02em; text-decoration: none; color: var(--text); }
/* Logo O → I ("zero a uno"): el 0 y el 1 en negro (blanco en modo oscuro), la flecha en verde. */
.logo { height: 17px; width: auto; aspect-ratio: 726 / 278; flex: none; display: block; }
.logo .l-o { fill: none; stroke: var(--logo-ink); stroke-width: 60; }
.logo .l-i { fill: var(--logo-ink); }
.logo .l-a { fill: var(--logo-green); }
.wordmark { font-weight: 700; letter-spacing: -0.035em; font-size: 17px; color: var(--text); }
.wordmark .wa { color: var(--accent); }
.landing-nav .logo { height: 20px; }
.landing-nav .wordmark { font-size: 19px; }
/* Versión cuadrada (favicon, chat, carga): fondo negro como la imagen de marca. */
.logo-badge { --logo-ink: #ffffff; --logo-green: var(--brand-green); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #121212; flex: none; box-shadow: inset 0 0 0 1px rgb(255 255 255 / 6%); }
.logo-badge .logo { height: auto; width: 74%; }
.logo-badge.sm { width: 26px; height: 26px; border-radius: 7px; }
.logo-badge.xl { width: 68px; height: 68px; border-radius: 19px; }
.beta { font-size: 10.5px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); background: var(--accent-soft); padding: 2px 7px; border-radius: 999px; }
.landing-foot { max-width: 640px; margin-left: auto; margin-right: auto; }
.landing-foot strong { color: var(--text-2); font-weight: 600; }
.landing-foot p { margin: 0 0 10px; }
.landing-foot a, .auth-powered a { color: var(--text-2); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
/* Mención de la tecnología de Agentico.cl */
.powered { display: inline-flex; align-items: center; gap: 6px; margin-top: 26px; font-size: 13px; color: var(--muted); text-decoration: none; }
.powered::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--logo-green); }
.powered strong { color: var(--text-2); font-weight: 600; }
.powered:hover strong { color: var(--accent); }
.auth-powered { text-align: center; font-size: 12.5px; color: var(--muted); margin: 16px 0 0; }
.side-powered { font-size: 11.5px; color: var(--muted); text-decoration: none; padding: 2px 8px 0; }
.side-powered:hover { color: var(--accent); }
.boot { height: 100%; display: grid; place-items: center; }
.boot .logo-badge { width: 60px; height: 60px; border-radius: 17px; animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .45; transform: scale(.95); } }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-weight: 560; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s, transform .06s;
}
.btn:hover { border-color: var(--line-2); background: var(--sunken); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--ink); color: var(--ink-text); border-color: transparent; }
.btn.primary:hover { opacity: .88; background: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--sunken); }
.btn.block { width: 100%; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; border-radius: 12px; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13.5px; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.danger { color: var(--danger); }
.btn.primary-soft { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.btn.primary.inline { width: auto; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--sunken); color: var(--text); }

/* Campos */
.field { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 0 0 14px; }
.field small { font-weight: 400; }
.field input, .field select, .search, .budget {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  color: var(--text); font-size: 14.5px; font-weight: 400; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .search:focus, .budget:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--sunken); border-radius: 10px; padding: 3px; margin: 0 0 18px; }
.tab { height: 34px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 560; font-size: 14px; }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Portada ---------- */
.landing { min-height: 100%; display: flex; flex-direction: column; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px clamp(16px, 4vw, 40px); position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(12px); }
.landing-actions { display: flex; gap: 8px; }
.hero { max-width: 760px; margin: 0 auto; padding: clamp(48px, 10vh, 112px) 20px 56px; text-align: center; }
.eyebrow { display: inline-block; font-size: 13px; color: var(--accent); background: var(--accent-soft); padding: 5px 12px; border-radius: 999px; margin: 0 0 22px; font-weight: 560; }
.hero h1 { font-size: clamp(36px, 6.4vw, 64px); margin: 0 0 18px; font-weight: 700; letter-spacing: -0.045em; }
.lead { font-size: clamp(16px, 2vw, 18px); color: var(--muted); max-width: 560px; margin: 0 auto 30px; }
.lead em { font-style: normal; color: var(--text-2); }
.hero-cta { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.landing-gallery { width: 100%; max-width: 1180px; margin: 0 auto; padding: 24px clamp(16px, 4vw, 40px) 56px; }
.section-head { margin-bottom: 18px; }
.section-head h2 { font-size: 22px; margin: 0 0 4px; }
.section-head p { margin: 0; }
.landing-foot { text-align: center; font-size: 13px; padding: 24px 16px 40px; margin-top: auto; }

/* Diálogo de acceso */
.auth-dialog { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0; width: min(420px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.auth-dialog::backdrop { background: rgb(9 9 11 / 45%); backdrop-filter: blur(4px); }
.auth-dialog[open] { animation: pop .18s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
#auth-form { padding: 28px 26px 26px; position: relative; }
#auth-form h2 { font-size: 22px; margin: 18px 0 18px; }
.close { position: absolute; top: 12px; right: 12px; }

/* ---------- Aplicación ---------- */
.app { display: grid; grid-template-columns: 264px 1fr; height: 100%; }
.sidebar { background: var(--bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; padding: 16px 12px 12px; min-height: 0; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 6px; }
.side-nav { display: grid; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.side-link .ic { color: var(--muted); }
.side-link:hover { background: var(--sunken); }
.side-link.active { background: var(--sunken); color: var(--text); }
.side-link.active .ic { color: var(--text); }
.projects { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.side-label { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 0 10px; margin: 4px 0 6px; text-transform: uppercase; letter-spacing: .06em; }
.ws-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.ws-list a { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 9px; color: var(--text-2); text-decoration: none; font-size: 13.5px; }
.ws-list a:hover { background: var(--sunken); }
.ws-list a.active { background: var(--sunken); color: var(--text); font-weight: 560; }
.ws-list .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); flex: none; }
.dot.published { background: var(--ok); }
.dot.working { background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 1.4s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 7px transparent; } }
.side-foot { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding: 12px 6px 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; text-transform: uppercase; flex: none; }
.me { flex: 1; font-weight: 560; font-size: 14px; overflow: hidden; text-overflow: ellipsis; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.topbar { display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); flex: none; }
.ws-title { font-size: 15px; font-weight: 600; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -0.01em; }
.top-actions { display: flex; align-items: center; gap: 6px; }

/* Interruptor */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--text-2); margin-right: 6px; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track .thumb { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Chat */
.content { flex: 1; display: flex; min-height: 0; }
.chat-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.messages { flex: 1; overflow-y: auto; padding: 32px 20px 16px; scroll-behavior: smooth; }
.messages > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.welcome { text-align: center; padding-top: 8vh; }
.welcome h1 { font-size: clamp(26px, 4vw, 36px); margin: 20px 0 8px; font-weight: 680; }
.welcome > p { max-width: 460px; margin: 0 auto; }
.ideas { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 32px; text-align: left; }
@media (max-width: 560px) { .ideas { grid-template-columns: 1fr; } }
.idea { display: grid; gap: 2px; padding: 14px 16px; text-align: left; align-content: start; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.idea:hover { border-color: var(--line-2); background: var(--sunken); transform: translateY(-1px); }
.idea strong { font-size: 14px; font-weight: 600; }
.idea span { font-size: 13px; color: var(--muted); }

.msg { display: flex; margin-bottom: 22px; animation: rise .25s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.msg.user { justify-content: flex-end; }
.msg.assistant { gap: 14px; }
.msg.assistant .logo-badge { margin-top: 1px; }
.bubble { max-width: 85%; white-space: pre-wrap; overflow-wrap: anywhere; min-width: 0; }
.msg.user .bubble { background: var(--sunken); padding: 10px 15px; border-radius: 18px 18px 6px 18px; }
.msg.assistant .bubble { padding-top: 2px; color: var(--text); }
.bubble.rich { white-space: normal; }
.bubble.rich p { margin: 0 0 10px; }
.bubble.rich ul, .bubble.rich ol { margin: 0 0 10px; padding-left: 20px; }
.bubble.rich li { margin: 4px 0; }
.bubble.rich li::marker { color: var(--muted); }
.bubble.rich > :last-child { margin-bottom: 0; }
.bubble a { color: var(--accent); }
.bubble a.app-card { color: var(--text); }
.bubble code { font: 13px var(--mono); background: var(--sunken); padding: 1px 6px; border-radius: 6px; }
.app-card { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); text-decoration: none; color: var(--text); white-space: normal; transition: border-color .15s, box-shadow .15s; }
.app-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); }
.app-card > div { min-width: 0; flex: 1; }
.app-card strong { display: block; font-size: 14px; }
.app-card .u { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.app-card .go { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 560; font-size: 13.5px; flex: none; }
.app-card .thumb-mini { width: 40px; height: 40px; border-radius: 10px; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; }

/* Indicador de trabajo */
.work { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px 16px; margin-bottom: 22px; background: var(--surface); box-shadow: var(--shadow); animation: rise .25s ease-out; }
.work::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent); background-size: 50% 100%; background-repeat: no-repeat; animation: sweep 1.6s ease-in-out infinite; }
@keyframes sweep { from { background-position: -50% 0; } to { background-position: 150% 0; } }
.work-head { display: flex; align-items: center; gap: 12px; }
.orb { width: 28px; height: 28px; border-radius: 50%; flex: none; background: conic-gradient(from 0deg, var(--accent), color-mix(in srgb, var(--accent) 20%, transparent), var(--accent)); animation: spin 1.4s linear infinite; mask: radial-gradient(circle, transparent 7px, #000 8px); -webkit-mask: radial-gradient(circle, transparent 7px, #000 8px); }
@keyframes spin { to { transform: rotate(1turn); } }
.work-title { font-weight: 600; font-size: 14.5px; }
.work-sub { font-size: 13px; color: var(--muted); }
.work-time { margin-left: auto; font: 500 13px var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 2px; list-style: none; padding: 0; }
.step { display: grid; gap: 8px; font-size: 12.5px; color: var(--muted); }
.step .track-line { height: 4px; border-radius: 999px; background: var(--sunken); overflow: hidden; position: relative; }
.step.done .track-line { background: var(--accent); }
.step.now .track-line::after { content: ""; position: absolute; inset: 0; width: 40%; border-radius: inherit; background: var(--accent); animation: fill 1.3s ease-in-out infinite; }
@keyframes fill { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.step.done, .step.now { color: var(--text-2); }
.step.now { font-weight: 600; color: var(--text); }
.step-label { display: flex; align-items: center; gap: 5px; }
.step .ic { width: 13px; height: 13px; stroke-width: 2.4; color: var(--accent); }

/* Compositor */
.composer { padding: 6px 20px 16px; flex: none; }
.composer-box { max-width: 720px; margin: 0 auto; display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: var(--line-2); box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
textarea { flex: 1; border: 0; outline: none; resize: none; background: transparent; padding: 8px 0; max-height: 220px; line-height: 1.5; font-size: 15px; }
textarea:focus-visible { outline: none; }
textarea::placeholder { color: var(--muted); }
.send { width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--ink); color: var(--ink-text); display: grid; place-items: center; cursor: pointer; flex: none; transition: opacity .15s, transform .1s; }
.send:hover { opacity: .85; }
.send:disabled { opacity: .2; cursor: not-allowed; }
.foot-note { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 0; }

/* Vista previa */
.preview { width: min(48%, 760px); border-left: 1px solid var(--line); display: flex; flex-direction: column; background: var(--bg); }
.preview-bar { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line-2); }
.preview-url { flex: 1; font: 12.5px var(--mono); color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview iframe { flex: 1; border: 0; width: 100%; background: #fff; }

/* ---------- Páginas ---------- */
.page { flex: 1; overflow-y: auto; padding: 32px 20px 56px; }
.page-inner { max-width: 880px; margin: 0 auto; display: grid; gap: 16px; }
.page-inner.wide { max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h1 { font-size: 28px; margin: 0 0 6px; font-weight: 680; }
.page-head p { margin: 0; max-width: 620px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 620; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; }
.tile-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.tile-value { font-size: 28px; font-weight: 680; letter-spacing: -0.035em; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.tile-sub { font-size: 12.5px; color: var(--muted); }
.limits { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--text-2); }
.meter-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; margin-bottom: 10px; }
.meter-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 999px; background: var(--sunken); overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s; }
.meter-fill.warn { background: var(--warn); }
.meter-fill.full { background: var(--danger); }
.status.warn { color: var(--text); margin: 12px 0 0; font-size: 13.5px; }
.card.status.warn { border-color: color-mix(in srgb, var(--warn) 45%, var(--line)); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); margin: 0; }

/* Gráfico: una serie, marcas finas con extremo redondeado, ejes discretos. */
.chart { position: relative; }
.chart-empty { margin: 8px 0; }
.axis-max { font-size: 11.5px; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.plot { height: 160px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); background-image: linear-gradient(to bottom, var(--line) 1px, transparent 1px); background-size: 100% 50%; }
.col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px 4px 0 0; }
.col.hover { background: var(--accent-soft); }
.bar { width: min(70%, 16px); background: color-mix(in srgb, var(--accent) 55%, var(--surface)); border-radius: 4px 4px 0 0; }
.bar.today, .col.hover .bar { background: var(--accent); }
.axis-x { display: flex; justify-content: space-between; font-size: 11.5px; margin-top: 6px; }
.tip { position: fixed; z-index: 50; background: var(--ink); color: var(--ink-text); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; line-height: 1.5; pointer-events: none; box-shadow: var(--shadow-lg); max-width: 240px; }
.table-toggle { margin-top: 14px; font-size: 14px; }
.table-toggle summary { cursor: pointer; color: var(--muted); }

/* Tablas */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-weight: 560; color: var(--muted); font-size: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--bg); }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--sunken) 60%, transparent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card.flush td { white-space: nowrap; }
.card.flush td:first-child { white-space: normal; min-width: 180px; }
td.excerpt { white-space: normal !important; min-width: 280px; max-width: 520px; font-size: 13px; color: var(--muted); }
.table-toggle table { margin-top: 8px; }
.badge { display: inline-flex; align-items: center; height: 22px; font-size: 12px; font-weight: 560; padding: 0 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.badge.active { background: color-mix(in srgb, var(--ok) 12%, transparent); color: var(--ok); }
.badge.pending { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.badge.disabled { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }
.badge.admin { margin-left: 6px; background: var(--accent-soft); color: var(--accent); }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn + .btn { margin-left: 6px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar input, .toolbar select { height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 13.5px; outline: none; }
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; }
.section-title { font-size: 15px; font-weight: 620; margin: 26px 0 10px; }
.admin-body > .tiles { margin: 14px 0 4px; }
.search { min-width: 240px; flex: 0 1 320px; }
.budget { width: 92px; text-align: right; height: 32px; }
.budget.saved { border-color: var(--ok); }
.seg { display: inline-flex; gap: 2px; background: var(--sunken); padding: 3px; border-radius: 10px; width: fit-content; max-width: 100%; overflow-x: auto; }
.seg a, .seg button { height: 32px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 560; white-space: nowrap; border: 0; background: transparent; cursor: pointer; }
.seg a.active, .seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.admin-body { display: grid; gap: 16px; }
.settings { display: grid; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 4px 14px; }
.form-actions { display: flex; align-items: center; gap: 14px; }
.form-actions .info { margin: 0; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 560; margin: 4px 0 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Galería ---------- */
.gallery-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-box { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); min-width: 260px; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input { border: 0; outline: none; background: transparent; flex: 1; font-size: 14.5px; color: var(--text); min-width: 0; }
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.app-tile { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; text-decoration: none; color: var(--text); transition: transform .18s, box-shadow .18s, border-color .18s; }
.app-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.cover { aspect-ratio: 16 / 9; position: relative; display: grid; place-items: center; overflow: hidden; }
.cover::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 30% 20%, rgb(255 255 255 / 28%), transparent 55%); }
.cover .mono-letter { font-size: 44px; font-weight: 750; letter-spacing: -0.05em; color: rgb(255 255 255 / 92%); text-shadow: 0 2px 12px rgb(0 0 0 / 18%); z-index: 1; }
.cover .rings { position: absolute; inset: -30%; background: repeating-radial-gradient(circle at 80% 110%, rgb(255 255 255 / 10%) 0 2px, transparent 2px 22px); }
.tile-body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; }
.tile-title { font-weight: 620; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-desc { font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.9em; }
.tile-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.tile-meta .owner { font-weight: 560; color: var(--text-2); }
.tile-meta .open { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 560; }
.tile-meta .ic { width: 14px; height: 14px; }
.empty { text-align: center; padding: 56px 16px; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--r-lg); grid-column: 1 / -1; }
.skeleton { border-radius: var(--r-lg); background: linear-gradient(90deg, var(--sunken), var(--bg), var(--sunken)); background-size: 200% 100%; animation: shimmer 1.2s infinite; aspect-ratio: 4 / 3.3; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Aviso flotante */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--ink-text); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow-lg); z-index: 60; max-width: calc(100vw - 32px); animation: rise .2s ease-out; }

.only-mobile { display: none; }
.scrim { position: fixed; inset: 0; background: rgb(9 9 11 / 40%); z-index: 9; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .only-mobile { display: inline-grid; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 284px; z-index: 10; transform: translateX(-100%); transition: transform .22s ease; background: var(--surface); }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .content { flex-direction: column; }
  .preview { width: 100%; height: 55%; border-left: 0; border-top: 1px solid var(--line); }
  .hide-sm { display: none; }
  .topbar { padding: 0 10px; }
  .switch-label { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
