:root {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #0f172a;
  background-color: #f1f5f9;
  line-height: 1.5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #e2e8f0 0%, #f8fafc 100%);
  min-height: 100vh;
}

input,
select,
textarea,
button {
  font: inherit;
}

button {
  cursor: pointer;
}

.container {
  width: min(1140px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2vw, 2rem);
}

.auth-layout {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 30px 75px rgba(15, 23, 42, 0.14);
  padding: clamp(2rem, 4vw, 3rem);
  width: min(440px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.6vw, 2.1rem);
}

.login-subtitle {
  margin: 0;
  color: #64748b;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.input-group span {
  font-weight: 600;
  color: #0f172a;
}

.input-group input,
.input-group textarea,
.input-group select {
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  padding: 0.65rem 0.85rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  background: #f8fafc;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16);
  background: #ffffff;
}

.hint {
  color: #94a3b8;
  font-size: 0.85rem;
}

.form-error {
  background: rgba(248, 113, 113, 0.16);
  color: #b91c1c;
  border-radius: 12px;
  padding: 0.85rem 1rem;
}

button.primary {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 0.75rem 1.6rem;
  font-weight: 600;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 10px 30px rgba(37, 99, 235, 0.25);
}

button.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(37, 99, 235, 0.32);
}

button.primary:disabled {
  background: #94a3b8;
  box-shadow: none;
  cursor: not-allowed;
}

button.primary.send-counter {
  background: linear-gradient(135deg, #f97316, #db2777);
  box-shadow: 0 12px 34px rgba(251, 146, 60, 0.35);
}

button.primary.send-counter:disabled {
  background: #f59e0b;
  box-shadow: none;
}

button.secondary {
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  padding: 0.65rem 1.4rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

button.secondary:hover:not(:disabled) {
  border-color: #2563eb;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.15);
}

button.ghost {
  background: transparent;
  border: none;
  font-size: 1rem;
  color: #ef4444;
}

button.secondary:disabled,
button.ghost:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.app-layout {
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding-bottom: 4rem;
}

.app-header {
  background: #ffffff;
  border-radius: 22px;
  padding: clamp(1.2rem, 2vw, 1.6rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

.app-header h1 {
  margin: 0 0 0.25rem;
  font-size: clamp(1.6rem, 2.4vw, 1.9rem);
}

.app-header .muted,
.muted {
  color: #64748b;
  font-size: 0.95rem;
}

.header-actions {
  display: flex;
  gap: 0.75rem;
}
.period-controls {
  background: #ffffff;
  border-radius: 22px;
  padding: clamp(1rem, 2vw, 1.3rem);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  align-items: flex-end;
  margin-top: -0.4rem;
}

.period-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 220px;
}

.period-field label {
  font-weight: 600;
  color: #0f172a;
}

.period-field input[type='month'] {
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  background: #f8fafc;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.period-field input[type='month']:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  background: #ffffff;
}

.period-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.period-buttons button {
  min-width: 150px;
}


.banner {
  border-radius: 18px;
  padding: 0.9rem 1.2rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.banner.success {
  background: rgba(34, 197, 94, 0.18);
  color: #047857;
}

.banner.error {
  background: rgba(248, 113, 113, 0.18);
  color: #b91c1c;
}

.table-section {
  background: #ffffff;
  border-radius: 22px;
  padding: clamp(1rem, 2vw, 1.4rem);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.table-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.table-header h2 {
  margin: 0;
  font-size: clamp(1.3rem, 2vw, 1.5rem);
}

.table-meta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.9rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.12);
  color: #1d4ed8;
  font-weight: 600;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.85) 0%, #ffffff 60%);
}

.table-wrapper table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}

.table-wrapper thead th {
  position: sticky;
  top: 0;
  background: rgba(148, 163, 184, 0.15);
  backdrop-filter: blur(8px);
  text-align: left;
  padding: 0.8rem 1rem;
  font-size: 0.9rem;
  color: #1f2937;
  border-bottom: 1px solid #cbd5f5;
  z-index: 1;
}

.table-wrapper tbody tr {
  transition: background 0.16s ease;
}

.table-wrapper tbody tr:hover {
  background: rgba(226, 232, 240, 0.35);
}

.table-wrapper tbody tr.is-new {
  background: rgba(37, 99, 235, 0.08);
}

.table-wrapper tbody tr.is-ready {
  background: rgba(34, 197, 94, 0.18);
}

.table-wrapper tbody tr.is-ready:hover {
  background: rgba(34, 197, 94, 0.24);
}

.table-wrapper tbody tr.is-counter {
  background: rgba(249, 210, 87, 0.22);
}

.table-wrapper tbody tr.is-counter:hover {
  background: rgba(249, 210, 87, 0.28);
}

.table-wrapper tbody tr.is-counter input,
.table-wrapper tbody tr.is-counter textarea {
  background: rgba(249, 210, 87, 0.16);
  color: #92400e;
}

.table-wrapper tbody tr.is-cancelled {
  background: rgba(248, 113, 113, 0.2);
}

.table-wrapper tbody tr.is-cancelled:hover {
  background: rgba(248, 113, 113, 0.26);
}

.table-wrapper tbody tr.is-ready input,
.table-wrapper tbody tr.is-ready textarea {
  background: rgba(34, 197, 94, 0.12);
  color: #065f46;
}

.table-wrapper tbody td[data-column='rutTrabajador'] input,
.table-wrapper tbody td[data-column='nombreTrabajador'] input {
  background: #f8fafc;
  color: #0f172a;
}

.table-wrapper tbody tr.is-cancelled input,
.table-wrapper tbody tr.is-cancelled textarea {
  background: rgba(248, 113, 113, 0.16);
  color: #7f1d1d;
}

.table-wrapper tbody tr.is-ready input:disabled,
.table-wrapper tbody tr.is-cancelled input:disabled,
.table-wrapper tbody tr.is-ready textarea:disabled,
.table-wrapper tbody tr.is-cancelled textarea:disabled {
  color: inherit;
}

.table-wrapper tbody td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}

