/* ============================================================
   App de clientes con contrato (Android, iPhone, Windows y web)
   ============================================================ */

body { font-size: 16px; background: var(--bg); min-height: 100vh; }
.input, .textarea, .select { font-size: 16px; min-height: 46px; }
.textarea { min-height: 150px; }
.btn { min-height: 44px; }

.wrap { width: min(560px, 100%); margin: 0 auto; padding: 0 18px; }

/* ---------------- Ingreso ---------------- */
.entry {
  min-height: 100vh; display: grid; place-items: center;
  padding: max(24px, env(safe-area-inset-top)) 18px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(900px 420px at 90% -10%, rgba(79, 134, 242, .35), transparent 60%), linear-gradient(165deg, #0E2747, #0A1C36);
}
.entry__card { width: min(420px, 100%); }
.entry__card > .stub-top, .entry__card > .stub-bottom { --notch: 13px; }
.entry__top { padding: 28px 26px 20px; display: flex; align-items: center; gap: 12px; }
.entry__top img { width: 50px; height: 50px; }
.entry__name { font-family: var(--font-narrow); font-weight: 700; font-size: 25px; color: var(--ink); line-height: 1; }
.entry__sub { color: var(--muted); font-size: 14px; margin-top: 4px; }
.entry__body { padding: 22px 26px 26px; display: grid; gap: 16px; }
.entry__foot { font-size: 13px; color: var(--muted); text-align: center; }

/* ---------------- Barra superior ---------------- */
.bar {
  position: sticky; top: 0; z-index: 10; background: var(--navy); color: #fff;
  padding-top: env(safe-area-inset-top);
}
:root[data-theme='dark'] .bar { background: #071121; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .bar { background: #071121; } }
.bar__in { display: flex; align-items: center; gap: 10px; min-height: 58px; }
.bar__brand { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.bar__brand img { width: 32px; height: 32px; border-radius: 8px; }
.bar__title { font-family: var(--font-narrow); font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar button { background: transparent; border: 0; color: #fff; cursor: pointer; }
.bar .icon-btn { color: #D6E2F5; width: 40px; height: 40px; }
.bar .icon-btn:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: #2F6AE0; font-weight: 700; font-size: 14px; letter-spacing: .3px;
}

/* ---------------- Inicio ---------------- */
.hello { padding: 22px 0 16px; }
.hello__name { font-size: 24px; font-weight: 700; color: var(--ink); }
.hello__company { color: var(--muted); margin-top: 2px; }
.cta {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 18px 18px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--brand); color: #fff; box-shadow: 0 10px 24px rgba(31, 94, 219, .28);
}
.cta:hover { background: var(--brand-hover); }
.cta__icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .16); flex: none; }
.cta__icon svg { width: 26px; height: 26px; }
.cta__title { font-size: 19px; font-weight: 700; display: block; }
.cta__sub { font-size: 14px; opacity: .85; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { font-size: 17px; }
.list { display: grid; gap: 12px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
.none { text-align: center; color: var(--muted); padding: 28px 12px; border: 1.5px dashed var(--line-strong); border-radius: 14px; }

/* Ticket en la lista: cuerpo + talón separados por una línea de corte */
.tk {
  display: grid; grid-template-columns: minmax(0, 1fr) 98px; width: 100%; padding: 0; border: 0; background: none;
  text-align: left; cursor: pointer; color: inherit;
  filter: drop-shadow(0 1px 1.5px rgba(14, 39, 71, .14)) drop-shadow(0 6px 14px rgba(14, 39, 71, .06));
}
.tk__main, .tk__side { --notch: 9px; background: var(--surface); }
.tk__main {
  padding: 14px 14px 14px 16px; border-radius: 14px 0 0 14px; display: grid; gap: 4px; min-width: 0;
  -webkit-mask: radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle var(--notch) at 100% 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 100% 100%, #0000 98%, #000);
  mask-composite: intersect;
}
.tk__side {
  position: relative; border-radius: 0 14px 14px 0; display: grid; place-items: center; align-content: center; gap: 6px;
  padding: 10px 6px; text-align: center; font-size: 12.5px; font-weight: 600;
  -webkit-mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000);
  -webkit-mask-composite: source-in;
  mask: radial-gradient(circle var(--notch) at 0 0, #0000 98%, #000), radial-gradient(circle var(--notch) at 0 100%, #0000 98%, #000);
  mask-composite: intersect;
}
.tk__side::before { content: ''; position: absolute; left: -1px; top: calc(var(--notch) + 5px); bottom: calc(var(--notch) + 5px); border-left: 2px dashed var(--line-strong); }
.tk__side .led { width: 11px; height: 11px; }
.tk__side--nuevo { color: var(--st-nuevo); }
.tk__side--en_proceso { color: var(--st-proceso); }
.tk__side--pendiente { color: var(--st-pendiente); }
.tk__side--atendido { color: var(--st-atendido); }
.tk__side--cancelado { color: var(--st-cancelado); }
.tk .tcode { font-size: 16px; }
.tk__subject { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk__when { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ---------------- Formulario ---------------- */
.page-head { display: flex; align-items: center; gap: 6px; }
.form { display: grid; gap: 18px; padding: 22px 0 calc(110px + env(safe-area-inset-bottom)); }
.form h1 { font-size: 22px; }
.hint-ids { display: grid; gap: 8px; padding: 14px; border-radius: 12px; background: var(--brand-soft); color: var(--ink); font-size: 14px; }
.hint-ids__row { display: flex; flex-wrap: wrap; gap: 6px; }
.id-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.id-chip b { font-family: var(--font-narrow); font-variant-numeric: tabular-nums; letter-spacing: .3px; color: var(--ink); }
.sticky-actions {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
}
.sticky-actions .btn { width: min(524px, 100%); margin: 0 auto; display: flex; }

/* ---------------- Confirmación ---------------- */
.done { padding-top: 34px; padding-bottom: 40px; display: grid; gap: 22px; }
.receipt { --stub-bg: var(--surface); filter: drop-shadow(0 12px 28px rgba(14, 39, 71, .16)); }
.receipt > .stub-top, .receipt > .stub-bottom { --notch: 14px; }
.receipt__top { padding: 26px 24px 22px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.receipt__ok { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--st-atendido-bg); color: var(--st-atendido); }
.receipt__ok svg { width: 28px; height: 28px; }
.receipt__label { color: var(--muted); font-size: 14px; }
.receipt .tcode { font-size: 30px; }
.receipt__bottom { padding: 22px 24px 24px; display: grid; gap: 14px; }
.receipt__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: center; }
.receipt__k { color: var(--muted); font-size: 13px; }
.receipt__v { font-family: var(--font-narrow); font-weight: 700; font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.receipt__note { color: var(--muted); font-size: 14px; text-align: center; }

/* ---------------- Hoja de detalle ---------------- */
dialog.sheet {
  width: min(560px, 100vw); max-width: 100vw; max-height: 88vh; margin: auto auto 0; padding: 0;
  border: 0; border-radius: 18px 18px 0 0; background: var(--surface); color: var(--text);
  padding-bottom: env(safe-area-inset-bottom);
}
dialog.sheet::backdrop { background: rgba(8, 18, 34, .55); }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 18px; } }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 20px 6px; }
.sheet__head .tcode { font-size: 22px; }
.sheet__body { padding: 6px 20px 22px; display: grid; gap: 16px; overflow: auto; max-height: calc(88vh - 70px); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; }
.steps li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; position: relative; padding-bottom: 14px; }
.steps li::before { content: ''; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: var(--line); }
.steps li:last-child::before { display: none; }
.steps__dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); }
.steps li.is-done .steps__dot { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 3px var(--surface); }
.steps li.is-done.is-ok .steps__dot { border-color: var(--st-atendido); background: var(--st-atendido); }
.steps li.is-done.is-bad .steps__dot { border-color: var(--st-cancelado); background: var(--st-cancelado); }
.steps li.is-done.is-warn .steps__dot { border-color: var(--st-pendiente); background: var(--st-pendiente); }
.steps__t { font-weight: 600; color: var(--ink); }
.steps__s { color: var(--muted); font-size: 13.5px; }
.box { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.box--ok { background: var(--st-atendido-bg); border-color: transparent; }
.box--bad { background: var(--st-cancelado-bg); border-color: transparent; }
.label { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }

/* ---------------- Menú ---------------- */
.menu { position: absolute; right: 12px; top: calc(100% + 6px); min-width: 230px; padding: 6px; border-radius: 14px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); display: grid; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; color: var(--text) !important; text-decoration: none; font-size: 15px; text-align: left; }
.menu button:hover, .menu a:hover { background: var(--surface-2); }
.menu svg { width: 19px; height: 19px; color: var(--muted); }
.menu__who { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu__who b { display: block; color: var(--ink); }
.menu__who span { color: var(--muted); font-size: 13px; }

.profile { padding-top: 22px; padding-bottom: 40px; display: grid; gap: 18px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; }
.card h2 { font-size: 16px; }
.kv2 { display: grid; grid-template-columns: 96px 1fr; gap: 8px 12px; }
.kv2 dt { color: var(--muted); font-size: 14px; }
.kv2 dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.rid { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.rid b { font-family: var(--font-narrow); font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: .3px; }
.offline-banner { background: #8F1717; color: #fff; text-align: center; font-size: 13.5px; padding: 6px 12px; }
