:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --text: #1f2328;
  --muted: #667085;
  --line: #d8dee4;
  --accent: #2f7d57;
  --accent-strong: #236646;
  --danger: #b42318;
  --warning-bg: #fff7ed;
  --warning-line: #fed7aa;
}

* {
  box-sizing: border-box;
}

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

a {
  color: var(--accent-strong);
  text-decoration: none;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  font: inherit;
  cursor: pointer;
}

button:hover,
.button:hover {
  background: var(--accent-strong);
}

.secondary,
.ghost {
  background: #fff;
  color: var(--text);
  border-color: var(--line);
}

.secondary:hover,
.ghost:hover {
  background: #eef1f3;
}

.app-shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 16px;
  background: #fff;
  border-right: 1px solid var(--line);
}

.brand {
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
  font-size: 16px;
}

.sidebar nav {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 6px;
  flex: 1;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  min-height: 38px;
  border-radius: 6px;
  color: var(--text);
  padding: 0 10px;
}

.sidebar nav a:hover {
  background: #eef1f3;
}

.sidebar nav a.active {
  background: #e8f5ee;
  color: var(--accent-strong);
  font-weight: 700;
}

[hidden] {
  display: none !important;
}

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

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

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

h1 {
  font-size: 24px;
}

h2 {
  font-size: 17px;
  margin-bottom: 16px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 18px;
  min-width: 0;
  overflow-x: auto;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metrics div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.metrics strong {
  display: block;
  font-size: 24px;
}

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

.two-column {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.1fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.stack,
.grid-form {
  display: grid;
  gap: 14px;
}

.grid-form {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  min-width: 0;
}

.full-span,
.form-actions {
  grid-column: 1 / -1;
}

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

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

textarea {
  resize: vertical;
  line-height: 1.55;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.checkline input {
  width: auto;
}

.field-group {
  display: grid;
  gap: 10px;
}

.field-label {
  color: var(--muted);
  font-weight: 700;
}

.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(64px, 1fr));
  gap: 8px;
}

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

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

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

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

code {
  background: #eef1f3;
  border-radius: 4px;
  padding: 2px 5px;
}

pre {
  overflow-x: auto;
  white-space: pre-wrap;
  background: #f0f2f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: #eef1f3;
  color: var(--muted);
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #e8f5ee;
  color: var(--accent-strong);
}

.badge.bad {
  background: #fee4e2;
  color: var(--danger);
}

.alert,
.notice {
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

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

.notice {
  background: #e8f5ee;
  border: 1px solid #bfe3ce;
  color: var(--accent-strong);
}

.link,
.link-danger {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  padding: 0;
}

.link-danger {
  color: var(--danger);
}

.link:hover,
.link-danger:hover {
  background: transparent;
  text-decoration: underline;
}

.detail dl {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px 16px;
  margin: 0 0 18px;
}

.detail dt {
  color: var(--muted);
  font-weight: 700;
}

.detail dd {
  margin: 0;
}

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

.login-panel {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}

.login-panel h1 {
  margin-bottom: 22px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 12px;
    padding: 14px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-width: 0;
  }

  .sidebar nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    flex: initial;
  }

  .sidebar nav a {
    white-space: nowrap;
  }

  .page {
    width: min(100% - 20px, 1280px);
    margin-top: 16px;
  }

  .metrics,
  .two-column,
  .grid-form {
    grid-template-columns: 1fr;
  }

  .weekday-grid {
    grid-template-columns: repeat(2, minmax(92px, 1fr));
  }
}