.table-wrapper tbody td[data-column='rutTrabajador'],
.table-wrapper tbody td[data-column='rutTrabajador'] input {
  min-width: 170px;
}

.table-wrapper tbody td[data-column='nombreTrabajador'],
.table-wrapper tbody td[data-column='nombreTrabajador'] input {
  min-width: 220px;
}

.table-wrapper tbody td[data-column='horasAtraso'],
.table-wrapper tbody td[data-column='horasAtraso'] input {
  min-width: 160px;
}

.table-wrapper tbody td[data-column='observaciones'],
.table-wrapper tbody td[data-column='observaciones'] textarea {
  min-width: 260px;
}

.table-wrapper tbody td input,
.table-wrapper tbody td textarea {
  width: 100%;
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  padding: 0.58rem 0.75rem;
  font-size: 0.95rem;
  background: #ffffff;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.table-wrapper tbody td input:focus,
.table-wrapper tbody td textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  background: #ffffff;
}

.table-wrapper tbody td input:disabled,
.table-wrapper tbody td textarea:disabled,
.table-wrapper tbody td select:disabled {
  background: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.actions {
  text-align: center;
  width: 70px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 960px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .header-actions button {
    flex: 1;
  }

  .period-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .period-buttons {
    width: 100%;
  }

  .period-buttons button {
    flex: 1;
    min-width: unset;
  }

}

@media (max-width: 720px) {
  .period-controls {
    padding: 1rem;
    gap: 0.9rem;
  }

  .period-field {
    width: 100%;
  }

  .period-buttons {
    width: 100%;
    gap: 0.6rem;
  }

  .period-buttons button {
    width: 100%;
  }


  .container {
    padding: 1rem;
  }

  .table-wrapper {
    border: none;
    background: transparent;
  }

  .table-wrapper table,
  .table-wrapper thead,
  .table-wrapper tbody,
  .table-wrapper th,
  .table-wrapper td,
  .table-wrapper tr {
    display: block;
  }

  .table-wrapper thead {
    display: none;
  }

  .table-wrapper tbody tr {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    background: #ffffff;
  }

  .table-wrapper tbody td {
    border: none;
    padding: 0.35rem 0;
    position: relative;
  }

  .table-wrapper tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.2rem;
  }

  .table-wrapper tbody td input,
  .table-wrapper tbody td textarea {
    font-size: 1rem;
  }

  .actions {
    width: 100%;
    margin-top: 0.4rem;
    text-align: right;
  }
}


.estado-pill-wrapper {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.estado-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.28rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(148, 163, 184, 0.25);
  color: #1f2937;
  text-transform: capitalize;
}

.estado-pill.pending {
  background: rgba(250, 204, 21, 0.18);
  color: #92400e;
}

.estado-pill.counter {
  background: rgba(249, 210, 87, 0.22);
  color: #92400e;
}

