@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: #F2F4F6;
  color: #191F28;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }

body.role-teacher .student-only { display: none !important; }
body.role-student  .teacher-only { display: none !important; }

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D6DB; border-radius: 99px; }
.no-scroll { -ms-overflow-style: none; scrollbar-width: none; }
.no-scroll::-webkit-scrollbar { display: none; }

/* ── SIDEBAR ──────────────────────────────────── */
.sidebar {
  width: 240px; background: #fff; border-right: 1px solid #ECEEF2;
  height: 100vh; position: sticky; top: 0; display: none;
  flex-direction: column; padding: 20px 12px; z-index: 40; flex-shrink: 0;
}
@media (min-width: 768px) { .sidebar { display: flex; } }
.sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 20px; border-bottom: 1px solid #F2F4F6; margin-bottom: 12px;
}
.sidebar-logo .logo-mark {
  width: 30px; height: 30px; border-radius: 9px; background: #3182F6;
  color: #fff; font-weight: 800; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.sidebar-logo h1 { font-size: 15px; font-weight: 700; color: #191F28; letter-spacing: -.3px; }
.sidebar nav { flex: 1; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  border-radius: 11px; font-size: 13.5px; font-weight: 500; color: #6B7684;
  text-decoration: none; transition: background .12s, color .12s;
}
.nav-item:hover { background: #F5F7FA; color: #191F28; }
.nav-item.is-active { background: #EEF5FF; color: #3182F6; font-weight: 600; }
.nav-icon { font-size: 18px; flex-shrink: 0; width: 20px; text-align: center; }
.nav-label { flex: 1; }
.nav-badge { background: #F04452; color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px; line-height: 1.6; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid #F2F4F6; display: flex; flex-direction: column; gap: 8px; }
.role-switch { display: flex; background: #F2F4F6; border-radius: 10px; padding: 3px; }
.role-btn { flex: 1; font-size: 12px; font-weight: 500; color: #8B95A1; padding: 6px 8px; border-radius: 8px; border: none; background: transparent; cursor: pointer; transition: all .15s; }
.role-btn.is-active { background: #fff; color: #191F28; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.profile-card { display: flex; align-items: center; gap: 10px; background: #F9FAFB; padding: 10px 12px; border-radius: 13px; border: 1px solid #ECEEF2; }
.profile-card img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.p-name { font-size: 13px; font-weight: 700; color: #191F28; }
.p-role { font-size: 11px; color: #8B95A1; margin-top: 1px; }

/* ── MOBILE NAV ───────────────────────────────── */
.mobile-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.96); backdrop-filter: blur(20px);
  border-top: 1px solid rgba(0,0,0,.06); z-index: 100;
  display: flex; justify-content: space-around; align-items: center;
  padding: 8px 0 calc(8px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 768px) { .mobile-nav { display: none; } }
.m-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 14px; font-size: 10px; font-weight: 500; color: #B0B8C1;
  text-decoration: none; border: none; background: none; cursor: pointer;
  transition: color .12s; -webkit-tap-highlight-color: transparent;
}
.m-nav-btn.is-active { color: #3182F6; }
.m-icon { font-size: 22px; position: relative; display: inline-flex; }
.m-dot { position: absolute; top: -1px; right: -3px; width: 7px; height: 7px; background: #F04452; border-radius: 50%; border: 1.5px solid #fff; animation: pulseDot 2s ease-in-out infinite; }
@keyframes pulseDot { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ── CARDS ────────────────────────────────────── */
.card { background: #fff; border-radius: 18px; border: 1px solid #ECEEF2; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-lg { background: #fff; border-radius: 22px; border: 1px solid #ECEEF2; box-shadow: 0 2px 12px rgba(0,0,0,.05); }

/* ── STAT WIDGETS ─────────────────────────────── */
.stat-widget {
  background: #fff; border-radius: 18px; border: 1px solid #ECEEF2;
  box-shadow: 0 1px 3px rgba(0,0,0,.04); padding: 18px 16px;
  cursor: pointer; text-decoration: none; display: block;
  transition: transform .15s, box-shadow .15s; -webkit-tap-highlight-color: transparent;
}
.stat-widget:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,.07); }
.stat-widget:active { transform: scale(.98); }
.stat-label { font-size: 12px; color: #8B95A1; font-weight: 500; margin-bottom: 8px; }
.stat-num   { font-size: 26px; font-weight: 800; color: #191F28; letter-spacing: -.5px; line-height: 1; }
.stat-num .u { font-size: 13px; font-weight: 500; color: #B0B8C1; margin-left: 2px; }

/* ── BUTTONS ──────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-family: inherit; font-weight: 700; border-radius: 13px;
  padding: 13px 20px; font-size: 15px; cursor: pointer; border: none;
  width: 100%; transition: background .12s, transform .1s, opacity .12s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-primary { background: #3182F6; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1B6CE8; }
.btn-dark { background: #191F28; color: #fff; }
.btn-dark:hover:not(:disabled) { background: #252D3A; }
.btn-ghost { background: #F5F7FA; color: #4E5968; border: 1px solid #ECEEF2; }
.btn-ghost:hover:not(:disabled) { background: #ECEEF2; }
.btn-danger { background: #FEECEE; color: #F04452; border: 1px solid #FFCDD0; }
.btn-danger:hover:not(:disabled) { background: #FFD6D9; }
.btn-sm { padding: 9px 15px; font-size: 13px; border-radius: 10px; gap: 5px; }

/* ── BADGES ───────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 7px; font-size: 11px; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.bd-blue   { background: #EEF5FF; color: #2172E5; }
.bd-mint   { background: #E6FBF2; color: #00A85A; }
.bd-red    { background: #FEECEE; color: #E0303D; }
.bd-yellow { background: #FFF4E0; color: #D97706; }
.bd-gray   { background: #F2F4F6; color: #6B7684; border: 1px solid #E5E8EB; }

/* ── INPUTS ───────────────────────────────────── */
.toss-input {
  width: 100%; background: #F7F8FA; border: 1.5px solid #ECEEF2;
  border-radius: 13px; padding: 12px 15px; font-size: 14px; color: #191F28;
  outline: none; transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-appearance: none;
}
.toss-input:focus { border-color: #3182F6; background: #fff; box-shadow: 0 0 0 3px rgba(49,130,246,.1); }
.toss-input::placeholder { color: #C0C7D0; }
.toss-input:disabled { opacity: .5; cursor: not-allowed; }
.toss-select { appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B95A1' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 38px; cursor: pointer; }

/* ── LIST ROWS ────────────────────────────────── */
.list-row {
  display: flex; align-items: center; gap: 13px; background: #fff;
  border-radius: 16px; border: 1px solid #ECEEF2; padding: 14px 16px;
  text-decoration: none; color: inherit; cursor: pointer;
  transition: background .12s, border-color .12s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.list-row:hover { background: #F9FAFB; border-color: #E0E3E8; }
.list-row:active { transform: scale(.99); }

/* ── ICON BOXES ───────────────────────────────── */
.ib { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 22px; }
.ib-blue   { background: #EEF5FF; color: #3182F6; }
.ib-red    { background: #FEECEE; color: #F04452; }
.ib-mint   { background: #E6FBF2; color: #00C471; }
.ib-yellow { background: #FFF4E0; color: #FF9F28; }
.ib-gray   { background: #F2F4F6; color: #6B7684; border: 1px solid #ECEEF2; }

/* ── PROGRESS ─────────────────────────────────── */
.prog-wrap { background: #ECEEF2; border-radius: 99px; overflow: hidden; }
.prog-bar  { border-radius: 99px; transition: width .7s cubic-bezier(.4,0,.2,1); }
.pb-blue   { background: linear-gradient(90deg, #3182F6, #5BA3FF); }
.pb-mint   { background: linear-gradient(90deg, #00C471, #2DE08A); }
.pb-yellow { background: linear-gradient(90deg, #FF9F28, #FFBE5E); }
.pb-red    { background: linear-gradient(90deg, #F04452, #FF6B76); }

/* ── TICKET ───────────────────────────────────── */
.ticket-card { display: flex; flex-direction: column; background: #fff; border-radius: 18px; border: 1px solid #ECEEF2; overflow: hidden; transition: box-shadow .15s; }
.ticket-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.07); }
@media (min-width: 580px) { .ticket-card { flex-direction: row; } }
.ticket-body { flex: 1; padding: 20px; }
.ticket-action { padding: 16px 20px; background: #F9FAFB; display: flex; flex-direction: column; align-items: stretch; justify-content: center; gap: 8px; }
@media (min-width: 580px) { .ticket-action { width: 130px; border-left: 1px dashed #E0E3E8; } }
@media (max-width: 579px) { .ticket-action { border-top: 1px dashed #E0E3E8; } }

/* ── CHAT ─────────────────────────────────────── */
.chat-bubble-in { background: #fff; border: 1px solid #ECEEF2; border-radius: 16px 16px 16px 4px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.chat-bubble-out { background: #3182F6; color: #fff; border-radius: 16px 16px 4px 16px; }

/* ── CALENDAR ─────────────────────────────────── */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: #ECEEF2; }
.cal-cell { background: #fff; min-height: 88px; padding: 7px 6px; display: flex; flex-direction: column; transition: background .1s; }
.cal-cell:hover { background: #FAFBFC; }
.cal-cell.other-month { opacity: .3; }
.cal-cell.is-today { background: #F0F7FF; }
.cal-today-num { width: 22px; height: 22px; border-radius: 50%; background: #3182F6; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.cal-num { font-size: 11px; font-weight: 500; color: #B0B8C1; }
.cal-num.sunday { color: #F04452; }
.ev { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; display: block; cursor: pointer; transition: opacity .1s; }
.ev:hover { opacity: .75; }
.ev-class    { background: #EEF5FF; color: #2172E5; }
.ev-deadline { background: #FEECEE; color: #E0303D; }
.ev-homework { background: #F2F4F6; color: #6B7684; }
.ev-today    { background: #3182F6; color: #fff; }
@media (min-width: 768px) { .cal-cell { min-height: 106px; } }

/* ── MODAL ────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(17,24,39,.5);
  backdrop-filter: blur(4px); z-index: 200; opacity: 0; pointer-events: none;
  transition: opacity .25s; display: flex; align-items: flex-end; justify-content: center;
}
@media (min-width: 640px) { #modal-overlay { align-items: center; padding: 20px; } }
#modal-overlay.is-open { opacity: 1; pointer-events: auto; }
.modal-sheet {
  width: 100%; max-width: 420px; background: #fff;
  border-radius: 24px 24px 0 0; overflow: hidden;
  transform: translateY(100%); transition: transform .32s cubic-bezier(.16,1,.3,1);
  display: flex; flex-direction: column; max-height: 92dvh;
}
@media (min-width: 640px) { .modal-sheet { border-radius: 24px; transform: translateY(12px) scale(.98); } }
#modal-overlay.is-open .modal-sheet.is-active { transform: translateY(0) scale(1); }
.modal-handle { width: 32px; height: 3px; background: #E0E3E8; border-radius: 99px; margin: 10px auto 0; flex-shrink: 0; }
@media (min-width: 640px) { .modal-handle { display: none; } }

/* ── TOGGLE BUTTONS ───────────────────────────── */
.stype-btn { cursor: pointer; border-radius: 10px; padding: 9px; font-size: 13px; font-weight: 600; transition: all .12s; border: 1.5px solid #ECEEF2; background: #F7F8FA; color: #8B95A1; -webkit-tap-highlight-color: transparent; }
.stype-btn:hover { border-color: #C5D0DC; color: #4E5968; }
.stype-btn.is-active { background: #EEF5FF; border-color: #3182F6; color: #3182F6; }

/* ── ANIMATIONS ───────────────────────────────── */
@keyframes fadeUp { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes toastIn { from { opacity:0; transform:translateY(8px) scale(.95); } to { opacity:1; transform:translateY(0) scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
.toast-pop { animation: toastIn .25s cubic-bezier(.16,1,.3,1) both; }
.page-in   { animation: fadeUp .22s cubic-bezier(.16,1,.3,1) both; }
.spin-icon { animation: spin .6s linear infinite; }


/* ───────────────────────────────────────────────
   UX RESTRUCTURE PASS — clean hierarchy
─────────────────────────────────────────────── */
:root{
  --lj-bg:#F5F6F8;
  --lj-card:#FFFFFF;
  --lj-line:#EDF0F3;
  --lj-text:#191F28;
  --lj-sub:#6B7684;
  --lj-muted:#9AA4B2;
  --lj-blue:#3182F6;
  --lj-blue-soft:#EEF5FF;
  --lj-shadow:0 10px 30px rgba(25,31,40,.055);
  --lj-shadow-soft:0 3px 12px rgba(25,31,40,.045);
}
body{ background:var(--lj-bg); }
main{ background:linear-gradient(180deg,#F7F8FA 0%,#F2F4F6 100%); }
.page-in{ max-width:1080px; }

.ux-hero{
  background:linear-gradient(135deg,#fff 0%,#F7FAFF 100%);
  border:1px solid rgba(49,130,246,.08);
  border-radius:30px;
  padding:28px;
  box-shadow:var(--lj-shadow);
  margin-bottom:24px;
  position:relative;
  overflow:hidden;
}
.ux-hero:after{
  content:""; position:absolute; right:-72px; top:-80px;
  width:210px; height:210px; border-radius:999px;
  background:rgba(49,130,246,.08);
  pointer-events:none;
}
.ux-kicker{ font-size:12px; font-weight:800; color:var(--lj-blue); margin-bottom:6px; }
.ux-title{ font-size:30px; line-height:1.18; letter-spacing:-.8px; font-weight:850; color:var(--lj-text); }
.ux-sub{ font-size:14px; color:var(--lj-sub); margin-top:8px; }
.ux-toolbar{ display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.ux-section{ margin-top:24px; }
.ux-section-head{ display:flex; justify-content:space-between; align-items:flex-end; gap:16px; margin-bottom:12px; }
.ux-section-title{ font-size:17px; font-weight:850; letter-spacing:-.2px; color:var(--lj-text); }
.ux-section-desc{ font-size:12px; color:var(--lj-muted); margin-top:2px; }
.ux-link{ font-size:13px; font-weight:750; color:var(--lj-sub); }
.ux-link:hover{ color:var(--lj-blue); }
.ux-grid-main{ display:grid; grid-template-columns:minmax(0,1.15fr) minmax(320px,.85fr); gap:18px; align-items:start; }

.card,.card-lg,.ticket-card,.list-row,.stat-widget,.profile-card,.auth-card{
  border:1px solid var(--lj-line) !important;
  box-shadow:var(--lj-shadow-soft);
}
.card,.card-lg{ border-radius:24px; }
.ticket-card,.list-row{ border-radius:20px; }
.stat-widget{
  border-radius:24px;
  padding:20px;
  background:#fff !important;
  position:relative;
  overflow:hidden;
}
.stat-widget:after{
  content:""; position:absolute; inset:auto -28px -34px auto;
  width:92px; height:92px; border-radius:999px; background:rgba(49,130,246,.06);
}
.stat-label{ color:var(--lj-sub); font-weight:750; }
.stat-num{ font-size:30px; letter-spacing:-1px; }
.list-row{ padding:16px; gap:14px; }
.list-row:hover{ transform:translateY(-1px); background:#fff; box-shadow:0 10px 24px rgba(25,31,40,.065); }
.ticket-card{ background:#fff; }
.ticket-body{ padding:22px; }
.ticket-action{ background:#FAFBFC; }
.ib{ border-radius:16px; }
.btn{ min-height:46px; border-radius:16px; }
.btn-sm{ min-height:40px; border-radius:14px; }
.toss-input{ background:#F8F9FB; border-color:#EDF0F3; border-radius:16px; min-height:44px; }
.badge{ border-radius:10px; padding:4px 10px; }
.sidebar{ width:252px; border-right:1px solid var(--lj-line); background:rgba(255,255,255,.92); backdrop-filter:blur(20px); }
.nav-item{ border-radius:14px; padding:11px 12px; font-weight:700; }
.nav-item.is-active{ background:#F0F6FF; }
.mobile-nav{ box-shadow:0 -8px 24px rgba(25,31,40,.06); }
.modal-sheet{ border-radius:28px 28px 0 0; }
@media (min-width:640px){ .modal-sheet{ border-radius:28px; } }

.ux-primary-action{
  background:#191F28 !important;
  color:#fff !important;
  border-color:#191F28 !important;
}
.ux-empty{
  background:#fff; border:1px dashed #DDE3EA; border-radius:24px;
  padding:34px 20px; text-align:center; color:var(--lj-muted);
}
.ux-empty i{ font-size:32px; display:block; margin-bottom:8px; opacity:.6; }
.ux-metric-strip{ display:grid; grid-template-columns:repeat(3,1fr); gap:12px; }
.ux-filter-card{ background:#fff; border:1px solid var(--lj-line); border-radius:24px; padding:14px; box-shadow:var(--lj-shadow-soft); }
.ux-list-card{ background:#fff; border:1px solid var(--lj-line); border-radius:26px; padding:14px; box-shadow:var(--lj-shadow-soft); }
.ux-list-card > .space-y-3, .ux-list-card > .space-y-2{ margin:0; }

@media (max-width:900px){
  .ux-grid-main{ grid-template-columns:1fr; }
  .ux-hero{ padding:24px 20px; border-radius:26px; }
  .ux-title{ font-size:26px; }
  .ux-metric-strip{ grid-template-columns:1fr; }
  .stat-widget{ padding:18px; }
}
@media (max-width:640px){
  .page-in{ padding-left:18px !important; padding-right:18px !important; }
  .ux-section-head{ align-items:flex-start; flex-direction:column; gap:8px; }
  .ux-toolbar{ width:100%; }
  .ux-toolbar .toss-input,.ux-toolbar .btn{ flex:1; }
}

/* ── ROLE-AWARE PAYMENT UI & MOBILE MODAL FIXES ───────────────── */
.pay-account-box,
.pay-account-detail {
  background: #F7F9FC;
  border: 1px solid #E5E8EB;
  border-radius: 18px;
  padding: 16px;
}
.pay-account-title {
  font-size: 13px;
  font-weight: 800;
  color: #191F28;
  margin-bottom: 12px;
}

@media (max-width: 639px) {
  #modal-overlay {
    align-items: flex-end;
    padding: 0;
    overflow: hidden;
  }
  .modal-sheet {
    width: 100%;
    max-width: none;
    max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 10px));
    border-radius: 22px 22px 0 0;
  }
  .modal-sheet > .p-6,
  .modal-sheet > div.p-6 {
    padding: 18px !important;
  }
  .modal-sheet .grid.grid-cols-2,
  .modal-sheet .grid.grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  .modal-sheet .flex.gap-2 {
    flex-wrap: wrap;
  }
  .modal-sheet .flex.gap-2 > .w-28 {
    width: 100% !important;
  }
  .modal-sheet input,
  .modal-sheet select,
  .modal-sheet textarea {
    font-size: 16px;
  }
  #pay-detail-actions .grid.grid-cols-3 {
    grid-template-columns: 1fr !important;
  }
  .ux-toolbar {
    width: 100%;
  }
  .ux-toolbar > * {
    width: 100% !important;
  }
}
