:root {
  --primary: #603f8b;
  --primary-light: #7a52a8;
  --primary-50: #f4f0f9;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-900: #0f172a;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--gray-50); color: var(--gray-900); font-size: 15px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }

/* ── Layout ── */
.header {
  background: var(--primary);
  color: white;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.header-right { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.clock { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.username { opacity: .85; }

.container { max-width: 960px; margin: 0 auto; padding: 24px 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ── Card ── */
.card {
  background: white;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 24px;
}
.card-title { font-size: 16px; font-weight: 700; color: var(--gray-700); margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* ── Login ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(150deg, #3b1f5e 0%, #603f8b 50%, #7a52a8 100%); }
.login-card { background: white; border-radius: 20px; padding: 44px 40px; width: 100%; max-width: 390px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .icon { font-size: 52px; }
.login-logo h1 { font-size: 23px; font-weight: 800; color: var(--primary); margin-top: 10px; letter-spacing: -.3px; }
.login-logo p { font-size: 13px; color: var(--gray-600); margin-top: 5px; }

/* ── Form ── */
.form-group { margin-bottom: 16px; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number] {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200);
  border-radius: 8px; font-size: 15px; outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
input[readonly] { background: var(--gray-50); color: var(--gray-600); }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600;
  border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #4e3170; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #15803d; }
.btn-outline { background: white; color: var(--gray-700); border: 1.5px solid var(--gray-200); }
.btn-outline:hover { background: var(--gray-50); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 16px; width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: transparent; color: white; opacity: .8; border: none; }
.btn-ghost:hover { opacity: 1; background: rgba(255,255,255,.1); border-radius: 6px; }

/* ── Ponto buttons ── */
.ponto-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.ponto-item {
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  transition: all .2s;
}
.ponto-item.feito { border-color: var(--success); background: var(--success-light); }
.ponto-item.proximo { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.ponto-item.bloqueado { opacity: .4; }
.ponto-item.opcional { border-style: dashed; }
.ponto-icon { font-size: 28px; margin-bottom: 6px; }
.ponto-label { font-size: 12px; font-weight: 600; color: var(--gray-600); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.ponto-hora { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--gray-900); margin-bottom: 10px; }
.ponto-hora.ok { color: var(--success); }
.ponto-btn { width: 100%; }

/* ── Semana table ── */
.semana-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.semana-table th { background: var(--gray-50); padding: 8px 12px; text-align: left; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--gray-600); border-bottom: 2px solid var(--gray-200); }
.semana-table td { padding: 10px 12px; border-bottom: 1px solid var(--gray-100); }
.semana-table tr:last-child td { border-bottom: none; }
.semana-table tr.hoje-row td { background: var(--primary-50); font-weight: 600; }
.saldo-pos { color: var(--success); font-weight: 700; }
.saldo-neg { color: var(--danger); font-weight: 700; }
.saldo-zero { color: var(--gray-400); }
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-agencia { background: var(--success-light); color: var(--success); }
.badge-externo { background: var(--warning-light); color: var(--warning); }
.badge-sem_gps { background: var(--gray-100); color: var(--gray-600); }

/* ── Saldo card ── */
.saldo-card { text-align: center; padding: 20px; }
.saldo-valor { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; }
.saldo-label { font-size: 13px; color: var(--gray-600); margin-top: 4px; }

/* ── Admin ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab { padding: 12px 20px; font-size: 14px; font-weight: 600; color: var(--gray-600); background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .15s; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.tab:hover:not(.active) { color: var(--gray-900); }

.colab-card { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--gray-100); }
.colab-card:last-child { border-bottom: none; }
.colab-info { flex: 1; }
.colab-name { font-weight: 600; }
.colab-email { font-size: 13px; color: var(--gray-600); }
.colab-saldo-col { text-align: right; min-width: 80px; }
.colab-saldo-label { font-size: 11px; color: var(--gray-400); }

.semana-nav { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.semana-titulo { flex: 1; text-align: center; font-weight: 700; font-size: 15px; }

/* ── Alert / Toast ── */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 12px; }
.alert-danger { background: var(--danger-light); color: #991b1b; border-left: 4px solid var(--danger); }
.alert-success { background: var(--success-light); color: #14532d; border-left: 4px solid var(--success); }
.alert-warning { background: var(--warning-light); color: #92400e; border-left: 4px solid var(--warning); }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 999;
  background: var(--gray-900); color: white;
  padding: 14px 20px; border-radius: 10px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.25);
  transform: translateY(80px); opacity: 0;
  transition: all .3s ease;
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.toast-success { border-left: 4px solid var(--success); }
.toast.toast-danger { border-left: 4px solid var(--danger); }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
}
.modal { background: white; border-radius: 16px; padding: 28px; max-width: 420px; width: 100%; box-shadow: 0 20px 40px rgba(0,0,0,.2); }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* ── Misc ── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--success); }
.dot-red { background: var(--danger); }
.text-muted { color: var(--gray-600); font-size: 13px; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 20px 0; }
.empty-state { text-align: center; padding: 40px; color: var(--gray-400); }
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

@media (max-width: 600px) {
  .grid2 { grid-template-columns: 1fr; }
  .ponto-grid { grid-template-columns: 1fr 1fr; }
  .header { padding: 0 14px; }
  .container { padding: 16px 10px; }
}
