:root {
  --bg-1: #edf6f9;
  --bg-2: #ffddd2;
  --bg-3: #83c5be;
  --card: rgba(131, 197, 190, 0.25);
  --ink: #000000;
  --muted: rgba(0, 0, 0, 0.6);
  --accent: #006d77;
  --accent-2: #e29578;
  --success: #83c5be;
  --danger: #e29578;
  --warning: #ffddd2;
  --shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Work Sans", sans-serif;
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2));
  background-color: var(--bg-1);
  color: var(--ink);
  min-height: 100vh;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 28px;
  color: var(--ink);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  display: block;
  height: clamp(90px, 12vw, 160px);
  width: auto;
  max-width: 420px;
}

.auth-shell {
  display: grid;
  gap: 20px;
  justify-items: center;
}

.auth-logo {
  display: block;
  width: clamp(140px, 22vw, 220px);
  height: auto;
}

.brand-name {
  font-family: "Space Grotesk", sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.brand-sub {
  font-size: 13px;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.view {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 24px;
  animation: fadeIn 0.4s ease;
}

#view-dashboard {
  display: block;
  padding: 24px 28px 32px;
}

#view-dashboard .topbar {
  max-width: 1200px;
  margin: 0 auto;
}

#view-dashboard .dashboard {
  margin: 20px auto 0;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px;
  max-width: 520px;
  width: 100%;
  backdrop-filter: blur(6px);
}

.card h1,
.card h2 {
  font-family: "Space Grotesk", sans-serif;
  margin-top: 0;
}

.card p {
  color: var(--muted);
}

.form-grid {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

input,
select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(0, 109, 119, 0.2);
  font-size: 15px;
  font-family: "Work Sans", sans-serif;
  background: rgba(237, 246, 249, 0.95);
  color: var(--ink);
}

input:focus,
select:focus {
  outline: 2px solid rgba(0, 109, 119, 0.25);
  border-color: var(--accent);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-family: "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 18px rgba(0, 109, 119, 0.18);
}

.btn-primary {
  background: var(--success);
  color: var(--ink);
  border: 1px solid var(--accent);
}

.btn-ghost {
  background: transparent;
  border: 1px solid rgba(0, 109, 119, 0.35);
  color: var(--ink);
}

.card .btn-ghost {
  border-color: rgba(0, 109, 119, 0.3);
  color: var(--ink);
}

.btn-success {
  background: var(--success);
  color: var(--ink);
}

.btn-warning {
  background: var(--warning);
  color: var(--ink);
}

.btn-danger {
  background: var(--danger);
  color: var(--ink);
}

.hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}

.dashboard {
  width: 100%;
  max-width: 1480px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  padding: 12px;
  align-items: start;
}

.sidebar {
  display: grid;
  gap: 18px;
  align-self: start;
  height: fit-content;
}

.user-card,
.tenant-card {
  background: rgba(131, 197, 190, 0.35);
  color: var(--ink);
  padding: 18px;
  border-radius: 16px;
  backdrop-filter: blur(8px);
}

.user-card {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-meta {
  display: grid;
  gap: 6px;
}

.user-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-logout {
  padding: 6px 14px;
  font-size: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(131, 197, 190, 0.9);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
}

.user-name {
  font-weight: 600;
}

.user-role {
  font-size: 13px;
  opacity: 0.7;
}

.tenant-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
}

.tenant-id {
  font-family: "Space Grotesk", sans-serif;
  font-size: 14px;
  margin: 6px 0 12px;
  word-break: break-all;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav-btn {
  background: rgba(131, 197, 190, 0.35);
  border: none;
  padding: 12px 16px;
  padding-right: 38px;
  border-radius: 12px;
  color: var(--ink);
  text-align: left;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s ease;
  position: relative;
}

.nav-btn.active,
.nav-btn:hover {
  background: rgba(0, 109, 119, 0.16);
}

.nav-btn.active::after {
  content: "✓";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  font-weight: 700;
}

.content {
  display: grid;
  gap: 18px;
  width: 100%;
}

.content .card {
  max-width: none;
}

.fichaje-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.2fr);
  gap: 20px;
  align-items: start;
}

