:root {
  --dark: #15161a;
  --charcoal: #3a3a33;
  --lime: #d6e022;
  --lime-dark: #aebb0c;
  --cream: #f7f6f0;
  --cream-2: #ffffff;
  --gray: #e4e2d8;
  --gray-track: #ece9de;
  --shadow-sm: 0 1px 2px rgba(21, 22, 26, 0.04);
  --shadow-md: 0 8px 24px -8px rgba(21, 22, 26, 0.12), 0 2px 6px rgba(21, 22, 26, 0.04);
  --shadow-lg: 0 24px 60px -16px rgba(21, 22, 26, 0.18), 0 4px 12px rgba(21, 22, 26, 0.05);
  --radius: 22px;
  --radius-lg: 28px;
  --radius-pill: 9999px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(214, 224, 34, 0.16), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(214, 224, 34, 0.10), transparent 55%),
    var(--cream);
  background-attachment: fixed;
  color: var(--dark);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
}

a { color: inherit; }

.container {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.75rem;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(21, 22, 26, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.brand__mark {
  border-radius: 7px;
  display: block;
}

.topbar__user {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 0.88rem;
  color: var(--charcoal);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  border-radius: var(--radius-pill);
  transition: background 0.2s ease;
  font-family: inherit;
  text-align: left;
}
.user-chip:hover { background: rgba(21, 22, 26, 0.05); }

.user-chip__avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: var(--dark);
  color: var(--lime);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.user-chip__text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.user-chip__nombre {
  font-weight: 600;
  color: var(--dark);
  font-size: 0.86rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}
.user-chip__rol {
  font-size: 0.74rem;
  color: var(--charcoal);
  text-transform: capitalize;
}

/* Mostrar/ocultar contraseña */
.input-with-toggle { position: relative; }
.input-with-toggle input { padding-right: 2.6rem; }
.toggle-password {
  position: absolute;
  right: 0.4rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  padding: 0.4rem;
  cursor: pointer;
  color: var(--charcoal);
  display: grid;
  place-items: center;
  border-radius: 8px;
}
.toggle-password:hover { background: rgba(21, 22, 26, 0.06); color: var(--dark); }
.toggle-password svg { width: 18px; height: 18px; }
.toggle-password.is-showing { color: var(--dark); }
.toggle-password.is-showing::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  top: 50%;
  height: 1.5px;
  background: currentColor;
  transform: rotate(-45deg);
}

.hint {
  font-size: 0.78rem;
  color: var(--charcoal);
  margin: 0.35rem 0 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: var(--radius-pill);
  padding: 0.7rem 1.5rem;
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.btn-primary {
  background: var(--lime);
  color: var(--dark);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: var(--dark);
  color: var(--lime);
  box-shadow: var(--shadow-md);
}
.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.btn-dark {
  background: var(--dark);
  color: var(--cream-2);
  box-shadow: var(--shadow-sm);
}
.btn-dark:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-ghost {
  background: rgba(21, 22, 26, 0.05);
  color: var(--dark);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(21, 22, 26, 0.09);
}

.btn-danger {
  background: rgba(163, 53, 43, 0.08);
  color: #a3352b;
}
.btn-danger:hover:not(:disabled) {
  background: rgba(163, 53, 43, 0.14);
}

.btn-danger-solid {
  background: #a3352b;
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-danger-solid:hover:not(:disabled) {
  background: #8a2c23;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-sm { padding: 0.48rem 1.05rem; font-size: 0.82rem; }

/* Cards */
.card {
  background: var(--cream-2);
  border: 1px solid rgba(21, 22, 26, 0.06);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.card + .card { margin-top: 1.5rem; }

/* Login */
.login-wrap {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  overflow: hidden;
  background: var(--cream);
}

.login-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  will-change: transform;
  animation: blob-float 22s ease-in-out infinite;
}
.blob-1 {
  width: 34rem;
  height: 34rem;
  top: -12rem;
  left: -10rem;
  background: var(--lime);
  opacity: 0.55;
}
.blob-2 {
  width: 30rem;
  height: 30rem;
  bottom: -14rem;
  right: -8rem;
  background: var(--dark);
  opacity: 0.3;
  animation-delay: -7s;
}
.blob-3 {
  width: 22rem;
  height: 22rem;
  top: 45%;
  right: 12%;
  background: var(--lime-dark);
  opacity: 0.32;
  animation-delay: -14s;
}

@keyframes blob-float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(3rem, -2.5rem) scale(1.08); }
  66% { transform: translate(-2rem, 2rem) scale(0.94); }
}

.login-split {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 860px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: rise 0.5s var(--ease);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand {
  background: var(--dark);
  color: var(--cream);
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-brand::after {
  content: "";
  position: absolute;
  width: 20rem;
  height: 20rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(214, 224, 34, 0.35), transparent 70%);
  top: -6rem;
  right: -8rem;
}

.login-brand h1 {
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 0.4rem;
  position: relative;
  z-index: 1;
}
.login-brand #login-tagline {
  color: rgba(247, 246, 240, 0.7);
  font-size: 0.92rem;
  margin: 0 0 2rem;
  position: relative;
  z-index: 1;
}

.login-brand__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  position: relative;
  z-index: 1;
}
.login-brand__list li {
  font-size: 0.85rem;
  color: rgba(247, 246, 240, 0.85);
  padding-left: 1.3rem;
  position: relative;
}
.login-brand__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
}

.login-form-panel {
  background: rgba(255, 255, 255, 0.6);
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-form-panel p.sub {
  color: var(--charcoal);
  font-size: 0.92rem;
  margin: 0 0 1.75rem;
}

.field { margin-bottom: 1.1rem; }
.field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--charcoal);
}
.field input, .field select {
  width: 100%;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  border: 1px solid rgba(21, 22, 26, 0.1);
  background: rgba(21, 22, 26, 0.025);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--lime-dark);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(214, 224, 34, 0.25);
}

