:root {
  --bg: #f7f8fb;
  --card: #ffffff;
  --ink: #12151c;
  --muted: #6b7280;
  --line: #e7e9ef;
  --accent: #5b5bf0;
  --accent-soft: #eeeeff;
  --green: #12a36b;
  --green-soft: #e4f7ee;
  --orange: #f59e0b;
  --orange-soft: #fff4dc;
  --blue: #3b82f6;
  --blue-soft: #e6f0ff;
  --red: #ef4444;
  --dark: #17191f;
  --radius: 20px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; position: relative;
  padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.top { padding: calc(14px + env(safe-area-inset-top)) 16px 8px; display: flex; align-items: center; gap: 10px; }
.top h1 { font-size: 22px; font-weight: 800; flex: 1; letter-spacing: -.3px; }
.icon-btn { width: 40px; height: 40px; border-radius: 14px; background: var(--card);
  box-shadow: 0 2px 8px rgba(20, 24, 40, .06); display: grid; place-items: center; font-size: 18px; }
.sub { color: var(--muted); font-size: 14px; }

.wrap { padding: 0 16px; }
.section-title { font-size: 20px; font-weight: 800; margin: 22px 16px 10px; display: flex; align-items: center; letter-spacing: -.2px; }
.section-title .more { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--ink); }

.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 0 16px 12px;
  box-shadow: 0 2px 10px rgba(20, 24, 40, .05); }
