/* Tripploy Front Desk — shared styles */
:root {
  --brand: #362d87;
  --brand-600: #2c2470;
  --brand-50: #f0eefb;
  --brand-100: #e2def7;
  --bg: #f6f6fb;
  --card: #ffffff;
  --text: #1d1b2f;
  --muted: #6b6980;
  --line: #e7e6f0;
  --ok: #148a5b;
  --ok-bg: #e6f6ef;
  --warn: #b86e00;
  --warn-bg: #fff4e0;
  --bad: #c62b3c;
  --bad-bg: #fde9ec;
  --info: #1f63c6;
  --info-bg: #e7f0fd;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 16, 60, .05), 0 4px 16px rgba(20, 16, 60, .05);
  --font: "Inter", "Hind Siliguri", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.2; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; } h4 { font-size: .95rem; }
p { margin: 0 0 .8em; }
a { color: var(--brand); }
small, .muted { color: var(--muted); }
.hidden { display: none !important; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1 1 auto; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, transform .05s; min-height: 40px; }
.btn:hover { background: var(--brand-50); border-color: var(--brand-100); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { color: var(--bad); border-color: #f3c3ca; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; min-height: 32px; font-size: .85rem; border-radius: 8px; }
.btn.lg { padding: 14px 20px; font-size: 1.05rem; min-height: 52px; border-radius: 12px; }
.btn.block { width: 100%; }

label.field { display: block; margin-bottom: 14px; }
label.field > span.lbl, .lbl { display: block; font-weight: 600; margin-bottom: 6px; font-size: .92rem; }
.req { color: var(--bad); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--text); min-height: 42px; }
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-100); border-color: var(--brand); }
.invalid input, .invalid select, .invalid textarea, input.invalid { border-color: var(--bad); }
.err-text { color: var(--bad); font-size: .85rem; margin-top: 4px; }

.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice span { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; cursor: pointer; font-weight: 500; user-select: none; }
.choice input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.choice input:focus-visible + span { outline: 2px solid var(--brand-100); }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }

/* ---------- surfaces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.pad-sm { padding: 12px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--brand-50); color: var(--brand); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.info { background: var(--info-bg); color: var(--info); }
.pill.grey { background: #eeeef3; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #bbb; flex: none; }
.dot.available { background: var(--ok); } .dot.in_session { background: var(--info); }
.dot.lunch, .dot.meeting, .dot.outside, .dot.other { background: var(--warn); }
.dot.absent, .dot.leave, .dot.unmarked { background: #c9c8d3; }
.notice { padding: 10px 12px; border-radius: 10px; background: var(--info-bg); color: #16407e; }
.notice.warn { background: var(--warn-bg); color: #7a4a00; }
.notice.bad { background: var(--bad-bg); color: #8a1d2a; }
.notice.ok { background: var(--ok-bg); color: #0d5c3d; }
.token { font-weight: 800; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.empty { padding: 22px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; background: #fafafd; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* ---------- toast & modal ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: #1d1b2f; color: #fff; padding: 11px 14px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; animation: pop .2s ease-out; }
.toast.bad { background: var(--bad); } .toast.ok { background: var(--ok); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal-back { position: fixed; inset: 0; background: rgba(20, 16, 50, .45); z-index: 900; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: min(100%, 560px); padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(100%, 860px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- student pages ---------- */
.kiosk { max-width: 620px; margin: 0 auto; padding: 16px 16px 60px; }
.brandbar { display: flex; align-items: center; gap: 12px; padding: 8px 0 16px; }
.brandbar img { width: 48px; height: 48px; }
.brandbar .title { font-weight: 800; font-size: 1.15rem; color: var(--brand); line-height: 1.1; }
.brandbar .sub { color: var(--muted); font-size: .85rem; }
.langswitch { margin-left: auto; }
.big-choice { display: grid; gap: 12px; }
.big-choice button { text-align: left; padding: 18px; border-radius: 14px; border: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; display: flex; gap: 14px; align-items: center; box-shadow: var(--shadow); }
.big-choice button:hover { border-color: var(--brand); background: var(--brand-50); }
.big-choice .ico { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-50); color: var(--brand); display: grid; place-items: center; font-size: 1.4rem; flex: none; }
.big-choice b { display: block; font-size: 1.05rem; }
.form-heading { margin: 22px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--brand); font-size: 1rem; }
.ticket-card { text-align: center; padding: 28px 18px; }
.ticket-token { font-size: 4.2rem; font-weight: 800; color: var(--brand); line-height: 1; margin: 8px 0 12px; }
.ticket-status { font-size: 1.15rem; font-weight: 600; }
.called-banner { background: var(--ok); color: #fff; border-radius: 16px; padding: 22px; text-align: center; animation: pulse 1.4s ease-in-out infinite; }
.called-banner .desk { font-size: 2.6rem; font-weight: 800; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(20,138,91,.5); } 50% { box-shadow: 0 0 0 14px rgba(20,138,91,0); } }
.position { font-size: 2.4rem; font-weight: 800; }

