/*
 * DevCode LMS styles: admin shell (resources/views/admin/), shared components and auth pages.
 * Arabic clone: right-to-left. Sidebar on the right, Assistant docked on the left, Tajawal font, no letter-spacing.
 */
:root {
  --h-bg: #F4F5F9;
  --h-card: #FFFFFF;
  --h-border: #E7E8F0;
  --h-line: #F0F1F6;
  --h-text: #1B1D2A;
  --h-text-2: #3D4157;
  --h-nav: #4B4F66;
  --h-muted: #8A8EA6;
  --h-faint: #A3A6BA;
  --h-accent: #5B4BDB;
  --h-accent-hover: #4A3CC4;
  --h-accent-soft: #EFEBFF;
  --h-nav-on: #EFEDFE;
  --h-green: #1F8F5F;   --h-green-soft: #E6F6EE;
  --h-red: #C9343C;     --h-red-soft: #FFE9EA;
  --h-amber: #B26B00;   --h-amber-soft: #FFF4E0;
  --h-blue: #1F6FD1;    --h-blue-soft: #E7F1FF;
  --h-neutral: #5E6278; --h-neutral-soft: #EEF0F6;
  --h-side-w: 236px;
  --h-drawer-w: 420px;
  --h-top-h: 68px;
  --h-radius: 16px;
  --h-radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.h-body {
  font-family: 'Tajawal', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
  background: var(--h-bg);
  color: var(--h-text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.h-body a { color: inherit; text-decoration: none; }
.h-body button { font-family: inherit; }
.ic { flex: none; }
.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; direction: ltr; unicode-bidi: isolate; }
.ic.flip { transform: scaleX(-1); }

/* ---------- shell ---------- */
.h-app { display: flex; min-height: 100vh; }
.h-side {
  width: var(--h-side-w); flex: none; background: var(--h-card); border-inline-end: 1px solid var(--h-border);
  display: flex; flex-direction: column; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 30;
}
.h-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.h-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none; position: relative;
  background: conic-gradient(from 210deg, #6C5CE7, #3DB2FF, #22C59A, #6C5CE7);
}
.h-mark::after { content: ""; position: absolute; inset: 9px; border-radius: 5px; background: #fff; }
.h-mark.has-logo { background: #fff; border: 1px solid var(--h-border); overflow: hidden; }
.h-mark.has-logo::after { display: none; }
.h-mark.has-logo img { width: 100%; height: 100%; object-fit: contain; }
.h-brand b { display: block; font-size: 16px; font-weight: 800; letter-spacing: 0; line-height: 1.25; }
.h-brand span { display: block; font-size: 11.5px; color: var(--h-muted); font-weight: 500; }
.h-navlabel { font-size: 11px; font-weight: 700; letter-spacing: 0; color: var(--h-faint); padding: 14px 10px 8px; text-transform: uppercase; }
.h-nav {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--h-nav); font-weight: 600; font-size: 14px; margin-bottom: 2px; transition: background .15s, color .15s;
}
.h-nav:hover { background: #F6F6FB; color: var(--h-text); }
.h-nav .ic { color: #9AA0B8; }
.h-nav.on { background: var(--h-nav-on); color: var(--h-accent); }
.h-nav.on .ic { color: var(--h-accent); }
.h-nav .pill { margin-inline-start: auto; font-size: 11px; background: #F1F2F7; color: #6B6F86; padding: 2px 8px; border-radius: 999px; }
.h-nav .pill.live { background: var(--h-red-soft); color: #D93A42; }
.h-me {
  margin-top: auto; display: flex; align-items: center; gap: 9px; padding: 12px 10px 12px 12px; border: 1px solid #EDEEF4;
  border-radius: 12px; position: relative;
}
.h-av { width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, #FFB86B, #FF7AA8); flex: none; }
.h-me b { display: block; font-size: 13px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-me span { display: block; font-size: 11.5px; color: var(--h-muted); }
.h-me .h-logout { margin-inline-start: auto; color: var(--h-faint); display: flex; padding: 3px; border-radius: 8px; background: none; border: 0; cursor: pointer; }
.h-me .h-logout:hover { color: var(--h-red); background: var(--h-red-soft); }
.h-powered { font-size: 11px; color: var(--h-faint); text-align: center; padding-top: 12px; }
.h-powered b { color: var(--h-muted); font-weight: 700; }

.h-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.h-top {
  height: var(--h-top-h); flex: none; display: flex; align-items: center; gap: 14px; padding: 0 28px;
  border-bottom: 1px solid var(--h-border); background: var(--h-card); position: sticky; top: 0; z-index: 20;
}
.h-top > div { flex: 0 0 auto; min-width: 0; }
.h-crumbs { font-size: 13px; color: var(--h-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-crumbs b { color: var(--h-text); font-weight: 700; }
.h-crumbs a:hover { color: var(--h-accent); }
.h-search {
  margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex: 0 1 250px; min-width: 120px; height: 38px;
  border: 1px solid var(--h-border); border-radius: 10px; padding: 0 12px; color: var(--h-faint); font-size: 13px; background: #fff;
}
.h-search input { border: 0; outline: 0; font: inherit; color: var(--h-text); width: 100%; background: transparent; }
.h-search input::placeholder { color: var(--h-faint); }
.h-search:focus-within { border-color: #B7ACFF; box-shadow: 0 0 0 3px var(--h-accent-soft); }
.h-iconbtn {
  width: 38px; height: 38px; border: 1px solid var(--h-border); border-radius: 10px; display: flex; align-items: center;
  justify-content: center; color: #6B6F86; background: #fff; cursor: pointer; flex: none;
}
.h-iconbtn:hover { color: var(--h-text); border-color: #D5D7E3; }
.h-askbtn {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 0;
  background: var(--h-text); color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; flex: none;
}
.h-askbtn .ic { color: #B8AEFF; }
.h-askbtn:hover { background: #2C2F44; }
.h-menu-btn { display: none; }
.h-content { flex: 1; padding: 24px 28px 40px; min-width: 0; }

/* ---------- page parts ---------- */
.card { background: var(--h-card); border: 1px solid var(--h-border); border-radius: var(--h-radius); }
.sect { padding: 18px 20px; }
.sect h3, .h-cardtitle { font-size: 14.5px; font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.sect h3 .r, .h-cardtitle .r { margin-inline-start: auto; font-size: 12px; color: var(--h-muted); font-weight: 600; }
.pagehead { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead h2 { font-size: 21px; font-weight: 800; letter-spacing: 0; margin: 0; }
.pagehead .actions { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.sub { font-size: 13px; color: var(--h-muted); font-weight: 500; }
.muted { color: var(--h-muted); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

/* stat cards */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { padding: 16px 18px; }
.stat .k { display: flex; align-items: center; justify-content: space-between; color: var(--h-muted); font-size: 12.5px; font-weight: 600; }
.stat .k .ic { color: #9AA0B8; }
.stat .v { font-size: 30px; font-weight: 800; letter-spacing: 0; margin-top: 8px; line-height: 1.2; }
.stat .v { white-space: nowrap; }
.stat .v .cur { font-size: 15px; font-weight: 700; color: var(--h-muted); margin-inline-start: 2px; }
.stat .d { font-size: 12px; font-weight: 600; color: var(--h-green); margin-top: 4px; }
.stat .d.n { color: var(--h-muted); }

/* horizontal bars */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: minmax(140px, 230px) 1fr auto; align-items: center; gap: 18px; font-size: 13.5px; }
.bar-row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; border-radius: 999px; background: #EEF0F6; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(270deg, #6C5CE7, #3DB2FF); }
.bar-row .val { font-weight: 800; min-width: 72px; text-align: end; }

/* buttons */
.btn, a.btn, button.btn {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; padding: 9px 16px; border-radius: 10px;
  border: 1px solid #E1E3EE; background: #fff; color: var(--h-text-2); cursor: pointer; line-height: 1.2; white-space: nowrap;
  font-family: inherit;
}
.btn:hover { border-color: #CFD2E0; color: var(--h-text); }
.btn.pri { background: var(--h-accent); border-color: var(--h-accent); color: #fff; }
.btn.pri:hover { background: var(--h-accent-hover); border-color: var(--h-accent-hover); }
.btn.dark { background: var(--h-text); border-color: var(--h-text); color: #fff; }
.btn.danger { color: var(--h-red); }
.btn.danger:hover { background: var(--h-red-soft); border-color: #F5C2C5; }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn.icon { padding: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* badges */
.bd { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.bd.g { color: var(--h-green); background: var(--h-green-soft); }
.bd.r { color: var(--h-red); background: var(--h-red-soft); }
.bd.y { color: var(--h-amber); background: var(--h-amber-soft); }
.bd.v { color: var(--h-accent); background: var(--h-accent-soft); }
.bd.b { color: var(--h-blue); background: var(--h-blue-soft); }
.bd.n { color: var(--h-neutral); background: var(--h-neutral-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th {
  color: var(--h-faint); font-size: 11px; letter-spacing: 0; text-align: start; font-weight: 700; padding: 0 0 10px; padding-inline-end: 12px;
  text-transform: uppercase; white-space: nowrap;
}
table.t td { padding: 12px 0; padding-inline-end: 12px; border-top: 1px solid var(--h-line); vertical-align: middle; }
table.t td.r, table.t th.r { text-align: end; }
table.t tr:hover td { background: #FBFBFE; }
table.t .strong { font-weight: 700; }
table.t .cell-title { display: flex; align-items: center; gap: 12px; min-width: 200px; }
table.t .thumb { width: 46px; height: 34px; border-radius: 8px; object-fit: cover; background: #EEF0F6; flex: none; }
table.t .who { display: flex; align-items: center; gap: 10px; }
table.t .who .h-av { width: 30px; height: 30px; font-size: 12px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* toolbar + filters */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--h-bg); border-radius: 10px; padding: 4px; gap: 4px; }
.seg a, .seg span { text-align: center; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 7px; color: #7C80A0; }
.seg .on { background: #fff; color: var(--h-text); box-shadow: 0 1px 3px rgba(20, 20, 40, .12); }

/* forms */
.lbl { font-size: 12px; font-weight: 700; color: #5E6278; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.lbl em { font-style: normal; color: #E5484D; }
.fld, .h-body input.fld, .h-body select.fld, .h-body textarea.fld {
  width: 100%; border: 1px solid #E1E3EE; border-radius: 10px; padding: 10px 12px; font-size: 13.5px; color: var(--h-text);
  background: #fff; min-height: 42px; line-height: 1.5; font-family: inherit; outline: 0;
}
.fld:focus { border-color: #B7ACFF; box-shadow: 0 0 0 3px var(--h-accent-soft); }
.fld.sm { min-height: 36px; padding: 7px 10px; font-size: 13px; }
.help { font-size: 12px; color: var(--h-muted); margin-top: 5px; }
.err { font-size: 12px; color: var(--h-red); margin-top: 5px; font-weight: 600; }
.field { margin-bottom: 14px; }
.toggle { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; padding: 8px 0; gap: 12px; }
.sw { width: 34px; height: 20px; border-radius: 999px; background: #D7DAE6; position: relative; flex: none; cursor: pointer; appearance: none; -webkit-appearance: none; border: 0; margin: 0; }
.sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: inset-inline-start .15s; }
.sw:checked, .sw.on { background: var(--h-accent); }
.sw:checked::after, .sw.on::after { inset-inline-start: 17px; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 9px 0; border-top: 1px solid var(--h-line); }
.kv:first-child { border-top: 0; }
.kv span { color: var(--h-muted); font-weight: 500; }
.kv b { font-weight: 700; text-align: end; }

/* settings tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--h-border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 700; font-size: 13.5px; color: var(--h-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--h-accent); border-bottom-color: var(--h-accent); }

/* flash + empty + pagination */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 13.5px; margin-bottom: 16px; }
.flash.ok { background: var(--h-green-soft); color: var(--h-green); }
.flash.bad { background: var(--h-red-soft); color: var(--h-red); }
.flash.info { background: var(--h-accent-soft); color: var(--h-accent); }
.empty { text-align: center; padding: 48px 20px; color: var(--h-muted); }
.empty .ic { color: #C4C7D6; margin-bottom: 10px; }
.empty b { display: block; color: var(--h-text); font-size: 15px; margin-bottom: 4px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; font-size: 12.5px; color: var(--h-muted); }
.pager .links { display: flex; gap: 6px; }
.pager .links a, .pager .links span { min-width: 32px; height: 32px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--h-border); border-radius: 8px; font-weight: 700; color: var(--h-text-2); background: #fff; }
.pager .links .on { background: var(--h-accent); border-color: var(--h-accent); color: #fff; }
.pager .links .off { opacity: .45; }

/* confirm dialog */
.h-dialog-back { position: fixed; inset: 0; background: rgba(27, 29, 42, .38); display: none; align-items: center; justify-content: center; z-index: 80; padding: 16px; }
.h-dialog-back.open { display: flex; }
.h-dialog { background: #fff; border-radius: 16px; width: 100%; max-width: 420px; padding: 22px; box-shadow: 0 24px 60px rgba(20, 20, 40, .2); }
.h-dialog h4 { margin: 0 0 6px; font-size: 16px; font-weight: 800; }
.h-dialog p { margin: 0 0 18px; color: var(--h-muted); font-size: 13.5px; }
.h-dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- assistant drawer ---------- */
.h-drawer {
  width: var(--h-drawer-w); flex: none; background: #fff; border-inline-start: 1px solid var(--h-border); display: none; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 40;
}
.h-app.ai-open .h-drawer { display: flex; }
.h-dh { height: var(--h-top-h); flex: none; display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid #EEEFF5; }
.h-orb { width: 34px; height: 34px; border-radius: 11px; background: linear-gradient(135deg, #6C5CE7, #3DB2FF); display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.h-dh > div { min-width: 0; }
.h-dh b { display: block; font-size: 15px; font-weight: 800; line-height: 1.3; }
.h-dh span { display: block; font-size: 11.5px; color: #22A06B; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-dh .new { margin-inline-start: auto; font-size: 12px; font-weight: 700; color: var(--h-accent); background: #F1EFFE; padding: 7px 12px; border-radius: 999px; border: 0; cursor: pointer; white-space: nowrap; flex: none; }
.h-dh .close { background: none; border: 0; color: var(--h-faint); cursor: pointer; display: flex; padding: 4px; border-radius: 8px; }
.h-dh .close:hover { color: var(--h-text); background: var(--h-bg); }
.h-dbody { flex: 1; overflow-y: auto; padding: 18px 18px 8px; display: flex; flex-direction: column; gap: 12px; }
.h-dbody .hello { margin: auto 0 0; color: var(--h-muted); font-size: 13px; text-align: center; padding: 20px 10px; }
.h-dbody .hello b { display: block; color: var(--h-text); font-size: 15px; margin-bottom: 4px; }
.msg { max-width: 88%; font-size: 13.3px; line-height: 1.6; padding: 11px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.u { align-self: flex-end; background: var(--h-accent); color: #fff; border-end-end-radius: 5px; }
.msg.a { align-self: flex-start; background: var(--h-bg); color: #25283A; border-end-start-radius: 5px; }
.msg.err { align-self: flex-start; background: var(--h-red-soft); color: var(--h-red); }
.tool { align-self: flex-start; display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 600; color: #7C80A0; padding: 2px; }
.tool i { width: 7px; height: 7px; border-radius: 50%; background: #22C59A; display: inline-block; }
.tool.run i { background: #F5B14C; animation: h-pulse 1s infinite; }
@keyframes h-pulse { 50% { opacity: .3; } }
.choices { align-self: stretch; display: flex; flex-direction: column; gap: 10px; background: #FBFAFF; border: 1px solid #ECE8FF; border-radius: 14px; padding: 12px 14px; }
.cg b { display: block; font-size: 11.5px; color: var(--h-muted); font-weight: 700; margin-bottom: 6px; letter-spacing: 0; }
.cg .row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 999px; border: 1px solid #D9D3FF; color: var(--h-accent); background: #fff; cursor: pointer; font-family: inherit; }
.chip.sel, .chip:hover { background: var(--h-accent); color: #fff; border-color: var(--h-accent); }
.h-dfoot { padding: 12px 18px 18px; border-top: 1px solid #EEEFF5; flex: none; }
.sugg { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.sugg button { font-size: 12px; font-weight: 600; color: var(--h-accent); background: #F1EFFE; padding: 6px 10px; border-radius: 999px; border: 0; cursor: pointer; font-family: inherit; }
.sugg button:hover { background: #E4DFFF; }
.inp { display: flex; align-items: center; gap: 10px; min-height: 46px; border: 1px solid #E1E3EE; border-radius: 12px; padding: 6px 6px 6px 14px; }
.inp:focus-within { border-color: #B7ACFF; box-shadow: 0 0 0 3px var(--h-accent-soft); }
.inp textarea { flex: 1; border: 0; outline: 0; resize: none; overflow: hidden; font: inherit; font-size: 13px; color: var(--h-text); max-height: 120px; background: transparent; padding: 6px 0; }
.inp textarea::placeholder { color: var(--h-faint); }
.inp .go { width: 34px; height: 34px; border-radius: 9px; background: var(--h-accent); color: #fff; display: flex; align-items: center; justify-content: center; border: 0; cursor: pointer; flex: none; }
.inp .go[disabled] { opacity: .5; cursor: default; }
.h-quota { font-size: 11px; color: var(--h-faint); margin-top: 8px; text-align: center; }
.ai-filled { border-color: #B7ACFF !important; box-shadow: 0 0 0 3px var(--h-accent-soft) !important; background: #FDFCFF !important; }
.sw.ai-filled { background: var(--h-accent) !important; border: 0 !important; }
.sw.ai-filled:not(:checked) { background: #D7DAE6 !important; }

/* ---------- auth pages ---------- */
.h-auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.h-auth .pane { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 96px); background: #fff; }
.h-auth .art { background: radial-gradient(1200px 600px at 20% 10%, #EFEBFF, transparent), linear-gradient(160deg, #F4F5F9, #E9ECF7); display: flex; align-items: center; justify-content: center; padding: 48px; }
.h-auth .box { max-width: 380px; width: 100%; }
.h-auth h1 { font-size: 26px; font-weight: 800; letter-spacing: 0; margin: 26px 0 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1440px) {
  :root { --h-drawer-w: 380px; }
}
@media (max-width: 1359px) {
  .h-app.ai-open .h-drawer { position: fixed; inset-inline-end: 0; top: 0; box-shadow: 18px 0 50px rgba(20, 20, 40, .12); }
}
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 991px) {
  .form-grid { grid-template-columns: 1fr !important; }
  .h-side { position: fixed; inset-inline-start: 0; top: 0; transform: translateX(100%); transition: transform .2s; box-shadow: -18px 0 50px rgba(20, 20, 40, .12); }
  .h-app.nav-open .h-side { transform: none; }
  .h-menu-btn { display: flex; }
  .h-top { padding: 0 16px; gap: 10px; }
  .h-search { display: none; }
  .h-top > a.h-iconbtn { margin-inline-start: auto; }
  .h-content { padding: 18px 16px 32px; }
  .h-auth { grid-template-columns: 1fr; }
  .h-auth .art { display: none; }
}
@media (max-width: 640px) {
  .h-askbtn .lbl-text { display: none; }
  .h-app.ai-open .h-drawer { width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .v { font-size: 24px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .bar { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- interactive lesson editor (admin/courses/_interactive_editor.blade.php, js/lesson-editor.js) ---------- */
.ie { border: 1px solid var(--h-border); border-radius: 14px; background: var(--h-card); padding: 14px 16px; margin-bottom: 14px; }
.ie[hidden], .ie [hidden] { display: none !important; }
.ie-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ie-title { font-size: 14px; font-weight: 800; }
.ie-count:empty { display: none; }
.ie-ai-btn { margin-inline-start: auto; }
.ie-ai-btn .ic { color: var(--h-accent); }
.ie-ai, .ie-paste { background: #FBFAFF; border: 1px solid #ECE8FF; border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.ie-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ie-ask { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--h-amber-soft); color: var(--h-amber); font-size: 13px; font-weight: 600; }
.ie-ask span { flex: 1 1 220px; }
.ie-note { padding: 9px 12px; border-radius: 10px; background: var(--h-green-soft); color: var(--h-green); font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.ie-note.bad { background: var(--h-red-soft); color: var(--h-red); }
.ie-error, .ie-card-err { white-space: pre-line; }
.ie-error:empty, .ie-card-err:empty, .ie-ai .err:empty, .ie-paste .err:empty { display: none; }
.ie-panel { border-radius: 12px; }
.ie-pass { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.ie-pass .lbl, .ie-pass .help { margin: 0; }
.ie .ie-pass .fld { width: 88px; }
.ie-list { display: flex; flex-direction: column; gap: 10px; }
.ie-card { border: 1px solid var(--h-border); border-radius: 12px; background: #FBFBFE; padding: 12px 14px; }
.ie-card.ie-bad { border-color: #F5C2C5; background: #FFFBFB; }
.ie-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ie-card-head b { font-size: 13px; font-weight: 800; }
.ie-tools { margin-inline-start: auto; display: flex; gap: 4px; flex: none; }
.ie-f { margin-top: 10px; }
.ie-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; border-radius: 10px; }
.ie-opt { display: flex; align-items: center; gap: 8px; }
.ie-opt input[type="radio"] { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--h-green); cursor: pointer; }
.ie .ie-opt .fld { flex: 1 1 auto; min-width: 0; width: auto; }
.ie .ie-opt .fld.ie-hint { flex: 0 1 170px; }
.ie .ie-opt.ok .fld:not(.ie-hint) { border-color: #9ED9BC; background: var(--h-green-soft); }
.ie-opts-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 2px; }
.ie-opts-foot .help { margin: 0; }
.ie-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.ie-around { gap: 10px; }
.ie-around .ie-f { margin-top: 10px; }
.ie-words { display: flex; flex-wrap: wrap; gap: 8px; border-radius: 10px; }
.ie-word { display: flex; flex-direction: column; gap: 5px; padding: 7px; border: 1px solid var(--h-border); border-radius: 10px; background: var(--h-card); min-width: 112px; }
.ie-word b { font-size: 16px; font-weight: 700; text-align: center; line-height: 1.5; }
.ie-word.on { border-color: #D9D3FF; background: var(--h-accent-soft); }
.ie-word.on b { color: var(--h-accent); }
.ie .ie-word .fld.sm { min-height: 32px; padding: 4px 8px; font-size: 12px; }
.ie-sample { font-size: 16px; line-height: 2; padding: 8px 12px; border-radius: 10px; background: var(--h-card); border: 1px dashed var(--h-border); }
.ie-sample mark { background: var(--h-accent-soft); color: var(--h-accent); border-radius: 6px; padding: 1px 8px; font-weight: 700; }
.ie-empty { text-align: center; color: var(--h-muted); font-size: 13px; padding: 18px 12px; border: 1px dashed var(--h-border); border-radius: 12px; }
.ie-empty.sm { width: 100%; padding: 10px; }
.ie-cards-bar { margin: 0 0 10px; }
.ie-cards { display: flex; flex-direction: column; gap: 2px; }
.ie-cards-head, .ie-cardrow { display: grid; grid-template-columns: 24px minmax(0, 1fr) minmax(0, 1.5fr) auto; grid-template-areas: "num front back tools" "err err err err"; gap: 0 8px; align-items: start; }
.ie-cards-head { font-size: 12px; font-weight: 700; color: #5E6278; padding: 0 8px 4px; }
.ie-cardrow { padding: 6px 8px; border-radius: 10px; }
.ie-cardrow.ie-bad { background: var(--h-red-soft); }
.ie-cardrow .ie-num { grid-area: num; }
.ie-cardrow .ie-front { grid-area: front; }
.ie-cardrow .ie-back { grid-area: back; resize: vertical; }
.ie-cardrow .ie-tools { grid-area: tools; padding-top: 4px; }
.ie-cardrow .ie-card-err { grid-area: err; }
.ie-num { font-size: 12px; font-weight: 800; color: var(--h-faint); padding-top: 11px; text-align: center; }
.ie .fld.ie-bad { border-color: var(--h-red); box-shadow: 0 0 0 3px var(--h-red-soft); }
.ie-opts.ie-bad, .ie-words.ie-bad { outline: 2px solid #F5C2C5; outline-offset: 4px; }
.ie-flash { animation: ie-flash 1.8s ease-out; }
@keyframes ie-flash { 0%, 35% { box-shadow: 0 0 0 4px #D9D3FF; background-color: #F7F5FF; } 100% { box-shadow: 0 0 0 0 transparent; } }
.btn.ie-busy::before { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-inline-end-color: transparent; border-radius: 50%; animation: ie-spin .7s linear infinite; flex: none; }
@keyframes ie-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .ie-flash, .btn.ie-busy::before { animation: none; }
}
@media (max-width: 640px) {
  .ie { padding: 12px; }
  .ie-card { padding: 10px; }
  .ie-opt { flex-wrap: wrap; }
  .ie .ie-opt .fld { flex-basis: calc(100% - 80px); }
  .ie .ie-opt .fld.ie-hint { flex: 1 1 100%; order: 3; margin-inline-start: 26px; }
  .ie-cards-head { display: none; }
  .ie-cardrow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "front tools" "back back" "err err"; gap: 6px 8px; }
  .ie-cardrow .ie-num { display: none; }
}

/* ---------- visitor statistics (admin/statistics.blade.php) ---------- */
.h-nav .pill.now { background: var(--h-green-soft); color: var(--h-green); }
.live-note { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--h-muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #22C59A; display: inline-block; animation: h-pulse 1.6s infinite; }
.live-note.stale .live-dot { background: var(--h-amber); animation: none; }
.cc { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10.5px; font-weight: 600; padding: 1px 5px; border-radius: 5px;
  background: var(--h-bg); color: var(--h-muted); margin-inline-end: 6px; direction: ltr; unicode-bidi: isolate; }
table.vis td { font-size: 13px; }
table.vis td:nth-child(2) { white-space: nowrap; }
.vis-sub { font-size: 12px; color: var(--h-muted); margin-top: 4px; white-space: nowrap; }
.vis-sub .mono { font-size: 11.5px; }
.vis-path { font-size: 12px; color: var(--h-accent); white-space: nowrap; }
.vis-ua { font-size: 12px; direction: ltr; unicode-bidi: isolate; white-space: nowrap; }
.dev { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dev .ic { color: #9AA0B8; }
.st-legend { display: inline-flex; align-items: center; gap: 6px; }
.st-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-inline-start: 8px; }
.st-legend i.p, .st-day i.p { background: var(--h-accent); }
.st-legend i.b, .st-day i.b { background: #D3D6E2; }
.st-days { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; align-items: end; }
.st-days.many { gap: 3px; }
.st-day .col { height: 150px; display: flex; flex-direction: column; justify-content: flex-end; border-bottom: 1px solid var(--h-line); }
.st-day i { display: block; min-height: 0; }
.st-day i.p { border-radius: 5px 5px 0 0; }
.st-day i.b:first-child, .st-day i.p + i.b { border-radius: 0; }
.st-day .lbl { display: block; text-align: center; font-size: 11.5px; color: var(--h-muted); margin-top: 6px; white-space: nowrap; overflow: hidden; }
.st-days.many .lbl { font-size: 10px; }
.st-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.st-top { display: flex; flex-direction: column; gap: 12px; }
.st-top .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 10px; align-items: center; font-size: 13.5px; }
.st-top .row .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-top .row .bar { grid-column: 1 / -1; height: 6px; }
@media (max-width: 640px) {
  .st-days.many .lbl, .st-day .lbl .dn { display: none; }
  .st-day .col { height: 110px; }
}

/* admin order page: refund rule check (admin/sales/show.blade.php) */
.refund-check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; font-size: 12.5px; margin: -4px 0 12px; line-height: 1.7; }
.refund-check.ok { background: var(--h-green-soft); color: var(--h-green); }
.refund-check.no { background: var(--h-amber-soft); color: var(--h-amber); }
.refund-check .ic { flex: none; margin-top: 3px; }
.refund-check div div { color: var(--h-muted); }