.card.dark { background: var(--dark); color: #fff; }
.card.dark .sub { color: #aab0bd; }
.card h3 { font-size: 18px; font-weight: 800; margin-bottom: 4px; }

.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 18px; border-radius: 16px; font-weight: 700; font-size: 15px; background: var(--dark); color: #fff; }
.btn.light { background: #fff; color: var(--ink); }
.btn.ghost { background: var(--accent-soft); color: var(--accent); }
.btn.block { display: flex; width: 100%; }
.btn.small { padding: 9px 14px; font-size: 14px; border-radius: 13px; }
.btn[disabled] { opacity: .4; }

.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 0 16px; }
.tile { background: var(--card); border-radius: 18px; padding: 14px 4px 10px; text-align: center;
  box-shadow: 0 2px 8px rgba(20, 24, 40, .05); font-size: 12px; font-weight: 600; }
.tile .ic { width: 44px; height: 44px; border-radius: 14px; margin: 0 auto 8px; display: grid; place-items: center; font-size: 22px; }
.ic.a { background: #ececff; } .ic.b { background: #e3f4fb; } .ic.c { background: #fdeceb; } .ic.d { background: #fff1d9; }
.ic.e { background: #e5f7ee; } .ic.f { background: #f1e8ff; } .ic.g { background: #e8f0ff; } .ic.h { background: #eceef2; }
.group-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; padding: 0 20px; margin: 18px 0 8px; }

.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.dot.g { background: var(--green); } .dot.o { background: var(--orange); } .dot.b { background: var(--blue); } .dot.r { background: var(--red); }
.time { width: 48px; font-weight: 800; font-size: 15px; flex: none; }
.name { font-weight: 700; font-size: 15px; }
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--green-soft); color: var(--green); }
.chip.o { background: var(--orange-soft); color: #b77700; }
.chip.b { background: var(--blue-soft); color: var(--blue); }
.chip.r { background: #fde8e8; color: var(--red); }
.chip.gr { background: #eef0f4; color: var(--muted); }
.chev { color: #b4b9c4; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.pill { padding: 9px 14px; border-radius: 999px; background: #fff; font-weight: 700; font-size: 14px; white-space: nowrap;
  box-shadow: 0 1px 4px rgba(20, 24, 40, .06); }
.pill.on { background: var(--dark); color: #fff; }
.days { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.days::-webkit-scrollbar { display: none; }
.day { flex: none; width: 56px; padding: 8px 0; border-radius: 16px; background: #fff; text-align: center; font-size: 12px; color: var(--muted);
  box-shadow: 0 1px 4px rgba(20, 24, 40, .06); }
.day b { display: block; font-size: 20px; color: var(--ink); margin-top: 2px; }
.day.on { background: var(--dark); color: #cfd3dc; } .day.on b { color: #fff; }
.day.off { opacity: .4; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot { padding: 12px 0; border-radius: 14px; background: #fff; text-align: center; font-weight: 700; border: 1.5px solid var(--line); }
.slot.on { background: var(--dark); color: #fff; border-color: var(--dark); }
.slot.busy { opacity: .35; text-decoration: line-through; pointer-events: none; }

.stat { font-size: 32px; font-weight: 800; letter-spacing: -.5px; }
.bar { height: 10px; border-radius: 999px; background: #eceef3; overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.seg { display: flex; background: #e9ebf1; border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; padding: 9px 4px; border-radius: 11px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(20, 24, 40, .1); }

input, textarea, select { width: 100%; font: inherit; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); }
label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 12px 0 6px; }
.toggle { width: 48px; height: 28px; border-radius: 999px; background: #d5d9e2; position: relative; flex: none; transition: .2s; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: .2s; }
.toggle.on { background: var(--green); } .toggle.on::after { left: 23px; }

.note { background: var(--orange-soft); color: #7a5200; border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.4; margin: 0 16px 12px; }
.hero { padding: 22px 18px; text-align: center; }
.avatar { width: 72px; height: 72px; border-radius: 50%; background: linear-gradient(135deg, #a5a5ff, #5b5bf0); color: #fff; display: grid; place-items: center; font-size: 28px; font-weight: 800; margin: 0 auto 10px; }

.picker { padding: calc(60px + env(safe-area-inset-top)) 20px 20px; }
.picker h1 { font-size: 30px; font-weight: 800; letter-spacing: -.5px; margin-bottom: 6px; }
.mode { display: block; width: 100%; text-align: left; background: #fff; border-radius: 22px; padding: 18px; margin-top: 12px; box-shadow: 0 2px 10px rgba(20, 24, 40, .06); }
.mode b { display: block; font-size: 18px; margin-bottom: 3px; }
.mode span { color: var(--muted); font-size: 14px; }

.tg { background: #dfe9f2; min-height: 100vh; }
.tg-head { background: #fff; padding: calc(12px + env(safe-area-inset-top)) 14px 12px; display: flex; gap: 10px; align-items: center; box-shadow: 0 1px 0 var(--line); }
.tg-head .ava { width: 38px; height: 38px; border-radius: 50%; background: #2aabee; color: #fff; display: grid; place-items: center; font-weight: 800; }
.tg-body { padding: 14px 12px 40px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 82%; padding: 10px 12px; border-radius: 16px; font-size: 15px; line-height: 1.35; white-space: pre-line; }
.msg.bot { background: #fff; align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: #d7f0c0; align-self: flex-end; border-bottom-right-radius: 4px; }
.kb { display: grid; gap: 6px; margin-top: 2px; }
.kb.cols3 { grid-template-columns: repeat(3, 1fr); }
.kb.cols2 { grid-template-columns: repeat(2, 1fr); }
.kb button { background: rgba(255,255,255,.85); padding: 11px 6px; border-radius: 12px; font-weight: 600; font-size: 14px; color: #1a6fb0; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.sys { align-self: center; font-size: 12px; color: #6a7a89; background: rgba(255,255,255,.55); padding: 4px 10px; border-radius: 999px; }

.toast { position: fixed; left: 16px; right: 16px; top: calc(12px + env(safe-area-inset-top)); max-width: 448px; margin: 0 auto; background: var(--dark); color: #fff;
  padding: 14px 16px; border-radius: 16px; z-index: 50; font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.25); animation: drop .3s ease; }
@keyframes drop { from { transform: translateY(-20px); opacity: 0; } to { transform: none; opacity: 1; } }
.spacer { height: 12px; }
