@import url('https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  --ink: #0E2A3D;
  --teal: #1F8A8F;
  --teal-dark: #176A6E;
  --amber: #D97B29;
  --green: #2F7D5B;
  --bg: #EEF3F2;
  --surface: #FFFFFF;
  --line: #D7E0DE;
  --text: #14232A;
  --text-muted: #5B6E72;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .num, .brand, .tabbar button span {
  font-family: 'Barlow Semi Condensed', sans-serif;
}

button { font-family: inherit; }

#app-root {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  position: relative;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 12px;
  background: var(--ink);
  color: #fff;
}
.topbar .brand {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .brand .drop { width: 14px; height: 14px; border-radius: 50% 50% 50% 0; background: var(--teal); transform: rotate(45deg); }
.topbar .date { font-size: 13px; color: #B9CBD1; }

/* Views */
.view { display: none; padding: 18px 18px 90px; flex: 1; }
.view.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
}

label { display: block; font-size: 13px; color: var(--text-muted); margin: 14px 0 6px; font-weight: 500; }
label:first-child { margin-top: 0; }

input[type=text], input[type=date], input[type=password], input[type=email], select, textarea {
  width: 100%;
  padding: 14px 12px;
  font-size: 16px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); border-color: var(--teal); }

.readonly-field {
  padding: 14px 12px;
  border-radius: 8px;
  background: #F3F7F6;
  border: 1.5px dashed var(--line);
  color: var(--text-muted);
  font-size: 15px;
}

.btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 16px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Barlow Semi Condensed', sans-serif;
  letter-spacing: 0.2px;
  cursor: pointer;
  min-height: 56px;
}
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:active { background: var(--teal-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--line); }
.btn-danger { background: #fff; color: #B3401D; border: 1.5px solid #E7C4B4; }
.btn-ghost { background: transparent; color: var(--teal-dark); text-decoration: underline; padding: 10px; min-height: unset; }
.btn + .btn { margin-top: 10px; }
.btn:disabled { opacity: 0.5; }

/* Tab bar */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  padding: 6px 4px calc(env(safe-area-inset-bottom, 0px) + 4px);
  z-index: 20;
}
.tabbar button {
  flex: 1;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 2px;
  color: var(--text-muted);
  min-height: 56px;
}
.tabbar button.active { color: var(--teal-dark); }
.tabbar button .dot { width: 7px; height: 7px; border-radius: 50%; background: transparent; }
.tabbar button.active .dot { background: var(--teal); }
.tabbar button span.label { font-size: 13px; font-weight: 600; }

/* Client picker / list rows */
.list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.list-row .main { font-weight: 600; font-size: 15px; }
.list-row .sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.badge { font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 20px; font-family: 'Barlow Semi Condensed', sans-serif; letter-spacing: 0.3px; }
.badge-pendiente { background: #FBE7D6; color: var(--amber); }
.badge-pagado { background: #DCEEE3; color: var(--green); }
.badge-contado { background: #E4EEF0; color: var(--teal-dark); }

.punto-option {
  border: 1.5px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.punto-option.selected { border-color: var(--teal); background: #EAF5F5; }
.punto-option .tag { font-size: 12px; color: var(--teal-dark); font-weight: 600; }

.stat-num { font-size: 40px; font-weight: 700; line-height: 1; color: var(--ink); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.center-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 30px 26px;
  background: var(--ink);
}
.center-screen .brand-lockup { text-align: center; margin-bottom: 34px; color: #fff; }
.center-screen .brand-lockup .drop { width: 34px; height: 34px; border-radius: 50% 50% 50% 0; background: var(--teal); transform: rotate(45deg); margin: 0 auto 14px; }
.center-screen .brand-lockup h1 { font-size: 26px; margin: 0; }
.center-screen .brand-lockup p { color: #9FB6BC; font-size: 13.5px; margin: 6px 0 0; }
.center-screen .card { background: #fff; }

.msg { font-size: 13.5px; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.msg-error { background: #FBE0D6; color: #A13B12; }
.msg-ok { background: #DCEEE3; color: #1E5F42; }

.doc-summary dt { font-size: 12.5px; color: var(--text-muted); margin-top: 10px; }
.doc-summary dd { margin: 2px 0 0; font-size: 16px; font-weight: 600; }

.qr-wrap { display: flex; justify-content: center; padding: 14px 0 6px; }
.qr-wrap canvas { border-radius: 8px; }

.search-box { position: relative; }
.autocomplete-list {
  border: 1.5px solid var(--line);
  border-top: none;
  border-radius: 0 0 8px 8px;
  background: #fff;
  max-height: 220px;
  overflow-y: auto;
}
.autocomplete-list .item { padding: 12px; border-bottom: 1px solid var(--line); font-size: 15px; }
.autocomplete-list .item:last-child { border-bottom: none; }
.autocomplete-list .item .sub { font-size: 12px; color: var(--text-muted); }
.autocomplete-list .item.new { color: var(--teal-dark); font-weight: 600; }

.section-title { font-size: 20px; font-weight: 700; margin: 4px 0 14px; color: var(--ink); }
.hint { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

.gps-status { display:flex; align-items:center; gap:8px; font-size: 13px; color: var(--text-muted); margin-bottom: 10px;}
.gps-dot { width: 8px; height: 8px; border-radius: 50%; background: #C7CFCE; }
.gps-dot.ok { background: var(--green); }
.gps-dot.searching { background: var(--amber); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.settings-group { margin-bottom: 22px; }
.settings-group h3 { font-size: 15px; color: var(--ink); margin-bottom: 8px; }

.toggle-row { display: flex; gap: 8px; margin-top: 6px; }
.toggle-row button {
  flex: 1;
  padding: 12px;
  border-radius: 8px;
  border: 1.5px solid var(--line);
  background: #fff;
  font-weight: 600;
  font-size: 14px;
}
.toggle-row button.on-pendiente.active { background: #FBE7D6; border-color: var(--amber); color: #9A5417; }
.toggle-row button.on-pagado.active { background: #DCEEE3; border-color: var(--green); color: #1E5F42; }

.empty-state { text-align: center; padding: 40px 10px; color: var(--text-muted); }
.empty-state .drop-big { width: 40px; height: 40px; border-radius: 50% 50% 50% 0; background: var(--line); transform: rotate(45deg); margin: 0 auto 14px; }
