/* Chambea · sistema visual. Verde bosque + sol naranja sobre papel cálido; modo oscuro con menta. */
:root {
  --bg: #f5f3ec;
  --bg-2: #ece9de;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #14201b;
  --ink-2: #2c3b34;
  --muted: #5a6962;
  --line: #e4e0d3;
  --line-2: #d3cebe;

  --brand: #0d5c46;
  --brand-2: #14805f;
  --brand-ink: #ffffff;
  --brand-soft: #def0e7;
  --sun: #ff6a2b;
  --sun-2: #ff8a52;
  --sun-soft: #ffe8db;
  --ok: #0f7a57;       --ok-soft: #d9f1e6;
  --info: #3b5bdb;     --info-soft: #e3e9fd;
  --violet: #6236c4;   --violet-soft: #ece5fb;
  --gold: #a86a00;     --gold-soft: #fdf0cc;
  --warn: #9a5800;     --warn-soft: #fbeed6;
  --off: #76838d;      --off-soft: #e9edf0;
  --danger: #c0392b;   --danger-soft: #fbe4e1;

  --shadow-s: 0 1px 2px rgba(20, 32, 27, .06), 0 1px 1px rgba(20, 32, 27, .04);
  --shadow-m: 0 1px 0 rgba(20, 32, 27, .04), 0 10px 24px -14px rgba(20, 32, 27, .28);
  --shadow-l: 0 2px 4px rgba(20, 32, 27, .05), 0 24px 48px -20px rgba(20, 32, 27, .35);
  --r-s: 8px; --r-m: 12px; --r-l: 18px; --r-xl: 26px;

  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "DM Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1310; --bg-2: #101a16; --surface: #121c18; --surface-2: #17231e; --ink: #e7f0eb; --ink-2: #cddbd3; --muted: #92a69b; --line: #22312a; --line-2: #2e4037;
    --brand: #3fd1a0; --brand-2: #2bb98a; --brand-ink: #06231a; --brand-soft: #123a2c; --sun: #ff8a52; --sun-2: #ffa077; --sun-soft: #3a2316;
    --ok: #4cc797; --ok-soft: #123226; --info: #8da4ff; --info-soft: #1a2349; --violet: #b49cff; --violet-soft: #2a2148; --gold: #f0b94d; --gold-soft: #3a2d0d;
    --warn: #f0aa4c; --warn-soft: #382812; --off: #8794a1; --off-soft: #1d2731; --danger: #ff8b7d; --danger-soft: #3b1a17;
    --shadow-s: 0 1px 2px rgba(0, 0, 0, .4); --shadow-m: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 28px -14px rgba(0, 0, 0, .7); --shadow-l: 0 28px 56px -22px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1310; --bg-2: #101a16; --surface: #121c18; --surface-2: #17231e; --ink: #e7f0eb; --ink-2: #cddbd3; --muted: #92a69b; --line: #22312a; --line-2: #2e4037;
  --brand: #3fd1a0; --brand-2: #2bb98a; --brand-ink: #06231a; --brand-soft: #123a2c; --sun: #ff8a52; --sun-2: #ffa077; --sun-soft: #3a2316;
  --ok: #4cc797; --ok-soft: #123226; --info: #8da4ff; --info-soft: #1a2349; --violet: #b49cff; --violet-soft: #2a2148; --gold: #f0b94d; --gold-soft: #3a2d0d;
  --warn: #f0aa4c; --warn-soft: #382812; --off: #8794a1; --off-soft: #1d2731; --danger: #ff8b7d; --danger-soft: #3b1a17;
  --shadow-s: 0 1px 2px rgba(0, 0, 0, .4); --shadow-m: 0 1px 0 rgba(0, 0, 0, .3), 0 12px 28px -14px rgba(0, 0, 0, .7); --shadow-l: 0 28px 56px -22px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 15.5px/1.55 var(--f-body); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { max-width: 100%; display: block; }
a { color: var(--brand); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--f-display); letter-spacing: -.02em; line-height: 1.08; margin: 0; text-wrap: balance; }
p { margin: 0; }
:focus-visible { outline: 2.5px solid var(--sun); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--sun); color: #fff; }

