:root {
  --bg: #f6f8f9;
  --card: #ffffff;
  --text: #1b2733;
  --muted: #5b6b7a;
  --border: #e2e8f0;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #b45309;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15, 40, 60, .08), 0 4px 14px rgba(15, 40, 60, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
[v-cloak] { display: none; }

.topbar {
  background: linear-gradient(120deg, #0f766e, #115e59);
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.brand { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: 8px; }
.status-offline-pill {
  font-size: 0.72rem;
  background: #ef4444;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-left: 6px;
}
.status-online-pill {
  font-size: 0.72rem;
  background: #10b981;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.3px;
  margin-left: 6px;
}
.brand-icon { font-size: 1.4rem; }
.tabs { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.tab {
  background: transparent; border: none; color: rgba(255,255,255,.85);
  padding: 8px 14px; border-radius: 10px; font-size: .95rem; cursor: pointer;
  transition: background .15s, color .15s;
}
.tab:hover { background: rgba(255,255,255,.14); color: #fff; }
.tab.active { background: rgba(255,255,255,.22); color: #fff; font-weight: 600; }

.content { max-width: 860px; margin: 0 auto; padding: 22px 16px 60px; }
.loading { text-align: center; color: var(--muted); padding: 60px 0; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}
.card h3 { margin: 0 0 12px; font-size: 1.05rem; }
.muted { color: var(--muted); font-size: .9rem; }

/* ---- cronómetro ---- */
.clock { text-align: center; padding: 34px 20px; }
.clock-time {
  font-size: clamp(2.6rem, 12vw, 4.2rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
  line-height: 1.1;
  color: var(--primary-dark);
}
.clock-status { margin-top: 6px; font-weight: 600; color: var(--muted); }
.clock-status.running { color: var(--ok); }
.clock-geo { margin-top: 14px; min-height: 28px; }
.geo-pill {
  display: inline-block; padding: 5px 12px; border-radius: 999px;
  font-size: .83rem; font-weight: 600;
}
.geo-pill.on { background: #ecfdf5; color: var(--ok); }
.geo-pill.waiting { background: #fffbeb; color: var(--warn); }
.geo-pill.off { background: #f1f5f9; color: var(--muted); }
.geo-pill.in { background: #d1fae5; color: #065f46; }
.geo-pill.out { background: #e0f2fe; color: #075985; }

.actions { margin-top: 22px; display: flex; gap: 12px; justify-content: center; }
.btn {
  border: none; border-radius: 12px; padding: 13px 26px;
  font-size: 1.05rem; font-weight: 600; cursor: pointer;
  color: #fff; transition: transform .08s, box-shadow .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn.start { background: var(--ok); box-shadow: 0 4px 12px rgba(22,163,74,.3); }
.btn.stop { background: var(--danger); box-shadow: 0 4px 12px rgba(220,38,38,.3); }
.btn.primary { background: var(--primary); box-shadow: 0 4px 12px rgba(15,118,110,.25); }
.btn.secondary { background: #334155; }
.btn.danger { background: var(--danger); }
.btn.small { padding: 7px 12px; font-size: .85rem; border-radius: 9px; }

/* ---- dinero ---- */
.money-card { text-align: center; }
.money-row { display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap; }
.money-input {
  font-size: 1.5rem; font-weight: 700; text-align: center;
  width: 220px; padding: 10px 14px; border: 2px solid var(--border);
  border-radius: 12px; font-variant-numeric: tabular-nums;
}
.money-input:focus { outline: none; border-color: var(--primary); }

/* ---- estadísticas ---- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat-card { text-align: center; margin-bottom: 0; }
.stat-label { display: block; color: var(--muted); font-size: .85rem; }
.stat-value { display: block; font-size: 1.6rem; font-weight: 700; margin-top: 4px; }
.stat-value.money { color: var(--primary-dark); }

.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.table th { color: var(--muted); font-weight: 600; font-size: .85rem; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.money { color: var(--primary-dark); font-weight: 600; }

.day-bars { display: flex; flex-direction: column; gap: 8px; }
.day-bar-row { display: grid; grid-template-columns: 130px 1fr 90px; gap: 10px; align-items: center; }
.day-label { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { background: #eef2f5; border-radius: 8px; height: 14px; overflow: hidden; }
.bar-fill { background: linear-gradient(90deg, var(--primary), #14b8a6); height: 100%; border-radius: 8px; min-width: 2px; }
.day-value { text-align: right; font-size: .85rem; font-variant-numeric: tabular-nums; }

/* ---- historial ---- */
.session-list { list-style: none; margin: 0; padding: 0; }
.session-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.session-item:last-child { border-bottom: none; }
.session-main { display: flex; gap: 14px; align-items: baseline; flex: 1; flex-wrap: wrap; }
.session-date { font-weight: 600; }
.session-dur { color: var(--muted); font-variant-numeric: tabular-nums; }
.session-money { font-weight: 700; color: var(--primary-dark); }
.session-why { font-size: .78rem; color: var(--muted); background: #f1f5f9; padding: 2px 8px; border-radius: 999px; }

/* ---- configuración ---- */
.config-view label { display: block; margin-top: 14px; font-size: .9rem; color: var(--muted); font-weight: 600; }
.config-view input[type="text"], .config-view input[type="number"],
.config-view input:not([type]) {
  width: 100%; margin-top: 5px; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: 10px; font-size: 1rem;
}
.config-view input:focus { outline: none; border-color: var(--primary); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.switch-row { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.switch-row input { width: auto; margin: 0; }
.radio-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; color: var(--muted); }
.radio-row label { margin-top: 0; display: flex; align-items: center; gap: 5px; font-weight: 500; color: var(--text); }
.radio-row input { width: auto; margin: 0; }
.btn.secondary { margin-top: 12px; }
.save-btn { margin-top: 6px; width: 100%; }
.saved-msg { color: var(--ok); font-weight: 600; text-align: center; margin-top: 10px; }

/* ---- misc ---- */
.hint { color: var(--muted); text-align: center; font-size: .95rem; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 12px;
  font-size: .9rem; box-shadow: var(--shadow); z-index: 50;
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* ---- periodo de estadísticas ---- */
.stats-period-card { padding: 12px 16px; }
.stats-period-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stats-period-row .btn { margin-top: 0; }
.month-nav { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.month-nav .btn { margin-top: 0; }
.month-nav .btn:disabled { opacity: .4; cursor: default; }
.month-label { font-weight: 600; color: var(--primary-dark); text-transform: capitalize; min-width: 130px; text-align: center; }
.day-bar-row.empty { opacity: .35; }

/* ---- edición de duración ---- */
.dur-row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 12px; font-size: .9rem; }
.dur-row .btn { margin-top: 0; }
.dur-input { width: 62px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 9px; font-size: .9rem; text-align: center; }
.dur-input:focus { outline: none; border-color: var(--primary); }
.session-dur-edit { display: flex; gap: 6px; align-items: center; width: 100%; justify-content: flex-end; font-size: .85rem; }
.session-item .btn.secondary { margin-top: 0; }
