:root {
  --ink: #12223f;
  --muted: #667391;
  --line: rgba(18, 34, 63, 0.14);
  --card: rgba(255, 255, 255, 0.84);
  --brand: #0d6efd;
  --brand2: #10b7a6;
  --ok: #0b9b60;
  --bad: #cf355b;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(1100px 450px at -10% -25%, #c7e2ff 0%, transparent 60%),
    radial-gradient(900px 380px at 120% 125%, #c8f4e0 0%, transparent 60%),
    linear-gradient(135deg, #edf5ff, #f3fff0);
}
.bg { position: fixed; border-radius: 50%; filter: blur(40px); opacity: .4; z-index: -1; }
.bg.one { width: 260px; height: 260px; top: -70px; right: 8%; background: #82b9ff; }
.bg.two { width: 240px; height: 240px; left: 8%; bottom: 52px; background: #74dfc0; }
.app {
  max-width: 1020px;
  margin: 0 auto;
  padding: 12px 10px 112px;
}
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 24px rgba(18, 34, 63, 0.08);
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px;
  margin-bottom: 10px;
  position: sticky;
  top: 8px;
  z-index: 3;
}
.sub { margin: 0 0 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
h1 { margin: 0; font-size: 18px; }
.status { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; font-weight: 700; }
.status.ok { color: var(--ok); }
.status.bad { color: var(--bad); }
.screen {
  min-height: 56vh;
  padding: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.hidden { display: none; }
.h-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.h-row h2 { margin: 0; font-size: 20px; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: rgba(255,255,255,.9);
  max-height: 48vh;
}
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid #e7edf8; white-space: nowrap; }
th { position: sticky; top: 0; background: #f7fbff; z-index: 1; }
.bullets { margin: 0; padding-left: 20px; }
.bullets li { margin: 6px 0; }
.bullets .done { color: #8ba0c6; text-decoration: line-through; }
.chip { font-size: 11px; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; background: #fff; }
.chart-controls { display: flex; gap: 8px; align-items: end; flex-wrap: nowrap; margin-bottom: 10px; }
.chart-controls.bottom { justify-content: space-between; }
.chart-controls label { min-width: 0; flex: 1; }
label { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #c6d5eb;
  border-radius: 10px;
  padding: 10px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.form-grid input[type="checkbox"] { width: auto; margin-top: 0; }
.chart-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: auto;
  padding: 8px;
}
svg.chart { min-width: 700px; width: 100%; height: 290px; display: block; }
.todo-controls {
  display: grid;
  grid-template-columns: 120px auto auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}
.todo-controls .chip { align-self: center; white-space: nowrap; }
.todo-controls-stack {
  grid-template-columns: 1fr;
  align-items: start;
}
.todo-controls-stack .chip { align-self: start; }
.todo-list { display: grid; gap: 8px; max-height: 46vh; overflow: auto; padding-right: 2px; }
.todo {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.88);
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.todo.done .title-text,
.todo.fail .title-text,
.todo.success .title-text { text-decoration: line-through; color: #8092b4; }
.ck {
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid #9db5d9;
  margin-top: 1px;
  cursor: pointer;
  position: relative;
  background: #fff;
}
.ck:checked { border-color: transparent; background: linear-gradient(130deg, var(--brand), var(--brand2)); }
.ck:checked::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.todo-main { flex: 1; }
.title { font-weight: 700; }
.meta { margin-top: 3px; color: var(--muted); font-size: 12px; }
.badge { margin-left: 8px; font-size: 11px; border-radius: 999px; padding: 2px 7px; border: 1px solid var(--line); }
.badge.fail { color: #a72948; border-color: #efb8c7; background: #fff2f5; }
.badge.success { color: #0b7e4c; border-color: #97dfbf; background: #effcf5; }
.todo.fail { border-color: #efb8c7; background: #fff5f7; }
.todo.success { border-color: #97dfbf; background: #f3fff8; }
.btn {
  border: 0;
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}
.btn.primary { color: #fff; background: linear-gradient(100deg, var(--brand), var(--brand2)); }
.btn.light { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn.danger { background: #fff1f5; border: 1px solid #efb8c7; color: #a72948; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.api-box { padding: 12px; }
.api-box summary { cursor: pointer; font-weight: 700; color: var(--muted); }
pre {
  margin: 0;
  border-radius: 10px;
  max-height: 210px;
  overflow: auto;
  background: #f2f6ff;
  color: #30466f;
  padding: 10px;
  font-size: 12px;
  margin-top: 8px;
}
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px);
}
.bottom-nav button {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 10px 6px;
  font: inherit;
  font-weight: 700;
}
.bottom-nav button.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(100deg, var(--brand), var(--brand2));
}
.fab {
  position: fixed;
  right: 14px;
  bottom: calc(76px + env(safe-area-inset-bottom));
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  font-size: 30px;
  line-height: 1;
  color: #fff;
  background: linear-gradient(100deg, var(--brand), var(--brand2));
  box-shadow: 0 12px 24px rgba(13,110,253,.34);
  cursor: pointer;
}
.modal {
  width: min(640px, 94vw);
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f9fcff;
  padding: 0;
}
.modal::backdrop { background: rgba(10, 18, 35, 0.35); }
.modal-body { padding: 14px; }
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.modal header h3 { margin: 0; }
.icon-btn { border: 0; background: #fff; width: 32px; height: 32px; border-radius: 8px; font-size: 22px; line-height: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid .full { grid-column: 1 / -1; }
.warn { margin-top: 8px; border: 1px solid #f2de91; background: #fff8dc; color: #735f00; border-radius: 10px; padding: 8px; font-size: 12px; }
@media (max-width: 760px) {
  .screen { min-height: 62vh; }
  .form-grid { grid-template-columns: 1fr; }
  .todo-controls { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
}
