:root {
  --bg: #111318; --card: #1b1e26; --card2: #232733; --line: #2e3342;
  --text: #f2f3f7; --muted: #9aa1b2; --accent: #7c6cff; --accent2: #a597ff;
  --green: #34d399; --yellow: #fbbf24; --red: #f87171; --blue: #60a5fa;
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; font-size: 16px; }
body { padding: env(safe-area-inset-top) 0 0; min-height: 100vh; }
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 110px; }
h1 { font-size: 28px; margin: 18px 0 6px; letter-spacing: -0.02em; }
h2 { font-size: 20px; margin: 22px 0 10px; }
p.muted, .muted { color: var(--muted); }
small { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 10px 0; }
.btn { display: block; width: 100%; border: 0; border-radius: 14px; padding: 15px 16px; font-size: 16px; font-weight: 600;
  background: var(--accent); color: #fff; cursor: pointer; margin: 10px 0; text-align: center; }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--card2); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #4a2a2e; }
.btn.small { display: inline-block; width: auto; padding: 9px 13px; font-size: 14px; margin: 4px 6px 4px 0; border-radius: 11px; }
.btn:disabled { opacity: 0.5; }
.choice { display: flex; gap: 14px; align-items: center; text-align: left; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px; margin: 12px 0; width: 100%; color: var(--text); font-size: 16px; cursor: pointer; }
.choice .ico { font-size: 30px; }
.choice b { display: block; font-size: 17px; margin-bottom: 3px; }
.choice.sel { border-color: var(--accent); background: #221f3d; }
input[type=text], input[type=time] { width: 100%; background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 12px; padding: 13px 12px; font-size: 16px; outline: none; }
input:focus { border-color: var(--accent); }
input[type=time] { padding: 10px 6px; min-width: 0; }
input.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: 0.25em; text-transform: uppercase; text-align: center; font-size: 22px; }
.back { background: none; border: 0; color: var(--accent2); font-size: 16px; padding: 8px 0; cursor: pointer; }

.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; background: var(--card2); border: 1px solid var(--line); color: var(--muted); padding: 9px 14px;
  border-radius: 999px; font-size: 15px; font-weight: 600; cursor: pointer; }
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab .cnt { opacity: 0.7; font-weight: 500; margin-left: 4px; }

.lesson { display: grid; grid-template-columns: 26px 1fr 30px; gap: 8px; align-items: center; margin: 8px 0; }
.lesson .nr { color: var(--muted); font-weight: 700; text-align: center; }
.lesson .times { grid-column: 2 / 3; display: flex; gap: 6px; align-items: center; }
.lesson .times span { color: var(--muted); }
.lesson .del { background: none; border: 0; color: var(--muted); font-size: 22px; cursor: pointer; }
.lesson-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 10px 10px; margin: 8px 0; }
.lesson-wrap.empty { opacity: 0.6; border-style: dashed; }

.thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.thumb { position: relative; width: 84px; height: 84px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.7); color: #fff; border: 0;
  border-radius: 50%; width: 24px; height: 24px; font-size: 14px; cursor: pointer; }
.addphoto { width: 84px; height: 84px; border-radius: 12px; border: 1px dashed var(--line); display: flex; align-items: center;
  justify-content: center; font-size: 30px; color: var(--muted); cursor: pointer; }

.person { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px; flex: 0 0 auto; color: #111; }
.person .info { flex: 1; min-width: 0; }
.person .name { font-weight: 700; font-size: 17px; }
.person .status { font-size: 14px; color: var(--muted); margin-top: 2px; }
.badge { flex: 0 0 auto; font-size: 13px; font-weight: 700; padding: 6px 10px; border-radius: 999px; white-space: nowrap; }
.b-free { background: #10342a; color: var(--green); }
.b-lesson { background: #3a1f24; color: var(--red); }
.b-break { background: #3a3014; color: var(--yellow); }
.b-before { background: #152a45; color: var(--blue); }
.b-weekend { background: #2b2350; color: var(--accent2); }
.tag { font-size: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; color: var(--muted); margin-left: 6px; font-weight: 600; }

.planrow { display: flex; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.planrow:last-child { border-bottom: 0; }
.planrow .t { color: var(--muted); font-variant-numeric: tabular-nums; width: 108px; flex: 0 0 auto; }
.planrow.now { background: #221f3d; border-radius: 10px; }
.planrow.past { opacity: 0.45; }

.codebox { font-family: ui-monospace, Menlo, monospace; font-size: 24px; letter-spacing: 0.2em; font-weight: 800;
  background: var(--card2); border-radius: 12px; padding: 10px; text-align: center; margin: 8px 0; user-select: all; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; padding: 10px 2px; font-size: 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

nav.bottom { position: fixed; left: 0; right: 0; bottom: 0; background: rgba(17,19,24,.95); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
nav.bottom .inner { display: flex; max-width: 560px; width: 100%; }
nav.bottom button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 12px; font-weight: 600; padding: 6px 0; cursor: pointer; }
nav.bottom button .i { display: block; font-size: 22px; margin-bottom: 2px; }
nav.bottom button.on { color: var(--accent2); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--bg); border: 1px solid var(--line); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px;
  max-height: 88vh; overflow-y: auto; padding: 18px 16px calc(24px + env(safe-area-inset-bottom)); }

.install { background: linear-gradient(135deg, #2b2350, #1b1e26); border: 1px solid #3d3470; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.9s linear infinite; margin: 30px auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #2d3140; color: var(--text);
  padding: 12px 18px; border-radius: 12px; font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 30; max-width: 90%; text-align: center; }
#toast.show { opacity: 1; }
.empty-state { text-align: center; padding: 30px 10px; color: var(--muted); }
.empty-state .big { font-size: 44px; }