/* ---------- staff portal ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.topbar img { width: 34px; height: 34px; }
.topbar .appname { font-weight: 800; color: var(--brand); line-height: 1.1; }
.topbar .appname small { display: block; font-weight: 500; font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 8px 16px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 51px; z-index: 40; scrollbar-width: thin; }
.tab { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; position: relative; }
.tab.active { background: var(--brand-50); color: var(--brand); }
.tab .badge { background: var(--bad); color: #fff; border-radius: 999px; font-size: .7rem; padding: 1px 6px; margin-left: 4px; }
.page { padding: 16px; max-width: 1400px; margin: 0 auto; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.stat .n { font-size: 1.7rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: .82rem; }
.vcard { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: #fff; }
.vcard + .vcard { margin-top: 10px; }
.vcard.alert { border-color: #f1a9b3; background: #fff8f9; }
.vcard.hl { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.vcard .token { font-size: 1.25rem; color: var(--brand); }
.vmeta { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0; }
.vactions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.vactions .btn.ghost { border-color: var(--line); }
.counselor-row { display: grid; grid-template-columns: minmax(130px, 1.2fr) 130px minmax(160px, 1.4fr); gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.counselor-row:last-child { border-bottom: 0; }
.counselor-row select, .counselor-row input { min-height: 34px; padding: 5px 8px; font-size: .88rem; }
.pick-list .pick { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; cursor: pointer; margin-bottom: 8px; }
.pick-list .pick:hover { border-color: var(--brand); background: var(--brand-50); }
.pick-list .pick.dim { opacity: .6; }
.netbar { background: var(--bad); color: #fff; padding: 8px 16px; text-align: center; font-weight: 600; }
.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 6px 12px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.subtabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.fb-field { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fff; margin-bottom: 8px; }
.fb-field.heading { background: var(--brand-50); }
.fb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.fb-grid label { font-size: .82rem; font-weight: 600; }

.note { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fff; margin-bottom: 8px; }
.note-text { margin: 4px 0; white-space: pre-wrap; word-break: break-word; }
.form-heading:first-child { margin-top: 0; border-top: 0; padding-top: 0; }

/* ---------- desktop popup ---------- */
.popup-body { background: #fff; }
.popup { padding: 10px; }
.popup .vcard { padding: 10px; }
.popup-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--brand); color: #fff; -webkit-app-region: drag; }
.popup-head img { width: 24px; height: 24px; }
.popup-head .btn { -webkit-app-region: no-drag; background: rgba(255,255,255,.15); border-color: transparent; color: #fff; min-height: 28px; padding: 3px 9px; }
.popup-head select { -webkit-app-region: no-drag; min-height: 28px; padding: 2px 6px; width: auto; font-size: .82rem; }

/* ---------- TV display ---------- */
.tv { background: #17123f; color: #fff; min-height: 100vh; padding: 2.2vw 2.6vw; font-size: 1.6vw; overflow: hidden; }
.tv-head { display: flex; align-items: center; gap: 1.2vw; margin-bottom: 1.6vw; }
.tv-head img { width: 4.5vw; height: 4.5vw; }
.tv-head .ttl { font-size: 2.4vw; font-weight: 800; }
.tv-head .clock { margin-left: auto; font-size: 2.6vw; font-weight: 700; font-variant-numeric: tabular-nums; }
.tv-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 2vw; }
.tv-panel { background: rgba(255,255,255,.06); border-radius: 1.2vw; padding: 1.4vw; }
.tv-panel h2 { font-size: 1.7vw; color: #c8c2ff; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 1vw; }
.tv-now { display: grid; grid-template-columns: 1fr 1fr; gap: 1vw; }
.tv-call { background: #fff; color: var(--brand); border-radius: 1vw; padding: 1.1vw 1.3vw; }
.tv-call .tk { font-size: 4vw; font-weight: 800; line-height: 1; }
.tv-call .ds { font-size: 1.8vw; font-weight: 700; color: #1d1b2f; margin-top: .4vw; }
.tv-call .nm { font-size: 1.3vw; color: #6b6980; }
.tv-call.fresh { background: #ffd84d; animation: flash 1s ease-in-out 6; }
@keyframes flash { 50% { background: #fff; } }
.tv-wait { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7vw; }
.tv-wait div { background: rgba(255,255,255,.1); border-radius: .7vw; padding: .6vw .8vw; font-weight: 700; font-size: 1.8vw; }
.tv-wait div small { display: block; color: #bdb8e8; font-weight: 500; font-size: 1.05vw; }
.tv-foot { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(0,0,0,.35); padding: .8vw 2.6vw; font-size: 1.3vw; color: #d9d6f5; }
.tv-sound { position: fixed; inset: 0; background: rgba(10,8,30,.85); display: grid; place-items: center; z-index: 10; }

@media (max-width: 980px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .tabs { top: 51px; }
}
@media (max-width: 560px) {
  .counselor-row { grid-template-columns: 1fr 1fr; }
  .counselor-row > :first-child { grid-column: 1 / -1; }
  .ticket-token { font-size: 3.4rem; }
  .topbar .appname small { display: none; }
}
