:root {
  --bg: #ffffff;
  --ink: #161616;
  --ink-85: rgba(22, 22, 22, 0.85);
  --ink-60: rgba(22, 22, 22, 0.6);
  --ink-45: rgba(22, 22, 22, 0.45);
  --ink-25: rgba(22, 22, 22, 0.25);
  --ink-15: rgba(22, 22, 22, 0.15);
  --field: #ededed;
  --border: #161616;
  --accent: #4b4b4b;
  --danger: #b02a20;

  --ticket-bg: #111111;
  --ticket-text: #f5f5f5;
  --ticket-text-85: rgba(245, 245, 245, 0.85);
  --ticket-text-55: rgba(245, 245, 245, 0.55);
  --ticket-divider: rgba(245, 245, 245, 0.2);

  /* Colores de estado: iguales en los dos temas, no dependen de claro/oscuro. */
  --status-pendiente: #d9483a;
  --status-agendado: #d9a02e;
  --status-senado: #3e9f5e;

  --radius: 3px;
  --font-ui: "Manrope", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
}

html[data-theme="dark"] {
  --bg: #121212;
  --ink: #f2f2f2;
  --ink-85: rgba(242, 242, 242, 0.85);
  --ink-60: rgba(242, 242, 242, 0.6);
  --ink-45: rgba(242, 242, 242, 0.45);
  --ink-25: rgba(242, 242, 242, 0.25);
  --ink-15: rgba(242, 242, 242, 0.15);
  --field: #232323;
  --border: #f2f2f2;
  --accent: #b7b7b7;
  --danger: #e0574a;

  /* El ticket siempre es oscuro, en los dos temas. */
  --ticket-bg: #111111;
  --ticket-text: #f5f5f5;
}

* { box-sizing: border-box; }

/* Barras de scroll con los colores del tema actual, en vez del gris generico del SO. */
:root { scrollbar-color: var(--ink-25) var(--bg); scrollbar-width: thin; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: var(--bg); }
*::-webkit-scrollbar-thumb {
  background: var(--ink-25);
  border-radius: 6px;
  border: 2px solid var(--bg);
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--ink-45); }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body {
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  padding-bottom: 84px;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* ---- Pantalla de login (gate): tapa toda la app hasta iniciar sesion ---- */
.login-gate { display: none; }
body.logged-out .login-gate {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  justify-content: center;
  max-width: 360px;
  margin: 0 auto;
  padding: 40px 20px;
}
.login-gate .login-brand { text-align: center; font-size: 28px; margin-bottom: 32px; }
body.logged-out .app,
body.logged-out nav.tabbar { display: none; }
body.checking .app,
body.checking nav.tabbar,
body.checking .login-gate { display: none; }

header.top {
  margin-bottom: 22px;
}

.brand-name {
  font-family: "Cinzel Decorative", var(--font-ui);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.06em;
  margin: 0 0 4px;
}
.sidebar-brand { display: none; }

.brand {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: var(--ink-60);
}

.subheader {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.back-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.back-btn:hover { background: var(--field); }
.back-btn svg { width: 20px; height: 20px; stroke: var(--ink); }
.subheader-title {
  font-size: 16px;
  font-weight: 800;
}

.field {
  width: 100%;
  background: var(--field);
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 14px;
  margin-bottom: 26px;
}
.field::placeholder { color: var(--ink-45); }
textarea.field { resize: vertical; min-height: 64px; }

.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.section-icon {
  width: 14px; height: 14px; flex-shrink: 0;
  stroke: var(--ink-45);
}
.section-icon-solid { fill: var(--ink-45); stroke: none; }
.section-icon-solid circle { fill: var(--bg); }
.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink-85);
}
.subtle-title {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: none;
  color: var(--ink-45);
}
.section-hint {
  font-size: 11px;
  color: var(--ink-45);
  margin: 0 0 26px;
}
.field-error {
  font-size: 12px;
  color: var(--danger);
  margin: -6px 0 14px;
}
.btn-google {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); border: 1px solid var(--ink-15); border-radius: var(--radius);
  padding: 12px; font-size: 14px; font-weight: 600; color: var(--ink);
  cursor: pointer;
}
.btn-google:hover { background: var(--field); }
.account-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 18px 0;
  font-size: 11px; color: var(--ink-45); text-transform: uppercase; letter-spacing: 0.04em;
}
.account-divider::before, .account-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--ink-15);
}
/* Cuando un control va seguido directo de su hint, se le achica el margen
   para que el texto explicativo quede pegado a la funcion, no "perdido". */
