:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-soft: #eef5f2;
  --ink: #1f2d2b;
  --muted: #687775;
  --line: #d9e4e0;
  --accent: #287c6b;
  --accent-dark: #15594d;
  --warning: #fff2cc;
  --warning-line: #e8c75c;
  --notice: #eaf1ff;
  --notice-line: #9db8f2;
  --danger: #b73f3f;
  --shadow: 0 16px 40px rgba(35, 52, 48, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
}

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

button {
  border: 0;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--ink);
  background: #e6efeb;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

button:hover {
  background: #d9e8e2;
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.ghost-action {
  width: 100%;
  margin-top: 0.75rem;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
}

.ghost-action:hover {
  background: rgba(255, 255, 255, 0.18);
}

.primary-action {
  color: #fff;
  background: var(--accent);
}

.primary-action:hover {
  background: var(--accent-dark);
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 2rem clamp(1rem, 4vw, 3rem);
  color: #fff;
  background: linear-gradient(135deg, #1f6f61, #263f49);
}

.app-header h1 {
  margin: 0;
  font-size: clamp(1.7rem, 4vw, 3rem);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: #d3ece5;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.eyebrow.dark {
  color: var(--accent);
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, #eaf4ef, #f6f8f6 55%, #dce9f3);
}

.auth-card {
  width: min(560px, 100%);
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.35rem);
}

.auth-card .auth-title {
  display: grid;
  justify-items: center;
  justify-content: center;
  text-align: center;
}

.auth-card .auth-title p {
  max-width: none;
  text-align: center;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.auth-tabs button.active {
  color: #fff;
  background: var(--accent);
}

.auth-form {
  display: grid;
  gap: 0.8rem;
}

.auth-note {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.header-total {
  min-width: 190px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  text-align: right;
}

.header-total span,
.header-total strong {
  display: block;
}

.header-total strong {
  margin-top: 0.25rem;
  font-size: 1.5rem;
}

.layout {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 1.25rem clamp(1rem, 3vw, 2rem) 3rem;
}

.card,
.table-section {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: end;
  margin-bottom: 1rem;
}

.section-title h2 {
  margin: 0;
  font-size: 1.2rem;
}

.section-title p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 0.85rem;
  align-items: end;
}

.generate-action {
  grid-column: 1 / -1;
  justify-self: center;
  min-width: 190px;
}

.period-dashboard {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) repeat(2, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.period-dashboard > div {
  display: grid;
  gap: 0.35rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.period-dashboard span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.period-dashboard strong {
  color: var(--accent-dark);
  font-size: 1.25rem;
}

.period-dashboard p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-width: 90px;
  min-height: 34px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(40, 124, 107, 0.22);
  border-color: var(--accent);
}

.checkbox-line {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
}

.checkbox-line input,
td input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.rates-panel {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.rates-panel div,
.summary-item {
  display: grid;
  gap: 0.3rem;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.rates-panel span,
.summary-item span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.rates-panel strong,
.summary-item strong {
  font-size: 1rem;
}

.weeks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.week-card {
  display: grid;
  gap: 0.6rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfc;
}

.week-card strong {
  font-size: 0.98rem;
}

.week-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 1fr);
  gap: 0.8rem;
  margin-bottom: 0.8rem;
}

.message {
  min-height: 1.2rem;
  margin: 0.85rem 0 0;
  color: var(--accent-dark);
  font-weight: 700;
}

.message.error {
  color: var(--danger);
}

.table-title {
  padding-inline: 0.25rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1100px;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #44504e;
  background: #eef5f2;
  font-size: 0.72rem;
}

td {
  font-size: 0.82rem;
}

tr.has-novelty td {
  background: var(--notice);
}

tr.is-holiday td {
  background: var(--warning);
}

tr.has-novelty.is-holiday td {
  background: linear-gradient(90deg, var(--notice), var(--warning));
}

.time-input {
  min-width: 82px;
  padding-inline: 0.35rem;
}

.summary-text {
  min-width: 220px;
  color: #34413e;
  line-height: 1.35;
}

.note-input {
  width: 90px;
  min-width: 90px;
  max-width: 90px;
  min-height: 34px;
  overflow: hidden;
  resize: none;
}

.holiday-control {
  display: grid;
  gap: 0.25rem;
  min-width: 132px;
}

.compensatory-check {
  min-width: 122px;
}

.mini-check {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--ink);
  font-size: 0.75rem;
}

.mini-check.is-disabled {
  color: var(--muted);
  opacity: 0.65;
}

.money-cell {
  min-width: 120px;
  font-weight: 800;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.75rem;
}

.summary-item strong {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: 1.1rem;
}

.grand-total strong {
  color: var(--accent-dark);
  font-size: 1.6rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .app-header,
  .section-title,
  .grand-total {
    align-items: stretch;
    flex-direction: column;
  }

  .header-total {
    width: 100%;
    text-align: left;
  }

  .form-grid,
  .rates-panel,
  .period-dashboard {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 620px) {
  .layout {
    padding-inline: 0.75rem;
  }

  .card,
  .table-section {
    padding: 0.8rem;
  }

  .form-grid,
  .rates-panel,
  .period-dashboard {
    grid-template-columns: 1fr;
  }

  .action-row button {
    width: 100%;
  }

  .history-row {
    grid-template-columns: 1fr;
  }
}
