:root {
  --bg: #f5efe3;
  --bg-alt: #efe3ce;
  --ink: #1f1a16;
  --muted: #6a6055;
  --card: #fffcf7;
  --line: #d8c7af;
  --brand: #0d7a6f;
  --brand-2: #e27339;
  --danger: #b62f2f;
  --shadow: 0 16px 36px rgba(25, 18, 10, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% -5%, #f8d9a7 0%, rgba(248, 217, 167, 0) 42%),
    radial-gradient(circle at 90% 0%, #bedfd4 0%, rgba(190, 223, 212, 0) 40%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-alt) 100%);
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  z-index: -1;
  filter: blur(2px);
  opacity: 0.28;
  animation: float 12s ease-in-out infinite;
}

.orb-a {
  width: 380px;
  height: 380px;
  background: #5ea596;
  left: -90px;
  bottom: -110px;
}

.orb-b {
  width: 320px;
  height: 320px;
  background: #f2b476;
  right: -100px;
  top: -70px;
  animation-delay: -6s;
}

.app {
  max-width: 1150px;
  margin: 0 auto;
  padding: 2rem 1rem 2.5rem;
}

.card {
  background: color-mix(in srgb, var(--card), #ffffff 20%);
  border: 1px solid color-mix(in srgb, var(--line), #fff 30%);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 1.4rem 1.5rem;
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  align-items: start;
}

.hero-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.73rem;
  color: var(--brand);
  font-weight: 700;
}

h1,
h2,
h3 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  margin: 0.45rem 0;
}

h1 {
  font-size: clamp(1.5rem, 3.2vw, 2.4rem);
}

.subtitle {
  margin: 0;
  color: var(--muted);
  max-width: 60ch;
}

.app-tabs {
  margin-top: 1rem;
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.3rem;
  border-radius: 999px;
  border: 1px solid #d8c8b2;
  background: #fff6ea;
}

.app-tab {
  text-decoration: none;
  color: #4d4339;
  font-weight: 700;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  padding: 0.45rem 0.95rem;
  border-radius: 999px;
  transition: background-color 180ms ease, color 180ms ease;
}

.app-tab:hover {
  background: #f2e4ce;
}

.app-tab.is-active {
  background: linear-gradient(130deg, var(--brand) 0%, #0a6d63 100%);
  color: #f9fffd;
}

.period {
  display: grid;
  gap: 0.7rem;
  min-width: 260px;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #40362b;
}

input {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.62rem 0.7rem;
  font: inherit;
  background: #fff;
}

select {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.62rem 0.7rem;
  font: inherit;
  background: #fff;
}

input:focus {
  outline: 2px solid color-mix(in srgb, var(--brand), #fff 35%);
  outline-offset: 1px;
}

select:focus {
  outline: 2px solid color-mix(in srgb, var(--brand), #fff 35%);
  outline-offset: 1px;
}

.stats-grid {
  margin-top: 1rem;
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.stat {
  padding: 1rem;
}

.stat p {
  margin: 0;
  color: var(--muted);
}

.stat h2 {
  margin-top: 0.35rem;
}

.layout-grid {
  margin-top: 1rem;
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.form-card,
.table-card {
  padding: 1.2rem;
}

.field-grid {
  display: grid;
  gap: 0.7rem;
  margin-top: 0.6rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.quincena-switch {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.4rem;
}

.quincena-switch legend {
  font-size: 0.88rem;
  font-weight: 600;
  color: #40362b;
  padding: 0;
}

.switch-options {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.switch-option {
  position: relative;
}

.switch-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-option span {
  display: inline-flex;
  align-items: center;
  border: 1px solid #d8c8b2;
  border-radius: 999px;
  background: #fff;
  padding: 0.45rem 0.82rem;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease;
}

.switch-option input:checked + span {
  background: #0d7a6f;
  border-color: #0d7a6f;
  color: #f7fffd;
}

.form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.6rem;
}

.report-page .app {
  max-width: 1400px;
}

.employees-layout {
  grid-template-columns: 1fr 1.2fr;
}

.page-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.page-toolbar .toolbar-controls {
  flex-wrap: wrap;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1rem;
}

.report-summary .stat h2 {
  font-size: 1.45rem;
}

.report-table .table-wrap {
  margin-top: 1rem;
}

.report-table table {
  min-width: 1300px;
}

.report-empty {
  margin: 1rem 0 0;
  text-align: center;
  color: var(--muted);
}

.report-note {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.93rem;
}

.report-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.report-actions .btn {
  padding-inline: 0.7rem;
}

.report-page .hero-actions {
  margin-top: 0.8rem;
  justify-content: flex-start;
}

.report-page .hero-actions .btn {
  min-width: 0;
}

.report-table th:first-child,
.report-table td:first-child {
  width: 42px;
  text-align: center;
}

.report-table td:first-child input {
  transform: scale(1.05);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  background: #eef7f4;
  color: #0a6d63;
  font-size: 0.78rem;
  font-weight: 700;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.toolbar-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.table-wrap {
  margin-top: 0.8rem;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 540px;
}

th,
td {
  text-align: left;
  border-bottom: 1px solid #e9dcc8;
  padding: 0.72rem 0.5rem;
}

th {
  color: #4d4339;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.actions {
  display: flex;
  gap: 0.45rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.54rem 0.9rem;
  font-weight: 700;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(130deg, var(--brand) 0%, #0a6d63 100%);
  color: #f9fffd;
  box-shadow: 0 10px 18px rgba(13, 122, 111, 0.25);
}

.secondary {
  background: linear-gradient(130deg, var(--brand-2) 0%, #c6602f 100%);
  color: #fff7ef;
}

.ghost {
  background: #fff;
  border-color: var(--line);
}

.tiny {
  padding: 0.35rem 0.72rem;
  border-radius: 12px;
  background: #fff;
  border-color: #d8c8b2;
}

.tiny.danger {
  color: var(--danger);
  border-color: #e6bcbc;
}

.empty {
  margin: 0.9rem 0 0;
  color: var(--muted);
  text-align: center;
}

.app-modal-root {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 16, 11, 0.45);
  backdrop-filter: blur(2px);
}

.app-modal {
  position: relative;
  width: min(92vw, 460px);
  border-radius: 18px;
  border: 1px solid #d9c8b0;
  background: #fffaf3;
  box-shadow: 0 24px 48px rgba(24, 18, 11, 0.25);
  padding: 1rem;
}

.app-modal-title {
  margin: 0;
  font-size: 1.15rem;
}

.app-modal-message {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.app-modal-actions {
  margin-top: 1rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

[data-animate] {
  opacity: 0;
  transform: translateY(14px);
  animation: rise 500ms ease forwards;
}

[data-animate]:nth-child(2) {
  animation-delay: 80ms;
}

[data-animate]:nth-child(3) {
  animation-delay: 130ms;
}

[data-animate]:nth-child(4) {
  animation-delay: 170ms;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-18px);
  }
}

@media (max-width: 980px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .layout-grid {
    grid-template-columns: 1fr;
  }

  .employees-layout {
    grid-template-columns: 1fr;
  }

  .report-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .hero {
    flex-direction: column;
  }

  .period {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .report-summary {
    grid-template-columns: 1fr;
  }
}