/* GestiaWeb Cuenta — cristal al estilo Apple (referencia: awesome-design-md/apple), con el oro de GestiaWeb como único color de acción.
   Superficies de vidrio sobre un fondo de luz suave, esquinas grandes, tipografía del sistema con tracking negativo,
   un solo acento. Sin sombras duras: la profundidad la da el desenfoque del fondo y un filo de luz arriba. */
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 200 800; font-display: swap; src: url('/fonts/plus-jakarta-sans-latin-wght-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Plus Jakarta Sans'; font-weight: 200 800; font-display: swap; src: url('/fonts/plus-jakarta-sans-latin-ext-wght-normal.woff2') format('woff2'); 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; }

:root {
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Plus Jakarta Sans', system-ui, sans-serif;
  --ink: #F5F5F7; --muted: #A9A9B3; --gold: #C9A24B; --goldtx: #E3C078; --btnink: #1A1408; --danger: #FF8A7A;
  --bg: #07070A;
  --glass: rgba(255, 255, 255, .07); --glass-2: rgba(255, 255, 255, .13); --glass-3: rgba(255, 255, 255, .2);
  --line: rgba(255, 255, 255, .15); --glow: rgba(255, 255, 255, .22);
  --shadow: 0 24px 60px -18px rgba(0, 0, 0, .65), 0 2px 10px rgba(0, 0, 0, .25);
  --orb-a: rgba(201, 162, 75, .55); --orb-b: rgba(140, 111, 209, .50); --orb-c: rgba(79, 157, 166, .42); --orb-d: rgba(217, 105, 79, .30); --field-line: rgba(255, 255, 255, .18);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --blur: blur(30px) saturate(180%);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --ink: #1D1D1F; --muted: #5E5E66; --goldtx: #85621C; --danger: #B3321F; --btnink: #1A1408;
    --bg: #EDEAF2;
    --glass: rgba(255, 255, 255, .55); --glass-2: rgba(255, 255, 255, .78); --glass-3: rgba(255, 255, 255, .92);
    --line: rgba(255, 255, 255, .8); --glow: rgba(255, 255, 255, .95);
    --shadow: 0 24px 60px -24px rgba(70, 50, 20, .35), 0 2px 10px rgba(70, 50, 20, .08);
    --orb-a: rgba(233, 190, 90, .65); --orb-b: rgba(168, 140, 235, .55); --orb-c: rgba(110, 190, 200, .55); --orb-d: rgba(240, 138, 112, .40); --field-line: rgba(30, 24, 12, .16);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.47; letter-spacing: -.011em; word-spacing: .06em; -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
/* La luz de fondo: tres focos grandes que se mueven despacio detrás del cristal */
body::before { content: ''; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background: radial-gradient(42% 38% at 18% 20%, var(--orb-a), transparent 70%), radial-gradient(40% 42% at 86% 14%, var(--orb-b), transparent 70%), radial-gradient(46% 44% at 62% 92%, var(--orb-c), transparent 70%), radial-gradient(34% 34% at 6% 86%, var(--orb-d), transparent 70%); }
@media (prefers-reduced-motion: no-preference) { body::before { animation: luz 38s ease-in-out infinite alternate; } }
@keyframes luz { from { transform: translate3d(-2%, -1%, 0) scale(1); } to { transform: translate3d(3%, 2%, 0) scale(1.08); } }

button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; }
a { color: var(--goldtx); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Vidrio ---- */
.glass, .appcard, .row, .sheet, .toast, .cred, .tabs, .hubtop-bar, .login-card, .opt {
  background: var(--glass); border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  box-shadow: inset 0 1px 0 var(--glow), var(--shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .appcard, .row, .sheet, .toast, .cred, .tabs, .hubtop-bar, .login-card { background: color-mix(in srgb, var(--bg) 88%, var(--ink)); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass, .appcard, .row, .sheet, .toast, .cred, .tabs, .hubtop-bar, .login-card { background: color-mix(in srgb, var(--bg) 90%, var(--ink)); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

/* ---- Marca ---- */
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.brand em { font-style: normal; color: var(--goldtx); }
.brand span { font-weight: 500; color: var(--muted); letter-spacing: -.01em; }

/* ---- Botones y campos ---- */
.btn { white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 22px; border: 0; border-radius: 999px; background: linear-gradient(180deg, #E0BC6A, var(--gold)); color: var(--btnink); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 8px 24px -10px rgba(201, 162, 75, .8);
  transition: transform .18s var(--ease), filter .18s var(--ease), box-shadow .18s var(--ease); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; cursor: wait; }
.btn.small { min-height: 38px; padding: 0 16px; font-size: .92rem; }
.btn.big { min-height: 54px; font-size: 1.05rem; width: 100%; }
.btn.ghost { background: var(--glass-2); color: var(--ink); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--glow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.btn.danger { background: linear-gradient(180deg, #FF8A7A, #E5604D); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn.ghost.danger { background: var(--glass-2); color: var(--danger); box-shadow: inset 0 1px 0 var(--glow); }
@media (hover: hover) and (pointer: fine) { .btn:hover { filter: brightness(1.07); } .btn.ghost:hover { background: var(--glass-3); } }
.linkbtn { background: none; border: 0; color: var(--goldtx); font-weight: 600; padding: 8px 0; text-align: left; }
.icon-btn { width: 42px; height: 42px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--glass-2); box-shadow: inset 0 1px 0 var(--glow); transition: transform .18s var(--ease), background .18s var(--ease); }
.icon-btn:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { background: var(--glass-3); } }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; padding: 0; margin: 0; }
.field label, .field legend { font-size: .82rem; font-weight: 600; color: var(--muted); padding: 0; }
.field input, .field select, .field textarea { min-height: 50px; width: 100%; padding: 0 16px; border: 1px solid var(--field-line); border-radius: 16px; background: var(--glass); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .12); transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease); }
.field input[readonly] { color: var(--muted); }
.field input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.field input:focus, .field select:focus { outline: none; border-color: var(--gold); background: var(--glass-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 28%, transparent); }
.field select option { color: #1D1D1F; background: #fff; }
.check { display: flex; align-items: center; gap: 12px; min-height: 30px; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); flex: none; }
.error { color: var(--danger); font-size: .9rem; min-height: 1.2em; }
.error:empty { display: none; }
.note { color: var(--muted); font-size: .9rem; }
.form { display: flex; flex-direction: column; gap: 16px; }
.form.inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-bottom: 8px; }
.form.inline .field { flex: 1 1 200px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .two { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.actions .btn { flex: 1 1 auto; }
.empty { color: var(--muted); padding: 12px 2px; }

/* ---- Acceso ---- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-wrap { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 22px; align-items: stretch; }
.login-wrap > .brand { justify-content: center; }
.login-card { border-radius: 36px; padding: clamp(26px, 6vw, 40px); display: flex; flex-direction: column; gap: 22px; }
.login-card h1 { font-size: clamp(2rem, 7vw, 2.5rem); line-height: 1.06; letter-spacing: -.04em; font-weight: 700; }
.login-card .lead { color: var(--muted); margin-top: 8px; }
.login-card .linkbtn { align-self: center; }
.login-points { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.login-points span { padding: 7px 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); font-size: .82rem; color: var(--muted); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }

/* ---- Panel ---- */
.hub { min-height: 100dvh; display: flex; flex-direction: column; }
.hubtop { position: sticky; top: 0; z-index: 20; padding: max(12px, env(safe-area-inset-top)) clamp(12px, 3vw, 28px) 8px; }
.hubtop-bar { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 20px; border-radius: 999px; }
.top-r { display: flex; align-items: center; gap: 8px; }
.hubmain { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: clamp(20px, 5vw, 56px) clamp(16px, 4vw, 28px) 72px; display: flex; flex-direction: column; gap: 28px; }
.hello h1 { font-size: clamp(2.4rem, 8vw, 4rem); line-height: 1.03; letter-spacing: -.045em; font-weight: 700; }
.hello p { color: var(--muted); font-size: 1.15rem; margin-top: 10px; max-width: 46ch; }

.appgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.appcard { --mx: 50%; --my: 0%; position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; width: 100%; min-height: 112px; padding: 20px; border-radius: 30px; text-align: left;
  transition: transform .35s var(--ease), background .25s var(--ease); }
/* Brillo que sigue al puntero (lo mueve app.js con --mx/--my) */
.appcard::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .3s var(--ease);
  background: radial-gradient(260px circle at var(--mx) var(--my), rgba(255, 255, 255, .22), transparent 65%); }
.appcard > * { position: relative; }
@media (hover: hover) and (pointer: fine) { .appcard:hover { transform: translateY(-3px) scale(1.012); background: var(--glass-2); } .appcard:hover::before { opacity: 1; } .appcard:hover .go { transform: translate(2px, -2px); color: var(--ink); } }
.appcard:active { transform: scale(.975); }
.appcard.busy { opacity: .6; cursor: wait; }
.tile { flex: none; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; color: #fff; background: linear-gradient(145deg, #E0BC6A, #B58A32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -8px 14px rgba(0, 0, 0, .12), 0 10px 22px -8px rgba(0, 0, 0, .5); }
.tile .ico { width: 30px; height: 30px; stroke-width: 1.7; }
.tile.sm { width: 42px; height: 42px; border-radius: 12px; }
.tile.sm .ico { width: 21px; height: 21px; }
.t-cal { background: linear-gradient(145deg, #F08A70, #D9694F); }
.t-mail { background: linear-gradient(145deg, #6BB9C2, #3F8E98); }
.t-panel { background: linear-gradient(145deg, #E0BC6A, #B58A32); color: #1A1408; }
.t-receipt { background: linear-gradient(145deg, #7CC48C, #4D9560); }
.t-globe { background: linear-gradient(145deg, #7B9BEA, #4F6FC4); }
.t-spark { background: linear-gradient(145deg, #A78BE8, #7656C2); }
.t-users { background: linear-gradient(145deg, #E58BB8, #BF5688); }
.atxt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.atxt strong { font-size: 1.15rem; font-weight: 650; letter-spacing: -.025em; }
.atxt small { color: var(--muted); font-size: .9rem; }
.go { color: var(--muted); transition: transform .3s var(--ease), color .2s var(--ease); }
@media (prefers-reduced-motion: no-preference) {
  .appcard { animation: entra .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
  .hello { animation: entra .6s var(--ease) both; }
}
@keyframes entra { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }

/* ---- Administración ---- */
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; max-width: 100%; overflow-x: auto; scrollbar-width: none; align-self: flex-start; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; min-height: 38px; padding: 0 18px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font-weight: 600; font-size: .92rem; transition: background .25s var(--ease), color .25s var(--ease); }
.tab.on { background: var(--glass-3); color: var(--ink); box-shadow: inset 0 1px 0 var(--glow), 0 4px 14px -6px rgba(0, 0, 0, .4); }
.paneh { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.rows { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 68px; padding: 12px 18px; border-radius: 22px; text-align: left; transition: transform .25s var(--ease), background .2s var(--ease); }
@media (hover: hover) and (pointer: fine) { button.row:hover { background: var(--glass-2); transform: translateY(-1px); } }
button.row:active { transform: scale(.985); }
.row.static { cursor: default; }
.rtxt { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rtxt strong { font-weight: 650; }
.rtxt strong, .rtxt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtxt small { color: var(--muted); font-size: .88rem; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.st { font-style: normal; font-size: .76rem; font-weight: 650; padding: 4px 11px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 24%, transparent); color: var(--goldtx); }
.st.no { background: var(--glass-2); color: var(--muted); }
.appgrant { display: flex; flex-direction: column; gap: 8px; padding: 10px 0; }
.appgrant + .appgrant { border-top: 1px solid var(--line); }
.gurl { min-height: 42px !important; font-size: .9rem; }
.cred { display: grid; gap: 4px; padding: 18px; border-radius: 22px; overflow-wrap: anywhere; box-shadow: inset 0 1px 0 var(--glow); }
.cred span { color: var(--muted); font-size: .82rem; }
.cred strong { font-size: 1.05rem; margin-bottom: 8px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .01em; user-select: all; }

/* ---- Hojas y avisos ---- */
.sheet-bg { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; background: rgba(8, 8, 14, .38); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.sheet { width: 100%; max-width: 560px; max-height: 92dvh; overflow: auto; border-radius: 34px 34px 0 0; padding: 0 22px 26px; background: color-mix(in srgb, var(--bg) 40%, var(--glass-2)); }
.sheet header { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 0 14px; background: linear-gradient(var(--bg), transparent); background: linear-gradient(color-mix(in srgb, var(--bg) 70%, transparent), transparent); }
.sheet h2 { font-size: 1.3rem; letter-spacing: -.03em; font-weight: 700; }
@media (min-width: 640px) { .sheet-bg { align-items: center; } .sheet { border-radius: 34px; padding-bottom: 30px; } }
@media (prefers-reduced-motion: no-preference) {
  .sheet-bg { animation: velo .25s var(--ease) both; }
  .sheet { animation: hoja .45s cubic-bezier(.32, .72, 0, 1) both; }
}
@keyframes velo { from { opacity: 0; } to { opacity: 1; } }
@keyframes hoja { from { opacity: 0; transform: translateY(40px) scale(.98); } to { opacity: 1; transform: none; } }
.toast { position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 80; padding: 12px 22px; border-radius: 999px; font-weight: 600; max-width: calc(100vw - 32px); text-align: center; }
@media (prefers-reduced-motion: no-preference) { .toast { animation: avisa .4s var(--ease) both; } }
@keyframes avisa { from { opacity: 0; transform: translate(-50%, -14px) scale(.96); } to { opacity: 1; transform: translateX(-50%); } }

@media (max-width: 520px) {
  .hubtop-bar { padding-left: 16px; }
  .hubtop-bar .btn span { display: none; }
  .hubtop-bar .btn { padding: 0; width: 42px; min-width: 42px; min-height: 42px; height: 42px; }
  .hubtop-bar .brand span { display: none; }
  .hubtop-bar { gap: 6px; padding-right: 6px; }
  .hubtop-bar .brand { min-width: 0; gap: 8px; font-size: 1rem; }
  .hubtop-bar .brand svg { width: 34px; height: auto; }
  .top-r { gap: 6px; flex: none; }
  .hubmain { gap: 18px; }
  .chip { text-align: left; line-height: 1.25; padding-block: 8px; }
}

.skip { position: fixed; left: 12px; top: -64px; z-index: 100; padding: 12px 18px; border-radius: 999px; background: var(--gold); color: var(--btnink); font-weight: 650; text-decoration: none; transition: top .2s var(--ease); }
.skip:focus { top: 12px; }
.sheet, .sheet-bg { overscroll-behavior: contain; }
#main { scroll-margin-top: 90px; outline: none; }

/* ---- Asistente ---- */
.assist { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; gap: 12px; margin: 0 0 26px; padding: 14px; border-radius: 28px; background: var(--glass); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); box-shadow: inset 0 1px 0 var(--glow), var(--shadow); }
.assist-log { display: grid; grid-template-columns: minmax(0, 1fr); padding-inline: 2px; gap: 8px; max-height: 46vh; overflow-y: auto; overscroll-behavior: contain; padding: 2px; }
.assist-log:empty { display: none; }
.bub { max-width: min(100%, 62ch); padding: 10px 15px; border-radius: 20px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.bub.me { justify-self: end; background: linear-gradient(180deg, #E0BC6A, var(--gold)); color: var(--btnink); border-bottom-right-radius: 6px; }
.bub.bot { justify-self: start; background: var(--glass-2); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.bub.wait { color: var(--muted); }
.bub.err { color: var(--danger); }
.bub.card { justify-self: start; display: grid; gap: 4px; background: var(--glass-2); border: 1px solid var(--gold); white-space: normal; }
.bub.card small { color: var(--muted); }
.cardact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.cardact .done { color: var(--goldtx); font-weight: 600; }
.bub.openrow { justify-self: start; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; background: none; }
.assist-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--glass); color: var(--muted); font-size: .88rem; touch-action: manipulation; transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease); }
.chip:active { transform: scale(.97); }
@media (hover: hover) and (pointer: fine) { .chip:hover { background: var(--glass-3); color: var(--ink); } }
.assist-form { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 16px; border: 1px solid var(--field-line); border-radius: 999px; background: var(--glass); }
.assist-form:focus-within { border-color: var(--gold); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 28%, transparent); }
.assist-ico { display: inline-grid; color: var(--goldtx); }
.assist-form input { flex: 1; min-width: 0; min-height: 40px; border: 0; background: none; color: var(--ink); font-size: 1rem; }
.assist-form input:focus { outline: none; }
.assist-form input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
@media (prefers-reduced-motion: reduce) { .chip { transition: none; } }

@media (max-width: 560px) {
  .assist { padding: 12px; border-radius: 24px; }
  .assist-form { padding-left: 12px; }
  .assist-form .btn { padding: 0 16px; }
  .hello h1 { font-size: clamp(2rem, 11vw, 2.6rem); }
}
