:root {
  --bg: #f4f7fb; --card: #fff; --ink: #1b2733; --muted: #5d6b7a; --line: #dbe3ec;
  --brand: #1769c2; --brand-ink: #fff; --brand-soft: #e6f0fb; --err-bg: #fdecec; --err: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11181f; --card: #18222c; --ink: #e8eef4; --muted: #9aa9b8; --line: #2a3846;
    --brand: #5aa6ee; --brand-ink: #0b1620; --brand-soft: #1d2e41; --err-bg: #3a1c1b; --err: #ff9d97;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.55 "Be Vietnam Pro", system-ui, sans-serif; background: var(--bg); color: var(--ink); }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; gap: 10px; align-items: center; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); display: grid; place-items: center; font-weight: 700; }
.status { font-size: 13px; padding: 4px 10px; border-radius: 99px; background: var(--err-bg); color: var(--err); }
.layout { max-width: 1100px; margin: 0 auto; padding: 16px; display: grid; grid-template-columns: 230px 1fr; gap: 16px; }
.tabs { display: flex; flex-direction: column; gap: 6px; align-self: start; position: sticky; top: 76px; }
.tab { text-align: left; padding: 10px 12px; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 10px; cursor: pointer; font: inherit; font-weight: 500; }
.tab small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.tab[aria-selected="true"] { border-color: var(--brand); background: var(--brand-soft); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 18px; margin: 0; }
.muted { color: var(--muted); } .small { font-size: 13px; margin: 10px 0 0; }
form { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.wide { grid-column: 1 / -1; }
label { font-weight: 500; font-size: 14px; }
input, select, textarea { font: inherit; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); width: 100%; }
textarea { resize: vertical; min-height: 90px; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tab:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.hint { font-size: 12px; color: var(--muted); }
.actions { margin-top: 14px; display: flex; gap: 8px; }
.btn { font: inherit; font-weight: 500; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn:disabled { opacity: .55; cursor: wait; }
.result-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.error { background: var(--err-bg); color: var(--err); padding: 10px 12px; border-radius: 8px; margin-bottom: 10px; }
.output { overflow-x: auto; }
.output h1 { font-size: 21px; } .output h2 { font-size: 18px; margin-top: 22px; } .output h3 { font-size: 16px; }
.output table { border-collapse: collapse; margin: 10px 0; font-size: 14px; }
.output th, .output td { border: 1px solid var(--line); padding: 6px 8px; vertical-align: top; }
.output th { background: var(--brand-soft); }
.slides { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.slide { border: 1px solid var(--line); border-radius: 10px; padding: 12px; background: var(--brand-soft); }
.slide h3 { margin: 0 0 6px; font-size: 15px; } .slide ul { margin: 0; padding-left: 18px; font-size: 14px; }
.slide .note { margin-top: 8px; font-size: 12px; color: var(--muted); font-style: italic; }
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .tabs { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .tab { white-space: nowrap; } .tab small { display: none; }
  form { grid-template-columns: 1fr; }
}
