:root{
  --bg0:#f6f9ff;
  --bg1:#ffffff;
  --ink:#0b1220;
  --muted:#5b6b84;
  --card: rgba(255,255,255,.78);
  --cardBorder: rgba(12, 26, 54, .10);
  --shadow: 0 20px 60px rgba(12, 26, 54, .12);
  --primary:#183bff;
  --primary2:#6aa7ff;
  --onlineBg: rgba(24, 59, 255, .10);
  --onlineInk: #183bff;
  --onsiteBg: rgba(14, 165, 233, .10);
  --onsiteInk: #0891b2;
  --radius: 22px;
  --header-navy: #00247d;
  --content-offset-top: 20vh;
}

*{ box-sizing:border-box; }
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji";
  color:var(--ink);
  background:
    radial-gradient(1200px 700px at 10% -10%, rgba(24,59,255,.12), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(106,167,255,.18), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  min-height:100vh;
  display:flex;
  align-items:stretch;
}

.wrap{
  width:100%;
  max-width:1180px;
  margin:0 auto;
  padding:var(--content-offset-top) 28px 48px;
  display:flex;
  flex-direction:column;
  gap:28px;
  justify-content:flex-start;
}

header.app-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:28px;
  padding:56px 48px;
  border:1px solid rgba(255,255,255,.14);
  border-radius: var(--radius);
  background-color:var(--header-navy) !important;
  background-image:none !important;
  box-shadow: 0 16px 48px rgba(0, 36, 125, .4);
}

.brand{
  display:flex;
  align-items:center;
  gap:28px;
  min-width: 0;
}

.logo{
  width:148px;
  height:auto;
  display:block;
}

.brandText{
  display:flex;
  flex-direction:column;
  min-width:0;
}

.app-header .title{
  font-weight:800;
  letter-spacing:-0.02em;
  font-size:clamp(28px, 4.8vw, 46px);
  line-height:1.12;
  margin:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  color:#fff;
}

.app-header .subtitle{
  margin:12px 0 0;
  color:#fff;
  font-size:clamp(18px, 2.6vw, 26px);
  font-weight:500;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

button.modeBtn,
button.floorTab{
  flex:0 0 auto;
  min-width:0;
  box-shadow:none !important;
  background-image:none !important;
  filter:none;
}

button.modeBtn:not(.is-active){
  background: transparent !important;
  color: var(--muted) !important;
}

button.floorTab:not(.is-active){
  background: #fff !important;
  color: var(--ink) !important;
  border:1px solid rgba(12, 26, 54, .14);
}

button.modeBtn.is-active,
button.floorTab.is-active{
  background: var(--header-navy) !important;
  color:#fff !important;
  border-color: var(--header-navy);
  box-shadow: 0 10px 22px rgba(0, 36, 125, .22) !important;
}

.staffBadge{
  margin:0;
  width:fit-content;
  padding:8px 12px;
  border-radius:999px;
  background: rgba(0, 36, 125, .10);
  color: var(--header-navy);
  font-size:13px;
  font-weight:800;
  letter-spacing:.02em;
}

.dayNav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 18px;
  padding:10px 12px;
  border:1px solid rgba(12, 26, 54, .10);
  border-radius:16px;
  background: rgba(255,255,255,.9);
}

.dayNavCompact{
  margin:10px 0 0;
  max-width:320px;
  padding:8px 10px;
}

.dayNavCenter{
  flex:1;
  text-align:center;
  min-width:0;
}

.dayNavLabel{
  margin:0;
  font-size:18px;
  font-weight:900;
  letter-spacing:-0.02em;
}

.dayNavDate{
  margin:2px 0 0;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}

button.dayArrow{
  flex:0 0 auto;
  min-width:44px;
  width:44px;
  height:44px;
  padding:0;
  border-radius:12px;
  border:1px solid rgba(12, 26, 54, .14);
  background:#fff !important;
  color: var(--header-navy);
  font-size:28px;
  font-weight:700;
  line-height:1;
  box-shadow:none !important;
  background-image:none !important;
}

button.dayArrow:hover:not(:disabled){
  filter:none;
  border-color: rgba(0, 36, 125, .35);
}

button.dayArrow:disabled{
  opacity:.35;
  cursor:not-allowed;
}

.modeBtn{
  min-width:0;
  height:48px;
  padding:0 20px;
  border-radius:12px;
  border:0;
  font-weight:800;
  font-size:16px;
  letter-spacing:.01em;
  cursor:pointer;
}

