/* SakalaVidya – mobile-first styles */
:root {
  /* SakalaVidya brand: samudra blue, turquoise, leaf green, akasham sky, chandanam */
  --bg: #f6f8f8; --card: #fff; --text: #16323a; --muted: #5f7379; --line: #dbe6ea;
  --primary: #0e6ba8; --primary-2: #0a578a; --primary-soft: #e3f1fa;
  --sky: #8fd3f4; --sky-soft: #e6f5fb; --turq: #12b3a6; --leaf: #3fae5a; --teal-deep: #0a4e7a;
  --live: #dc2626; --live-soft: #fee2e2; --go: #16a34a; --go-2: #15803d; --wa: #1fa855;
  --warn: #b45309; --warn-soft: #fef3c7; --ok-soft: #dcfce7;
  --radius: 14px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .05);
  --nav-h: 62px; --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@font-face { font-family: "Marcellus"; src: url("fonts/marcellus-latin.woff2") format("woff2"); font-display: swap; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Telugu", sans-serif; color: var(--text); background: var(--bg); -webkit-tap-highlight-color: transparent; }
body.modal-open { overflow: hidden; }
a { color: var(--primary); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.25; }
h2 { font-size: 1.35rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; margin-top: 1em; }
p { margin: .3em 0 .6em; }
code { background: #eaf2f6; padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.ic { width: 20px; height: 20px; flex: none; }
.ic.big { width: 48px; height: 48px; color: var(--muted); }
.ic.flip { transform: scaleX(-1); margin-left: auto; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center { text-align: center; } .pad { padding: 14px; }
.mt { margin-top: 12px; } .mt-s { margin-top: 6px; } .mt-l { margin-top: 20px; } .mb { margin-bottom: 12px; }
.row { display: flex; align-items: center; } .row.wrap { flex-wrap: wrap; } .gap { gap: 8px; } .end { justify-content: flex-end; } .between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.pre { white-space: pre-wrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; transition: background .15s, transform .05s; }
.btn:hover { background: #f8fafc; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn small { font-weight: 500; opacity: .85; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn-primary:hover { background: var(--primary-2); }
.btn-live { background: var(--go); border-color: var(--go); color: #fff; } .btn-live:hover { background: var(--go-2); }
.btn-danger { background: var(--live); border-color: var(--live); color: #fff; }
.btn-ghost-danger { color: var(--live); border-color: #fecaca; } .btn-ghost-danger:hover { background: var(--live-soft); }
.btn-wa { background: var(--wa); border-color: var(--wa); color: #fff; } .btn-wa:hover { background: #178f47; }
.btn-sm { min-height: 32px; padding: 4px 10px; font-size: .85rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2px solid currentColor; border-color: #94a3b8 transparent #94a3b8 transparent; border-radius: 50%; animation: spin .8s linear infinite; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; background: transparent; border-radius: 10px; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: #eef2f7; }
.icon-btn.light { color: #e2e8f0; } .icon-btn.light:hover { background: rgba(255, 255, 255, .1); }
.link-btn { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; padding: 6px; }

/* pills & tags */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: .78rem; font-weight: 700; background: #eef2f7; color: #334155; white-space: nowrap; }
.pill.live { background: var(--live); color: #fff; animation: pulse 1.6s infinite; }
.pill.now { background: var(--ok-soft); color: var(--go-2); }
.pill.today { background: var(--primary-soft); color: var(--primary); }
.pill.later { background: #f1f5f9; color: #475569; }
.pill.muted { background: #f1f5f9; color: #94a3b8; }
.pill.ok { background: var(--ok-soft); color: var(--go-2); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.cancel { background: #fee2e2; color: #b91c1c; }
.noclass-note { display: flex; gap: 8px; align-items: flex-start; background: #fef2f2; color: #991b1b; border-radius: 10px; padding: 8px 10px; font-size: .88rem; margin: 6px 0; }
.noclass-note .ic { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.noclass-note small { color: #b91c1c; opacity: .8; }
.alert-banner { align-items: center; }
.alert-banner .ic { color: var(--primary); }
.tag { font-size: .75rem; font-weight: 700; color: var(--primary); background: var(--primary-soft); padding: 2px 8px; border-radius: 6px; }
.role-chip { font-size: .75rem; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }

/* forms */
.input { width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; font: inherit; color: inherit; }
.input:focus { outline: 2px solid #8fd3f4; border-color: var(--primary); }
textarea.input { resize: vertical; min-height: 70px; }
.input:disabled { background: #f8fafc; color: var(--muted); }
.sel { width: auto; min-width: 160px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: .85rem; font-weight: 600; color: #334155; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: .92rem; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--primary); }
.fs { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; }
.fs legend { font-weight: 700; font-size: .9rem; padding: 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 7px 12px; border: 1px solid #cbd5e1; border-radius: 999px; font-size: .88rem; font-weight: 600; background: #fff; user-select: none; }
.chip input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip input:focus-visible + span { outline: 2px solid #8fd3f4; }
.pw { position: relative; } .pw .icon-btn { position: absolute; right: 2px; top: 1px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search .ic { position: absolute; left: 11px; top: 11px; color: var(--muted); }
.search .input { padding-left: 38px; }
.seg { display: inline-flex; background: #eef2f7; border-radius: 10px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg > button, .seg > label { border: 0; background: transparent; padding: 7px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: #475569; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.seg > button.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }
.seg.small > button { padding: 5px 10px; font-size: .85rem; }
.progress { height: 8px; background: #e2e8f0; border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; width: 0; background: var(--primary); transition: width .2s; }

/* cards & lists */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid .card { margin: 0; }
.list { padding: 4px 0; }
.prow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 14px; border: 0; border-bottom: 1px solid #f1f5f9; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
button.prow:hover, a.prow:hover { background: #f8fafc; }
.prow:last-child { border-bottom: 0; }
.prow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow small { display: block; color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 800; font-size: .85rem; }
.avatar.t { background: #fef3c7; color: #b45309; } .avatar.a { background: #ede9fe; color: #6d28d9; }
.avatar.big { width: 64px; height: 64px; font-size: 1.3rem; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; margin-bottom: 6px; color: #94a3b8; }
.empty.small { padding: 20px; }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; background: var(--sky-soft); color: #0a4e7a; font-size: .9rem; margin-bottom: 12px; }
.note.warn { background: var(--warn-soft); color: #78350f; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: .88rem; } .kv dd { margin: 0; }
.syl { white-space: pre-wrap; font: inherit; margin: 0; background: #f8fafc; border-radius: 10px; padding: 12px; }
details summary { cursor: pointer; font-weight: 600; color: var(--primary); margin: 6px 0; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th, .tbl td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { color: var(--muted); font-weight: 600; }

/* class cards */
.class-card { display: flex; flex-direction: column; gap: 10px; border: 2px solid transparent; }
.class-card.is-live, .class-hero.is-live { border: 2px solid var(--live); }
.cc-main { color: inherit; display: block; }
.cc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 6px; }
.class-card h3 { font-size: 1.08rem; margin: 2px 0 6px; }
.meta { display: flex; align-items: center; gap: 7px; color: #475569; font-size: .88rem; margin: 3px 0; }
.meta .ic { width: 16px; height: 16px; color: var(--muted); }
.cc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.class-hero h2 { margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px; font-weight: 600; }
.trow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #f1f5f9; }
.trow:last-child { border-bottom: 0; }
.trow.is-live { background: #fff5f5; }
.t-time { width: 74px; flex: none; font-weight: 700; font-size: .9rem; }
.t-time small { display: block; color: var(--muted); font-weight: 500; }
.t-main { flex: 1; min-width: 0; color: inherit; }
.t-main b, .t-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-main small { color: var(--muted); }
.t-act { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.t-act .btn { min-height: 34px; padding: 5px 10px; font-size: .85rem; }
.roster .prow { cursor: default; padding: 8px 0; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.tile .ic { color: var(--primary); } .tile b { font-size: 1.5rem; } .tile span { color: var(--muted); font-size: .85rem; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h2 { margin: 0; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.sec { margin: 22px 0 10px; font-size: 1.05rem; }
.profile { display: flex; gap: 14px; align-items: center; }
.steps { padding-left: 20px; } .steps li { margin: 6px 0; }
.pick-list { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 10px; }
.pick { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-bottom: 1px solid #f1f5f9; cursor: pointer; }
.pick input { width: 18px; height: 18px; accent-color: var(--primary); }
.pick b, .pick small { display: block; } .pick small { color: var(--muted); }

/* timetable */
.tt-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 82%; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
.tt-col { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; scroll-snap-align: start; min-height: 160px; }
.tt-col.today { outline: 2px solid var(--primary); }
.tt-head { display: flex; gap: 6px; align-items: baseline; margin-bottom: 8px; }
.tt-head small { margin-left: auto; color: var(--muted); }
.tt-item { display: block; position: relative; padding: 8px 10px; border-radius: 10px; background: #f8fafc; margin-bottom: 8px; color: inherit; border-left: 4px solid var(--primary); }
.tt-item.is-live { border-left-color: var(--live); background: #fff5f5; }
.tt-item.clash { border-left-color: var(--warn); background: #fffbeb; }
.tt-item b, .tt-item small, .tt-time { display: block; }
.tt-time { font-size: .8rem; font-weight: 700; color: var(--primary); }
.tt-item small { color: var(--muted); }
.tt-item .pill { margin-top: 4px; margin-right: 4px; }

/* app shell */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--top-h); display: flex; align-items: center; justify-content: space-between; padding: 0 14px; background: rgba(255, 255, 255, .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); box-shadow: inset 0 3px 0 var(--turq); }
.tb-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.tb-brand b { font-family: "Marcellus", Georgia, serif; font-weight: 400; font-size: 1.2rem; color: var(--primary); letter-spacing: .4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tb-right { display: flex; gap: 8px; align-items: center; }
.view { padding: 16px 14px calc(var(--nav-h) + 24px + var(--safe-b)); max-width: 1180px; margin: 0 auto; }
.bottomnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: #fff; border-top: 1px solid var(--line); }
.bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #78898f; font-size: .72rem; font-weight: 600; }
.bottomnav a.on { color: var(--primary); }
.bottomnav .ic { width: 22px; height: 22px; }
body.in-chat .bottomnav { display: none; }
body.in-chat .view { padding: 0; max-width: none; }

@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span2 { grid-column: span 2; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tt-grid { grid-auto-columns: 45%; }
}
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; }
  .sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, var(--primary) 0%, var(--teal-deep) 100%); color: #e4f1f4; padding: 16px 12px; }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
  .side-brand b { font-family: "Marcellus", Georgia, serif; font-weight: 400; font-size: 1.3rem; letter-spacing: .5px; color: #ffffff; }
  .side-brand img { width: 34px; height: 34px; border-radius: 9px; box-shadow: 0 0 0 1.5px rgba(143, 211, 244, .7); }
  .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
  .sidebar nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #d7ecf7; font-weight: 600; }
  .sidebar nav a:hover { background: rgba(255, 255, 255, .06); }
  .sidebar nav a.on { background: rgba(143, 211, 244, .18); color: #ffffff; box-shadow: inset 3px 0 0 var(--turq); }
  .side-foot { margin-top: auto; padding: 10px; border-top: 1px solid rgba(255, 255, 255, .1); }
  .side-foot b, .side-foot small { display: block; } .side-foot small { color: #a8cde3; }
  .tb-brand { visibility: hidden; }
  .bottomnav { display: none; }
  .view { padding: 22px 28px 40px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .tt-grid { grid-template-columns: repeat(7, minmax(150px, 1fr)); grid-auto-flow: row; grid-auto-columns: auto; overflow-x: auto; }
  body.in-chat .view { padding: 0; }
}

/* auth */
.auth { min-height: 100vh; padding: 28px 14px 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; background: linear-gradient(180deg, #d9eff8 0%, var(--bg) 360px); }
.auth-card { width: 100%; max-width: 420px; padding: 22px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.auth-brand img { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 0 0 1px var(--line); }
.auth-brand h1 { font-family: "Marcellus", Georgia, serif; font-weight: 400; font-size: 1.65rem; line-height: 1.1; letter-spacing: .4px; color: var(--primary); margin: 0; } .auth-brand p { margin: 0; color: var(--muted); }
.auth .seg { width: 100%; margin-bottom: 14px; } .auth .seg > button { flex: 1; justify-content: center; }
.auth-batches { width: 100%; max-width: 1000px; }
.install-btn { display: none; } body.can-install .install-btn { display: inline-flex; }
.install-card { display: flex; align-items: center; gap: 12px; width: 100%; max-width: 420px; background: #fff; border: 2px solid var(--primary); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 12px; }
.view .install-card { max-width: none; }
.install-card img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 0 0 1px var(--line); }
.install-card b, .install-card small { display: block; } .install-card small { color: var(--muted); }
.linkbox { padding: 8px 10px; word-break: break-all; }
.demo-box { width: 100%; max-width: 420px; }
.demo-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; }
.demo-row b, .demo-row small { display: block; } .demo-row small { color: var(--muted); font-family: ui-monospace, monospace; font-size: .8rem; }
.splash { min-height: 100vh; display: grid; place-items: center; align-content: center; gap: 18px; }
.splash img { width: 72px; height: 72px; border-radius: 18px; }

/* modal & toast */
.modal-wrap { position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .15s; }
.modal { background: #fff; width: 100%; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 0 16px calc(16px + var(--safe-b)); animation: up .2s ease-out; }
.modal-head { position: sticky; top: 0; background: #fff; display: flex; align-items: center; justify-content: space-between; padding: 14px 0 8px; z-index: 1; }
.modal-head h3 { margin: 0; }
.modal-body { padding-bottom: 6px; }
.confirm-msg { white-space: pre-line; }
.full-img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 10px; background: #f1f5f9; }
@media (min-width: 700px) {
  .modal-wrap { align-items: center; padding: 20px; }
  .modal { max-width: 520px; border-radius: 18px; padding-bottom: 18px; }
  .modal.wide { max-width: 760px; }
}
#toasts { position: fixed; z-index: 1100; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 16px + var(--safe-b)); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: #0a4e7a; color: #fff; padding: 11px 14px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: .92rem; animation: up .2s; transition: opacity .4s; }
.toast.err { background: #991b1b; } .toast.ok { background: #166534; } .toast.live { background: var(--live); font-weight: 700; }
.toast.out { opacity: 0; }
.update-bar { position: fixed; z-index: 1050; top: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; align-items: center; background: #0a4e7a; color: #fff; padding: 8px 10px 8px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: .9rem; }
.spinner { width: 34px; height: 34px; border: 3px solid #cbd5e1; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto; }

/* chat */
.chat { display: flex; flex-direction: column; height: calc(100dvh - var(--top-h)); background: #eef2f7; }
@media (min-width: 900px) { .chat { height: 100vh; } .view-chat + * {} }
.chat-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: #fff; border-bottom: 1px solid var(--line); }
.ch-title { flex: 1; min-width: 0; } .ch-title b, .ch-title small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .ch-title small { color: var(--muted); }
.chat-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.day-sep { text-align: center; margin: 8px 0; } .day-sep span { background: #dde3ec; color: #475569; font-size: .75rem; padding: 3px 10px; border-radius: 99px; }
.msg { max-width: 82%; align-self: flex-start; background: #fff; border-radius: 4px 14px 14px 14px; padding: 7px 10px 5px; box-shadow: 0 1px 1px rgba(0, 0, 0, .05); }
.msg.mine { align-self: flex-end; background: #e3f1fa; border-radius: 14px 4px 14px 14px; }
.msg.staff:not(.mine) { background: #fff7ed; }
.msg-name { font-size: .78rem; font-weight: 700; color: var(--primary); margin-bottom: 2px; }
.rtag { margin-left: 6px; font-size: .68rem; background: #f59e0b; color: #fff; padding: 1px 6px; border-radius: 6px; }
.msg-text { white-space: pre-wrap; word-break: break-word; }
.msg-meta { display: flex; justify-content: flex-end; align-items: center; gap: 4px; font-size: .7rem; color: var(--muted); margin-top: 2px; }
.msg-del { border: 0; background: none; color: #94a3b8; cursor: pointer; padding: 0 2px; display: flex; }
.msg-del .ic { width: 14px; height: 14px; }
.msg-img { position: relative; display: block; border: 0; padding: 0; margin: 2px 0 4px; background: #e2e8f0; border-radius: 10px; overflow: hidden; cursor: pointer; min-width: 120px; min-height: 80px; }
.msg-img img { display: block; max-width: 220px; max-height: 220px; filter: blur(1px); }
.msg-img span { position: absolute; left: 6px; bottom: 6px; display: flex; align-items: center; gap: 4px; background: rgba(15, 23, 42, .75); color: #fff; font-size: .75rem; padding: 3px 8px; border-radius: 8px; }
.msg-img span .ic { width: 14px; height: 14px; }
.chat-compose { display: flex; align-items: flex-end; gap: 6px; padding: 8px 8px calc(8px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); }
.chat-compose textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; border: 1px solid #cbd5e1; border-radius: 20px; padding: 10px 14px; font: inherit; }
.chat-compose .send { background: var(--primary); color: #fff; border-radius: 50%; }
.chat-locked { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 14px; background: #fff; color: var(--muted); border-top: 1px solid var(--line); }

/* live classroom */
.room { position: fixed; inset: 0; z-index: 900; background: #0b1020; color: #e2e8f0; display: grid; grid-template-rows: auto 1fr auto; }
.room-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top, 0px)); background: rgba(0, 0, 0, .35); }
.rt-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.rt-title b, .rt-title small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rt-title small { color: #94a3b8; font-size: .78rem; }
.rt-count { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; color: #cbd5e1; }
.rt-count .ic { width: 16px; height: 16px; }
.room-body { position: relative; display: flex; min-height: 0; }
.room-stage { position: relative; flex: 1; min-width: 0; display: grid; place-items: center; overflow: hidden; background: #000; }
.room-stage > video[data-main] { width: 100%; height: 100%; object-fit: contain; background: #000; }
.room-stage video.mirror { transform: scaleX(-1); }
.room-stage video.contain { object-fit: contain; }
.pip { position: absolute; right: 10px; bottom: 10px; width: 26%; max-width: 220px; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .5); background: #111; z-index: 3; }
.stage-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 20px; color: #cbd5e1; pointer-events: none; }
.stage-msg .ic { width: 48px; height: 48px; color: #64748b; }
.stage-msg:empty { display: none; }
.speaker-tag { position: absolute; left: 10px; top: 10px; z-index: 3; background: rgba(22, 163, 74, .9); color: #fff; padding: 4px 10px; border-radius: 99px; font-size: .82rem; font-weight: 700; }
.sound-btn { position: absolute; z-index: 4; }
.room.board-on .speaker-tag { top: auto; bottom: 10px; }
.room.board-on .pip { width: 18%; max-width: 160px; }
.room-controls { display: flex; justify-content: center; gap: 6px; padding: 8px 8px calc(8px + var(--safe-b)); background: rgba(0, 0, 0, .45); overflow-x: auto; }
.rc-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 64px; padding: 8px 6px; border: 0; border-radius: 12px; background: rgba(255, 255, 255, .08); color: #e2e8f0; font: inherit; font-size: .72rem; font-weight: 600; cursor: pointer; }
.rc-btn:hover { background: rgba(255, 255, 255, .16); }
.rc-btn.off { background: rgba(220, 38, 38, .25); color: #fecaca; }
.rc-btn.on { background: rgba(37, 99, 235, .45); color: #fff; }
.rc-btn.danger { background: var(--live); color: #fff; }
.rc-btn .ic { width: 22px; height: 22px; }
.room-panel { display: none; width: 320px; flex: none; background: #111827; border-left: 1px solid #1f2937; flex-direction: column; min-height: 0; }
.room.panel-open .room-panel { display: flex; }
.rp-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid #1f2937; }
.rp-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #1f2937; }
.rp-tools .btn { background: #1f2937; color: #e2e8f0; border-color: #374151; }
.rp-tools .check { color: #cbd5e1; }
.rp-list { flex: 1; overflow-y: auto; }
.rp-list .muted { color: #94a3b8; }
.rp-row { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #1f2937; }
.rp-row .btn { background: #1f2937; color: #e2e8f0; border-color: #374151; }
.rp-row .btn-primary { background: var(--primary); border-color: var(--primary); }
.rp-name { flex: 1; min-width: 0; } .rp-name b, .rp-name small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; } .rp-name small { color: #94a3b8; font-size: .75rem; }
.rp-ic { font-size: 1rem; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #f59e0b; flex: none; }
.dot.connected { background: #22c55e; } .dot.failed, .dot.closed { background: #ef4444; }
.rp-cams { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; }
.rp-cams:empty { display: none; }
.rp-cams figure { margin: 0; position: relative; }
.rp-cams video { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #000; border-radius: 6px; display: block; }
.rp-cams figcaption { position: absolute; left: 3px; bottom: 3px; font-size: .62rem; background: rgba(0, 0, 0, .6); padding: 0 4px; border-radius: 4px; max-width: 95%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rp-close { display: inline-flex; }
@media (min-width: 900px) {
  .room.is-host .room-panel { display: flex; }
  .room.is-host .people-btn { display: none; }
  .rp-close { display: none; }
}
@media (max-width: 899px) {
  .room-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(92vw, 360px); z-index: 5; box-shadow: -10px 0 30px rgba(0, 0, 0, .4); }
}
.share-opt { justify-content: flex-start; text-align: left; gap: 12px; padding: 12px 14px; white-space: normal; }
.share-opt b, .share-opt small { display: block; } .share-opt small { color: var(--muted); font-weight: 500; }
.share-opt .ic { width: 26px; height: 26px; color: var(--primary); }

/* whiteboard */
.board { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; background: #1e293b; }
.board-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 6px; }
.board-canvas { max-width: 100%; max-height: 100%; background: #fff; border-radius: 6px; touch-action: none; cursor: crosshair; box-shadow: 0 4px 20px rgba(0, 0, 0, .4); }
.board-tools { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; padding: 6px 8px; background: #0f172a; }
.bt-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.bt { display: inline-flex; align-items: center; gap: 4px; min-width: 36px; height: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: #1e293b; color: #e2e8f0; font: inherit; font-size: .75rem; cursor: pointer; }
.bt.on { background: var(--primary); }
.bt .ic { width: 18px; height: 18px; }
.bt.flip .ic { transform: scaleX(-1); }
.bt-color { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #334155; background: var(--c); cursor: pointer; padding: 0; }
.bt-color.on { outline: 3px solid #fff; outline-offset: 1px; }
.bt-dot { display: inline-block; border-radius: 50%; background: #111827; border: 1px solid #94a3b8; }
.bt-pg { color: #cbd5e1; font-size: .8rem; min-width: 40px; text-align: center; }
@media (max-width: 600px) { .bt small { display: none; } .room.board-on .room-top { padding-top: 4px; padding-bottom: 4px; } .room.board-on .rc-btn { min-width: 54px; padding: 5px 4px; } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .7; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(16px); opacity: 0; } }

/* ---------- announcements ---------- */
[data-nav].has-dot { position: relative; }
[data-nav].has-dot::after { content: ''; position: absolute; top: 7px; left: calc(50% + 7px); width: 9px; height: 9px; border-radius: 50%; background: #e63946; box-shadow: 0 0 0 2px #fff; }
.sidebar [data-nav].has-dot::after { top: 50%; left: auto; right: 12px; margin-top: -4px; box-shadow: none; }
.news-strip { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.news-mini { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: #fff; box-shadow: var(--shadow); border-left: 4px solid var(--turq); color: var(--text); }
.news-mini > .ic { color: var(--primary); flex: none; }
.news-mini .grow { min-width: 0; }
.news-mini b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.news-mini small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--muted); font-size: .84rem; }
.news-mini .small { flex: none; }
.news-list { display: grid; gap: 14px; max-width: 760px; }
.news-list .card { margin: 0; }
.card.news { display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--turq); }
.news-pic { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 120px; max-height: 340px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: #eef5f7; cursor: zoom-in; color: var(--muted); }
.news-pic img { width: 100%; max-height: 340px; object-fit: cover; display: block; }
.news-top { display: flex; align-items: flex-start; gap: 8px; }
.news-top h3 { flex: 1; margin: 0; font-size: 1.08rem; }
.news-top .icon-btn { margin: -8px -8px 0 0; color: var(--muted); }
.news-body p { margin: 4px 0 8px; }
.news-status { margin-top: 6px; }
.news-status .pill .ic { width: 14px; height: 14px; }
.block { display: block; margin-top: 4px; }
.ann-pic { display: flex; flex-direction: column; gap: 8px; }
.ann-prev img { display: block; max-width: 100%; max-height: 220px; border-radius: 10px; object-fit: contain; background: #f1f5f9; }
.ann-classes { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 0 26px; padding: 10px; border-radius: 10px; background: #f6fafb; max-height: 280px; overflow: auto; }
.ann-wt { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--line); }
.fs .check + .check { margin-top: 8px; }
