:root {
  --primary: #FFC400;
  --primary-light: #e6b000;
  --accent: #2196F3;
  --success: #43a047;
  --warning: #FB8C00;
  --danger: #e53935;
  --bg: #f0f4f8;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7a99;
  --border: #dde3ed;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(30,56,100,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

/* ── Layout ─────────────────────────────────────────────────────── */

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }

header {
  background: var(--primary);
  color: #1a1a2e;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.20);
  min-height: 72px;
}

/* Izquierda: logo */
.header-left { flex-shrink: 0; display: flex; align-items: center; }
.header-logo { height: 56px; display: block; }

/* Centro: ContaBot + subtítulo — posicionado en el centro absoluto del header */
.header-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}
.header-title {
  font-size: 26px;
  font-weight: 800;
  color: #1a1a2e;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.header-sub {
  font-size: 10px;
  font-weight: 600;
  color: #1a1a2e;
  opacity: 0.55;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* Derecha: usuario + logout */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
header .user-badge { font-size: 11px; opacity: .75; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#btn-logout { background: none; border: none; color: #1a1a2e; font-size: 20px; cursor: pointer; padding: 6px; border-radius: 8px; opacity: 0.7; }
#btn-logout:active { background: rgba(0,0,0,.12); opacity: 1; }

#content { flex: 1; padding: 18px; padding-top: 90px; }

/* ── Cards ──────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* ── Botones ─────────────────────────────────────────────────────── */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: filter .15s, transform .1s;
  text-decoration: none;
}
.btn:active { transform: scale(.97); filter: brightness(.9); }
.btn-primary { background: var(--primary); color: #1a1a2e; }
.btn-accent  { background: var(--accent);  color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-ghost     { background: var(--bg);      color: var(--primary); border: 2px solid var(--border); }
.btn-secondary { background: #f0f4f8;      color: #1e3864;        border: 2px solid #c8d4e8; }
.btn-sm      { padding: 9px 14px; font-size: 13px; width: auto; border-radius: 10px; }
.btn-row     { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ── Menú principal ──────────────────────────────────────────────── */

.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.menu-btn {
  background: var(--card);
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  color: var(--text);
}
.menu-btn:active { transform: scale(.95); box-shadow: none; }
.menu-btn .icon  { font-size: 34px; }
.menu-btn .label { font-size: 13px; font-weight: 600; text-align: center; line-height: 1.3; }
.menu-btn.accent  .icon { filter: drop-shadow(0 0 4px rgba(33,150,243,.5)); }
.menu-btn.success .icon { filter: drop-shadow(0 0 4px rgba(67,160,71,.5)); }

/* ── Formularios ─────────────────────────────────────────────────── */

.form-group { margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; display: block; margin-bottom: 6px; }
.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  color: var(--text);
  background: #fff;
  outline: none;
  transition: border-color .2s;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255,196,0,.18); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7a99' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }

/* ── Login ───────────────────────────────────────────────────────── */

#screen-login {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80dvh;
  gap: 16px;
}
.login-logo  { line-height: 1; }
.login-title { font-size: 28px; font-weight: 800; color: var(--primary); letter-spacing: -0.5px; }
.login-sub   { font-size: 14px; color: var(--muted); text-align: center; margin-top: -8px; }
.login-card  { width: 100%; }
.login-card .form-label { color: var(--primary); }
.login-card .btn-primary { font-size: 16px; font-weight: 700; letter-spacing: 0.3px; }

/* ── Alerta / Estado ─────────────────────────────────────────────── */

.alert {
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error   { background: #fdecea; color: #c62828; }
.alert-success { background: #e8f5e9; color: #2e7d32; }
.alert-info    { background: #e3f2fd; color: #1565c0; }

/* ── Spinner ─────────────────────────────────────────────────────── */

.spinner-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 0; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Foto upload ─────────────────────────────────────────────────── */

.photo-drop {
  border: 2.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--bg);
  transition: border-color .2s;
}
.photo-drop:hover { border-color: var(--accent); }
.photo-drop .drop-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.photo-drop .drop-hint { font-size: 14px; color: var(--muted); }
#photo-preview { max-width: 100%; border-radius: var(--radius); display: none; margin-bottom: 14px; box-shadow: var(--shadow); }

/* ── Resumen data ────────────────────────────────────────────────── */

.resumen-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.resumen-row:last-child { border-bottom: none; }
.resumen-key { font-size: 14px; color: var(--muted); }
.resumen-val { font-size: 15px; font-weight: 700; color: var(--text); }
.resumen-total { font-size: 18px; font-weight: 800; color: var(--primary); }

/* ── Lista items ─────────────────────────────────────────────────── */

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-item-left { flex: 1; }
.list-item-title { font-size: 15px; font-weight: 600; }
.list-item-sub   { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ── Badge ───────────────────────────────────────────────────────── */

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff8e1; color: #f57f17; }
.badge-danger  { background: #fdecea; color: #c62828; }
.badge-info    { background: #e3f2fd; color: #1565c0; }
.badge-muted   { background: var(--bg); color: var(--muted); }

/* ── Permiso toggles ─────────────────────────────────────────────── */

.perm-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.perm-toggle:last-child { border-bottom: none; }
.toggle-switch { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 12px;
  transition: background .2s;
  cursor: pointer;
}
.toggle-slider:before {
  content: ''; position: absolute;
  width: 18px; height: 18px;
  left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform .2s;
}
input:checked + .toggle-slider { background: var(--success); }
input:checked + .toggle-slider:before { transform: translateX(20px); }

/* ── Campos editables en revisión de foto ────────────────────────── */

.field-edit {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.field-edit:last-child { border-bottom: none; }
.field-key { font-size: 13px; color: var(--muted); font-weight: 600; min-width: 110px; }
.field-val { font-size: 14px; flex: 1; text-align: right; cursor: pointer; color: var(--primary); text-decoration: underline dotted; }
.field-val.plain { color: var(--text); text-decoration: none; cursor: default; }

/* ── Back button ─────────────────────────────────────────────────── */

.back-btn { background: none; border: none; color: var(--primary); font-size: 15px; font-weight: 600; cursor: pointer; padding: 0 0 14px; display: flex; align-items: center; gap: 6px; }

/* ── Tabs ────────────────────────────────────────────────────────── */

.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.tab { flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Galería grid ────────────────────────────────────────────────── */

.galeria-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.galeria-item { background: var(--bg); border-radius: 10px; padding: 12px; font-size: 12px; color: var(--muted); text-align: center; cursor: pointer; border: 2px solid transparent; transition: border-color .2s; }
.galeria-item:hover { border-color: var(--accent); }
.galeria-item .gi-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.galeria-item .gi-text { line-height: 1.4; }

/* ── Utilidades ──────────────────────────────────────────────────── */

.mt-8  { margin-top: 8px;  }
.mt-10 { margin-top: 10px; }
.mt-14 { margin-top: 14px; }
.mb-14 { margin-bottom: 14px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: 13px; }
.divider     { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.hidden      { display: none !important; }
.bold        { font-weight: 700; }
.big-num     { font-size: 28px; font-weight: 800; color: var(--primary); }