.modeBtn:hover{
  filter:none;
  color: var(--ink);
}

.boardHeader{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:18px;
}

.boardTitle{
  margin:0;
  font-weight:900;
  font-size:clamp(20px, 2.8vw, 26px);
  letter-spacing:-0.02em;
}

.boardSub{
  margin:6px 0 0;
  color:var(--muted);
  font-weight:600;
  font-size:15px;
}

.boardHint{
  margin:0 0 16px;
  color:var(--muted);
  font-size:14px;
  font-weight:700;
}

.floorTabs{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-bottom:12px;
}

.floorTab{
  min-width:88px;
  height:48px;
  padding:0 18px;
  border-radius:12px;
  font-weight:800;
  font-size:16px;
  cursor:pointer;
}

.floorTab:hover{
  filter:none;
}

.board{
  min-height:120px;
}

.scheduleList{
  display:flex;
  flex-direction:column;
  border:1px solid rgba(12, 26, 54, .10);
  border-radius:16px;
  overflow:hidden;
  background: rgba(255,255,255,.95);
}

.scheduleHead,
.scheduleRow{
  display:grid;
  grid-template-columns: 10.5rem minmax(0, 1fr) 5.75rem;
  gap: 0 1.25rem;
  align-items:center;
  padding:16px 18px;
  box-sizing:border-box;
}

.scheduleHead{
  background: rgba(0, 36, 125, .06);
  color: var(--muted);
  font-size:12px;
  font-weight:800;
  letter-spacing:.06em;
  text-transform:uppercase;
  border-bottom:1px solid rgba(12, 26, 54, .08);
}

.scheduleRow{
  border-top:1px solid rgba(12, 26, 54, .08);
  min-height:64px;
}

.scheduleRow + .scheduleRow{
  border-top:1px solid rgba(12, 26, 54, .08);
}

.scheduleTime{
  color:var(--muted);
  font-weight:800;
  font-size:15px;
  line-height:1.3;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  font-variant-numeric: tabular-nums;
}

.scheduleName{
  font-size:clamp(15px, 1.8vw, 18px);
  font-weight:800;
  letter-spacing:-0.02em;
  line-height:1.35;
  min-width:0;
  overflow-wrap:anywhere;
  word-break:break-word;
}

.scheduleRoom{
  display:flex;
  justify-content:flex-end;
  align-items:center;
}

.scheduleRoomCode{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:88px;
  height:40px;
  padding:0 12px;
  border-radius:12px;
  background: var(--header-navy);
  color:#fff;
  font-weight:900;
  font-size:17px;
  letter-spacing:-0.02em;
  white-space:nowrap;
}

/* Legacy room-card styles kept for compatibility */
.roomGrid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap:14px;
}

.roomSection{
  border:1px solid rgba(12, 26, 54, .10);
  border-radius:16px;
  background: rgba(255,255,255,.9);
  overflow:hidden;
}

.roomHeading{
  padding:14px 16px 12px;
  background: linear-gradient(180deg, rgba(0,36,125,.08), rgba(0,36,125,.02));
  border-bottom:1px solid rgba(12, 26, 54, .08);
}

.roomCode{
  margin:0;
  font-size:28px;
  font-weight:900;
  letter-spacing:-0.03em;
  color: var(--header-navy);
  line-height:1.1;
}

.roomMeta{
  margin:4px 0 0;
  color:var(--muted);
  font-size:13px;
  font-weight:700;
}

.lessonList{
  display:flex;
  flex-direction:column;
}

.boardRow{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:12px;
  padding:14px 16px;
  border-top:1px solid rgba(12, 26, 54, .06);
}

.boardRow:first-child{
  border-top:0;
}

.boardName{
  font-size:18px;
  font-weight:800;
  letter-spacing:-0.01em;
  line-height:1.25;
  min-width:0;
}

.boardTime{
  flex:0 0 auto;
  white-space:nowrap;
  color:var(--muted);
  font-weight:800;
  font-size:15px;
}

.kv > div{
  min-width: min(100%, 220px);
}

main{
  display:grid;
  grid-template-columns: 1fr;
  gap:18px;
}

.panel{
  border:1px solid var(--cardBorder);
  border-radius: var(--radius);
  background: var(--card);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 40px rgba(12, 26, 54, .06);
  overflow:hidden;
}

.panelInner{
  padding:32px 36px;
}

