:root {
  --bg: #f4f6fb; --card: #ffffff; --ink: #22243a; --muted: #6b6f85; --line: #e4e7f0;
  --accent: #5b5bd6; --accent-2: #eef0ff; --good: #2e9e6a; --good-bg: #e6f6ee; --warn: #c98a12; --warn-bg: #fff4dc;
  --bad: #d64545; --bad-bg: #fde8e8; --info-bg: #e8f1fd; --radius: 16px; --shadow: 0 6px 24px rgba(40, 44, 80, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
a { color: var(--accent); }
h1 { font-size: 26px; margin: 0 0 4px; }
h2 { font-size: 19px; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 0 0 6px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--bad); min-height: 20px; }
.ok { color: var(--good); }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }
.stat { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat .n { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 14px; }
input, select, textarea { font: inherit; color: inherit; background: #fbfbfe; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
textarea { min-height: 120px; resize: vertical; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-2); border-color: var(--accent); }
label.f { display: block; margin-bottom: 10px; font-size: 14px; color: var(--muted); }
label.f > span { display: block; margin-bottom: 4px; }
label.c { display: inline-flex; gap: 8px; align-items: center; margin: 6px 12px 6px 0; cursor: pointer; }
label.c input { width: auto; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 12px; padding: 9px 14px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.good { background: var(--good); color: #fff; border-color: var(--good); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 5px 10px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; background: var(--accent-2); color: var(--accent); white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: #2d63b3; }
.pill.grey { background: #eef0f4; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 14px; }
.chip.on { background: var(--accent); color: #fff; border-color: var(--accent); }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
tr.click { cursor: pointer; }
tr.click:hover { background: #f8f8fd; }
.progress { height: 12px; background: #e9ebf3; border-radius: 999px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), #8f8ff0); transition: width .4s; }
.log { font-size: 13px; color: var(--muted); max-height: 220px; overflow: auto; background: #fafbff; border-radius: 10px; padding: 8px 12px; }
.log div { padding: 2px 0; border-bottom: 1px dashed var(--line); }
pre.letter { white-space: pre-wrap; font: 15px/1.5 Georgia, serif; background: #fdfdf7; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--card); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.side a { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 12px; color: var(--ink); text-decoration: none; cursor: pointer; font-size: 15.5px; }
.side a:hover { background: var(--bg); }
.side a.on { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.side-foot { margin-top: auto; padding: 8px 4px; }
.logo { font-weight: 800; font-size: 20px; padding: 6px 12px 16px; }
.logo.big { font-size: 28px; text-align: center; padding: 0; }
.badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: 12px; padding: 0 7px; margin-left: auto; }
main { padding: 26px 30px 60px; max-width: 1200px; }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.slider { width: 44px; height: 24px; background: #cfd3e0; border-radius: 999px; position: relative; transition: .2s; flex: none; }
.slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--good); }
.switch input:checked + .slider::after { left: 23px; }
.switch-label { font-size: 15px; }
.drawer { position: fixed; top: 0; right: 0; width: min(560px, 100vw); height: 100vh; background: var(--card); box-shadow: -10px 0 40px rgba(0,0,0,.12); overflow: auto; padding: 22px 24px 60px; z-index: 20; }
.drawer .close { position: absolute; top: 12px; right: 14px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 14.5px; margin: 8px 0; }
.kv b { color: var(--muted); font-weight: 500; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; font-size: 14.5px; white-space: pre-wrap; }
.msg.in { background: #f5fbf7; }
.msg .h { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; z-index: 50; font-size: 15px; box-shadow: var(--shadow); }
.toast.bad { background: var(--bad); }
.login { min-height: 100vh; display: grid; place-items: center; }
.login .card { width: 340px; text-align: center; }
.login input { margin: 14px 0 10px; }
.steps { padding-left: 18px; font-size: 14.5px; }
.steps li { margin: 4px 0; }
.bars { display: flex; gap: 3px; align-items: flex-end; height: 80px; }
.bars > div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars > div span { position: absolute; bottom: -18px; left: 0; font-size: 10px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { background: none; border: none; font: inherit; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--accent); border-color: var(--accent); font-weight: 600; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.todo { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.todo .dot { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; flex: none; }
.todo.done .dot { background: var(--good); border-color: var(--good); color: #fff; }
.todo.done span { color: var(--muted); text-decoration: line-through; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; bottom: 0; top: auto; height: auto; width: 100%; flex-direction: row; overflow-x: auto; padding: 6px; border-top: 1px solid var(--line); border-right: 0; z-index: 10; }
  .side .logo, .side-foot, .side a span { display: none; }
  .side a { font-size: 22px; padding: 8px 10px; }
  main { padding: 16px 16px 90px; }
  .kv { grid-template-columns: 90px 1fr; }
  th:nth-child(n+5), td:nth-child(n+5) { display: none; }
}