.calendar-card,
.fichaje-info {
  background: rgba(237, 246, 249, 0.95);
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.calendar-month {
  font-size: 14px;
  color: var(--muted);
}

.calendar-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-day-name {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  text-align: center;
}

.calendar-day {
  border: 1px solid rgba(0, 0, 0, 0.12);
  background: rgba(237, 246, 249, 0.95);
  border-radius: 12px;
  padding: 10px 0;
  min-height: 38px;
  text-align: center;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.calendar-day:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12);
}

.calendar-day.empty {
  border: none;
  background: transparent;
  cursor: default;
  box-shadow: none;
}

.calendar-day.has-entry {
  background: rgba(34, 197, 94, 0.25);
  border-color: #22c55e;
}

.calendar-day.missed {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.15);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.info-item {
  background: rgba(131, 197, 190, 0.3);
  border-radius: 12px;
  padding: 12px 14px;
}

.info-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.info-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  margin-top: 6px;
}

.schedule-card {
  background: rgba(237, 246, 249, 0.95);
}

.schedule-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}

.schedule-range {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.schedule-table {
  display: grid;
  gap: 12px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: center;
}

.schedule-row.future {
  opacity: 0.55;
}

.schedule-header {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
}

.schedule-date {
  font-size: 13px;
  color: var(--muted);
}

.schedule-axis {
  display: grid;
  grid-template-columns: repeat(var(--axis-count), minmax(0, 1fr));
  gap: 0;
}

.schedule-axis span {
  text-align: center;
}

.schedule-bars {
  display: grid;
  gap: 6px;
}

.schedule-bar-track {
  position: relative;
  height: 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.schedule-empty {
  height: 18px;
  border-radius: 999px;
  border: 1px dashed rgba(0, 0, 0, 0.12);
  background: transparent;
}

.schedule-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.55);
}

.schedule-break {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 999px;
  background: rgba(249, 115, 22, 0.8);
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.modal-card {
  position: relative;
  background: var(--bg-1);
  border-radius: 18px;
  padding: 20px;
  width: min(92vw, 560px);
  box-shadow: var(--shadow);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-content {
  margin-top: 16px;
  display: grid;
  gap: 12px;
}

.entry-row {
  background: rgba(131, 197, 190, 0.2);
  border-radius: 12px;
  padding: 12px 14px;
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.tab {
  display: none;
  animation: slideIn 0.3s ease;
}

.tab.active {
  display: block;
}

.state {
  font-size: 28px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  margin: 12px 0;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.actions .btn-success,
.actions .btn-danger {
  padding: 18px 34px;
  font-size: 18px;
  min-width: 160px;
  font-weight: 700;
  border-radius: 999px;
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.18);
}

.actions .btn-success {
  background: #22c55e;
  border: 2px solid #15803d;
  color: #000000;
}

.actions .btn-danger {
  background: #ef4444;
  border: 2px solid #b91c1c;
  color: #000000;
}

.table {
  margin-top: 18px;
  display: grid;
  gap: 8px;
  font-size: 14px;
}

.table-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px 12px;
  background: rgba(237, 246, 249, 0.95);
  border-radius: 10px;
}

.table-row.header {
  background: rgba(255, 221, 210, 0.9);
  font-weight: 600;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(131, 197, 190, 0.95);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  font-size: 14px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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

@media (max-width: 960px) {
  .dashboard {
    grid-template-columns: 1fr;
  }
  .fichaje-grid {
    grid-template-columns: 1fr;
  }
  .sidebar {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .table-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .actions {
    flex-direction: column;
  }
  .table-row {
    grid-template-columns: 1fr;
  }
}