.searchRow{
  display:flex;
  gap:16px;
  align-items:stretch;
  flex-wrap:wrap;
}

label{
  display:block;
  font-size:16px;
  color:var(--muted);
  margin-bottom:10px;
  font-weight:600;
  letter-spacing:.02em;
}

.field{
  flex: 1 1 320px;
  min-width: 240px;
}

input[type="text"]{
  width:100%;
  height:56px;
  padding:0 18px;
  border-radius: 14px;
  border: 1px solid rgba(12, 26, 54, .14);
  background: rgba(255,255,255,.9);
  color:var(--ink);
  outline: none;
  transition: box-shadow .2s ease, border-color .2s ease, transform .05s ease;
  font-size:18px;
}

input[type="text"]:focus{
  border-color: rgba(24, 59, 255, .45);
  box-shadow: 0 0 0 4px rgba(24, 59, 255, .15);
}

button{
  flex:0 0 auto;
  min-width: 180px;
  height:56px;
  padding:0 22px;
  border:0;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24,59,255,1), rgba(24,59,255,.9));
  color:#fff;
  font-weight:800;
  font-size:18px;
  letter-spacing:.01em;
  cursor:pointer;
  transition: transform .08s ease, filter .2s ease, box-shadow .2s ease;
  box-shadow: 0 14px 30px rgba(24,59,255,.25);
}

button:disabled{
  cursor:not-allowed;
  filter:saturate(.7);
  box-shadow:none;
  opacity:.75;
}

button:not(:disabled):hover{
  filter: brightness(1.04);
}

button:active{
  transform: translateY(1px);
}

.searchBtnWrap{
  flex:0 0 180px;
  min-width: 180px;
  margin-top: 26px;
}

.searchActions{
  display:flex;
  justify-content:flex-end;
  margin-top:4px;
  min-height:0;
}

button.btnRefresh{
  min-width:140px;
  height:48px;
  padding:0 18px;
  font-size:16px;
  font-weight:800;
  border-radius:14px;
  border:1px solid rgba(12, 26, 54, .16);
  background:rgba(255,255,255,.95);
  color:var(--ink);
  box-shadow:0 6px 18px rgba(12, 26, 54, .08);
}

button.btnRefresh:hover{
  filter:none;
  border-color:rgba(24, 59, 255, .35);
  box-shadow:0 8px 22px rgba(24, 59, 255, .12);
}

button.btnRefresh:active{
  transform:translateY(1px);
}

.results{
  display:flex;
  flex-direction:column;
  gap:16px;
  margin-top:20px;
}

.empty{
  padding:32px 22px;
  text-align:center;
  color:var(--muted);
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
  font-size:17px;
}

.empty .hint{
  font-weight:600;
  color: rgba(11, 18, 32, .7);
  font-size:18px;
}

.card{
  border:1px solid rgba(12, 26, 54, .10);
  background: rgba(255,255,255,.86);
  border-radius: 18px;
  padding:22px;
  transition: transform .12s ease, box-shadow .2s ease, border-color .2s ease;
  box-shadow: 0 10px 30px rgba(12, 26, 54, .06);
}

.card:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: rgba(24, 59, 255, .20);
}

