:root {
  color-scheme: light;
  --bg: #f1f4f2;
  --panel: #ffffff;
  --ink: #17211e;
  --muted: #42504b;
  --line: #cbd7d1;
  --accent: #0b6a52;
  --accent-strong: #0a4f40;
  --warn: #a35413;
  --danger: #9f2d2d;
  --soft: #eaf3ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft JhengHei", "Noto Sans TC", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.65;
}

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

.topbar {
  align-items: center;
  background: #174f43;
  color: white;
  display: flex;
  height: 56px;
  justify-content: space-between;
  padding: 0 24px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 56px);
}

.sidebar {
  background: #fbfcfb;
  border-right: 1px solid var(--line);
  padding: 24px 18px;
}

.sidebar a {
  border-radius: 6px;
  color: var(--ink);
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  padding: 12px 13px;
}

.sidebar a.active,
.sidebar a:hover {
  background: var(--soft);
  color: var(--accent-strong);
}

.main {
  padding: 28px;
}

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

h1 {
  font-size: 30px;
  line-height: 1.25;
  margin: 0 0 8px;
}

h2 {
  font-size: 22px;
  margin: 28px 0 12px;
}

p {
  line-height: 1.7;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}

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

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

input,
select,
textarea {
  background: #fff;
  border: 1px solid #c9d2ce;
  border-radius: 6px;
  color: var(--ink);
  font: inherit;
  min-height: 46px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

textarea.large-writing {
  min-height: 210px;
}

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

.inline-actions {
  flex-wrap: nowrap;
  margin-top: 0;
}

.nowrap-button {
  white-space: nowrap;
}

.form-actions {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.save-reminder {
  color: #33423d;
  font-size: 15px;
  font-weight: 700;
}

button,
.button {
  align-items: center;
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 700;
  justify-content: center;
  min-height: 46px;
  padding: 10px 16px;
}

button.secondary,
.button.secondary {
  background: #dfe8e4;
  color: var(--ink);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.note {
  background: #eef6f3;
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  color: #26443b;
  margin: 16px 0;
  padding: 14px 16px;
}

.warning {
  background: #fff7ed;
  border-left: 4px solid var(--warn);
  border-radius: 6px;
  color: #6d3c0b;
  margin: 12px 0;
  padding: 12px 14px;
}

.danger {
  background: #fff0f0;
  border-left: 4px solid var(--danger);
  color: #692222;
}

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

.reading-panel {
  max-width: 900px;
}

.copy-helper {
  background: #eef1ef;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #35423e;
  display: grid;
  gap: 12px;
  margin-bottom: 10px;
  padding: 14px;
}

.row-list {
  display: grid;
  gap: 14px;
}

.item-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

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

.login-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 460px;
  padding: 30px;
  width: 100%;
}

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

.case-item {
  align-items: center;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 16px;
}

pre.preview {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #111a17;
  font-family: "PMingLiU", "MingLiU", "Microsoft JhengHei", "Noto Sans TC", serif;
  font-size: 18px;
  line-height: 1.8;
  max-height: 560px;
  overflow: auto;
  padding: 18px;
  white-space: pre-wrap;
}

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

  .sidebar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px;
  }

  .sidebar a {
    white-space: nowrap;
  }

  .grid,
  .grid.three {
    grid-template-columns: 1fr;
  }
}