.field:has(+ .section-hint),
.size-row:has(+ .section-hint),
.chips:has(+ .section-hint),
.check-row:has(+ .section-hint),
.suffix-field:has(+ .section-hint),
input[type="range"]:has(+ .section-hint) {
  margin-bottom: 6px;
}
/* Un checkbox que activa/desactiva algo tiene que quedar pegado a esa funcion,
   no a 26px de distancia (pero sin pisarse con un hint que venga antes). */
.field:has(+ .check-row),
.section-hint:has(+ .check-row) {
  margin-bottom: 10px;
}

.presets {
  display: flex;
  gap: 8px;
  margin-bottom: 26px;
}
.preset-box {
  flex: 1;
  border: 1.5px dashed var(--ink-25);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  background: none;
  text-align: left;
}
.preset-box.active { background: var(--ink); border-style: solid; border-color: var(--ink); }
.preset-title { font-size: 13px; font-weight: 700; color: var(--ink); display: block; }
.preset-sub { font-size: 10.5px; color: var(--ink-60); }
.preset-box.active .preset-title { color: var(--bg); }
.preset-box.active .preset-sub { color: var(--bg); opacity: 0.7; }

.duration-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.duration-value { font-family: var(--font-mono); font-size: 15px; font-weight: 600; }

input[type="range"] {
  width: 100%;
  margin-bottom: 26px;
  accent-color: var(--ink);
}

.size-row { display: flex; gap: 10px; margin-bottom: 26px; }
.size-field { flex: 1; }
.size-field label { font-size: 10.5px; color: var(--ink-45); display: block; margin-bottom: 4px; }
.size-field .field { margin-bottom: 0; display: flex; align-items: center; gap: 6px; }
.size-field input { border: none; background: none; width: 100%; outline: none; font-size: 14px; }
.size-field .unit { color: var(--ink-45); font-size: 12px; }

/* Stepper "-  N  +": solo los botones redondos y el numero, sin caja de fondo. */
.stepper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  padding: 6px 0;
  margin-bottom: 8px;
}
.stepper-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1.5px solid var(--ink-25); background: none;
  font-size: 17px; cursor: pointer; line-height: 1; color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.stepper-btn:hover { background: var(--field); }
.stepper-btn:active { background: var(--ink-15); }
.stepper-btn:focus { outline: none; }
.stepper-value { font-family: var(--font-mono); font-weight: 700; font-size: 17px; min-width: 24px; text-align: center; }
.stepper-label { font-size: 12.5px; color: var(--ink-60); margin-bottom: 26px; text-align: center; }

/* Fila de stepper + descriptor a la derecha (colores extra). */
.stepper-row { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.stepper-row .stepper { margin-bottom: 0; }
.stepper-inline-label { font-size: 12.5px; color: var(--ink-60); margin: 0; }

.chips { display: flex; flex-direction: column; gap: 8px; margin-bottom: 26px; }
.chip-row { display: flex; gap: 8px; }
.chip {
  flex: 1;
  border: 1.5px solid var(--ink-15);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
  background: none;
  text-align: left;
}
.chip.active { background: var(--ink); border-color: var(--ink); }
.chip-label { font-size: 12.5px; font-weight: 600; display: block; color: var(--ink); }
.chip-sub { font-size: 10px; color: var(--ink-45); }
.chip.active .chip-label { color: var(--bg); }
.chip.active .chip-sub { color: var(--bg); opacity: 0.6; }

.check-row {
  display: flex; align-items: center; gap: 8px;
  padding: 2px 0; border-radius: 0; background: none;
  cursor: pointer; margin-bottom: 26px; border: none; width: auto; text-align: left;
}
.check-box {
  width: 16px; height: 16px; border-radius: 3px;
  border: 1.5px solid var(--ink-25); background: var(--bg);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 10px;
}
.check-box.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.check-text { font-size: 13px; font-weight: 600; }

.suffix-field { display: flex; align-items: center; background: var(--field); border-radius: var(--radius); padding: 0 12px; margin-bottom: 26px; }
.suffix-field input { flex: 1; border: none; background: none; padding: 12px 0; outline: none; font-size: 14px; min-width: 0; }
.suffix-field .suffix { color: var(--ink-45); font-size: 13px; }

.ticket {
  background: var(--ticket-bg);
  color: var(--ticket-text);
  border-radius: 6px;
  padding: 22px 20px;
  margin: 6px 0 16px;
}
/* El ticket es oscuro en los dos temas: con el tema oscuro se le agrega un borde
   gris para que no se pierda contra el fondo (tambien oscuro) de la app. */
html[data-theme="dark"] .ticket {
  border: 1px solid var(--ink-25);
}
.ticket-heading {
  font-weight: 700;
  font-size: 12.5px;
  margin: 0 0 6px;
}
.ticket-heading:not(:first-child) { margin-top: 14px; }
.ticket-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12.5px;
  padding: 2px 0;
  color: var(--ticket-text-85);
}
.ticket-row.muted { color: var(--ticket-text-55); }
.ticket-row .val { font-family: var(--font-mono); }
.ticket-divider { border: none; border-top: 1px solid var(--ticket-divider); margin: 14px 0; }
.ticket-total-row { display: flex; justify-content: space-between; align-items: baseline; }
.ticket-total-label { font-size: 13px; color: var(--ticket-text-85); }
.ticket-total-value { font-family: var(--font-mono); font-size: 27px; font-weight: 700; }

