/* Vorka OS · estilos
   Interfaz móvil primero, tipo app nativa: fuente del sistema, blanco/negro, separadores finos,
   morado Vorka solo como acento y el anillo de "historias" para clientes que necesitan atención. */
:root {
  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #efefef;
  --fg: #0c0c0c;
  --fg-2: #737373;
  --fg-3: #a8a8a8;
  --line: #dbdbdb;
  --line-2: #efefef;
  --accent: #6b2a85;
  --accent-fg: #ffffff;
  --link: #5b2373;
  --good: #1f8a4c;
  --warn: #b7791f;
  --crit: #e0245e;
  --ring: linear-gradient(45deg, #e5a93a 0%, #e88a3d 25%, #c94b3a 55%, #a3307a 78%, #6b2a85 100%);
  --sheet: #ffffff;
  --scrim: rgba(0, 0, 0, .45);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --tab-h: 52px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --bg-2: #0c0c0c; --bg-3: #1f1f1f;
    --fg: #f5f5f5; --fg-2: #a8a8a8; --fg-3: #6e6e6e;
    --line: #262626; --line-2: #1a1a1a;
    --accent: #b98fd0; --accent-fg: #000000; --link: #c9a6dc;
    --good: #3fbf74; --warn: #e3a64a; --crit: #ff4d7d;
    --sheet: #1c1c1e; --scrim: rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- estructura ---------- */
.app { max-width: 630px; margin: 0 auto; min-height: 100%; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 24px); }
@media (min-width: 700px) { .app { border-left: 1px solid var(--line-2); border-right: 1px solid var(--line-2); } }

.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px; min-height: 52px;
}
.topbar.line { border-bottom: 1px solid var(--line); }
.wordmark { font-size: 24px; font-weight: 700; letter-spacing: -.045em; }
.wordmark span { color: var(--accent); }
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; flex: 1; text-align: center; }
.topbar .side { width: 32px; display: flex; }
.topbar .right { margin-left: auto; display: flex; gap: 18px; }
.icon-btn { width: 28px; height: 28px; display: grid; place-items: center; position: relative; }
.icon-btn .badge { position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--crit); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); box-sizing: content-box; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabbar nav { max-width: 630px; margin: 0 auto; height: var(--tab-h); display: grid; grid-template-columns: repeat(5, 1fr); }
.tab { display: grid; place-items: center; color: var(--fg); }
.tab svg { width: 26px; height: 26px; }
.tab .on { display: none; }
.tab[aria-current="page"] .on { display: block; }
.tab[aria-current="page"] .off { display: none; }

/* ---------- historias ---------- */
.stories { display: flex; gap: 14px; overflow-x: auto; padding: 8px 16px 14px; scrollbar-width: none; border-bottom: 1px solid var(--line-2); }
.stories::-webkit-scrollbar { display: none; }
.story { flex: none; width: 70px; display: grid; justify-items: center; gap: 5px; }
.story span { font-size: 12px; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story.seen span { color: var(--fg-2); }

.ring { padding: 2.5px; border-radius: 50%; background: var(--line); display: inline-grid; }
.ring.hot { background: var(--ring); }
.ring > .av { border: 2.5px solid var(--bg); }
.av {
  border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; flex: none;
  letter-spacing: .01em; user-select: none;
}
.av.s28 { width: 28px; height: 28px; font-size: 11px; }
.av.s32 { width: 32px; height: 32px; font-size: 12px; }
.av.s44 { width: 44px; height: 44px; font-size: 15px; }
.av.s60 { width: 60px; height: 60px; font-size: 20px; }
.av.s86 { width: 86px; height: 86px; font-size: 28px; }
.add-story .av { background: var(--bg-3); color: var(--fg); border: 1px solid var(--line); }

/* ---------- secciones ---------- */
.sec { padding: 18px 16px 4px; display: flex; align-items: baseline; gap: 8px; }
.sec h2 { font-size: 16px; font-weight: 700; margin: 0; }
.sec .more { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--link); }
.sec .muted { margin-left: auto; font-size: 13px; color: var(--fg-2); }

.hello { padding: 14px 16px 2px; }
.hello h2 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 2px; }
.hello p { margin: 0; color: var(--fg-2); font-size: 14px; }

