:root {
  --ink: #1d2430;
  --muted: #667085;
  --line: #dbe3e6;
  --paper: #e6eef0;
  --card: #ffffff;
  --accent: #0f6e6b;
  --accent-deep: #0b5553;
  --accent-soft: #e5f5f4;
  --good: #067647;
  --good-bg: #e8f7ef;
  --wait: #b54708;
  --wait-bg: #fff4e8;
  --bad: #b42318;
  --bad-bg: #fdecea;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(820px 280px at 0% -8%, rgba(15, 110, 107, .16), transparent 60%),
    radial-gradient(640px 240px at 100% 0%, rgba(20, 145, 155, .12), transparent 55%),
    var(--paper);
  font: 15px/1.5 "Segoe UI", system-ui, sans-serif;
}
button, input, select { font: inherit; }
a { color: inherit; }

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 0 max(16px, calc((100% - 1180px) / 2));
  background: rgba(255, 255, 255, .94);
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 10px 28px rgba(15, 70, 68, .08);
  backdrop-filter: blur(10px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 16px rgba(15, 110, 107, .28);
}
.brand strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.page-switch {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #f3f7f7;
  border-radius: 999px;
}
.page-switch a {
  padding: 8px 16px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}
.page-switch a:hover { color: var(--ink); }
.page-switch a.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 14px rgba(15, 110, 107, .28);
}

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 56px;
}
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 16px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 28px rgba(16, 40, 40, .06);
}
.mode-switch button {
  border: 0;
  border-radius: 12px;
  padding: 13px 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}
.mode-switch button.active {
  background: linear-gradient(180deg, #14918d, var(--accent));
  color: #fff;
  box-shadow: 0 8px 16px rgba(15, 110, 107, .24);
}
.report-panel[hidden] { display: none; }

.composer.jms-board {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  background: var(--card);
  border: 1px solid #d5e2e4;
  border-radius: 22px;
  box-shadow: 0 20px 44px rgba(16, 40, 40, .09);
  overflow: hidden;
}
.pick-span {
  grid-column: 1 / -1;
  padding: 18px;
  background:
    linear-gradient(180deg, #f4fbfa 0%, #fff 100%);
  border-bottom: 1px solid var(--line);
}
.pick-label {
  margin: 0 0 12px;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.section-label { margin-bottom: 12px; }
.pick-hint { margin: 0; color: var(--muted); font-size: 13.5px; font-weight: 600; }
.pick-hint[hidden], .pick-block[hidden] { display: none; }
.pick-cats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.pick-cats button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  border: 1px solid #d3e0e2;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 70, 68, .05);
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
}
.pick-cats button:hover {
  border-color: #8ec9c6;
  background: #f7fcfb;
}
.pick-cats button.active {
  background: linear-gradient(180deg, #14918d, var(--accent));
  color: #fff;
  border-color: var(--accent-deep);
  box-shadow: 0 8px 16px rgba(15, 110, 107, .28);
}
.composer-setup, .composer-result { padding: 18px; }
.composer-setup { min-width: 0; background: #fff; }
.composer-result {
  position: sticky;
  top: 88px;
  align-self: start;
  background:
    linear-gradient(180deg, #f3faf9 0%, #f7fbfb 88px);
  border-left: 1px solid var(--line);
}
.pick-items { display: grid; gap: 8px; }
.pick-items button {
  padding: 12px 14px;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13.5px;
  font-weight: 650;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}
.pick-items button:hover { border-color: #b7e3e1; background: #f8fbfb; }
.pick-items button.active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: #9fd4d1;
  box-shadow: inset 4px 0 0 var(--accent);
}
.composer.jms-board .section-label {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.field { display: grid; gap: 6px; margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.composer-setup > .field { margin-top: 12px; }
.extra-fields { display: grid; gap: 12px; margin-top: 12px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.composer select,
.composer input[type="text"] {
  width: 100%;
  background: #fbfefe;
  border: 1px solid #d0d5dd;
  border-radius: 12px;
  padding: 11px 12px;
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 1px 2px rgba(16, 40, 40, .04);
}
.composer select:focus,
.composer input[type="text"]:focus {
  outline: 3px solid rgba(15, 110, 107, .18);
  border-color: var(--accent);
  background: #fff;
}
.field small { font-weight: 600; }
.field small.ok { color: var(--good); }
.field small.warn { color: var(--wait); }
.usage, .meta-grid article {
  padding: 12px 14px;
  border-radius: 14px;
  background: #f7fcfb;
  border: 1px solid #d7ebe9;
}
.usage { margin: 12px 0 0; }
.usage small, .meta-grid small {
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.usage p, .meta-grid p { margin: 4px 0 0; color: var(--ink); font-size: 13px; font-weight: 600; line-height: 1.45; }
.meta-grid { display: grid; gap: 8px; margin-top: 12px; }
.meta-grid[hidden], .extra-fields[hidden] { display: none; }
.result-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.result-head strong { display: block; font-size: 16px; letter-spacing: -.02em; }
.result-head span, .copy-status { color: var(--muted); font-size: 12px; font-weight: 600; }
.copy-status { margin: 10px 0 0; color: var(--good); }
.reply-preview {
  min-height: 280px;
  margin: 0;
  padding: 18px 16px 16px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid #d7ebe9;
  border-top: 4px solid var(--accent);
  box-shadow: 0 12px 24px rgba(15, 110, 107, .08);
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--ink);
}
.reply-empty { margin: 0; color: var(--muted); text-align: center; }
.reply-empty img, .empty-art {
  display: block;
  width: 148px;
  height: 148px;
  margin: 4px auto 14px;
  border-radius: 18px;
  object-fit: cover;
}
.empty-art { width: 180px; height: 180px; }
.reply-preview mark { padding: 0 4px; border-radius: 4px; font-weight: 700; }
.reply-preview mark.ok { background: var(--good-bg); color: var(--good); }
.reply-preview mark.wait { background: var(--wait-bg); color: var(--wait); }
.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #14918d, var(--accent));
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 8px 16px rgba(15, 110, 107, .24);
}
button:disabled { opacity: .4; cursor: default; box-shadow: none; }
.flash { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; }
.flash.err { background: var(--bad-bg); color: var(--bad); }

.empty-board {
  padding: 56px 32px;
  background:
    linear-gradient(180deg, #f4fbfa, #fff 120px);
  border: 1px solid #d5e2e4;
  border-radius: 22px;
  box-shadow: 0 20px 44px rgba(16, 40, 40, .09);
}
.empty-board h1 { margin: 0; font-size: 28px; letter-spacing: -.03em; }
.empty-board p:last-child { margin: 8px 0 0; color: var(--muted); }

@media (max-width: 980px) {
  .pick-cats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .appbar { min-height: 0; padding: 14px 16px; align-items: flex-start; flex-direction: column; }
  .page-switch { width: 100%; }
  .page-switch a { flex: 1; text-align: center; }
  .composer.jms-board, .field-row { grid-template-columns: 1fr; }
  .composer-result { position: static; border-left: 0; border-top: 1px solid var(--line); }
  .pick-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-switch button { font-size: 13px; line-height: 1.3; }
}