.btn-primary {
  width: 100%;
  background: var(--ink);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 15px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-primary:hover { opacity: 0.88; }

.btn-outline {
  width: 100%;
  background: none;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 13px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 10px;
}
.btn-outline.danger { border-color: var(--danger); color: var(--danger); }

/* Botones lado a lado (Editar/Duplicar, Compartir/Eliminar). */
.btn-row { display: flex; gap: 10px; }
.btn-row .btn-outline, .btn-row .btn-primary { margin-top: 0; }
.btn-icon-label { display: flex; align-items: center; justify-content: center; gap: 8px; }
.btn-icon-label svg { width: 16px; height: 16px; stroke: currentColor; flex-shrink: 0; }
.btn-icon-square { flex: 0 0 48px; width: 48px; padding: 0; display: flex; align-items: center; justify-content: center; }
.btn-icon-square svg { width: 18px; height: 18px; stroke: currentColor; }

.quote-disclaimer {
  font-size: 10.5px; color: var(--ink-45); text-align: center;
  line-height: 1.45; margin: 12px 0 6px;
}
.footer-credit {
  font-size: 10.5px; color: var(--ink-45); text-align: center;
  font-style: italic; margin: 0;
}

.view { display: none; }
.view.active { display: block; }

.saved-list { display: flex; flex-direction: column; gap: 8px; }
.saved-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--field); border-radius: var(--radius); padding: 12px;
  cursor: pointer; border: none; width: 100%; text-align: left;
}
.saved-name-row { display: flex; align-items: center; gap: 6px; }
.saved-row .name { font-weight: 700; font-size: 13px; }
.saved-row .sub { font-size: 11px; color: var(--ink-60); }
.saved-row .amount { font-family: var(--font-mono); font-size: 13px; }

.empty-msg { color: var(--ink-45); font-size: 13px; text-align: center; padding: 40px 0; }

.status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.status-dot[data-status="pendiente"] { background: var(--status-pendiente); }
.status-dot[data-status="agendado"] { background: var(--status-agendado); }
.status-dot[data-status="senado"] { background: var(--status-senado); }

.status-pills { display: flex; gap: 8px; margin-bottom: 18px; }
.status-pill {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1.5px solid var(--ink-15);
  border-radius: var(--radius);
  padding: 10px 6px;
  cursor: pointer;
  background: none;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
}
.status-pill.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.share-image-wrap {
  background: var(--field);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  justify-content: center;
  /* align-items: flex-start (no el "stretch" por defecto) es lo que evita que una
     imagen mas alta que el recuadro se aplaste para "entrar" -- en cambio, el
     recuadro scrollea y la imagen mantiene su alto real. */
  align-items: flex-start;
  max-height: 60vh;
  overflow-y: auto;
}
.share-image-wrap img { max-width: 100%; height: auto; border-radius: 4px; display: block; }

.search-field { position: relative; margin-bottom: 26px; }
.search-field .field { padding-right: 38px; margin-bottom: 0; }
.search-clear {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 50%; border: none;
  background: var(--ink-15); color: var(--ink-60);
  font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.search-clear:hover { background: var(--ink-25); }

/* ---- Menu de "Ajustes": Perfil / Configuracion / Idioma / Tema / Acerca de ---- */
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--field); border: none; border-radius: var(--radius);
  padding: 14px; cursor: pointer; text-align: left; width: 100%;
}
.menu-item:hover { opacity: 0.9; }
.menu-item svg { width: 20px; height: 20px; stroke: var(--ink); flex-shrink: 0; }
.menu-item-text { flex: 1; }
.menu-item-title { font-size: 13.5px; font-weight: 700; }
.menu-item-sub { font-size: 11px; color: var(--ink-60); }
.menu-item .chev { width: 16px; height: 16px; stroke: var(--ink-45); }

