:root {
  --bg: #f3efe6;
  --card: #ffffff;
  --ink: #12263a;
  --muted: #5c6b7a;
  --line: #e4dccb;
  --brand: #12263a;
  --gold: #c9a227;
  --gold-2: #e8c547;
  --green: #1b7a4a;
  --orange: #c05621;
  --violet: #5b4b8a;
  --rose: #b42318;
  --teal: #0f6e6a;
  --navy: #12263a;
  --red: #b42318;
  --yellow: #e8b931;
  --ok: #1b7a4a;
  --shadow: 0 10px 28px rgba(18, 38, 58, .08);
  --safe: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --font: "DM Sans", system-ui, sans-serif;
  --side: 272px;
  --tab: calc(72px + var(--safe));
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
}
#root { min-height: 100vh; min-height: 100dvh; }
button, input, select, textarea { font-family: inherit; font-size: 16px; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.app {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.desk-nav { display: none; }

/* LOGIN — compact on phones so name + password + button stay on screen */
.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(900px 380px at 10% -8%, #1c3d5c 0%, transparent 55%),
    linear-gradient(180deg, #0d1b2a 0%, #1b3a55 36%, #f3efe6 36%);
  padding: calc(12px + var(--safe-top)) 14px calc(20px + var(--safe));
}
.login-card {
  width: min(440px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-bottom: 8px;
}
.login-brand { text-align: center; }
.login-card img {
  width: 64px; height: 64px; border-radius: 18px;
  display: block; margin: 0 auto 8px;
  background: #0b1220; box-shadow: 0 10px 24px rgba(0,0,0,.28);
  object-fit: cover;
}
.login-card .school {
  color: #fff; text-align: center; margin: 0 0 4px;
  font-size: clamp(20px, 6vw, 26px); font-weight: 800; line-height: 1.2;
}
.login-card .sub {
  color: rgba(255,255,255,.82); text-align: center; margin: 0 0 12px; font-size: 13px;
  line-height: 1.35; padding: 0 8px;
}
.login-sheet {
  background: #fff;
  border-radius: 22px;
  padding: 16px 16px 18px;
  box-shadow: var(--shadow);
}
.login-sheet h3 { margin: 0 0 4px; font-size: 18px; }
.login-sheet .lead { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.login-form { display: block; }
.login-sheet label {
  display: block; font-size: 13px; font-weight: 700; color: #374151; margin: 10px 0 6px;
}
.login-sheet input,
.login-sheet select {
  width: 100%;
  min-height: 50px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  background: #faf8f3;
  font-size: 16px;
  line-height: 1.3;
  color: var(--ink);
}
.login-sheet select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2312263a' stroke-width='2'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}
.login-sheet input:focus,
.login-sheet select:focus { outline: none; border-color: var(--gold); background: #fff; }
.login-sheet .hint { margin: 10px 0 0; font-size: 13px; }
.login-sheet .btn-primary {
  width: 100%;
  min-height: 52px;
  margin-top: 14px;
  font-size: 17px;
}
.login-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.login-tabs button {
  border: 0; border-radius: 12px; padding: 12px; font-weight: 800; min-height: 44px;
  background: #efe8d8; color: var(--muted);
}
.login-tabs button.on { background: var(--navy); color: #fff; }
.login-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 14px; }
.login-methods button {
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 8px; font-weight: 800;
  background: #faf8f3; color: var(--muted);
}
.login-methods button.on { background: var(--gold); color: var(--navy); border-color: var(--gold); }

.btn {
  border: 0; border-radius: 16px; padding: 15px 18px; font-weight: 700; font-size: 16px;
}
.btn-gold, .btn-primary {
  background: var(--gold); color: #12263a; width: 100%; margin-top: 18px;
}
.btn-navy { background: var(--navy); color: #fff; }
.btn-red { background: var(--red); color: #fff; }
.btn-ghost { background: #efe8d8; color: var(--ink); }
.btn-ok { background: var(--green); color: #fff; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* CHROME */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(12px + var(--safe-top)) 16px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar img { width: 44px; height: 44px; border-radius: 14px; background: #0b1220; object-fit: cover; }
.topbar h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.topbar .grow { flex: 1; min-width: 0; }
.logo-hit { border: 0; background: none; padding: 0; border-radius: 14px; }
.top-ico {
  width: 46px; height: 46px; border: 0; border-radius: 14px;
  background: #f3efe6; position: relative; display: grid; place-items: center; flex: 0 0 46px;
}
.top-ico svg { width: 22px; height: 22px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  position: absolute; top: 4px; right: 4px;
  background: var(--rose); color: #fff; border-radius: 99px;
  font-size: 10px; min-width: 16px; height: 16px; display: grid; place-items: center;
}

.screen {
  padding: 16px 16px calc(var(--tab) + 20px);
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.hello { margin: 2px 0 16px; }
.hello h2 { margin: 0; font-size: clamp(22px, 6vw, 28px); }
.hello p { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.4; }

.app-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.app-tile {
  border: 0; background: #fff; border-radius: 20px;
  padding: 18px 12px 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  min-height: 118px;
}
.app-tile-ic {
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--c, var(--navy));
  color: #fff;
}
.app-tile-ic svg { width: 24px; height: 24px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.app-tile b { font-size: 14px; font-weight: 700; text-align: center; line-height: 1.3; color: var(--ink); }

.punch { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 0 0 16px; }
.punch .btn { margin: 0; min-height: 56px; display: flex; align-items: center; justify-content: center; gap: 8px; }
.punch .btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 520px) {
  .punch { grid-template-columns: 1fr 1fr; }
}

.status-card {
  display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center;
}
.status-card img, .att-thumb {
  width: 72px; height: 72px; border-radius: 16px; object-fit: cover; background: #efe8d8;
}
.late { color: var(--rose); font-weight: 800; }
.on-time { color: var(--green); font-weight: 800; }

.card {
  background: var(--card);
  border-radius: 20px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.card h3 { margin: 0 0 8px; font-size: 18px; }
.hint { font-size: 14px; color: var(--muted); line-height: 1.5; }
label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 6px; color: #3d4d5c; }
input, select, textarea {
  width: 100%; border: 1.5px solid var(--line); background: #fff;
  border-radius: 14px; padding: 14px 14px; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold); }
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }

.step {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.step:last-child { border-bottom: 0; }
.step-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy); color: #fff; font-size: 13px; font-weight: 800;
  display: grid; place-items: center; flex: 0 0 28px; margin-top: 2px;
}
.step h4 { margin: 0 0 4px; font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1.5px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 999px; padding: 10px 14px; font-weight: 700; font-size: 14px;
}
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.dates { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 520px) {
  .dates { grid-template-columns: 1fr 1fr; }
}

.table-wrap { overflow: auto; border-radius: 14px; border: 1px solid var(--line); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--navy); color: #fff; font-size: 12px; white-space: nowrap; }
.pill { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.pending { background: #fef3c7; color: #92400e; }
.approved { background: #d1fae5; color: #065f46; }
.lop { background: #ffedd5; color: #9a3412; }
.rejected { background: #fee2e2; color: #991b1b; }

.att-list { display: grid; gap: 10px; }
.att-item {
  display: grid; grid-template-columns: 64px 1fr; gap: 12px;
  background: #faf8f3; border-radius: 16px; padding: 12px;
}
.att-item img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; background: #efe8d8; }
.att-item b { display: block; font-size: 15px; }
.att-meta { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 4px; }
.selfie-pair { display: flex; gap: 8px; margin-top: 8px; }
.selfie-pair img { width: 56px; height: 56px; border-radius: 12px; object-fit: cover; }

.cal-wrap {
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 12px;
  padding: 12px 10px 16px;
  box-shadow: 0 1px 2px rgba(60,64,67,.12);
}
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-head h3 { margin: 0; font-size: 18px; color: #3c4043; font-weight: 600; }
.cal-head button {
  background: transparent; color: #5f6368; border: 0; min-width: 40px; min-height: 40px;
  border-radius: 50%; font-size: 22px; line-height: 1;
}
.cal-head button:hover { background: #f1f3f4; }
.weekdays { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 0; margin-bottom: 4px; }
.weekdays span { text-align: center; font-size: 11px; letter-spacing: .04em; color: #70757a; font-weight: 700; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.day-tile {
  min-height: 44px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: transparent; color: #3c4043;
  padding: 0;
}
.day-tile b { font-size: 13px; font-weight: 500; }
.day-tile.mute { color: #bdc1c6; }
.day-tile.today { color: #1a73e8; box-shadow: inset 0 0 0 1px #1a73e8; }
.day-tile.yellow { background: #fbbc04; color: #202124; border-radius: 10px; }
.day-tile.red { background: #ea4335; color: #fff; border-radius: 10px; }
.day-tile.selected { background: #d2e3fc; color: #174ea6; }
.day-tile.selected.yellow, .day-tile.selected.red { outline: 2px solid #1a73e8; outline-offset: 1px; }
.day-tile.holiday::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #1a73e8; display: block; margin-top: -2px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; margin-top: 12px; color: #5f6368; }
.dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 4px; }

.chat-box { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px; background: #efe8d8; }
#map { height: min(52vh, 420px); border-radius: 16px; overflow: hidden; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tab) + 12px); transform: translateX(-50%);
  background: #12263a; color: #fff; padding: 12px 18px; border-radius: 999px; z-index: 90;
  font-size: 14px; max-width: min(92vw, 420px); text-align: center;
}
.video-box { background: #000; border-radius: 16px; overflow: hidden; position: relative; }
.video-box video { width: 100%; display: block; max-height: 240px; }
.consent-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 10px 12px 12px;
  background: linear-gradient(transparent, rgba(8,14,24,.92));
  color: #fff; font-size: 12px; line-height: 1.35; font-weight: 700;
}
.consent-overlay p { margin: 0 0 4px; }
.agree-row {
  display: flex; gap: 10px; align-items: flex-start;
  margin: 12px 0; font-weight: 700; font-size: 14px; color: #12263a;
}
.agree-row input { width: auto; margin-top: 3px; }
.cl-lock-box {
  margin: 16px 0; padding: 14px; border-radius: 16px; background: #12263a; color: #fff;
}
.cl-lock-box h3 { color: #f3e6b4; margin: 0 0 6px; }
.cl-lock-box .hint, .cl-lock-box label { color: rgba(255,255,255,.82); }
.cl-lock-box input[type="number"] { background: #fff; color: #12263a; }
.tpl-test-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.tpl-test-row .btn { width: auto; margin: 0; }
.login-media {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0;
}
.login-media a, .login-media video {
  display: block; background: #0d1b2a; border-radius: 12px; overflow: hidden; color: #fff; text-decoration: none;
}
.login-media img, .login-media video { width: 100%; height: 110px; object-fit: cover; display: block; }
.login-media span { display: block; font-size: 11px; padding: 4px 6px; }
.leave-consent-mini { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.side-list button { width: 100%; text-align: left; background: #fff; border: 1px solid var(--line); margin-bottom: 8px; border-radius: 14px; padding: 14px; }
.side-list button.active { background: var(--navy); color: #fff; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  width: 100%;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: #fff;
  border-top: 1px solid var(--line);
  padding: 8px 4px calc(10px + var(--safe));
  z-index: 30;
}
.tabbar button {
  border: 0; background: none; color: #8a8070;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; padding: 6px 2px;
}
.tabbar button svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.active { color: var(--navy); }

.stat { padding: 12px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.grid { display: grid; gap: 14px; }
.cards-4, .cards-2 { grid-template-columns: 1fr; }
.hidden { display: none !important; }

.logo-box {
  display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center;
}
.logo-box img { width: 72px; height: 72px; border-radius: 18px; object-fit: cover; background: #0b1220; }

/* Selfie sheet */
.sheet {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(13, 27, 42, .72);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 12px 12px calc(12px + var(--safe));
}
.sheet-card {
  width: min(520px, 100%);
  background: #fff;
  border-radius: 24px 24px 20px 20px;
  padding: 18px 16px 16px;
  max-height: calc(100dvh - 24px);
  overflow: auto;
}
.sheet-card h3 { margin: 0 0 10px; font-size: 20px; }
.selfie-stage {
  position: relative; background: #0b1220; border-radius: 18px; overflow: hidden;
  min-height: 280px;
}
.selfie-stage video, .selfie-stage canvas, .selfie-stage img {
  width: 100%; display: block; max-height: 58vh; object-fit: cover;
}
.selfie-hud {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 28px 12px 12px;
  background: linear-gradient(transparent, rgba(8,14,24,.92));
  color: #fff; font-size: 13px; line-height: 1.4;
}
.leave-card {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 10px; align-items: flex-start;
}
.leave-card:last-child { border-bottom: 0; }

@media (min-width: 900px) {
  body { background: #0d1b2a; }
  .app {
    display: grid;
    grid-template-columns: var(--side) 1fr;
    min-height: 100vh;
    background: var(--bg);
  }
  .desk-nav {
    display: flex;
    flex-direction: column;
    background: #12263a;
    color: #fff;
    padding: 22px 16px 20px;
    min-height: 100vh;
    position: sticky;
    top: 0;
  }
  .desk-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
  .desk-brand img { width: 48px; height: 48px; border-radius: 14px; object-fit: cover; background: #0b1220; }
  .desk-brand b { display: block; font-size: 16px; }
  .desk-brand span { display: block; font-size: 12px; color: #d6c48a; }
  .desk-nav button {
    width: 100%; text-align: left; border: 0; background: transparent;
    color: rgba(255,255,255,.78); border-radius: 14px;
    padding: 12px 12px; margin-bottom: 4px;
    display: flex; align-items: center; gap: 10px; font-weight: 700;
  }
  .desk-nav button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; flex: 0 0 20px; }
  .desk-nav button.active, .desk-nav button:hover { background: rgba(201,162,39,.18); color: #fff; }
  .tabbar { display: none; }
  .screen { padding: 22px 28px 36px; }
  .toast { bottom: 28px; }
  .cards-2 { grid-template-columns: 1.05fr .95fr; }
  .app-grid { grid-template-columns: repeat(4, 1fr); }
  .sheet { align-items: center; }
  .sheet-card { border-radius: 24px; }
  .login-page {
    align-items: center;
    background:
      radial-gradient(900px 420px at 80% 10%, rgba(201,162,39,.22), transparent 50%),
      linear-gradient(120deg, #0d1b2a 0%, #1b3a55 55%, #12263a 100%);
    padding: 36px 24px;
  }
  .login-card { margin: 0; }
  .login-card img { width: 88px; height: 88px; border-radius: 24px; margin-bottom: 16px; }
  .login-card .sub { margin-bottom: 24px; font-size: 15px; }
  .login-sheet { padding: 26px 22px 22px; border-radius: 28px; }
  .login-sheet h3 { font-size: 22px; }
  .login-sheet .lead { margin-bottom: 16px; font-size: 14px; }
}

@media (min-width: 1200px) {
  .app-grid { grid-template-columns: repeat(5, 1fr); }
}

.punch-grid { display: grid; gap: 12px; }
.punch-card {
  border: 0; background: #fff; border-radius: 22px; padding: 18px;
  box-shadow: var(--shadow); text-align: left; width: 100%;
  display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center;
  min-height: 96px;
}
.punch-card.frozen { opacity: .55; }
.punch-ic {
  width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; color: #fff;
}
.punch-ic svg { width: 26px; height: 26px; fill: none; stroke: #fff; stroke-width: 2; }
.punch-card b { display: block; font-size: 18px; }
.punch-card span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.4; }

.leave-hero { margin-bottom: 16px; }
.leave-types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.leave-type {
  border: 1.5px solid var(--line); background: #fff; border-radius: 18px;
  padding: 18px 12px; min-height: 84px; font-weight: 800; font-size: 15px;
}
.leave-type.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.leave-nav { display: flex; gap: 10px; margin-top: 16px; }
.leave-nav .btn { flex: 1; margin: 0; }
.progress-dots { display: flex; gap: 6px; margin: 0 0 16px; }
.progress-dots i { height: 6px; flex: 1; border-radius: 99px; background: #e4dccb; }
.progress-dots i.on { background: var(--gold); }

.cam-full {
  position: fixed; inset: 0; z-index: 120; background: #000;
}
.cam-full video, .cam-full img, .cam-full canvas {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.cam-hud {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(14px + var(--safe-top)) 16px 80px;
  background: linear-gradient(rgba(8,14,24,.72), transparent);
  color: #fff; font-size: 14px; line-height: 1.45;
}
.cam-bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 16px calc(18px + var(--safe));
  background: linear-gradient(transparent, rgba(0,0,0,.88));
  display: flex; gap: 10px; flex-wrap: wrap;
}
.cam-bar .btn { flex: 1; margin: 0; min-height: 54px; }
.cam-shutter {
  width: 74px; height: 74px; border-radius: 50%; border: 5px solid #fff;
  background: var(--gold); flex: 0 0 74px !important; min-height: 74px !important; padding: 0;
}

.form-card label { margin-top: 8px; }
.manual-grid { display: grid; gap: 10px; }
@media (min-width: 520px) {
  .manual-grid { grid-template-columns: 1fr 1fr; }
}

.leave-type.blocked { background: #f8f4ea; color: #8a8070; text-decoration: line-through; }
.protocol-pop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(18, 26, 40, .72);
  display: grid; place-items: center; padding: 20px;
}
.protocol-box {
  background: #fff; border-radius: 20px; padding: 28px 22px 20px;
  max-width: 420px; width: min(92vw, 420px); text-align: center;
  box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.protocol-box p {
  margin: 0 0 18px; font-size: 16px; font-weight: 800; letter-spacing: .02em;
  color: var(--navy); line-height: 1.45;
}
.protocol-box input { margin: 0 0 4px; text-align: left; }
.loc-on { background: #ecfdf3; }
.loc-on h3 { color: #065f46; }
.pipe { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.pipe li {
  border-left: 3px solid #e4dccb; padding: 4px 0 4px 10px;
  font-size: 13px; color: var(--muted);
}
.pipe li.on { border-color: var(--gold); color: var(--navy); }
.pipe li b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.pipe li span { display: block; }
.tpl-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.tpl-list code {
  background: #f4efe4; border-radius: 999px; padding: 6px 10px; font-size: 12px;
}
.tpl-pick { display: grid; gap: 8px; }
@media (min-width: 720px) {
  .tpl-pick { grid-template-columns: 1fr 1fr 1fr; }
}
.leave-desk-card { margin: 12px 0; box-shadow: none; border: 1px solid var(--line); }
.leave-thanks { background: linear-gradient(180deg, #12263a, #1b3a55); color: #fff; }
.leave-thanks h3 { color: #f3e6b4; }
.leave-thanks .hint { color: rgba(255,255,255,.78); }
.leave-detail { margin-bottom: 14px; }
.leave-detail.leave-focus { box-shadow: 0 0 0 2px #c9a227, var(--shadow); }
.leave-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px;
  margin: 14px 0; padding: 12px; border-radius: 16px; background: #faf8f3;
}
.leave-meta dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.leave-meta dd { margin: 2px 0 0; font-weight: 700; }
.leave-reason { margin: 8px 0 14px; }
.leave-reason p { margin: 6px 0 0; white-space: pre-wrap; }
.leave-media {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px;
}
.leave-media figure { margin: 0; }
.leave-media img, .leave-media video {
  width: 100%; border-radius: 16px; background: #0d1b2a; max-height: 240px; object-fit: cover;
}
.leave-media figcaption { font-size: 12px; color: var(--muted); margin-top: 6px; }
.otp-box { margin-top: 12px; padding: 12px; border-radius: 16px; background: #faf8f3; }
.login-secret { background: linear-gradient(160deg, #0d1b2a, #1b3a55); color: #fff; }
.login-secret h3 { color: #f3e6b4; }
.login-secret .hint, .login-secret label { color: rgba(255,255,255,.78); }
.login-secret input, .login-secret select { background: #fff; color: #12263a; }
.secret-tag {
  display: inline-block; margin: 0 0 10px; padding: 4px 10px; border-radius: 999px;
  background: rgba(201,162,39,.2); color: #f3e6b4; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
}
.login-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 12px 0; }
.login-stats .stat {
  background: #fff; border-radius: 18px; padding: 14px; text-align: center; box-shadow: var(--shadow);
}
.login-stats .stat b { display: block; font-size: 22px; color: #12263a; }
.login-stats .stat span { font-size: 12px; color: var(--muted); }
.login-person { margin-bottom: 12px; }
.login-events { list-style: none; padding: 0; margin: 10px 0 0; }
.login-events li {
  padding: 8px 10px; border-radius: 12px; margin-bottom: 6px; font-size: 13px; background: #faf8f3;
}
.login-events li.login { border-left: 3px solid #1b7a4a; }
.login-events li.logout { border-left: 3px solid #b42318; }
.hw-result tr.fail td { color: #b42318; }
.hw-result tr.ok td { color: #1b7a4a; }
@media (max-width: 720px) {
  .leave-media, .leave-meta { grid-template-columns: 1fr; }
}
.radar-stats {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px;
}
.radar-stats .stat { background: #faf8f3; border-radius: 14px; text-align: center; }
.radar-school { margin: 0 0 14px; padding: 12px; border-radius: 16px; background: #faf8f3; }
.radar-pin { background: transparent !important; border: 0 !important; }
.radar-pin span {
  display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 800;
  color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); white-space: nowrap;
}
.radar-pin span.live { background: #1b7a4a; }
.radar-pin span.last { background: #12263a; }
tr.radar-row { cursor: pointer; }
.leave-track-wrap { margin-top: 8px; }
table.leave-track { width: 100%; border-collapse: collapse; font-size: 13px; }
table.leave-track th, table.leave-track td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
table.leave-track th { background: #12263a; color: #fff; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
table.leave-track tr.wait td { color: #6b7280; background: #fafafa; }
table.leave-track tr.done td { background: #fff; }
table.leave-track input { margin: 0; width: 100%; min-width: 120px; }
.pill.waiting { background: #f3f4f6; color: #4b5563; }
.pill.received, .pill.verified, .pill.pushed, .pill.submitted { background: #e0e7ff; color: #3730a3; }
.coordinator, .admin { background: #e0e7ff; color: #3730a3; }
.rolled_back { background: #f3f4f6; color: #4b5563; }
.wa-status { border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.wa-status.on { background: #d1fae5; color: #065f46; }
.wa-status.off { background: #fee2e2; color: #991b1b; }
.tpl-official { display: grid; gap: 10px; margin: 10px 0 14px; }
.tpl-official .tpl-card { background: #faf8f3; }
.tpl-card { background: #faf8f3; border-radius: 14px; padding: 12px; border: 1px solid var(--line); }
.tpl-card b { display: block; font-size: 13px; word-break: break-all; }
.tpl-card span { display: block; font-size: 11px; color: var(--muted); margin-top: 4px; }
.tpl-card p { margin: 6px 0 0; font-size: 12px; color: #4b5563; }
.alert-row {
  display: flex; gap: 12px; align-items: flex-start; width: 100%;
  text-align: left; background: #fff; border: 0; border-bottom: 1px solid var(--line);
  padding: 12px 0; cursor: pointer;
}
.alert-row .pill { flex: 0 0 auto; margin-top: 2px; }
.alert-enable { background: #12263a; color: #fff; }
.alert-enable h3, .alert-enable .hint { color: #fff; }
.wing-table { width: 100%; border-collapse: collapse; }
.wing-table th, .wing-table td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.wing-table select { margin: 0; }
.pill.late, .pill.sms { background: #b42318; color: #fff; }
.pill.chat { background: #1b7a4a; color: #fff; }
.pill.leave, .pill.leave_desk { background: #5b4b8a; color: #fff; }
@media (max-width: 720px) {
  .radar-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.update-gate {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: linear-gradient(165deg, #0d1b2a 0%, #1b3a55 55%, #12263a 100%);
}
.update-box {
  width: min(420px, 100%); text-align: center; color: #fff;
}
.update-box img {
  width: 88px; height: 88px; border-radius: 24px; margin: 0 auto 18px; display: block;
  background: #0b1220; object-fit: cover;
}
.update-box h2 { margin: 0 0 10px; font-size: 28px; }
.update-box p { margin: 0 0 22px; color: rgba(255,255,255,.82); line-height: 1.45; }
.update-box .btn { width: 100%; }

.screen:has(.chat-app) {
  padding: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 72px);
}
.chat-app {
  display: flex;
  flex: 1;
  min-height: calc(100dvh - 72px - var(--tab));
  background: #fff;
}
.chat-people {
  width: min(280px, 38vw);
  border-right: 1px solid var(--line);
  overflow: auto;
  background: #fff;
  padding: 10px;
}
.chat-online {
  font-size: 13px; font-weight: 700; color: #1b7a4a;
  padding: 8px 10px 12px;
}
.chat-people button {
  width: 100%; text-align: left; border: 0; background: #faf8f3;
  border-radius: 14px; padding: 10px 12px; margin-bottom: 6px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
}
.chat-people button.active { background: var(--navy); color: #fff; }
.chat-people button .dot { width: 8px; height: 8px; border-radius: 50%; background: #c4bba8; }
.chat-people button .dot.on { background: #22c55e; box-shadow: 0 0 0 4px rgba(34,197,94,.2); }
.chat-people button span { font-weight: 700; }
.chat-people button small { width: 100%; margin-left: 16px; font-size: 11px; color: var(--muted); }
.chat-people button.active small { color: rgba(255,255,255,.7); }
.chat-thread {
  flex: 1; min-width: 0; display: flex; flex-direction: column; background: #efe8d8;
}
.chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--line);
}
.chat-head h3 { margin: 0; font-size: 16px; }
.chat-head .hint { margin: 2px 0 0; }
.chat-head #chat-back { width: auto; display: none; }
.chat-composer {
  display: flex; gap: 8px; align-items: center;
  padding: 8px 10px calc(10px + var(--safe));
  background: #fff; border-top: 1px solid var(--line);
}
.chat-composer input { flex: 1; margin: 0; }
.chat-composer .btn { width: auto; margin: 0; }
.chat-pic {
  width: 42px; height: 42px; border-radius: 14px; background: #efe8d8;
  display: grid; place-items: center; font-size: 22px; font-weight: 700; cursor: pointer;
}
.chat-pic input { display: none; }
.bubble { max-width: 86%; padding: 10px 12px; border-radius: 16px; background: #fff; font-size: 15px; }
.bubble.me { margin-left: auto; background: var(--navy); color: #fff; }
.bubble.gone { opacity: .72; font-style: italic; }
.bubble img { max-width: min(220px, 70vw); border-radius: 10px; display: block; margin-top: 6px; }
.chat-meta { font-size: 11px; opacity: .7; margin-bottom: 3px; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chat-actions button {
  border: 0; background: rgba(0,0,0,.08); color: inherit;
  border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 700;
}
.bubble.me .chat-actions button { background: rgba(255,255,255,.16); color: #fff; }
table.staff-log { width: 100%; border-collapse: collapse; font-size: 13px; }
table.staff-log th, table.staff-log td { border: 1px solid var(--line); padding: 8px; text-align: left; white-space: nowrap; }
table.staff-log th { background: #12263a; color: #fff; font-size: 11px; text-transform: uppercase; }
.log-shots { display: flex; gap: 4px; }
.log-shots img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.pwd-tick { margin-top: 6px; font-size: 13px; }
.radar-pin span.at_school { background: #1b7a4a; }
.radar-pin span.coming { background: #c9a227; color: #12263a; }
.radar-pin span.leaving { background: #b42318; }
.radar-pin span.away { background: #c05621; }
.radar-pin span.last_school, .radar-pin span.last_away, .radar-pin span.none { background: #5c6b7a; }
.pill.mv-at_school { background: #d1fae5; color: #065f46; }
.pill.mv-coming { background: #fef3c7; color: #92400e; }
.pill.mv-leaving { background: #fee2e2; color: #991b1b; }
.pill.mv-away { background: #ffedd5; color: #9a3412; }
.pill.mv-last_school, .pill.mv-last_away, .pill.mv-none { background: #f3f4f6; color: #4b5563; }
@media (max-width: 768px) {
  .chat-app { min-height: calc(100dvh - 64px - var(--tab)); }
  .chat-people { width: 100%; border-right: 0; }
  .chat-thread { display: none; position: relative; width: 100%; }
  .chat-app.thread-open .chat-people { display: none; }
  .chat-app.thread-open .chat-thread { display: flex; min-height: calc(100dvh - 64px - var(--tab)); }
  .chat-head #chat-back { display: inline-flex; }
}
