/* ============================================================
   WebEdu — bố cục WEB-APP (.edw-*): sidebar 240px + topbar + nội dung ≤ 1200px
   ============================================================ */
html, body { height: 100%; }
.edw-root { min-height: 100vh; }
.edw-shell { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
.edw-sidebar { width: 240px; flex: 0 0 240px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: width .2s var(--ease), flex-basis .2s var(--ease); z-index: 30; }
.is-collapsed .edw-sidebar { width: 72px; flex-basis: 72px; }
.edw-brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; position: relative; }
.edw-brand-logo { width: 36px; height: 36px; border-radius: 10px; object-fit: contain; flex: 0 0 auto; }
.edw-brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.edw-brand-name { font-weight: 800; font-size: var(--fs-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.is-collapsed .edw-brand-name, .is-collapsed .edw-nav-label, .is-collapsed .edw-child, .is-collapsed .edw-nav-badge { display: none; }
.edw-collapse { position: absolute; right: -12px; top: 22px; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--sh-1); }
.edw-nav { padding: 6px 10px; flex: 1 1 auto; overflow-y: auto; }
.edw-nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--r); color: var(--text-2); font-weight: 600; cursor: pointer; border: 0; background: transparent; width: 100%; text-align: left; margin-bottom: 2px; position: relative; transition: background .15s; }
.edw-nav-item:hover { background: var(--surface-3); color: var(--text-1); }
.edw-nav-item.is-active { background: var(--primary-soft); color: var(--primary); }
.edw-nav-item.is-active::before { content: ''; position: absolute; left: -10px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--primary); }
.edw-nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px; padding: 1px 7px; }
.is-collapsed .edw-nav-item { justify-content: center; padding: 11px 0; }
.edw-sidebar-foot { padding: 10px; border-top: 1px solid var(--border); }
.edw-child { padding: 6px 14px 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.edw-child-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 6px; }
.edw-child-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 1px solid transparent; background: transparent; padding: 6px; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.edw-child-item.is-on { background: var(--primary-soft); border-color: var(--primary-line); }
.edw-child-name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- topbar ---------- */
.edw-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.edw-topbar { height: 64px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.edw-burger { display: none; border: 0; background: transparent; color: var(--text-2); width: 40px; height: 40px; border-radius: 50%; align-items: center; justify-content: center; cursor: pointer; }
.edw-topbar-title { font-weight: 800; font-size: var(--fs-lg); }
.edw-topbar-spacer { flex: 1; }
.edw-top-btn { position: relative; width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--text-2); background: var(--surface-3); }
.edw-top-badge { position: absolute; top: -2px; right: -2px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 5px; min-width: 18px; text-align: center; }
.edw-user { display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 6px 8px 6px 6px; border-radius: 999px; position: relative; }
.edw-user:hover { background: var(--surface-3); }
.edw-user-name { font-weight: 700; font-size: var(--fs-sm); line-height: 1.2; }
.edw-user-role { font-size: 11px; color: var(--text-3); }
.edw-user-menu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--sh-3); min-width: 220px; padding: 6px; z-index: 40; }
.edw-user-menu a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--text-1); font-weight: 600; font-size: var(--fs-sm); }
.edw-user-menu a:hover { background: var(--surface-3); }

/* ---------- nội dung ---------- */
.edw-content { flex: 1 1 auto; padding: 24px; }
.edw-role, .edw-page { max-width: 1200px; margin: 0 auto; }
.edw-page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.edw-page-head .edu-h1 { margin: 0; }
.edw-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.edw-toolbar .edu-input { width: auto; min-width: 180px; }
/* minmax(0, …) + min-width 0: dòng chữ nowrap dài (thông báo, ghi chú…) không được kéo giãn cột → vỡ lưới, tràn ngang (màn Hôm nay GV 26/10) */
.edw-cols-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.edw-cols-3 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.edw-cols-2 > *, .edw-cols-3 > * { min-width: 0; }
.edw-split { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 20px; align-items: start; }
.edw-split-side { position: sticky; top: 84px; max-height: calc(100vh - 100px); overflow-y: auto; }
.edw-split-main { min-width: 0; }

