:root {
  color-scheme: dark;
  --bg: #071814;
  --panel: #10231f;
  --panel-strong: #132c27;
  --field: #0b1d1a;
  --line: #25453e;
  --text: #f1fbf7;
  --muted: #9fbdb5;
  --primary: #22c7a9;
  --primary-strong: #0d8f7b;
  --accent: #f2c14e;
  --danger: #7e363c;
  --danger-text: #ffd6da;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(34, 199, 169, .08), transparent 260px),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 "Microsoft YaHei", "Segoe UI", sans-serif;
}

main {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(16, 35, 31, .78);
}

.brand-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--primary);
  color: #031411;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0;
}

p {
  margin: 0;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.switch {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
}

.switch input,
.checks input {
  width: 20px;
  height: 20px;
  accent-color: var(--primary);
}

#groups {
  display: grid;
  gap: 14px;
}

.group {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 10px;
  padding: 18px;
}

.group.collapsed .group-body {
  display: none;
}

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

.group.collapsed .group-head {
  margin-bottom: 0;
}

.group-title {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
  flex-wrap: wrap;
}

.group-index {
  color: var(--accent);
  white-space: nowrap;
}

.group-summary {
  color: var(--muted);
  font-size: 13px;
}

.group-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.grid {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, .7fr) 1fr 1fr;
  gap: 12px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  min-width: 0;
}

input {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--text);
  font: inherit;
  outline: none;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34, 199, 169, .18);
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 14px;
  color: var(--muted);
}

.checks label {
  display: inline-flex;
  grid-template-columns: none;
  gap: 8px;
  align-items: center;
}

.fixed-section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.template-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  margin-bottom: 12px;
}

.template-button {
  width: 36px;
  height: 32px;
  padding: 0;
  border: 1px solid #315d53;
  border-radius: 5px;
  background: #0d211d;
  color: var(--text);
  font-weight: 700;
}

.template-button.active {
  border-color: var(--accent);
  background: #826619;
}

.fixed-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.fixed-card {
  gap: 8px;
  padding: 10px;
  border: 1px solid #315d53;
  border-radius: 6px;
  background: var(--panel-strong);
}

.fixed-number {
  display: grid;
  place-items: center;
  height: 28px;
  border-radius: 6px;
  background: var(--primary-strong);
  color: #fff;
  font-weight: 700;
}

.fixed-label {
  color: var(--text);
  font-weight: 700;
}

.preview {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #0b1d1a;
  color: var(--muted);
}

.preview strong {
  color: var(--accent);
  font-size: 20px;
  margin-left: 8px;
  letter-spacing: 1px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  color: white;
  background: #1d3a34;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

button.primary { background: var(--primary-strong); }
button.danger { background: var(--danger); color: var(--danger-text); }
button.ghost {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
button:hover { filter: brightness(1.1); }

.status {
  margin-top: 14px;
  min-height: 24px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .app-header { align-items: stretch; flex-direction: column; }
  .grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  main { width: calc(100vw - 20px); margin: 16px auto; }
  .grid { grid-template-columns: 1fr; }
  .group-head { align-items: stretch; flex-direction: column; }
  .group-actions { justify-content: flex-end; }
  .toolbar { align-items: stretch; flex-direction: column; }
}
