/* Shared base: reset, typography, buttons, forms, cards, tables, overlays. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
}
img, video, iframe { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4, h5 { margin: 0; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1, h2 { color: var(--heading); text-wrap: balance; }
h1 { font-size: 24px; } h2 { font-size: 20px; } h3 { font-size: 16px; } h4 { font-size: 14px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 600; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Layout helpers */
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; max-width: none; margin: 0; padding-inline: 0; }
.row.between { justify-content: space-between; }
.row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); min-width: 0; }
.card.soft { background: var(--bg-2); }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 26px 0 14px; }
.section-title:first-child { margin-top: 0; }
.section-title h2 { font-size: 20px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--card); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer;
  white-space: nowrap; transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { background: var(--bg-2); }
.btn:focus-visible, .input:focus, .select:focus, .textarea:focus { outline: none; box-shadow: 0 0 0 3px rgba(200, 16, 46, .14); border-color: var(--primary); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn.white { background: #fff; border-color: #fff; color: var(--primary); }
.btn.white:hover { background: #fff5f6; }
.btn.success { background: var(--success); border-color: var(--success); color: #fff; }
.btn.navy { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.btn.navy:hover { background: var(--navy-600); }
.btn.soft { background: var(--primary-soft); border-color: transparent; color: var(--primary-700); }
.btn.soft:hover { background: var(--primary-soft-2); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-soft { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12px; border-radius: var(--radius-xs); }
.btn.lg { height: 46px; padding: 0 22px; font-size: 14px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 40px; padding: 0; }
.btn.sm.icon-only { width: 32px; }
.link { color: var(--primary); font-weight: 500; cursor: pointer; background: none; border: 0; padding: 0; display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.link:hover { text-decoration: underline; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 11px; color: var(--muted); }
.field .error { font-size: 11px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--card); transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8a99' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.input.sm, .select.sm { height: 36px; font-size: 13px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.input-icon .input { padding-left: 34px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track { width: 38px; height: 22px; border-radius: var(--pill); background: var(--switch-off); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(200, 16, 46, .2); }

/* Pills / badges */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--pill); font-size: 11px; font-weight: 600; background: var(--bg-2); color: var(--text-2); white-space: nowrap; text-transform: capitalize; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.plain::before { display: none; }
.pill.orange { background: var(--primary-soft); color: var(--primary-700); }
.pill.green { background: var(--success-soft); color: var(--success); }
.pill.red { background: var(--danger-soft); color: var(--danger); }
.pill.amber { background: var(--warning-soft); color: var(--warning); }
.pill.blue { background: var(--info-soft); color: var(--info); }
.pill.violet { background: var(--violet-soft); color: var(--violet); }
.pill.gray { background: var(--gray-soft); color: var(--muted); }
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--pill); background: var(--danger); color: #fff; font-size: 10px; font-weight: 600; }
.tag { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: var(--pill); background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; }

/* Avatar */
.avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: var(--primary); background: var(--primary-soft); overflow: hidden; letter-spacing: .02em; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 56px; height: 56px; font-size: 19px; }
.avatar.xl { width: 76px; height: 76px; font-size: 26px; }
.avatar.ring { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--primary); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--card); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* Progress */
.progress { height: 8px; border-radius: var(--pill); background: var(--track); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.progress.thin { height: 5px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding: 13px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; }
.table-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px; border-bottom: 1px solid var(--border); }
.table-toolbar .input-icon { flex: 1; min-width: 180px; max-width: 320px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.pager { display: flex; gap: 4px; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-user .meta { min-width: 0; }
.cell-user .meta .name { font-weight: 500; }
.cell-user .meta .sub { font-size: 12px; color: var(--muted); }

/* Empty state */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .icon-wrap { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; }
.empty .icon-wrap svg { width: 24px; height: 24px; }
.empty h4 { color: var(--text); margin-bottom: 4px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; padding: 11px 14px; font-weight: 600; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.seg { display: inline-flex; background: var(--bg-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; flex: none; }
.seg button.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

/* Overlays */
.overlay { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s ease; }
.modal { background: var(--card); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .18s ease; }
.modal.lg { max-width: 820px; }
.modal.sm { max-width: 420px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.overlay.drawer-wrap { justify-content: flex-end; padding: 0; }
.drawer { background: var(--card); width: 100%; max-width: 520px; height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: slide .2s ease; }
.drawer .modal-body { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--toast-bg); color: #fff; padding: 11px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13px; display: flex; align-items: center; gap: 8px; animation: pop .18s ease; max-width: 360px; }
.toast.success .icon { color: #4ade80; } .toast.error .icon { color: #f87171; }
.menu { position: absolute; z-index: 60; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 180px; padding: 6px; }
.menu button, .menu a { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; }
.menu button:hover, .menu a:hover { background: var(--bg-2); }

/* Uploader */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 22px; text-align: center; background: var(--surface-2); cursor: pointer; transition: border-color .15s, background .15s; color: var(--muted); }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .icon { width: 26px; height: 26px; color: var(--primary); margin: 0 auto 8px; }
.dropzone strong { color: var(--text); }
.file-list { display: flex; flex-direction: column; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); }
.file-item .ficon { width: 34px; height: 34px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: flex; align-items: center; justify-content: center; flex: none; }
.file-item .progress { margin-top: 5px; }
.image-pick { display: flex; align-items: center; gap: 12px; }
.image-pick .preview { width: 96px; height: 64px; border-radius: var(--radius-sm); background: var(--bg-2) center/cover no-repeat; border: 1px solid var(--border); flex: none; }

/* Stat / icon tiles */
.icon-tile { width: 42px; height: 42px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.icon-tile.green { background: var(--success-soft); color: var(--success); }
.icon-tile.blue { background: var(--info-soft); color: var(--info); }
.icon-tile.violet { background: var(--violet-soft); color: var(--violet); }
.icon-tile.amber { background: var(--warning-soft); color: var(--warning); }
.icon-tile svg { width: 20px; height: 20px; }

/* Course thumbnail placeholder */
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: linear-gradient(135deg, var(--pink-grad-1), var(--pink-grad-2)); color: var(--primary); display: flex; align-items: flex-end; padding: 14px; background-size: cover; background-position: center; }
.thumb::before, .thumb::after { content: ''; position: absolute; border-radius: 50%; background: rgba(255,255,255,.35); pointer-events: none; }
.thumb::before { width: 38%; aspect-ratio: 1; right: -8%; top: -16%; }
.thumb::after { width: 26%; aspect-ratio: 1; left: -6%; bottom: -14%; }
.thumb .thumb-title { display: none; }
.thumb .thumb-icon { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 34%; max-width: 74px; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; color: var(--primary); z-index: 1; }
.thumb .thumb-icon svg { width: 100%; height: 100%; stroke-width: 1.6; }
.thumb.has-img::before, .thumb.has-img::after { display: none; }
.thumb .tag { position: absolute; left: 12px; top: 12px; }
.thumb.has-img .thumb-title, .thumb.has-img .thumb-icon { display: none; }
.stars { display: inline-flex; align-items: center; gap: 4px; color: var(--text); font-weight: 600; font-size: 13px; }
.stars svg { width: 15px; height: 15px; fill: #f59e0b; stroke: #f59e0b; }
.stars .count { color: var(--muted); font-weight: 400; }

.demo-ribbon { position: fixed; left: 12px; bottom: 12px; z-index: 250; background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; padding: 7px 12px; border-radius: var(--pill); box-shadow: var(--shadow-lg); pointer-events: none; opacity: .92; }
.kbd { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; background: var(--card); }
.divider-v { width: 1px; align-self: stretch; background: var(--border); }
.note { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--note-warn-text); font-size: 12px; display: flex; gap: 8px; align-items: flex-start; }
.note.info { background: var(--info-soft); color: var(--note-info-text); }
.note .icon { margin-top: 1px; }