.error-msg {
  background: rgba(163, 53, 43, 0.08);
  border: 1px solid rgba(163, 53, 43, 0.18);
  color: #a3352b;
  padding: 0.65rem 0.95rem;
  border-radius: 12px;
  font-size: 0.85rem;
  margin-bottom: 1.1rem;
}

/* Clock */
.clock-card {
  text-align: center;
  padding: 3rem 2rem;
}
.clock-time {
  font-size: 3.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.clock-date {
  color: var(--charcoal);
  font-size: 0.92rem;
  margin-bottom: 1.5rem;
}

.worked-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  margin-bottom: 0.4rem;
}

.reloj-mini {
  color: var(--charcoal);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  margin: 0.6rem 0 1.75rem;
  opacity: 0.75;
}

.estado-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: rgba(214, 224, 34, 0.22);
  color: var(--dark);
  padding: 0.4rem 1rem;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 2rem;
}
.estado-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime-dark);
}

.clock-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}
.clock-actions .btn {
  padding: 0.85rem 2rem;
  font-size: 0.98rem;
}

.stats-row {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(21, 22, 26, 0.07);
}
.stat-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 0.76rem;
  color: var(--charcoal);
  margin-top: 0.2rem;
}

/* Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
th, td {
  text-align: left;
  padding: 0.75rem 0.8rem;
  border-bottom: 1px solid rgba(21, 22, 26, 0.06);
}
tbody tr {
  transition: background 0.15s ease;
}
tbody tr:hover {
  background: rgba(21, 22, 26, 0.02);
}
th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--charcoal);
  font-weight: 600;
}
.tipo-badge {
  display: inline-block;
  padding: 0.22rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
}
.tipo-entrada { background: rgba(214,224,34,.32); color: var(--dark); }
.tipo-salida { background: var(--dark); color: var(--lime); }
.tipo-pausa_inicio, .tipo-pausa_fin { background: rgba(21,22,26,.07); color: var(--charcoal); }

.rectificado {
  font-size: 0.74rem;
  color: var(--charcoal);
  font-style: italic;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}
.section-title h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Segmented tabs (iOS style) */
.tabs {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  margin-bottom: 1.75rem;
  background: var(--gray-track);
  border-radius: var(--radius-pill);
}
.tab {
  padding: 0.5rem 1.15rem;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--charcoal);
  font-family: inherit;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.tab.active {
  background: var(--cream-2);
  color: var(--dark);
  box-shadow: var(--shadow-sm);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1.5rem;
}
.filters .field { margin-bottom: 0; min-width: 160px; }

.footer-note {
  text-align: center;
  font-size: 0.78rem;
  color: var(--charcoal);
  padding: 2.5rem 1rem 3.5rem;
  opacity: 0.85;
}
.footer-note a { text-decoration: underline; text-underline-offset: 2px; }

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: #a3352b;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 0.3rem;
}

.estado-badge {
  display: inline-block;
  padding: 0.22rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.74rem;
  font-weight: 600;
}
.estado-pendiente { background: rgba(214, 224, 34, 0.32); color: var(--dark); }
.estado-aprobada { background: rgba(90, 140, 90, 0.16); color: #2f6b2f; }
.estado-rechazada { background: rgba(163, 53, 43, 0.1); color: #a3352b; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(21, 22, 26, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  z-index: 100;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--cream-2);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  animation: rise 0.3s var(--ease);
}

.modal-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.modal-card p.sub {
  color: var(--charcoal);
  font-size: 0.86rem;
  margin: 0 0 1.4rem;
  line-height: 1.4;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-scroll table { min-width: 480px; }

.loading-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--charcoal);
  font-size: 0.88rem;
  padding: 1rem 0;
}
.spinner {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(21, 22, 26, 0.15);
  border-top-color: var(--dark);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  z-index: 200;
  max-width: min(360px, calc(100vw - 2rem));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: var(--cream-2);
  border: 1px solid rgba(21, 22, 26, 0.07);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.86rem;
  animation: toast-in 0.3s var(--ease);
}
.toast.leaving { animation: toast-out 0.25s var(--ease) forwards; }
.toast__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 0.35rem;
  flex-shrink: 0;
}
.toast-success .toast__dot { background: #2f6b2f; }
.toast-error .toast__dot { background: #a3352b; }
.toast-info .toast__dot { background: var(--lime-dark); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.97); }
}

.hidden { display: none !important; }

@media (max-width: 640px) {
  .clock-time { font-size: 2.4rem; }
  .clock-card { padding: 2.25rem 1.25rem; }
  .filters { flex-direction: column; align-items: stretch; }
  .card { padding: 1.5rem; border-radius: var(--radius); }
  .topbar { padding: 0.85rem 1.1rem; flex-wrap: wrap; gap: 0.5rem; }
  .brand { font-size: 0.95rem; }
  .tabs { flex-wrap: wrap; width: 100%; }
  .tab { flex: 1 1 auto; text-align: center; }
  .stats-row { gap: 1.25rem; }
  .toast-container { left: 1rem; right: 1rem; max-width: none; }
  .section-title { flex-direction: column; align-items: flex-start; gap: 0.6rem; }

  .login-split { grid-template-columns: 1fr; max-width: 420px; }
  .login-brand { padding: 2rem 1.75rem 1.5rem; }
  .login-brand__list { display: none; }
  .login-form-panel { padding: 1.75rem; }
  .blob { filter: blur(60px); }
}