.profile-image-row { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.profile-image-preview {
  width: 84px; height: 84px; border-radius: var(--radius);
  background: var(--field); background-size: cover; background-position: center;
  flex-shrink: 0;
  /* El alto/ancho real se fija por JS para igualar la altura de los botones de al lado. */
}
.profile-image-actions { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.profile-image-actions .btn-outline { margin-top: 0; }

.future-note { font-size: 11px; color: var(--ink-45); margin-top: 4px; line-height: 1.5; }

.field-row-with-toggle .field { margin-bottom: 8px; }

/* Fila de zona con precio + flechas de reordenar (modo edicion) */
.zone-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--field); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px;
}
.zone-row .zone-name { flex: 1; font-size: 12.5px; font-weight: 600; }
.zone-row .zone-price { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-60); }
.zone-row input.mini-price { width: 90px; background: var(--bg); border: none; border-radius: var(--radius); padding: 6px 8px; font-family: var(--font-mono); font-size: 12px; }
.zone-row .arrow-btn { background: none; border: none; cursor: pointer; padding: 4px; }
.zone-row .arrow-btn svg { width: 18px; height: 18px; stroke: var(--ink); }
.zone-row .arrow-btn:disabled svg { stroke: var(--ink-25); }
.zone-row .arrow-btn:disabled { cursor: default; }

.config-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--field); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 6px;
}
.config-row .config-name { flex: 1; font-size: 12.5px; font-weight: 600; }
.config-row input.mini-price { width: 100px; background: var(--bg); border: none; border-radius: var(--radius); padding: 6px 8px; font-family: var(--font-mono); font-size: 12px; text-align: right; }

.zone-edit-toggle { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.pencil-btn { background: none; border: none; cursor: pointer; padding: 4px; }
.pencil-btn svg { width: 18px; height: 18px; stroke: var(--ink-60); }
.pencil-btn.active svg { stroke: var(--accent); }

.preset-edit-box { background: var(--field); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.preset-edit-title { font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.preset-edit-row { display: flex; gap: 8px; }
.preset-edit-field { flex: 1; }
.preset-edit-field label { font-size: 9.5px; color: var(--ink-45); display: block; margin-bottom: 3px; }
.preset-edit-field input { width: 100%; background: var(--bg); border: none; border-radius: var(--radius); padding: 8px; font-family: var(--font-mono); font-size: 12px; }

.disclaimer-hint {
  margin-top: 30px !important;
  padding-top: 16px;
  border-top: 1px solid var(--ink-15);
}

/* En "Configuracion" todos los titulos de funcion/campo van en mayuscula. */
#view-config .stepper-label,
#view-config .preset-edit-title,
#view-config .preset-edit-field label {
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ---- Modal de confirmacion generico (planilla sin nombre, etc.) ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 1000;
}
.modal-box {
  background: var(--bg); color: var(--ink); border-radius: 6px;
  padding: 22px; max-width: 360px; width: 100%;
}
.modal-message { font-size: 13.5px; line-height: 1.55; margin: 0 0 18px; white-space: pre-line; }
.modal-actions { display: flex; flex-direction: column; gap: 8px; }
.modal-actions .btn-outline, .modal-actions .btn-primary { margin-top: 0; }

/* ---- Idioma / Tema: lista de opciones tipo chip grande ---- */
.option-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.option-box {
  border: 1.5px solid var(--ink-15); border-radius: var(--radius);
  padding: 14px; text-align: center; cursor: pointer; background: none; font-weight: 700; font-size: 13px;
}
.option-box.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---- Acerca de ---- */
.about-version { font-size: 13px; color: var(--ink-60); margin-bottom: 8px; }
.about-expiry { font-size: 13px; color: var(--accent); font-weight: 600; margin-bottom: 20px; }
.about-line { font-size: 14px; margin-bottom: 20px; }
.about-credits { font-size: 12px; color: var(--ink-60); margin-bottom: 26px; font-style: italic; }

.legal-block { margin-bottom: 16px; }
.legal-heading { font-weight: 700; font-size: 12.5px; margin-bottom: 4px; }
.legal-body { font-size: 12px; color: var(--ink-60); line-height: 1.55; }

/* ---- Pantalla de beta expirada: bloquea todo, sin nav ---- */
.expired-screen {
  position: fixed; inset: 0; background: var(--bg); color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 32px; z-index: 999;
}
.expired-screen h1 { font-size: 20px; margin-bottom: 14px; }
.expired-screen p { font-size: 14px; color: var(--ink-60); max-width: 320px; line-height: 1.6; }

nav.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg);
  border-top: 1px solid var(--ink-15);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 0 calc(8px + env(safe-area-inset-bottom));
  z-index: 10;
}
.user-bar {
  display: flex; align-items: center; gap: 10px;
  width: 100%; max-width: 480px;
  padding: 10px 16px;
  background: none; border: none;
  cursor: pointer; text-align: left;
}
/* #userBar vive en la nav (sidebar de desktop): solo se ve ahi, no en mobile
   (en mobile se muestra la variante de abajo, adentro de "Ajustes"). */
