:root {
  --bg: #f6f8f7;
  --panel: #ffffff;
  --panel-2: #f3f7f5;
  --line: #e2e8e4;
  --line-strong: #cfd8d3;
  --ink: #1e2a24;
  --muted: #6b7a71;
  --accent: #0d7a57;
  --accent-ink: #ffffff;
  --accent-dim: #e8f5ef;
  --warn: #a15c00;
  --err: #b3403a;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow: hidden;
}
.app { height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.brand b { font-weight: 700; }
.brand .sub { color: var(--muted); font-size: 11px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}
.icon {
  width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink); font-size: 16px; cursor: pointer;
}
.icon:hover { border-color: var(--accent); }
.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 8px 10px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.tab {
  padding: 8px 6px; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.tab.active { color: var(--accent); background: var(--panel-2); border-color: var(--line); }
main { flex: 1; min-height: 0; overflow: auto; }
.page { display: none; padding: 10px 12px 14px; }
.page.active { display: block; }
label {
  display: block; margin: 10px 0 4px; color: var(--muted);
  font-size: 9.5px; text-transform: uppercase; letter-spacing: .09em; font-weight: 700;
}
textarea, select {
  width: 100%; border: 1px solid var(--line-strong); border-radius: 9px;
  background: #ffffff; color: var(--ink); font: 12px/1.5 "Segoe UI", Arial, sans-serif;
  padding: 8px 9px; outline: none;
}
textarea { resize: vertical; min-height: 120px; }
textarea:focus, select:focus { border-color: var(--accent); }
#chat { min-height: 150px; }
#draft { min-height: 140px; }
#transcript { min-height: 240px; }
select { height: 34px; }
.row { display: flex; gap: 7px; margin-top: 8px; }
.btn {
  flex: 1; padding: 9px 10px; border-radius: 9px; font: inherit; font-size: 12px;
  font-weight: 700; cursor: pointer; border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink);
}
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.progressbox {
  margin-top: 8px; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--panel-2);
}
.progress {
  height: 6px; border-radius: 999px; background: #dce6e1; overflow: hidden;
}
.progress > div {
  height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #2ee6a8);
  transition: width .4s ease;
}
.progress-label { margin-top: 6px; font-size: 11px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.grid2 .btn { padding: 9px 6px; font-size: 11.5px; }
#fuOut, #upOut, #offOut, #tplOut { min-height: 130px; }
.tone { font-size: 11px; padding: 7px 4px; }
#cardBtn { width: 100%; margin-top: 7px; }
.tpllist { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.tplgroup {
  margin-top: 8px; font-size: 10px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--accent);
}
.tplbtn {
  width: 100%; text-align: left; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #ffffff; color: var(--ink);
  font: inherit; font-size: 12px; cursor: pointer;
}
.tplbtn:hover { border-color: var(--accent); background: var(--accent-dim); }
.tplbtn.hl { background: #fff8e1; border-color: #f0c040; box-shadow: inset 0 0 0 1px #f0c040; }
.tplhint {
  margin-top: 8px; padding: 6px 8px; border-radius: 8px;
  background: #fff8e1; color: #8a6d00; font-size: 11px;
}
.status { margin-top: 7px; min-height: 17px; font-size: 11.5px; color: var(--muted); }
.status.ok { color: var(--accent); }
.status.work { color: var(--warn); }
.status.err { color: var(--err); }
.hint { margin-top: 8px; font-size: 10.5px; color: var(--muted); line-height: 1.4; }
.foot {
  padding: 7px 12px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 10px; text-align: center; background: var(--panel);
}
