:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --surface: #ffffff;
  --surface-soft: #f0f5f4;
  --ink: #1d2528;
  --muted: #657174;
  --line: #d9e0dd;
  --teal: #1f8a80;
  --teal-dark: #15655f;
  --teal-soft: #e4f4f2;
  --amber: #b87516;
  --amber-soft: #fff2d8;
  --rose: #bf3f4a;
  --rose-soft: #fff0f2;
  --shadow: 0 12px 30px rgba(29, 37, 40, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

.hidden {
  display: none !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 247, 243, 0.95);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  width: 36px;
  height: 36px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(31, 138, 128, 0.18);
}

h1 {
  font-size: 24px;
  line-height: 1.2;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.toolbar,
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn,
.icon-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 9px 13px;
  font-weight: 700;
  cursor: pointer;
}

.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
}

.btn:hover,
.icon-btn:hover {
  border-color: #a8b9b5;
}

.btn-primary {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.btn-danger {
  border-color: #d9a0a7;
  color: var(--rose);
}

.btn-danger:hover {
  border-color: var(--rose);
  background: var(--rose-soft);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shell {
  min-height: calc(100vh - 66px);
}

.login-panel {
  min-height: calc(100vh - 66px);
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-box {
  width: min(100%, 430px);
  display: grid;
  gap: 14px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-box h2 {
  font-size: 24px;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
}

input:focus {
  outline: 2px solid rgba(31, 138, 128, 0.2);
  border-color: var(--teal);
}

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

.workspace {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 36px) 36px;
}

.sidebar,
.form-panel,
.output-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.sidebar {
  position: sticky;
  top: 84px;
  height: calc(100vh - 104px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.account {
  display: grid;
  gap: 2px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

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

.case-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 12px 8px 16px;
}

.case-list-head h2 {
  font-size: 18px;
}

.case-list {
  overflow: auto;
  padding: 0 10px 12px;
}

.case-item {
  width: 100%;
  display: grid;
  gap: 3px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 10px;
  background: transparent;
  cursor: pointer;
}

.case-item:hover,
.case-item.active {
  background: var(--teal-soft);
  border-color: #9ed3cc;
}

.case-item strong {
  font-size: 15px;
}

.case-item span {
  color: var(--muted);
  font-size: 13px;
}

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

.form-panel {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 18px;
  padding: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

fieldset {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0;
}

legend {
  padding: 0 6px;
  font-weight: 800;
}

.check,
.inline-options label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}

.check input,
.inline-options input {
  width: 18px;
  min-height: 18px;
}

.inline-options {
  display: grid;
  gap: 8px;
  padding: 8px 12px;
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.output-panel {
  min-height: calc(100vh - 104px);
  padding: 24px;
}

.output-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.output-head h2 {
  font-size: 30px;
}

.output-head p {
  color: var(--muted);
  font-weight: 700;
  margin-top: 4px;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid #9ed3cc;
  border-radius: 999px;
  padding: 4px 12px;
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 800;
}

.notice {
  margin-top: 22px;
  padding: 13px 16px;
  border: 1px solid #9ed3cc;
  border-radius: var(--radius);
  background: var(--teal-soft);
  color: var(--teal-dark);
  font-weight: 800;
}

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.empty {
  margin-top: 24px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 700;
}

.sections {
  margin-top: 24px;
}

.result-section {
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.result-section:first-child {
  border-top: 0;
  padding-top: 0;
}

.result-section + .result-section {
  margin-top: 20px;
}

.result-section h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.result-section ul {
  margin: 0;
  padding-left: 24px;
}

.result-section li {
  margin: 7px 0;
  white-space: pre-line;
}

.danger-list {
  background: var(--rose-soft);
  border-radius: var(--radius);
  padding-top: 8px;
  padding-bottom: 8px;
}

.highlight-pain {
  display: inline-block;
  padding: 0 5px;
  background: #ffe66f;
  color: #6c3f00;
  font-size: 1.5em;
  font-weight: 900;
  line-height: 1.1;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1120px) {
  .workspace,
  .editor {
    grid-template-columns: 1fr;
  }

  .sidebar,
  .form-panel {
    position: static;
    height: auto;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 21px;
  }

  .toolbar {
    width: 100%;
  }

  .btn {
    flex: 1 1 auto;
  }

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

  .output-panel {
    padding: 18px;
  }

  .output-head {
    flex-direction: column;
  }
}
