:root {
  --ink: #1c1b17;
  --ink-soft: #5c574c;
  --line: #e4dfd4;
  --paper: #f6f4ee;
  --card: #fffcf7;
  --gold: #f0c230;
  --gold-deep: #8a6a00;
  --green: #1f7a4d;
  --green-bg: #e5f6ec;
  --red: #a33b32;
  --red-bg: #fdecea;
  --amber: #8a5a00;
  --amber-bg: #fff3d6;
  --blue: #1d4e89;
  --blue-bg: #e7f0fa;
  --shadow: 0 16px 40px rgba(40, 32, 16, .08);
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.5 "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(240, 194, 48, .35), transparent 60%),
    var(--paper);
}
.login-card {
  width: min(440px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px 22px;
  box-shadow: var(--shadow);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; }
.brand b { font-weight: 800; }
.mark {
  width: 32px; height: 32px; border-radius: 9px; background: var(--ink); color: var(--gold);
  display: grid; place-items: center; font-size: 16px;
}
.login h1 { font-size: 32px; line-height: 1.15; letter-spacing: -.03em; margin: 18px 0 8px; }
.muted { color: var(--ink-soft); }
.small { font-size: 14px; }
.personas { display: grid; gap: 8px; margin-top: 18px; }
.persona, .btn {
  border: 1px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; text-align: left;
}
.persona strong { display: block; }
.persona span, .hint { color: var(--ink-soft); font-size: 13px; }
.btn-gold, .persona.primary {
  background: var(--gold); border-color: #e0b000; font-weight: 700;
}
.btn-gold { text-align: center; width: 100%; }
.login-error, .banner {
  margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: var(--red-bg); color: var(--red); font-size: 14px;
}
.banner.ok { background: var(--green-bg); color: var(--green); }
.qr {
  margin-top: 14px; min-height: 180px; display: grid; place-items: center;
  border: 1px dashed var(--line); border-radius: 14px; background: #fff;
}
.phone-row { display: flex; gap: 8px; margin-top: 10px; }
.phone-row input { flex: 1; }

.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 20px; background: rgba(246, 244, 238, .92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.grow { margin-left: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select, input[type="text"], input[type="date"], textarea {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 10px;
}
nav.views { display: flex; gap: 4px; padding: 10px 16px 0; overflow-x: auto; }
nav.views button {
  border: 0; background: transparent; padding: 8px 12px; border-radius: 999px; color: var(--ink-soft); white-space: nowrap;
}
nav.views button.on { background: var(--ink); color: #fff; }

main { width: min(1080px, calc(100% - 32px)); margin: 8px auto 48px; }
.hello { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin: 18px 0; }
.hello h1 { margin: 0; font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip { font-size: 12px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 3px 8px; }

.stats, .cards, .split { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 16px; }
.stat, .card, .panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px;
}
.stat b { display: block; font-size: 28px; letter-spacing: -.03em; line-height: 1.1; }
.stat span, .card .sub { color: var(--ink-soft); font-size: 13px; }
.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lesson {
  display: grid; grid-template-columns: 92px 1fr auto; gap: 10px; align-items: center;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.lesson:first-child { border-top: 0; }
.lesson time { font-variant-numeric: tabular-nums; font-weight: 700; }
.week { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.day { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 180px; }
.day h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); }
.block { background: #fff8e1; border-radius: 10px; padding: 8px; margin-bottom: 6px; }
.block b { display: block; font-size: 14px; }
.block span { font-size: 12px; color: var(--ink-soft); }

.roll { display: grid; gap: 8px; }
.student {
  display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px;
}
.statuses { display: flex; gap: 4px; }
.statuses button, .scale button {
  border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 10px; font-size: 13px;
}
.statuses button.on.present { background: var(--green); color: #fff; border-color: var(--green); }
.statuses button.on.absent { background: var(--red); color: #fff; border-color: var(--red); }
.statuses button.on.late { background: var(--amber); color: #fff; border-color: var(--amber); }
.statuses button.on.excused { background: var(--blue); color: #fff; border-color: var(--blue); }
.scale { display: flex; gap: 6px; flex-wrap: wrap; }
.scale button.on { background: var(--ink); color: #fff; }

.msg { padding: 12px 0; border-top: 1px solid var(--line); }
.msg h3 { margin: 0; font-size: 16px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-soft); padding: 8px; }
.table td { padding: 8px; border-top: 1px solid var(--line); vertical-align: top; }
.form { display: grid; gap: 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 140px; }
.split { grid-template-columns: 1.2fr .8fr; align-items: start; }
.panel h2, .card h2 { margin: 0 0 8px; font-size: 18px; }
.empty { padding: 28px 8px; color: var(--ink-soft); }
.tag { font-size: 11px; font-weight: 700; border-radius: 999px; padding: 2px 7px; background: #fff3d6; color: var(--amber); }

@media (max-width: 860px) {
  .stats, .cards, .week, .split { grid-template-columns: 1fr; }
  .hello h1 { font-size: 28px; }
  .lesson { grid-template-columns: 76px 1fr; }
  .lesson .btn { grid-column: 1 / -1; }
}

html, body { height: 100%; }
.hidden { display: none !important; }
.login {
  --ink: #1f2023; --ink-2: #5c616a; --ink-3: #8b909a; --line: #e4e6ea; --bg: #eceef1;
  --bad: #a33b32; --bad-bg: #fdecea; --accent: #ffdb4d; --accent-hover: #ffd21f;
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 16px; background: radial-gradient(900px 500px at 80% -10%, #fff3c4 0%, transparent 60%), #eceef1;
  color: #1f2023; font-size: 14px; line-height: 1.5;
}
.login .small { font-size: 12.5px; }
.login .muted { color: var(--ink-2); }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 20px; padding: 32px 28px 24px; box-shadow: 0 10px 30px rgba(0, 0, 0, .06); text-align: center; }
.login-logo { width: 44px; height: 48px; }
.login-brand h1 { font-size: 22px; font-weight: 650; margin: 12px 0 4px; letter-spacing: 0; }
.login-brand h1 span { font-weight: 650; }
.login-brand p { margin: 0 0 22px; }
.login-checking { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 24px 0; }
.login-profile { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.login-avatar { width: 64px; height: 64px; border-radius: 50%; background: #fff2bf; display: grid; place-items: center; font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.login-profile-name { font-size: 17px; font-weight: 600; }
.login-profile-phone { margin-bottom: 16px; }
.login .btn { display: inline-flex; align-items: center; justify-content: center; height: 36px; border: 0; background: #f4f5f7; font: inherit; font-weight: 500; border-radius: 10px; padding: 0 16px; cursor: pointer; }
.login .btn-primary { background: #ffdb4d; color: #1b1b1b; }
.login .btn-primary:hover { background: #ffd21f; }
.login .btn-block { width: 100%; }
.login .btn-link { background: none; color: var(--ink-2); height: auto; padding: 8px; }
.login .btn-link:hover { color: var(--ink); text-decoration: underline; }
.login-tabs { display: flex; background: #f4f5f7; border-radius: 10px; padding: 3px; margin-bottom: 16px; }
.login-tab { flex: 1; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.login-tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.login-panel { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.login-panel p { margin: 0; }
.login-panel[data-panel="phone"] { width: 100%; align-items: stretch; }
.phone-field { position: relative; display: flex; width: 100%; align-items: stretch; text-align: left; }
.phone-dial { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 42px; padding: 0 12px; border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; background: #f4f5f7; color: var(--ink); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.phone-dial::after { content: ""; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .55; }
.phone-flag { font-size: 18px; line-height: 1; }
.phone-code { font-variant-numeric: tabular-nums; }
.login .input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; background: #fff; color: var(--ink); }
.phone-field > .input { border-radius: 0 10px 10px 0; font-size: 14px; }
.phone-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 280px; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(20, 24, 31, .16); z-index: 30; overflow: hidden; }
.phone-search { flex: 0 0 auto; width: calc(100% - 16px); margin: 8px; height: 40px; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; font-size: 14px; }
.phone-menu-list { flex: 1 1 auto; min-height: 0; overflow: auto; padding-bottom: 6px; }
.phone-option { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; padding: 8px 12px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left; }
.phone-option .name { flex: 1; }
.phone-option .dial { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.phone-option:hover, .phone-option.active { background: #f0f1f4; }
.phone-wait { padding: 12px 14px; border-radius: 12px; background: #fff4c2; border: 1px solid #f0d56a; color: #1b1b1b; font-size: 14.5px; font-weight: 650; line-height: 1.35; }
.login-as { align-self: stretch; width: 100%; height: 36px; border: 0; border-radius: 10px; background: var(--accent); color: #1b1b1b; font: inherit; font-size: 14px; cursor: pointer; }
.login-as:hover { background: var(--accent-hover); }
.qr-box { width: 232px; height: 232px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fff; }
.qr-box img, .qr-box canvas, .qr-box svg { width: 100% !important; height: auto !important; display: block; }
.login-status { min-height: 0; margin: 14px 0 0; }
.login-status:empty { margin: 0; }
.login-error { margin: 10px 0 0; color: var(--bad); background: var(--bad-bg); border-radius: 10px; padding: 10px; font-size: 13px; }
.login-foot { margin-top: 22px; display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; }
.login-back { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 14px 0 8px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; text-decoration: none; }
.login-back svg { width: 16px; height: 16px; }
.login-back:hover { background: #f4f5f7; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line, #e4e6ea); border-top-color: #e5b400; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
