:root{
  --bg:#f4f8ff;
  --card:#ffffff;
  --muted:#6b7a95;
  --text:#1e2a43;
  --line:#dbe6f5;
  --primary:#1976d2;
  --primary2:#125ca8;
  --accent-orange:#ef6c00;
  --accent-orange-2:#d75f00;
  --accent-green:#1f7a5a;
  --accent-green-2:#186247;
  --accent-red:#d84343;
  --accent-red-2:#b93434;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0;background:linear-gradient(180deg,#f7fbff 0%, #eef5ff 55%, #f8fbff 100%);color:var(--text);font-family:ui-sans-serif,system-ui,-apple-system,"Segoe UI",Roboto,Arial}
a{color:inherit;text-decoration:none}
.app-shell{min-height:100vh}
.container{max-width:980px;margin:0 auto;padding:16px}
.login-container{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
}
.login-container .card{
  width:min(420px,100%);
}
.topbar{position:sticky;top:0;z-index:10;backdrop-filter:saturate(140%) blur(8px);background:rgba(246,250,255,.88);border-bottom:1px solid var(--line);padding:12px 16px;display:flex;align-items:center;justify-content:space-between;gap:12px}
.topbar-title{font-weight:700}
.topbar-actions{display:flex;gap:8px;align-items:center}
.topbar-user-meta{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.btn{
  border:1px solid transparent;
  background:linear-gradient(180deg,var(--accent-green),var(--accent-green-2));
  color:#fff;
  padding:10px 12px;
  border-radius:12px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  cursor:pointer;
  transition:all .15s ease;
  box-shadow:0 3px 10px rgba(24,98,71,.22);
}
.btn.small{padding:6px 10px;border-radius:10px;font-size:12px}
.btn.primary{background:linear-gradient(180deg,var(--accent-orange),var(--accent-orange-2));box-shadow:0 3px 10px rgba(215,95,0,.25)}
.btn.ghost{background:linear-gradient(180deg,var(--primary),var(--primary2));box-shadow:0 3px 10px rgba(18,92,168,.22)}
.btn.info{background:linear-gradient(180deg,var(--primary),var(--primary2));box-shadow:0 3px 10px rgba(18,92,168,.22)}
.btn.success{background:linear-gradient(180deg,var(--accent-green),var(--accent-green-2));box-shadow:0 3px 10px rgba(24,98,71,.22)}
.btn.danger{background:linear-gradient(180deg,var(--accent-red),var(--accent-red-2));box-shadow:0 3px 10px rgba(185,52,52,.24)}
.btn:hover{transform:translateY(-1px);filter:saturate(1.04) brightness(1.02)}
.btn:disabled{opacity:.45;cursor:not-allowed}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:14px;box-shadow:0 6px 20px rgba(30,42,67,.06)}
.card.tappable{transition:transform .08s ease, border-color .08s ease}
.card.tappable:active{transform:scale(.99);border-color:rgba(59,130,246,.5)}
.card-title{font-weight:700;font-size:16px}
.card-sub{color:var(--muted);font-size:13px;margin-top:6px}
.grid{display:grid;grid-template-columns:1fr;gap:12px}
.grid2{display:grid;grid-template-columns:1fr;gap:10px}
@media (min-width:720px){.grid{grid-template-columns:1fr 1fr}.grid2{grid-template-columns:1fr 1fr}}
.muted{color:var(--muted)}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace}
.h1{margin:0 0 12px 0;font-size:20px}
.form .field{margin-bottom:10px}
.label{display:block;color:var(--muted);font-size:12px;margin-bottom:6px}
.input,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="url"],
input[type="email"],
input[type="search"],
select,
textarea{
  width:100%;
  border:1px solid #c9daf4;
  background:#fcfeff;
  color:var(--text);
  border-radius:14px;
  padding:8px 10px;
  outline:none;
  font-size:14px;
  line-height:1.35;
  transition:border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus{
  border-color:#6fa0ff;
  background:#fff;
  box-shadow:0 0 0 3px rgba(79,140,255,.15);
}
textarea{resize:vertical;min-height:76px}
input[type="radio"], input[type="checkbox"]{accent-color:var(--primary)}
.tri-radio > div{display:flex;flex-wrap:wrap;gap:12px 16px}
.tri-radio > div > div{display:flex;align-items:center}
.input.title-input{font-size:18px;font-weight:800;letter-spacing:.2px}
.input.combo{appearance:auto}
.editor-header{display:flex;align-items:flex-end;gap:12px;justify-content:space-between;margin-bottom:10px}
.editor-title{flex:1;min-width:240px}
.editor-status{width:170px}
.editor-status .input{padding:10px 12px}
.tox-tinymce{border-radius:16px !important; border:1px solid #cfdef3 !important; overflow:hidden; box-shadow:0 6px 20px rgba(30,42,67,.06)}
.tox .tox-toolbar, .tox .tox-toolbar__primary{background:#f6f9ff !important}
.tox .tox-statusbar{background:#f6f9ff !important; color:#6b7a95 !important}
.alert{margin:10px 0;padding:10px 12px;border:1px solid rgba(239,68,68,.35);background:rgba(239,68,68,.10);border-radius:12px}
.cards{margin-top:12px}
.handover-card{display:none}
.handover-head{display:flex;align-items:center;gap:10px}
.handover-title{font-weight:800;flex:1}
.badge{font-size:12px;padding:4px 8px;border-radius:999px;border:1px solid var(--line);color:var(--muted)}
.kv{margin-top:12px;border-top:1px dashed #d9e5f6;padding-top:12px;display:grid;grid-template-columns:1fr;gap:8px}
.kv.compact{gap:6px}
.kv .k{display:inline-block;min-width:96px;color:var(--muted)}
.kv .v{color:var(--text)}
.section{margin-top:12px;border-top:1px dashed #d9e5f6;padding-top:12px}
.section-title{font-weight:700;margin-bottom:6px}
.section-body{color:var(--text);opacity:.95;line-height:1.5}
.pager{position:sticky;bottom:12px;margin-top:16px;display:flex;align-items:center;justify-content:space-between;gap:10px;background:rgba(246,250,255,.92);border:1px solid var(--line);border-radius:16px;padding:10px 12px;backdrop-filter:saturate(140%) blur(8px)}
.pager-mid{color:var(--muted)}
.list{display:flex;flex-direction:column;gap:10px}
.course-tabs{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:12px}
.course-tab-btn{border:1px solid #c9daf4;background:#fff;color:var(--text);padding:8px 12px;border-radius:10px;cursor:pointer}
.course-tab-btn.is-active{background:linear-gradient(180deg,var(--primary),var(--primary2));color:#fff;border-color:transparent}
.course-tab-panel{display:none}
.course-tab-panel.is-active{display:flex;flex-direction:column;gap:10px}
.course-meta-tags{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.badge.badge-ok{background:rgba(34,197,94,.12);border-color:rgba(22,163,74,.35);color:#166534}
.badge.badge-warn{background:rgba(245,158,11,.14);border-color:rgba(217,119,6,.35);color:#92400e}
.badge.badge-muted{background:rgba(100,116,139,.12);border-color:rgba(100,116,139,.35);color:#334155}
.badge.badge-info{background:rgba(59,130,246,.12);border-color:rgba(37,99,235,.35);color:#1d4ed8}
.badge.badge-dept{background:rgba(20,184,166,.12);border-color:rgba(13,148,136,.35);color:#0f766e}
.badge.badge-pwd-on{background:rgba(239,68,68,.12);border-color:rgba(220,38,38,.35);color:#b91c1c}
.badge.badge-pwd-off{background:rgba(16,185,129,.12);border-color:rgba(5,150,105,.35);color:#047857}
.badge.badge-pwd-plain{background:rgba(124,58,237,.12);border-color:rgba(109,40,217,.35);color:#6d28d9}
.card-inactive-course{background:#f7f8fb;border-color:#d5d9e6;opacity:.82}
.card-inactive-course .card-title,.card-inactive-course .card-sub{color:#6b7280}
.card-inactive-course .inactive-actions .btn{filter:grayscale(1) opacity(.75);box-shadow:none}
.ratio{position:relative;width:100%;padding-top:56.25%}
.ratio iframe{position:absolute;inset:0;width:100%;height:100%;border:0;border-radius:12px}
.prose{line-height:1.65}
.form .card{margin-top:12px}
.upload-progress-box .progress-track{margin-top:10px;height:10px;border-radius:999px;background:rgba(255,255,255,.1);overflow:hidden}
.upload-progress-box .progress-bar{height:100%;width:0;background:linear-gradient(90deg,#22d3ee,#3b82f6)}
.media-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:10px}
.media-card{border:1px solid var(--line);border-radius:12px;overflow:hidden;background:#fff}
.media-card img{display:block;width:100%;height:150px;object-fit:cover;background:#edf4ff}
.media-meta{padding:10px}
.media-name{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.qr-modal-backdrop{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.45);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:1000;
  padding:16px;
}
.qr-modal-backdrop[hidden]{display:none !important}
.qr-modal-card{
  width:min(360px,100%);
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:0 10px 32px rgba(15,23,42,.22);
  padding:16px;
  text-align:center;
}
.qr-modal-title{font-weight:700;font-size:16px;word-break:break-word}
.qr-modal-image-wrap{margin-top:12px}
.qr-modal-image-wrap img{
  width:220px;
  height:220px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
}
.qr-modal-hint{color:var(--muted);font-size:12px;margin-top:10px}
.qr-modal-actions{margin-top:12px;display:flex;justify-content:center}
@media (max-width:640px){
  .topbar{
    align-items:flex-start;
    flex-direction:column;
  }
  .topbar-actions{
    width:100%;
    flex-wrap:wrap;
    gap:6px;
  }
  .btn{
    padding:8px 10px;
    border-radius:10px;
    font-size:13px;
    box-shadow:0 2px 8px rgba(24,98,71,.18);
  }
}