/* ---------- bảng ---------- */
.edw-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; font-size: var(--fs-sm); }
.edw-table th { text-align: left; font-weight: 700; color: var(--text-3); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; padding: 12px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.edw-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.edw-table tr:last-child td { border-bottom: 0; }
.edw-table tr.is-clickable { cursor: pointer; }
.edw-table tr.is-clickable:hover td { background: var(--surface-2); }
.edw-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.edw-table-wrap { overflow-x: auto; }

/* ---------- màn auth (chưa đăng nhập) ---------- */
.is-guest .edw-content { padding: 0; }
.edw-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: radial-gradient(1200px 600px at 10% -10%, var(--primary-soft2), transparent), radial-gradient(900px 500px at 110% 110%, var(--primary-soft), transparent), var(--bg); background-size: cover; background-position: center; }
.edw-auth-login::before { content: ''; position: absolute; inset: 0; background: var(--overlay-deep); opacity: 0; }
.edw-auth-card { width: 100%; max-width: 440px; padding: 32px 30px 24px; position: relative; }
.edw-auth-logo { width: 60px; height: 60px; border-radius: 18px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: var(--sh-primary); margin-bottom: 14px; }
.edw-auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.edw-auth-brandlogo { width: 60px; height: 60px; border-radius: 16px; object-fit: contain; background: var(--surface-3); }
.edw-auth-title { font-size: var(--fs-xl); font-weight: 800; margin: 0 0 4px; letter-spacing: -.01em; }
.edw-auth-sub { color: var(--text-2); margin: 0 0 18px; line-height: 1.5; }
.edw-auth-welcome { color: var(--text-2); font-size: var(--fs-sm); margin: 0 0 14px; }
.edw-auth-change { font-size: var(--fs-xs); font-weight: 600; cursor: pointer; }
.edw-auth-roles { margin-bottom: 8px; }
.edw-auth-hint { font-size: var(--fs-xs); color: var(--text-3); margin: 0 2px 14px; }
.edw-auth-row { display: flex; justify-content: flex-end; margin: -6px 0 14px; font-size: var(--fs-sm); font-weight: 600; min-height: 18px; }
.edw-auth-row a { cursor: pointer; }
.edw-auth-register { text-align: center; margin-top: 16px; font-size: var(--fs-sm); color: var(--text-2); }
.edw-auth-register a { font-weight: 700; cursor: pointer; }
.edw-auth-foot { text-align: center; font-size: var(--fs-xs); color: var(--text-3); margin-top: 18px; }
.edw-auth-foot a { cursor: pointer; }
.edw-auth-back { margin: -8px 0 10px -8px; }
.edw-auth-recent { margin-top: 20px; }
.edw-auth-current-actions { display: flex; gap: 10px; margin-top: 12px; }
.edw-auth-current-actions .edu-btn { flex: 1; margin: 0; }

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .edw-sidebar { width: 72px; flex-basis: 72px; }
  .edw-brand-name, .edw-nav-label, .edw-child, .edw-nav-badge, .edw-collapse { display: none; }
  .edw-nav-item { justify-content: center; padding: 11px 0; }
  .edw-cols-3 { grid-template-columns: minmax(0, 1fr); }
  .edw-split { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .edw-sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; flex-basis: 260px; transform: translateX(-100%); transition: transform .22s var(--ease); height: 100vh; }
  .is-nav-open .edw-sidebar { transform: none; }
  .edw-brand-name, .edw-nav-label, .edw-child, .edw-nav-badge { display: block; }
  .edw-nav-item { justify-content: flex-start; padding: 11px 12px; }
  .edw-nav-badge { display: inline-block; }
  .edw-backdrop { position: fixed; inset: 0; background: var(--overlay); z-index: 25; }
  .edw-burger { display: flex; }
  .edw-topbar { padding: 0 14px; height: 56px; }
  .edw-user-text { display: none; }
  .edw-content { padding: 14px; }
  .edw-cols-2, .edw-split { grid-template-columns: minmax(0, 1fr); }
  .edw-split-side { position: static; max-height: none; }
  .edu-grid-3, .edu-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .edw-auth-card { padding: 24px 20px; }
}