/* tarjeta tipo publicación */
.post { border-bottom: 1px solid var(--line-2); padding: 12px 0 14px; }
.post-h { display: flex; align-items: center; gap: 10px; padding: 0 16px; }
.post-h .who { min-width: 0; flex: 1; }
.post-h b { font-size: 14px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-h small { font-size: 12px; color: var(--fg-2); }
.post-b { padding: 10px 16px 0; }
.post-b h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em; }
.post-b p { margin: 0; font-size: 14px; color: var(--fg); white-space: pre-line; }
.post-b .why { margin-top: 6px; color: var(--fg-2); font-size: 13px; }
.post-a { display: flex; gap: 8px; padding: 12px 16px 0; flex-wrap: wrap; }
.pill { font-size: 11px; font-weight: 700; letter-spacing: .02em; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.pill.crit { background: color-mix(in srgb, var(--crit) 12%, transparent); color: var(--crit); }
.pill.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.pill.acc { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.pill.good { background: color-mix(in srgb, var(--good) 12%, transparent); color: var(--good); }
.pill.mute { background: var(--bg-3); color: var(--fg-2); }

/* botones */
.btn { height: 34px; padding: 0 16px; border-radius: 8px; font-size: 14px; font-weight: 600; background: var(--bg-3); color: var(--fg); display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: opacity .15s, transform .1s; white-space: nowrap; }
.btn:active { transform: scale(.97); opacity: .8; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.block { width: 100%; height: 44px; border-radius: 10px; font-size: 15px; }
.btn.flex { flex: 1; }
.btn.danger { color: var(--crit); }
.btn[disabled] { opacity: .45; pointer-events: none; }
.link { color: var(--link); font-weight: 600; font-size: 14px; }

/* cifras */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); padding: 14px 16px; gap: 8px; border-bottom: 1px solid var(--line-2); }
.stat { text-align: center; }
.stat b { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.stat span { font-size: 12.5px; color: var(--fg-2); }
.stat.crit b { color: var(--crit); }

/* listas */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 9px 16px; min-height: 60px; width: 100%; text-align: left; }
.row:active { background: var(--bg-2); }
.row .txt { min-width: 0; flex: 1; }
.row .txt b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .txt span { display: block; font-size: 13px; color: var(--fg-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex: none; display: grid; justify-items: end; gap: 3px; }
.row .end b { font-size: 14px; font-weight: 600; }
.row .chev { color: var(--fg-3); flex: none; }
.date-chip { width: 44px; height: 44px; border-radius: 10px; background: var(--bg-3); display: grid; place-items: center; text-align: center; line-height: 1; flex: none; }
.date-chip b { font-size: 16px; font-weight: 700; display: block; }
.date-chip span { font-size: 10px; font-weight: 600; text-transform: uppercase; color: var(--fg-2); letter-spacing: .04em; }
.date-chip.crit { background: color-mix(in srgb, var(--crit) 12%, transparent); }
.date-chip.crit b, .date-chip.crit span { color: var(--crit); }

/* actividad */
.act { display: flex; gap: 12px; padding: 10px 16px; align-items: flex-start; }
.act .dot { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-3); display: grid; place-items: center; flex: none; color: var(--fg-2); }
.act .dot.auto { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.act p { margin: 0; font-size: 14px; flex: 1; min-width: 0; }
.act time { color: var(--fg-2); font-size: 13px; margin-left: 4px; white-space: nowrap; }

/* búsqueda */
.search { margin: 4px 16px 8px; position: relative; }
.search input { width: 100%; height: 36px; border-radius: 10px; border: 0; background: var(--bg-3); padding: 0 12px 0 36px; font-size: 15px; outline: none; }
.search svg { position: absolute; left: 11px; top: 9px; color: var(--fg-2); }

/* segmentos */
.seg { display: flex; border-top: 1px solid var(--line-2); position: sticky; top: calc(52px + env(safe-area-inset-top, 0px)); background: var(--bg); z-index: 10; }
.seg button { flex: 1; height: 44px; display: grid; place-items: center; color: var(--fg-3); border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.seg button[aria-selected="true"] { color: var(--fg); border-bottom: 1.5px solid var(--fg); }
.chips { display: flex; gap: 8px; padding: 6px 16px 10px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { height: 32px; padding: 0 14px; border-radius: 8px; background: var(--bg-3); font-size: 14px; font-weight: 600; white-space: nowrap; flex: none; }
.chip[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

/* perfil */
.profile { padding: 14px 16px 6px; }
.profile-top { display: flex; align-items: center; gap: 22px; }
.profile-top .stats { flex: 1; border: 0; padding: 0; }
.profile h2 { font-size: 15px; font-weight: 700; margin: 12px 0 1px; }
.profile .bio { font-size: 14px; white-space: pre-line; }
.profile .bio span { color: var(--fg-2); }
.profile-a { display: flex; gap: 6px; margin-top: 12px; }
.profile-a .btn { padding: 0 8px; min-width: 0; font-size: 13.5px; }

/* vacío */
.empty { text-align: center; padding: 48px 32px; display: grid; justify-items: center; gap: 10px; }
.empty .ico { width: 72px; height: 72px; border-radius: 50%; border: 2px solid var(--fg); display: grid; place-items: center; }
.empty h3 { margin: 6px 0 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.empty p { margin: 0; color: var(--fg-2); font-size: 14px; max-width: 34ch; }
.done { margin: 10px 16px; padding: 18px; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line-2); display: flex; gap: 12px; align-items: center; }
.done .ok { width: 36px; height: 36px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; flex: none; }
.done b { display: block; font-size: 14.5px; }
.done span { font-size: 13px; color: var(--fg-2); }

.note { margin: 10px 16px; padding: 12px 14px; border-radius: 12px; background: color-mix(in srgb, var(--warn) 10%, transparent); font-size: 13.5px; display: flex; gap: 10px; align-items: flex-start; }
.note b { font-weight: 600; }

/* ---------- hojas ---------- */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 50; opacity: 0; transition: opacity .25s; }
.scrim.in { opacity: 1; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; background: var(--sheet); border-radius: 14px 14px 0 0;
  max-height: 92vh; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .32s cubic-bezier(.2, .9, .25, 1);
  max-width: 630px; margin: 0 auto; padding-bottom: env(safe-area-inset-bottom, 0px);
}
.sheet.in { transform: translateY(0); }
.sheet .grab { width: 36px; height: 4px; border-radius: 2px; background: var(--fg-3); margin: 8px auto 2px; opacity: .6; flex: none; }
.sheet-h { display: flex; align-items: center; padding: 6px 16px 10px; border-bottom: 1px solid var(--line); flex: none; }
.sheet-h h3 { flex: 1; text-align: center; margin: 0; font-size: 16px; font-weight: 700; }
.sheet-h button { min-width: 64px; font-size: 15px; }
.sheet-h .go { color: var(--link); font-weight: 700; text-align: right; }
.sheet-h .x { text-align: left; }
.sheet-b { overflow-y: auto; padding: 4px 0 18px; -webkit-overflow-scrolling: touch; }
.menu button { width: 100%; display: flex; gap: 14px; align-items: center; padding: 14px 20px; font-size: 15px; text-align: left; }
.menu button:active { background: var(--bg-2); }
.menu button.danger { color: var(--crit); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* formularios */
.field { padding: 10px 16px; border-bottom: 1px solid var(--line-2); display: grid; gap: 4px; }
.field label { font-size: 12.5px; color: var(--fg-2); font-weight: 600; }
.field input, .field textarea, .field select { border: 0; background: transparent; padding: 2px 0; font-size: 16px; outline: none; width: 100%; resize: none; }
.field textarea { min-height: 96px; line-height: 1.45; }
.field.tall textarea { min-height: 220px; }
.field .hint { font-size: 12.5px; color: var(--fg-3); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; }
.field-row .field + .field { border-left: 1px solid var(--line-2); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-2); font-size: 15px; }
.toggle small { display: block; color: var(--fg-2); font-size: 12.5px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 16px; background: var(--bg-3); border: 1px solid var(--line); transition: background .2s; }
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 25px; height: 25px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--good); border-color: var(--good); }
.switch input:checked + i::after { transform: translateX(20px); }
.group-t { padding: 18px 16px 6px; font-size: 13px; font-weight: 700; color: var(--fg-2); text-transform: uppercase; letter-spacing: .04em; }
.picker { display: flex; gap: 8px; padding: 10px 16px; overflow-x: auto; scrollbar-width: none; }

/* login */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: 100%; max-width: 350px; display: grid; gap: 12px; text-align: center; }
.login-box .wordmark { font-size: 44px; margin-bottom: 18px; }
.login-box input { height: 44px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); padding: 0 12px; font-size: 15px; outline: none; }
.login-box input:focus { border-color: var(--fg-3); }
.login-box p { margin: 0; font-size: 13.5px; color: var(--fg-2); }
.login-box .err { color: var(--crit); }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px) + 16px); transform: translate(-50%, 20px); opacity: 0;
  background: var(--fg); color: var(--bg); padding: 11px 18px; border-radius: 10px; font-size: 14px; font-weight: 600; z-index: 60; transition: all .25s; max-width: calc(100% - 32px); text-align: center; pointer-events: none; }
.toast.in { opacity: 1; transform: translate(-50%, 0); }

/* esqueleto de carga */
.skel { background: linear-gradient(90deg, var(--bg-3), var(--bg-2), var(--bg-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }

.fade { animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.post.leaving { transition: opacity .3s, transform .3s; opacity: 0; transform: translateX(30px); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.field select { appearance: none; -webkit-appearance: none; padding-right: 24px;
  background: no-repeat right 2px center / 14px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a8a8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.field input[type="date"] { min-height: 24px; }
