:root{
  --navy:#17365d;
  --navy-light:#eef4fb;
  --red:#9f1d35;
  --border:#e5e7eb;
  --background:#f7f8fa;
  --muted:#6b7280;
  --yellow-bg:#fff3cd;
  --yellow-text:#856404;
  --blue-bg:#e3f2fd;
  --blue-text:#175a94;
}

*{box-sizing:border-box}

body{
  margin:0;
  font-family:Arial,Helvetica,sans-serif;
  background:var(--background);
  color:#111827;
}

header{
  background:var(--navy);
  color:white;
  padding:14px 22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:15px;
}

header h1{margin:0;font-size:22px}

.subtitle{font-size:12px;opacity:.85;margin-top:5px}

.header-right{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.room-badge{
  background:white;
  color:var(--navy);
  border-radius:20px;
  padding:8px 13px;
  font-weight:700;
}

.preview-badge{
  background:#fef3c7;
  color:#92400e;
  border-radius:6px;
  padding:7px 10px;
  font-size:11px;
  font-weight:700;
}

main{
  max-width:1500px;
  margin:auto;
  padding:20px;
}

.grid{
  display:grid;
  grid-template-columns:minmax(320px,.85fr) minmax(500px,1.6fr);
  gap:20px;
}

.card{
  background:white;
  border:1px solid var(--border);
  border-radius:12px;
  padding:18px;
}

h2,h3{color:var(--navy);margin-top:0}

label{
  display:block;
  font-weight:700;
  margin:13px 0 6px;
}

input,select,textarea{
  width:100%;
  padding:11px 12px;
  border:1px solid #cbd5e1;
  border-radius:8px;
  font-size:15px;
  background:white;
}

textarea{min-height:90px}

button{cursor:pointer;font-family:inherit}

.primary{
  border:0;
  background:var(--red);
  color:white;
  padding:12px 14px;
  border-radius:8px;
  font-weight:700;
}

.secondary{
  border:1px solid var(--navy);
  background:white;
  color:var(--navy);
  padding:9px 12px;
  border-radius:7px;
  font-weight:600;
}

.wide{width:100%;margin-top:15px}

.muted,.details{
  color:var(--muted);
  font-size:12px;
}

.station-banner{
  background:var(--navy-light);
  border:1px solid #cbd5e1;
  border-radius:9px;
  padding:12px;
  margin-bottom:15px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.station-name{
  color:var(--navy);
  font-size:18px;
  font-weight:800;
}

.suggestions{
  border:1px solid var(--border);
  max-height:240px;
  overflow:auto;
  background:white;
}

.suggestion{
  display:block;
  width:100%;
  border:0;
  border-top:1px solid #f3f4f6;
  padding:12px;
  text-align:left;
  background:white;
}

.suggestion:hover{background:var(--navy-light)}

.selected-student{
  margin-top:8px;
  padding:10px;
  border-radius:7px;
  background:var(--navy-light);
}

.count-badge{
  background:var(--navy-light);
  color:var(--navy);
  border-radius:30px;
  padding:6px 12px;
  font-weight:800;
}

.section-heading{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
}

table{
  width:100%;
  border-collapse:collapse;
}

th,td{
  padding:12px 10px;
  border-bottom:1px solid var(--border);
  text-align:left;
  vertical-align:top;
}

th{
  color:var(--navy);
  font-size:12px;
  text-transform:uppercase;
}

.timer{
  font-weight:800;
  font-variant-numeric:tabular-nums;
  white-space:nowrap;
}

.timer.over{
  color:var(--red);
  background:#fde8ec;
  padding:6px 9px;
  border-radius:8px;
}

.status{
  display:inline-block;
  padding:8px 14px;
  border-radius:12px;
  font-weight:700;
  font-size:13px;
  white-space:nowrap;
}

.status.traveling{
  background:var(--yellow-bg);
  color:var(--yellow-text);
  border:1px solid #ffe69c;
}

.status.arrived{
  background:var(--blue-bg);
  color:var(--blue-text);
  border:1px solid #bbdefb;
}

.actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  flex-wrap:wrap;
}

.notice{
  padding:11px 13px;
  background:#ecfdf5;
  border:1px solid #a7f3d0;
  border-radius:8px;
  margin-bottom:14px;
}

.notice.error{
  background:#fef2f2;
  border-color:#fecaca;
  color:#991b1b;
}

dialog{
  border:0;
  border-radius:12px;
  padding:24px;
  width:min(560px,94vw);
  box-shadow:0 20px 70px #0004;
}

dialog::backdrop{background:#0008}

.confirm-name{
  font-size:30px;
  font-weight:800;
  margin:12px 0;
}

.confirm-box{
  background:var(--navy-light);
  padding:18px;
  border-radius:10px;
  line-height:1.8;
  margin:14px 0;
}

.confirm-box strong{color:var(--navy)}

.modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:18px;
  flex-wrap:wrap;
}

.monitor-filters{
  margin:14px 0;
  padding:12px 14px;
  border:1px solid #d7dde5;
  border-radius:12px;
  background:#f8fafc;
}

.filter-row{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px;
  margin:8px 0;
}

.filter-label{
  min-width:90px;
  font-size:12px;
  text-transform:uppercase;
  font-weight:700;
  color:#64748b;
}

.filter-button{
  border:1px solid #cbd5e1;
  background:white;
  color:var(--navy);
  border-radius:999px;
  padding:8px 13px;
  font-size:13px;
  font-weight:700;
}

.filter-button.active{
  background:var(--navy);
  border-color:var(--navy);
  color:white;
}

.filter-button.overtime.active{
  background:var(--red);
  border-color:var(--red);
}

.action-buttons{
  display:flex;
  flex-wrap:wrap;
  gap:7px;
}

.pass-manager-dialog .suggestions{
  border-radius:8px;
  margin-top:4px;
}

.pass-manager-dialog .selected-student{
  font-weight:700;
  color:var(--navy);
}

.section-heading h2{margin-bottom:0}

.action-buttons button{white-space:nowrap}

.link{
  color:var(--navy);
  text-decoration:underline;
}

footer{
  padding:18px 22px;
  font-size:12px;
  color:var(--muted);
  display:flex;
  justify-content:space-between;
}

[hidden]{display:none!important}

@media(max-width:900px){
  .grid{grid-template-columns:1fr}
  header{flex-direction:column;align-items:flex-start}
  main{padding:12px}
}

@media(max-width:650px){
  .card{overflow-x:auto}
  .filter-label{width:100%}
  .modal-actions{flex-direction:column}
  .modal-actions button{width:100%}
}

/* Current academic period indicator */
.current-period-banner {
  background: #eef3fa;
  color: #17365d;
  border: 1px solid #cbd8e8;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.current-period-banner.active {
  background: #e8f0fa;
  border-color: #9bb7d8;
  color: #142e52;
}
.monitor-auth[hidden] { display: none; }

.student-with-photo {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.student-photo-frame {
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 2px solid #d5deea;
  border-radius: 50%;
  background: #edf2f7;
}

.student-photo-frame.has-photo {
  cursor: zoom-in;
}

.student-photo-frame:focus-visible {
  outline: 3px solid #2d6aa3;
  outline-offset: 2px;
}

.student-photo,
.student-photo-fallback {
  grid-area: 1 / 1;
}

.student-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.student-photo-fallback {
  color: #42566f;
  font-weight: 800;
  letter-spacing: .03em;
}

.student-photo-dialog {
  text-align: center;
  max-width: min(560px, calc(100vw - 32px));
}

.student-photo-dialog img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  margin: 12px auto;
  border-radius: 12px;
}

.student-photo-dialog strong {
  display: block;
  font-size: 1.25rem;
}

.student-photo-close {
  float: right;
}