.estado-pill.ready {
  background: rgba(34, 197, 94, 0.18);
  color: #047857;
}

.estado-pill.cancelled {
  background: rgba(239, 68, 68, 0.2);
  color: #991b1b;
}

.role-switch {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.role-switch button {
  border: none;
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  font-weight: 600;
  transition: background 0.18s ease, color 0.18s ease;
}

.role-switch button.active {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
}

.counter-card {
  background: white;
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.12);
  padding: clamp(2rem, 4vw, 2.6rem);
  width: min(520px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin: 0 auto;
}

.counter-dashboard {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.counter-header {
  background: white;
  border-radius: 22px;
  padding: clamp(1.2rem, 2vw, 1.6rem);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  display: grid;
  gap: 1.2rem;
}

.counter-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: rgba(59, 130, 246, 0.08);
  border-radius: 16px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card span {
  font-size: 0.85rem;
  color: #475569;
}

.stat-card strong {
  font-size: 1.4rem;
  color: #1f2937;
}

.stat-card.warning {
  background: rgba(249, 210, 87, 0.2);
}

.stat-card.info {
  background: rgba(56, 189, 248, 0.18);
}

.stat-card.success {
  background: rgba(34, 197, 94, 0.18);
}

.counter-filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.counter-filters button {
  border: 1px solid #cbd5f5;
  background: white;
  color: #475569;
  border-radius: 999px;
  padding: 0.45rem 1.1rem;
  font-weight: 600;
}

.counter-filters button.active {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white;
  border-color: transparent;
}

.counter-list {
  display: grid;
  gap: 1rem;
}

.counter-card-item {
  background: white;
  border-radius: 20px;
  padding: 1.2rem 1.4rem;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.counter-card-item h3 {
  margin: 0 0 0.3rem;
}

.status-tags {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
}

.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tag.warning {
  background: rgba(249, 210, 87, 0.24);
  color: #92400e;
}

.tag.info {
  background: rgba(56, 189, 248, 0.24);
  color: #0e7490;
}

.tag.success {
  background: rgba(34, 197, 94, 0.24);
  color: #047857;
}

@media (max-width: 720px) {
  .counter-card-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .counter-card-item button {
    width: 100%;
  }
}

.counter-dashboard-wrapper {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.counter-header-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.counter-header-actions button {
  flex: 1;
  min-width: 140px;
}

.counter-search {
  display: flex;
  margin-bottom: 0.8rem;
}

.counter-search input {
  width: 100%;
  border: 1px solid #cbd5f5;
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  background: #f8fafc;
}

.counter-search input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
  background: #ffffff;
}

.tag-meta {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.75rem;
  color: #475569;
}

.tag.id-tag {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
}

.counter-accounts {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.counter-accounts__header {
  background: white;
  border-radius: 22px;
  padding: clamp(1.2rem, 2vw, 1.6rem);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
}

.counter-accounts__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.accounts-table {
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
}

.accounts-table table {
  width: 100%;
  min-width: 880px;
  border-collapse: separate;
  border-spacing: 0;
}

.accounts-table thead th {
  background: rgba(226, 232, 240, 0.6);
  padding: 0.8rem 0.9rem;
  text-align: left;
  font-size: 0.88rem;
  color: #475569;
}

.accounts-table tbody td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #e2e8f0;
}

.accounts-table tbody input {
  width: 100%;
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.accounts-table tbody input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.counter-columns {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.counter-columns__header {
  background: white;
  border-radius: 22px;
  padding: clamp(1.2rem, 2vw, 1.6rem);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
}

.counter-columns__actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.columns-table {
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
}

.columns-table table {
  width: 100%;
  min-width: 920px;
  border-collapse: separate;
  border-spacing: 0;
}

.columns-table thead th {
  background: rgba(226, 232, 240, 0.6);
  padding: 0.8rem 0.9rem;
  text-align: left;
  font-size: 0.88rem;
  color: #475569;
}

.columns-table tbody td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid #e2e8f0;
}

.columns-table tbody input,
.columns-table tbody select {
  width: 100%;
  border: 1px solid #cbd5f5;
  border-radius: 10px;
  padding: 0.5rem;
  font-size: 0.9rem;
}

.columns-table tbody input:focus,
.columns-table tbody select:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.18);
}

.columns-table .boolean-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.columns-table .boolean-cell input {
  width: auto;
  border: none;
  box-shadow: none;
}
