:root {
  --background: #f3f5f4;
  --surface: #ffffff;
  --surface-muted: #f7f8f7;
  --text: #17201a;
  --muted: #68736c;
  --border: #dce2de;
  --primary: #146c43;
  --primary-dark: #0e5031;
  --danger: #a92f2f;
  --danger-background: #fff0f0;
  --shadow: 0 10px 30px rgba(15, 35, 24, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.container {
  width: min(1500px, calc(100% - 32px));
  margin-inline: auto;
}

.site-header {
  margin-bottom: 24px;
  padding: 22px 0;
  color: white;
  background:
    linear-gradient(
      135deg,
      #0c4c2e,
      #168452
    );
  box-shadow: var(--shadow);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

h2 {
  margin-bottom: 0;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.78;
}

.header-actions,
.toolbar,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-status {
  font-weight: 700;
}

.card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toolbar {
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 16px;
}

.toolbar > div {
  display: grid;
  gap: 6px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 11px 12px;
  color: var(--text);
  background: white;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid rgba(20, 108, 67, 0.16);
  border-color: var(--primary);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  color: white;
  background: var(--primary);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

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

.button-secondary {
  border: 1px solid currentColor;
  color: inherit;
  background: transparent;
}

.button-secondary:hover {
  color: white;
  background: rgba(255, 255, 255, 0.13);
}

.toolbar .button-secondary,
.dialog-actions .button-secondary {
  color: var(--text);
  border-color: var(--border);
}

.button-full {
  width: 100%;
  margin-top: 12px;
}

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

.summary-card {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.summary-card strong {
  font-size: 1.35rem;
}

.summary-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.table-card {
  margin-bottom: 40px;
  overflow: hidden;
}

.section-heading {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.table-scroll {
  max-width: 100%;
  overflow: auto;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  min-width: 125px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px;
  text-align: center;
  vertical-align: middle;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  max-width: 170px;
  color: #26342b;
  background: #e9efeb;
}

thead th span,
thead th small,
tbody td strong,
tbody td small {
  display: block;
}

thead th small,
tbody td small {
  margin-top: 5px;
  color: var(--muted);
  font-weight: 500;
}

tbody tr:nth-child(even) td,
tbody tr:nth-child(even) th {
  background: var(--surface-muted);
}

.sticky-column {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 190px;
  text-align: left;
  background: white;
}

thead .sticky-column {
  z-index: 4;
  background: #dbe6df;
}

.total-column {
  min-width: 115px;
  font-weight: 800;
  background: #eef5f0;
}

.empty-cell {
  color: #a4aaa6;
}

.alert {
  margin: 16px 20px;
  border-radius: 10px;
  padding: 12px 14px;
}

.alert-error {
  border: 1px solid #edbebe;
  color: var(--danger);
  background: var(--danger-background);
}

.hidden {
  display: none !important;
}

dialog {
  width: min(520px, calc(100% - 28px));
  border: 0;
  border-radius: 18px;
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

dialog::backdrop {
  background: rgba(7, 18, 11, 0.62);
}

dialog form {
  display: grid;
  gap: 12px;
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 8px;
}

.icon-button {
  border: 0;
  padding: 0;
  font-size: 2rem;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(
      circle at top left,
      #237d51,
      #0c3824 65%
    );
}

.login-container {
  width: min(430px, 100%);
}

.login-card {
  padding: 30px;
}

.login-card form {
  display: grid;
  gap: 8px;
}

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

.back-link {
  display: block;
  margin-top: 18px;
  color: var(--primary);
  text-align: center;
  font-weight: 700;
}

@media (max-width: 750px) {
  .container {
    width: min(100% - 20px, 1500px);
  }

  .header-content {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

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

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

  .toolbar .button {
    width: 100%;
  }

  .sticky-column {
    min-width: 150px;
  }

  th,
  td {
    min-width: 105px;
    padding: 9px;
    font-size: 0.86rem;
  }
}