:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #18201c;
  --muted: #68716b;
  --line: #d9ded7;
  --panel: #ffffff;
  --accent: #197a57;
  --accent-dark: #115c42;
  --soft: #e9f4ef;
  --danger: #a33a3a;
}

* {
  box-sizing: border-box;
}

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

button,
input {
  font: inherit;
}

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

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

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 40px;
  line-height: 1;
}

.actions,
.add-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

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

input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

.button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 14px;
  background: white;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.button:hover {
  border-color: var(--accent);
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
}

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

.panel,
.sheet {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel {
  padding: 14px;
  margin-bottom: 14px;
}

.sheet {
  overflow: hidden;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.sheet-head h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.sheet-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.saved-state {
  white-space: nowrap;
  color: var(--accent);
  font-weight: 700;
}

.saved-state[data-mode="warn"] {
  color: #8a5b00;
}

.saved-state[data-mode="ok"] {
  color: var(--accent);
}

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

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

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

th:last-child,
td:last-child {
  border-right: 0;
}

thead th {
  background: #f1f4f0;
  color: #35423b;
  font-size: 13px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.name-cell {
  min-width: 210px;
  font-weight: 700;
}

.date-cell,
.presence-cell {
  width: 96px;
  text-align: center;
}

.presence-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--accent);
  font-size: 26px;
  font-weight: 900;
  cursor: pointer;
}

.presence-button.present {
  border-color: #97cfb8;
  background: var(--soft);
}

.delete-button {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 18px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .sheet-head {
    display: block;
  }

  h1 {
    margin-bottom: 16px;
    font-size: 34px;
  }

  .actions,
  .add-form {
    align-items: stretch;
  }

  .actions > *,
  .add-form > *,
  .button,
  input {
    width: 100%;
  }

  table {
    min-width: 650px;
  }
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body {
    background: white;
  }

  .app {
    width: 100%;
    padding: 0;
  }

  .no-print {
    display: none !important;
  }

  .sheet {
    border: 0;
  }

  .sheet-head {
    padding: 0 0 10px;
  }

  .table-wrap {
    overflow: visible;
  }

  table {
    min-width: 0;
    font-size: 11px;
  }

  th,
  td {
    padding: 6px;
  }

  .presence-button {
    width: 22px;
    height: 22px;
    border: 0;
    background: transparent;
    font-size: 18px;
  }

  .delete-col,
  .delete-button {
    display: none;
  }
}