/* Botones */
.btn { --b: var(--surface); --bc: var(--ink); --bl: var(--line-2); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 18px; border-radius: 12px; border: 1px solid var(--bl); background: var(--b); color: var(--bc); font-weight: 600; font-size: 14.5px; text-decoration: none; line-height: 1.2; transition: transform .12s, box-shadow .15s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--muted); transform: translateY(-1px); box-shadow: var(--shadow-s); }
.btn:active { transform: none; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn.primary { --b: var(--brand); --bc: var(--brand-ink); --bl: var(--brand); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.sun { --b: var(--sun); --bc: #fff; --bl: var(--sun); box-shadow: 0 8px 20px -10px var(--sun); }
.btn.sun:hover { background: var(--sun-2); border-color: var(--sun-2); }
.btn.ghost { --b: transparent; --bl: transparent; }
.btn.ghost:hover { background: var(--bg-2); border-color: transparent; box-shadow: none; }
.btn.danger { --bc: var(--danger); --bl: var(--danger); --b: transparent; }
.btn.sm { padding: 7px 12px; font-size: 13.5px; border-radius: 10px; }
.btn.lg { padding: 14px 24px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; }
.btn svg { flex: none; }

/* Formularios */
.field { display: grid; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 11px 14px; line-height: 1.4; transition: border-color .15s, box-shadow .15s; }
.input:hover { border-color: var(--muted); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
textarea.input { resize: vertical; min-height: 90px; }
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 44px; height: 26px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .2s; }
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2.5px solid var(--sun); outline-offset: 2px; }

/* Chips y etiquetas */
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line-2); background: var(--surface); border-radius: 99px; padding: 5px 13px; font-size: 13.5px; font-weight: 500; line-height: 1.3; color: var(--ink-2); transition: all .15s; }
button.chip:hover { border-color: var(--muted); }
button.chip[aria-pressed="true"], .chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .c { font: 500 11.5px var(--f-mono); opacity: .7; font-variant-numeric: tabular-nums; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; border-radius: 8px; padding: 3px 9px; background: var(--bg-2); color: var(--muted); white-space: nowrap; }
.tag b { color: var(--ink); font-weight: 600; }
.tag.brand { background: var(--brand-soft); color: var(--brand); } .tag.brand b { color: inherit; }
.tag.sun { background: var(--sun-soft); color: var(--sun); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.violet { background: var(--violet-soft); color: var(--violet); }

/* Anillo de compatibilidad */
.ring { --p: 0; --size: 64px; --c: var(--brand); width: var(--size); height: var(--size); border-radius: 50%; display: grid; place-items: center; flex: none; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--line) 0); }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring b { position: relative; font: 700 calc(var(--size) * .3)/1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring b small { font-size: .6em; opacity: .55; margin-left: 1px; }
.ring.hi { --c: var(--ok); } .ring.mid { --c: var(--info); } .ring.lo { --c: var(--off); }

/* Logo / avatar de empresa */
.logo { display: inline-flex; align-items: center; gap: 10px; font: 800 21px/1 var(--f-display); letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.logo svg { width: 34px; height: 34px; }
.coav { --h: 150; width: 44px; height: 44px; border-radius: 12px; flex: none; display: grid; place-items: center; font: 700 17px var(--f-display); color: hsl(var(--h) 55% 28%); background: hsl(var(--h) 60% 90%); overflow: hidden; border: 1px solid hsl(var(--h) 40% 82%); }
.coav img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .coav { color: hsl(var(--h) 70% 80%); background: hsl(var(--h) 35% 20%); border-color: hsl(var(--h) 30% 28%); } }
:root[data-theme="dark"] .coav { color: hsl(var(--h) 70% 80%); background: hsl(var(--h) 35% 20%); border-color: hsl(var(--h) 30% 28%); }

/* Avisos y toasts */
.notice { border-radius: 12px; padding: 11px 14px; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); color: var(--warn); }
.notice.info { background: var(--info-soft); color: var(--info); } .notice.ok { background: var(--ok-soft); color: var(--ok); } .notice.err { background: var(--danger-soft); color: var(--danger); }
.toasts { position: fixed; z-index: 100; right: 16px; bottom: 16px; display: grid; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { background: var(--ink); color: var(--bg); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow-l); font-size: 14.5px; animation: subir .25s ease; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes subir { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Modales */
.veil { position: fixed; inset: 0; z-index: 60; background: rgba(8, 14, 11, .55); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: aparecer .15s ease; overflow-y: auto; }
.modal { background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-l); width: min(560px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; overflow: hidden; animation: subir .2s ease; }
.modal.wide { width: min(760px, 100%); }
.modal > header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px 24px 8px; }
.modal > header h3 { font-size: 22px; }
.modal .body { padding: 8px 24px 20px; overflow-y: auto; display: grid; gap: 16px; }
.modal > footer { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; background: var(--surface-2); }
.x { border: 0; background: var(--bg-2); border-radius: 10px; width: 34px; height: 34px; display: grid; place-items: center; color: var(--muted); }
.x:hover { color: var(--ink); }
@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }

.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 25%, transparent); border-top-color: currentColor; animation: giro .7s linear infinite; display: inline-block; }
@keyframes giro { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; scroll-behavior: auto !important; } }