#userBar { display: none; border-bottom: 1px solid var(--ink-15); }
/* #userBarSettings vive arriba del todo en la vista "Ajustes": solo en mobile. */
.user-bar-settings {
  padding: 14px 0;
  margin-bottom: 18px;
  border-top: 1px solid var(--ink-15);
  border-bottom: 1px solid var(--ink-15);
}
.user-avatar {
  flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--field) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-45);
}
.user-avatar svg { width: 16px; height: 16px; stroke: currentColor; }
/* Fondo blanco fijo detras de la imagen: si suben un PNG con transparencia,
   que se vea sobre blanco siempre, sin importar el tema claro/oscuro. */
.user-avatar.has-image { background-color: #fff; }
.user-avatar.has-image svg { display: none; }
.user-text {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 8px;
}
.user-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 600; color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-plan-pill {
  flex: none;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--ink-60); background: var(--field); border: 1px solid var(--ink-15);
  padding: 3px 8px; border-radius: 999px;
}
.tabbar-inner { display: flex; width: 100%; max-width: 480px; padding: 8px 0 0; }
.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  font-size: 10px; color: var(--ink-45); letter-spacing: 0.03em;
}
.tab.active { color: var(--ink); font-weight: 700; }
.tab svg { width: 20px; height: 20px; stroke: currentColor; }

/* ---- Desktop: aprovecha el ancho, formulario + ticket lado a lado, y la nav
   pasa de barra inferior a columna fija a la izquierda de la pantalla. ---- */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: 280px; }
  /* Sin sesion, el menu de la izquierda esta oculto -- que el body no le siga
     reservando el espacio, si no la pantalla de login queda corrida a la derecha
     en vez de centrada de verdad. */
  body.logged-out, body.checking { padding-left: 0; }

  .app {
    max-width: 1040px;
    margin: 0 auto;
    padding-top: 48px;
  }
  #view-calc.active {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 48px;
    align-items: start;
  }
  /* Sticky: el ticket baja/sube seguido con el scroll de la pagina, en vez de
     quedarse fijo arriba o desaparecer al scrollear. Solo en desktop. */
  .ticket-col { position: sticky; top: 24px; align-self: start; }

  nav.tabbar {
    top: 0; bottom: 0; left: 0; right: auto;
    width: 280px;
    border-top: none;
    border-right: 1px solid var(--ink-15);
    justify-content: flex-start;
    padding: 40px 24px;
  }
  /* "TATTOOLATOR" pasa del header de contenido a la nav (arriba de la barra de
     usuario), asi no se repite en desktop. */
  #mainHeader .brand-name { display: none; }
  .sidebar-brand { display: block; max-width: none; margin-bottom: 22px; }

  /* La previsualizacion del ticket a compartir, a tamaño real (ancho fijo del canvas),
     se ve enorme en una pantalla ancha -- la achicamos y el alto sigue scrolleando si
     el ticket crece por tener muchos items. */
  .share-image-wrap { max-width: 640px; margin-left: auto; margin-right: auto; }

  /* La barra de usuario vive en la nav en desktop, no adentro de "Ajustes". */
  #userBar { display: flex; max-width: none; }
  .user-bar-settings { display: none; }
  /* En la sidebar angosta, nombre y pildora en dos lineas: si van en la misma
     fila que el avatar, el nombre queda con muy poco lugar y se corta de mas. */
  #userBar .user-text { flex-direction: column; align-items: flex-start; gap: 3px; }
  #userBar .user-name { width: 100%; }
  .tabbar-inner { flex-direction: column; max-width: none; width: 100%; gap: 4px; }
  .tab {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius);
  }
  .tab:hover { background: var(--field); }
  .tab.active { background: var(--field); }
}
