:root {
  --bg: #f5f1e8;
  --paper: #fffdf8;
  --ink: #21302c;
  --soft: #66726d;
  --line: #d9cdb9;
  --accent: #29594a;
  --accent-soft: #edf4f1;
  --ghost: #f2e8da;
  --shadow: 0 16px 42px rgba(36, 28, 16, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(41, 89, 74, 0.1), transparent 24%),
    radial-gradient(circle at bottom right, rgba(190, 128, 70, 0.1), transparent 22%),
    var(--bg);
}

.page {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.login-page {
  max-width: 560px;
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.login-panel {
  width: 100%;
}

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

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

.account-chip {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
}

.account-chip span {
  color: var(--soft);
  font-size: 13px;
}

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

.top-tab {
  color: var(--ink);
  background: var(--ghost);
}

.top-tab.is-active {
  color: white;
  background: linear-gradient(135deg, var(--accent), #1d4338);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-copy,
.hero-card,
.panel,
.note-box {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.hero-copy,
.hero-card,
.panel {
  padding: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #b56c38;
  font-size: 12px;
}

.hero h1 {
  margin: 0 0 10px;
  font-size: 36px;
  line-height: 1.08;
}

.sub {
  margin: 0;
  color: var(--soft);
  line-height: 1.8;
}

.hero-card {
  display: grid;
  gap: 10px;
}

.stat {
  padding: 14px;
  border-radius: 14px;
  background: var(--accent-soft);
}

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

.stat span {
  color: var(--soft);
}

.panel {
  margin-bottom: 18px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 24px;
}

.panel-head p {
  margin: 0 0 14px;
  color: var(--soft);
  line-height: 1.7;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 14px 16px;
  resize: vertical;
  font: inherit;
  line-height: 1.7;
}

input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.5;
}

input[type="password"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.5;
}

.accent-row,
.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.manager-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.manager-row-3 {
  grid-template-columns: 1fr 1fr auto;
}

.manager-row-4 {
  grid-template-columns: 1fr 1fr 1fr 160px auto auto;
}

.default-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: center;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  color: white;
  background: linear-gradient(135deg, var(--accent), #1d4338);
}

button:disabled {
  cursor: wait;
  opacity: 0.75;
}

button.ghost {
  color: var(--ink);
  background: var(--ghost);
}

button.danger {
  color: #7c1b10;
  background: #fbe3de;
}

button.small-btn {
  padding: 9px 14px;
  font-size: 14px;
}

.meta {
  margin-top: 12px;
  color: var(--soft);
  line-height: 1.7;
}

.output {
  min-height: 180px;
  margin: 12px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  white-space: pre-wrap;
  line-height: 1.8;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 14px;
}

.output-editor {
  resize: vertical;
}

.review-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.review-section {
  display: grid;
  gap: 12px;
}

.review-section-title {
  font-weight: 700;
  color: var(--ink);
}

.review-guide {
  background: #fffcf6;
}

.review-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 14px;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

.review-note {
  color: var(--soft);
  line-height: 1.7;
}

.warning-note {
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid #e3c889;
  border-radius: 12px;
  background: #fff7df;
  color: #7c5d10;
  line-height: 1.7;
}

.legend-list {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.legend-text {
  color: var(--soft);
  line-height: 1.7;
}

.entry-editor {
  margin-top: 12px;
}

.entry-editor-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.entry-editor-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.9fr) 1fr 1fr auto;
  gap: 8px;
  align-items: center;
}

.entry-field {
  display: grid;
  gap: 6px;
}

.entry-label {
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.entry-editor-row input {
  min-width: 0;
}

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

.account-summary-card {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.review-submeta {
  margin-top: 6px;
  font-size: 13px;
}

.mini-output {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  background: #faf7f2;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.8;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 13px;
}

.rule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.rule-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 14px;
  display: grid;
  gap: 6px;
}

.rule-card strong {
  font-size: 18px;
}

.rule-card span {
  color: var(--soft);
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

.logic-list {
  display: grid;
  gap: 12px;
}

.logic-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 14px;
}

.logic-item strong {
  display: block;
  margin-bottom: 6px;
}

.logic-item p {
  margin: 0;
  color: var(--soft);
  line-height: 1.8;
}

.guide-output {
  min-height: 320px;
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.9;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  font-size: 14px;
}

.guide-editor {
  margin-top: 14px;
}

.date-group {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.78);
  overflow: hidden;
}

.date-group + .date-group {
  margin-top: 12px;
}

.date-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
}

.date-group-summary::-webkit-details-marker {
  display: none;
}

.date-group-summary::before {
  content: "▸";
  color: var(--accent);
  margin-right: 8px;
}

.date-group[open] .date-group-summary::before {
  content: "▾";
}

.date-group-count {
  color: var(--soft);
  font-weight: 600;
  font-size: 13px;
}

.date-group-items {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
}

.audit-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: white;
  display: grid;
  gap: 8px;
}

.audit-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.audit-meta {
  color: var(--soft);
  font-size: 13px;
  line-height: 1.7;
}

.note-box {
  padding: 14px 18px;
  color: var(--soft);
  line-height: 1.8;
}

.note-box p {
  margin: 0;
}

@media (max-width: 820px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .default-form,
  .manager-row-3,
  .manager-row-4,
  .entry-editor-row,
  .manager-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

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

  .manager-row {
    grid-template-columns: 1fr;
  }

  .entry-editor-row {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}
