:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d8dee8;
  --primary: #0f766e;
  --primary-dark: #0b5f59;
  --danger: #b42318;
  --warning: #b54708;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Tahoma, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

a {
  color: inherit;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.title h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: #101828;
}

.title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.month-switcher {
  display: flex;
  align-items: end;
  gap: 10px;
}

.month-switcher > div {
  width: 100%;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 18px;
}

.section-title {
  margin: 0 0 16px;
  font-size: 20px;
  font-weight: 800;
  color: #0f766e;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.absence-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.absence-item,
.absence-total-card {
  border: 1px solid #b7d7d3;
  border-radius: 8px;
  background: #eef8f6;
  padding: 10px;
}

.absence-total-card {
  width: 100%;
  margin-top: 16px;
}

.month-switcher > div,
.absence-total-card {
  max-width: none;
  min-height: auto;
}

.absence-item label,
.absence-total-card label {
  color: #0b5f59;
  font-weight: 700;
}

.absence-item input,
.absence-total-card input {
  border-color: #9fcac5;
  background: #ffffff;
}

.notes-field {
  margin-top: 16px;
}

.inline-extra {
  margin-top: 10px;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  font-weight: 600;
  background: #fff;
}

input:focus,
select:focus {
  border-color: var(--primary);
  outline: 2px solid rgba(15, 118, 110, 0.18);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 14px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

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

.button.danger {
  border-color: #fecdca;
  color: var(--danger);
}

.button.download {
  border-color: #175cd3;
  background: #eff8ff;
  color: #175cd3;
}

.button.backup {
  border-color: #b54708;
  background: #fffaeb;
  color: #b54708;
}

.topbar .button.danger {
  background: #fef3f2;
}

.table-wrap {
  overflow-x: auto;
}

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-weight: 700;
  background: #f9fafb;
}

.flash {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  background: #ecfdf3;
  border: 1px solid #abefc6;
}

.flash.error,
.notice {
  background: #fffaeb;
  border-color: #fedf89;
  color: var(--warning);
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login .panel {
  width: min(420px, 100%);
}

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

@media (max-width: 760px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .absence-grid {
    grid-template-columns: 1fr 1fr;
  }

  .actions {
    width: 100%;
  }

  .button {
    flex: 1;
  }
}