.cardTop{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.cardTitle{
  font-weight:900;
  letter-spacing:-0.01em;
  font-size:18px;
  margin:0;
  line-height:1.3;
}

.cardTime{
  white-space:nowrap;
  color:var(--muted);
  font-weight:700;
  font-size:15px;
  margin-top:2px;
}

.metaRow{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
  margin-bottom:10px;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:8px;
  height:32px;
  padding:0 14px;
  border-radius: 999px;
  font-size:14px;
  font-weight:800;
  letter-spacing:.01em;
  border:1px solid rgba(12, 26, 54, .12);
  background: rgba(255,255,255,.6);
  color: rgba(11, 18, 32, .85);
}

.badge .dot{
  width:8px;
  height:8px;
  border-radius:99px;
  background: rgba(11,18,32,.35);
  box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}

.badge.online{
  background: var(--onlineBg);
  border-color: rgba(24, 59, 255, .22);
  color: var(--onlineInk);
}
.badge.online .dot{
  background: var(--onlineInk);
}

.badge.onsite{
  background: var(--onsiteBg);
  border-color: rgba(8, 145, 178, .22);
  color: var(--onsiteInk);
}
.badge.onsite .dot{
  background: var(--onsiteInk);
}

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

.kv .k{
  font-size:13px;
  color:var(--muted);
  font-weight:800;
  letter-spacing:.03em;
  text-transform:uppercase;
}
.kv .v{
  font-weight:900;
  letter-spacing:-0.01em;
  font-size:16px;
}

.loading{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
  padding:28px 22px;
  color:var(--muted);
  font-weight:700;
  font-size:17px;
}

.spinner{
  width:18px;
  height:18px;
  border-radius:999px;
  border:3px solid rgba(24,59,255,.18);
  border-top-color: rgba(24,59,255,.9);
  animation: spin .85s linear infinite;
}
@keyframes spin{
  from{ transform: rotate(0deg); }
  to{ transform: rotate(360deg); }
}

.srOnly{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}

@media (prefers-reduced-motion: reduce){
  *{ scroll-behavior:auto !important; }
  .card{ transition:none; }
  .spinner{ animation:none; }
  button{ transition:none; }
}

/* Modal (name disambiguation) */
.modalOverlay{
  position:fixed;
  inset:0;
  background: rgba(11,18,32,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:18px;
  z-index:50;
}

.modal{
  width:100%;
  max-width:520px;
  border-radius: 18px;
  border:1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 30px 90px rgba(11,18,32,.22);
  overflow:hidden;
}

.modalHeader{
  padding:16px 16px 10px;
  display:flex;
  flex-direction:column;
  gap:6px;
}

.modalTitle{
  font-weight:900;
  letter-spacing:-0.02em;
  font-size:19px;
  margin:0;
}

.modalSub{
  margin:0;
  color:var(--muted);
  font-size:15px;
  font-weight:700;
}

.modalBody{
  padding:8px 16px 16px;
  display:flex;
  flex-direction:column;
  gap:10px;
}

.choiceGrid{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.choiceBtn{
  width:100%;
  text-align:left;
  height:52px;
  padding:0 16px;
  border-radius: 14px;
  border:1px solid rgba(12, 26, 54, .14);
  background: rgba(255,255,255,.9);
  color:var(--ink);
  cursor:pointer;
  font-weight:900;
  font-size:17px;
  letter-spacing:-0.01em;
  transition: box-shadow .2s ease, border-color .2s ease, transform .05s ease;
}

.choiceBtn:hover{
  border-color: rgba(24, 59, 255, .35);
  box-shadow: 0 0 0 4px rgba(24, 59, 255, .12);
}

.modalActions{
  padding:0 16px 16px;
  display:flex;
  gap:10px;
  justify-content:flex-end;
}

.btnSecondary{
  height:52px;
  padding:0 16px;
  border-radius: 14px;
  border:1px solid rgba(12, 26, 54, .14);
  background: rgba(255,255,255,.7);
  color:var(--ink);
  cursor:pointer;
  font-weight:900;
  font-size:17px;
  letter-spacing:-0.01em;
}

.btnSecondary:hover{
  border-color: rgba(24, 59, 255, .35);
}

@media (max-width: 768px){
  :root{
    --content-offset-top: 16px;
    --radius: 18px;
  }

  .wrap{
    padding: max(16px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
    gap:14px;
  }

  header.app-header{
    padding:22px 18px;
    border-radius: 18px;
  }

  .brand{
    gap:14px;
    width:100%;
  }

  .logo{
    width:72px;
    flex:0 0 auto;
  }

  .app-header .title{
    font-size:22px;
    white-space:normal;
    overflow:visible;
    text-overflow:unset;
    line-height:1.2;
  }

  .app-header .subtitle{
    margin-top:6px;
    font-size:14px;
    white-space:normal;
    overflow:visible;
    text-overflow:unset;
    line-height:1.35;
    opacity:.92;
  }

  .modeSwitch{
    width:100%;
  }

  .modeBtn{
    flex:1 1 0;
    height:44px;
    font-size:14px;
    padding:0 10px;
  }

  .staffBadge{
    font-size:12px;
    padding:6px 10px;
  }

  .panelInner{
    padding:18px 16px;
  }

  .dayNav{
    margin-bottom:14px;
    padding:8px 10px;
    gap:8px;
    border-radius:14px;
  }

  .dayNavCompact{
    max-width:none;
    width:100%;
    margin-top:12px;
  }

  .dayNavLabel{
    font-size:16px;
  }

  .dayNavDate{
    font-size:12px;
  }

  button.dayArrow{
    width:40px;
    min-width:40px;
    height:40px;
    font-size:24px;
  }

  .searchRow{
    gap:10px;
  }

  .field{
    min-width: 0;
    flex: 1 1 100%;
  }

  label{
    font-size:14px;
    margin-bottom:8px;
  }

  input[type="text"]{
    height:50px;
    font-size:16px; /* avoids iOS zoom */
    border-radius:12px;
  }

  .searchBtnWrap{
    flex: 1 1 100%;
    min-width: 0;
    margin-top: 0;
  }

  .searchBtnWrap button{
    width:100%;
    min-width: 0;
    height:50px;
    font-size:16px;
  }

  .searchActions{
    margin-top:8px;
  }

  button.btnRefresh{
    width:100%;
    min-width:0;
    height:44px;
    font-size:15px;
  }

  .results{
    gap:12px;
    margin-top:16px;
  }

  .boardHeader{
    flex-direction:column;
    align-items:stretch;
    gap:12px;
    margin-bottom:14px;
  }

  .boardTitle{
    font-size:20px;
  }

  .boardHeader .btnRefresh{
    width:100%;
    order:3;
  }

  .floorTabs{
    gap:6px;
    margin-bottom:10px;
  }

  .floorTab{
    flex:1 1 0;
    min-width:0;
    height:44px;
    padding:0 8px;
    font-size:15px;
  }

  .boardHint{
    margin:0 0 12px;
    font-size:13px;
  }

  .scheduleList{
    border-radius:14px;
  }

  .scheduleHead{
    display:none;
  }

  .scheduleRow{
    display:grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "time room"
      "name name";
    gap: 8px 12px;
    padding:14px;
    align-items:start;
    min-height:0;
  }

  .scheduleTime{
    grid-area: time;
    white-space:normal;
    font-size:13px;
    line-height:1.3;
    padding-top:2px;
  }

  .scheduleName{
    grid-area: name;
    font-size:15px;
    font-weight:800;
    line-height:1.35;
  }

  .scheduleRoom{
    grid-area: room;
    justify-content:flex-end;
    align-items:flex-start;
  }

  .scheduleRoomCode{
    min-width:76px;
    height:36px;
    font-size:15px;
    padding:0 10px;
    border-radius:10px;
  }

  .roomGrid{
    grid-template-columns: 1fr;
  }

  .card{
    padding:16px;
    border-radius: 14px;
  }

  .cardTop{
    flex-direction:column;
    gap:6px;
    margin-bottom:10px;
  }

  .cardTitle{
    font-size:17px;
  }

  .cardTime{
    white-space:normal;
    font-size:14px;
  }

  .badge{
    height:30px;
    font-size:13px;
    padding:0 12px;
  }

  .kv{
    gap:10px 14px;
    flex-direction:column;
    align-items:stretch;
  }

  .kv > div{
    min-width:0;
  }

  .kv .v{
    font-size:15px;
  }

  .empty{
    padding:24px 12px;
    font-size:15px;
  }

  .empty .hint{
    font-size:16px;
  }

  .modalOverlay{
    padding:12px;
    align-items:flex-end;
  }

  .modal{
    border-radius: 16px 16px 12px 12px;
    max-width:100%;
  }

  .modalHeader{
    padding:14px 14px 8px;
  }

  .modalTitle{
    font-size:18px;
  }

  .modalSub{
    font-size:14px;
  }

  .modalBody{
    padding:6px 14px 14px;
  }

  .choiceBtn{
    height:50px;
    font-size:16px;
  }
}

@media (max-width: 420px){
  .wrap{
    padding: 12px 12px 24px;
    gap:12px;
  }

  header.app-header{
    padding:18px 14px;
  }

  .brand{
    gap:12px;
  }

  .logo{
    width:56px;
  }

  .app-header .title{
    font-size:19px;
  }

  .app-header .subtitle{
    font-size:13px;
  }

  .panelInner{
    padding:16px 14px;
  }

  .dayNavLabel{
    font-size:15px;
  }

  button.dayArrow{
    width:38px;
    min-width:38px;
    height:38px;
  }

  input[type="text"],
  .searchBtnWrap button,
  .choiceBtn,
  .btnSecondary{
    height:48px;
    font-size:16px;
  }

  .scheduleRow{
    padding:12px;
  }

  .scheduleName{
    font-size:14px;
  }

  .scheduleRoomCode{
    min-width:70px;
    height:34px;
    font-size:14px;
  }

  .modalActions{
    justify-content:stretch;
    padding:0 14px 14px;
  }

  .modalActions .btnSecondary{
    width:100%;
  }
}
