:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --text: #20231f;
  --muted: #6d746a;
  --line: #dde2d8;
  --accent: #2f6f62;
  --accent-dark: #214f47;
  --warning: #b6532f;
  --soft: #edf4ef;
  --shadow: 0 18px 45px rgba(42, 53, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 64px;
  padding: 0 32px;
  background: rgba(246, 247, 244, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand,
.nav {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: var(--accent);
  border-radius: 8px;
}

.nav {
  gap: 8px;
}

.nav a,
.ghost-link,
.text-btn,
.danger-btn,
button,
.button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  font: inherit;
  cursor: pointer;
}

.nav a {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
}

.nav a:hover {
  color: var(--text);
  background: #e9ede5;
}

.primary-link,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  color: #fff !important;
  background: var(--accent);
  font-weight: 650;
}

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

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

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

.hero h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 750;
}

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

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

.metric {
  padding: 18px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  line-height: 1.15;
}

.metric.warning strong {
  color: var(--warning);
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 20px;
}

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

.panel-head.compact {
  margin-bottom: 10px;
}

.ghost-link {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--accent);
  background: var(--soft);
  font-weight: 650;
}

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

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

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

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

.date-cell {
  white-space: nowrap;
}

.date-cell span {
  display: block;
  color: var(--muted);
}

.strong {
  font-weight: 720;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  color: var(--accent-dark);
  background: var(--soft);
  font-weight: 700;
  white-space: nowrap;
}

.actions {
  width: 118px;
  white-space: nowrap;
}

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

td.actions form {
  margin: 0;
}

.text-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  background: #edf0ea;
  color: var(--text);
}

.danger-btn {
  color: var(--warning);
}

.month-list {
  display: grid;
  gap: 8px;
}

.month-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  text-align: left;
}

.month-item.active {
  border-color: var(--accent);
  background: var(--soft);
}

.search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  outline: 2px solid rgba(47, 111, 98, 0.18);
  border-color: var(--accent);
}

.search input {
  flex: 1;
}

.search button {
  padding: 0 16px;
  color: #fff;
  background: var(--accent);
  font-weight: 650;
}

.form-panel {
  max-width: 860px;
}

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

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

.wide {
  grid-column: 1 / -1;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.messages {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.message {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
}

.message.success {
  border-color: #a6c9b0;
  background: #eff8f1;
}

.message.error {
  border-color: #d9a28a;
  background: #fff2ed;
  color: var(--warning);
}

.empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
}

.empty h2 {
  color: var(--text);
}

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

@media (max-width: 900px) {
  .metrics,
  .layout,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .side-panel {
    order: -1;
  }
}

@media (max-width: 640px) {
  .topbar,
  .hero,
  .search,
  .form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: static;
    padding: 14px 20px;
  }

  .nav {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(3, 1fr);
  }

  .nav a {
    justify-content: center;
  }

  .page {
    width: min(100% - 24px, 1180px);
    margin-top: 18px;
  }
}
