:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d2730;
  --muted: #66717d;
  --line: #dce2e8;
  --primary: #0b6b5f;
  --primary-dark: #064b43;
  --accent: #c9362c;
  --soft: #eef5f3;
  --warning: #fff5d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: var(--primary-dark);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(16px, 4vw, 40px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.15;
}

.brand small {
  color: var(--muted);
  margin-top: 3px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.main-nav a,
.menu-button,
.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 13px;
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.main-nav a[aria-current="page"],
.main-nav a:hover,
.button.primary,
.menu-button:hover {
  background: var(--primary);
  color: #fff;
}

.button {
  border-color: var(--line);
  background: var(--panel);
}

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

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

.button.success {
  border-color: #83c7a3;
  background: #e6f6ee;
  color: #16633a;
  font-weight: 800;
}

.menu-button {
  display: none;
  border-color: var(--line);
}

.page {
  width: min(1540px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px clamp(16px, 4vw, 40px);
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel);
}

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

.hero {
  padding: clamp(22px, 4vw, 42px);
  display: grid;
  grid-template-columns: 1.4fr .9fr;
  gap: 24px;
  align-items: center;
}

h1,
h2,
h3 {
  margin: 0 0 12px;
  line-height: 1.15;
}

p {
  color: var(--muted);
  line-height: 1.55;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.card {
  padding: 18px;
}

.metric {
  font-size: 34px;
  font-weight: 750;
}

.muted {
  color: var(--muted);
}

.panel {
  padding: clamp(18px, 3vw, 28px);
  margin-top: 18px;
}

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

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.tabs a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  text-decoration: none;
  font-weight: 750;
}

.tabs a.is-active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--primary-dark);
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

.wide-table {
  min-width: 1180px;
}

.calendar-table {
  min-width: 1450px;
}

.date-col {
  min-width: 118px;
}

.nowrap {
  white-space: nowrap;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.sort-link {
  color: inherit;
  text-decoration: none;
}

.sort-link:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.group-row td {
  background: #fff4bf;
  color: #604400;
  font-weight: 900;
  letter-spacing: 0;
  border-top: 2px solid #e8c857;
}

.group-row.is-other,
.group-row.is-other td {
  background: #eef1f4 !important;
  color: #667085;
  border-top-color: #d8dde4;
}

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

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 650;
}

fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

legend {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 750;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
}

.check-grid label,
td label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--text);
  font-weight: 600;
}

.check-grid input,
td input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  flex: 0 0 18px;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 24px;
  font-weight: 700;
}

.compact-input {
  min-width: 160px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 42px;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.span-2 {
  grid-column: span 2;
}

.flash,
.notice {
  padding: 13px 15px;
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
}

.flash-success {
  background: var(--soft);
  border-color: #bddbd4;
}

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

.link-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.link-list a {
  display: block;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 13px;
}

.status-pill.done {
  background: #dff4e7;
  color: #16633a;
}

.status-pill.todo {
  background: #fff4bf;
  color: #604400;
}

.status-pill.is-ok {
  background: #dff4e7;
  color: #16633a;
}

.status-pill.is-off {
  background: #eef1f4;
  color: #667085;
}

.account-box {
  border-radius: 14px;
}

.account-box legend {
  padding: 0 6px;
  font-weight: 800;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

.inline-form {
  margin-top: 8px;
}

.inline-form .button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

tr.is-done td {
  background: #f0fbf4;
}

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.calendar-head h2 {
  margin: 0;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  border: 1px solid var(--line);
  overflow-x: auto;
}

.month-label,
.month-cell {
  min-height: 92px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.month-label {
  min-height: auto;
  background: var(--soft);
  color: var(--primary-dark);
  font-weight: 800;
  text-align: center;
}

.month-cell.empty {
  background: #fafbfc;
}

.calendar-event {
  margin-top: 6px;
  padding: 6px;
  border-left: 3px solid var(--primary);
  background: var(--soft);
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.3;
}

.calendar-event span {
  display: block;
  color: var(--primary-dark);
  font-weight: 800;
}

@media (max-width: 760px) {
  .site-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .menu-button {
    display: inline-flex;
  }

  .main-nav {
    display: none;
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav a {
    justify-content: flex-start;
  }

  .hero,
  .grid,
  .link-list,
  .filters,
  .check-grid,
  form.grid-form {
    grid-template-columns: 1fr;
  }

  .month-grid {
    grid-template-columns: repeat(7, minmax(110px, 1fr));
  }

  .span-2 {
    grid-column: auto;
  }

  .site-footer {
    flex-direction: column;
  }
}

@media print {
  .site-header,
  .site-footer,
  .toolbar,
  .actions,
  .flash,
  .notice {
    display: none;
  }

  body {
    background: #fff;
  }

  .page {
    width: 100%;
    margin: 0;
  }

  .panel,
  .card,
  .hero {
    border: 0;
    padding: 0;
  }
}
