/* =====================================================================
   Ximpli.Selaras Digital Academy · theme on top of Bootstrap 5.3
   Colours and shapes from the design package (assets/css/app.css).
   Rule: use Bootstrap classes first; add here only what Bootstrap can't do.
   ===================================================================== */

/* ---------- design tokens ---------- */
:root {
  --sx-navy: #0E2A47;
  --sx-navy-2: #1F3F63;
  --sx-amber: #F2A900;
  --sx-amber-soft: #FFF4D6;
  --sx-amber-ink: #6B4600;
  --sx-bg: #F5F6F3;
  --sx-line: #DDE1E6;
  --sx-line-2: #EEF0F2;
  --sx-ink: #1B2430;
  --sx-ink-2: #3B4654;
  --sx-ink-3: #5A6472;
  --sx-good-soft: #E7F3EC;
  --sx-good-ink: #1F5E3D;
  --sx-bad: #B42318;
  --sx-bad-soft: #FDECEA;
  --sx-bad-ink: #9A1B12;
  --sx-info-soft: #E6EEF7;
  --sx-info-ink: #1D4F86;

  /* Bootstrap variables mapped to the design */
  --bs-body-font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --bs-body-font-size: 0.9375rem;
  --bs-body-bg: var(--sx-bg);
  --bs-body-color: var(--sx-ink);
  --bs-secondary-color: var(--sx-ink-3);
  --bs-primary: #0E2A47;
  --bs-primary-rgb: 14, 42, 71;
  --bs-warning: #F2A900;
  --bs-warning-rgb: 242, 169, 0;
  --bs-link-color: #0E2A47;
  --bs-link-color-rgb: 14, 42, 71;
  --bs-link-hover-color: #1D5FA8;
  --bs-link-hover-color-rgb: 29, 95, 168;
  --bs-border-color: var(--sx-line);
  --bs-border-radius: 10px;
  --bs-border-radius-lg: 14px;
  --bs-focus-ring-color: rgba(29, 95, 168, .25);
}

h1, h2, h3, .h1, .h2, .h3 { color: var(--sx-navy); line-height: 1.2; }
h1, .h1 { font-size: 1.75rem; font-weight: 800; }
h2, .h2 { font-size: 1.2rem; font-weight: 700; }
h3, .h3 { font-size: 1rem; font-weight: 700; }
/* Bootstrap's h4-h6 are light and large; follow the design scale instead. */
h4, .h4 { font-size: 1.2rem; font-weight: 700; color: var(--sx-navy); line-height: 1.2; }
h5, .h5, h6, .h6 { font-size: 1rem; font-weight: 700; color: var(--sx-navy); line-height: 1.25; }
.small, small { font-size: .85rem; }
.text-navy { color: var(--sx-navy) !important; }
.mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; font-size: .8125rem; }

/* ---------- buttons ---------- */
.btn { --bs-btn-font-weight: 600; --bs-btn-padding-y: .55rem; --bs-btn-padding-x: 1.1rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; --bs-btn-padding-y: .3rem; --bs-btn-padding-x: .75rem; }
.btn-primary {
  --bs-btn-bg: #0E2A47; --bs-btn-border-color: #0E2A47;
  --bs-btn-hover-bg: #163B63; --bs-btn-hover-border-color: #163B63;
  --bs-btn-active-bg: #163B63; --bs-btn-active-border-color: #163B63;
  --bs-btn-disabled-bg: #0E2A47; --bs-btn-disabled-border-color: #0E2A47;
}
.btn-amber {
  --bs-btn-color: #0E2A47; --bs-btn-bg: #F2A900; --bs-btn-border-color: #F2A900;
  --bs-btn-hover-color: #0E2A47; --bs-btn-hover-bg: #E09D00; --bs-btn-hover-border-color: #E09D00;
  --bs-btn-active-color: #0E2A47; --bs-btn-active-bg: #E09D00;
  --bs-btn-disabled-color: #0E2A47; --bs-btn-disabled-bg: #F2A900; --bs-btn-disabled-border-color: #F2A900;
}
.btn-ghost {
  --bs-btn-color: #0E2A47; --bs-btn-bg: #fff; --bs-btn-border-color: #C9CFD6;
  --bs-btn-hover-color: #0E2A47; --bs-btn-hover-bg: var(--sx-line-2); --bs-btn-hover-border-color: #C9CFD6;
  --bs-btn-active-bg: var(--sx-line-2); --bs-btn-disabled-color: var(--sx-ink-3); --bs-btn-disabled-bg: #fff;
}

/* ---------- forms ---------- */
.form-label { font-size: .8125rem; font-weight: 600; color: var(--sx-ink-2); margin-bottom: .35rem; }
.form-control, .form-select { min-height: 44px; border-color: #C9CFD6; font-weight: 500; }
.form-control:focus, .form-select:focus { border-color: #1D5FA8; box-shadow: 0 0 0 .2rem rgba(29, 95, 168, .2); }
.form-check-input:checked { background-color: var(--sx-navy); border-color: var(--sx-navy); }
.form-text { font-size: .78rem; color: var(--sx-ink-3); }
.invalid-feedback { font-weight: 600; }

/* ---------- cards, chips, KPIs ---------- */
.card { --bs-card-bg: #fff; --bs-card-border-color: var(--sx-line); --bs-card-border-radius: 14px; }
/* Design: white surfaces on the light grey page (Bootstrap would use the page colour). */
.form-control, .form-select, .form-control:focus { background-color: #fff; }
.form-control:disabled, .form-select:disabled { background-color: var(--sx-line-2); }
.card-head { padding: 16px 20px; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--sx-line-2); }
.card-head h2 { margin: 0; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--sx-line-2); display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.list > li:last-child { border-bottom: 0; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap; background: var(--sx-line-2); color: var(--sx-ink-2); }
.chip-good { background: var(--sx-good-soft); color: var(--sx-good-ink); }
.chip-warn { background: var(--sx-amber-soft); color: var(--sx-amber-ink); }
.chip-bad { background: var(--sx-bad-soft); color: var(--sx-bad-ink); }
.chip-info { background: var(--sx-info-soft); color: var(--sx-info-ink); }
.chip-navy { background: var(--sx-navy); color: #fff; }
.kpi .label { font-size: .84rem; font-weight: 600; color: var(--sx-ink-2); }
.kpi .value { font-size: clamp(1rem, 4.3vw, 1.6rem); font-weight: 800; color: var(--sx-navy); font-variant-numeric: tabular-nums; }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand b { display: block; font-size: 1.05rem; font-weight: 800; color: var(--sx-navy); line-height: 1.1; }
.brand small { display: block; font-size: .78rem; font-weight: 600; color: var(--sx-ink-3); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--sx-line); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: var(--sx-ink-2); flex: none; }
.logo-box { width: 40px; height: 40px; border-radius: 10px; background: var(--sx-navy); color: var(--sx-amber); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; }

/* ---------- public layout ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--sx-line); }
.site-nav a { padding: .6rem .75rem; font-weight: 600; text-decoration: none; border-radius: 8px; }
.site-nav a[aria-current="page"] { background: var(--sx-line-2); }
.site-footer { background: #fff; border-top: 1px solid var(--sx-line); margin-top: 3rem; color: var(--sx-ink-3); font-size: .875rem; }
.site-footer a { color: var(--sx-ink-3); }

/* ---------- portal layout: sidebar + topbar ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 260px; flex: none; background: #fff; border-right: 1px solid var(--sx-line); padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.sidebar .who { padding: 6px 12px 14px; display: flex; gap: 10px; align-items: center; }
.sidebar .who b { display: block; font-size: .9rem; }
.sidebar .who small { display: block; font-size: .78rem; color: var(--sx-ink-3); }
.side-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 0 12px; border-radius: 10px; font-weight: 600; font-size: .9rem; text-decoration: none; color: var(--sx-ink-2); }
.side-link:hover { background: var(--sx-line-2); color: var(--sx-navy); }
.side-link[aria-current="page"] { background: var(--sx-navy); color: #fff; }
.side-group { font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sx-ink-3); padding: 14px 12px 4px; }
.sidebar.dark { background: var(--sx-navy); border-right-color: var(--sx-navy); }
.sidebar.dark .who b { color: #fff; }
.sidebar.dark .who small { color: #9FB3C8; }
.sidebar.dark .side-link { color: #D5DEE8; }
.sidebar.dark .side-link:hover { background: var(--sx-navy-2); color: #fff; }
.sidebar.dark .side-link[aria-current="page"] { background: var(--sx-amber); color: var(--sx-navy); }
.sidebar.dark .side-group { color: #8FA3B8; }
.sidebar.dark .logo-box { background: var(--sx-amber); color: var(--sx-navy); }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--sx-line); padding: 10px 24px; display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.app-content { padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1360px; width: 100%; }
.menu-toggle { display: none !important; }
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: auto; border-right: 0; border-bottom: 1px solid var(--sx-line); display: none; }
  .sidebar.open { display: flex; }
  .menu-toggle { display: inline-flex !important; }
  .app-content { padding: 16px; }
}

/* ---------- mobile staff layout ---------- */
.phone { max-width: 430px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.phone-head { background: var(--sx-navy); color: #fff; padding: 16px 20px; }
.phone-head h1 { color: #fff; font-size: 1.1rem; margin: 0; }
.phone-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 14px; }

/* ---------- toasts (api.js / ui.toast) ---------- */
.toast-area { position: fixed; right: 16px; bottom: 16px; z-index: 1090; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }

/* ---------- loading: grey bars while a box waits for its data ----------
   Blade: <ul id="list" data-loading></ul>   JS: ui.loading(el, false) when the data is in. */
[data-loading] { position: relative; min-height: 5.5rem; }
[data-loading] > * { visibility: hidden; }
[data-loading]::after {
  content: ''; position: absolute; inset: 16px; border-radius: 6px;
  background: linear-gradient(90deg, var(--sx-line-2) 25%, var(--sx-line) 50%, var(--sx-line-2) 75%);
  background-size: 200% 100%;
  -webkit-mask: repeating-linear-gradient(to bottom, #000 0 14px, transparent 14px 30px);
  mask: repeating-linear-gradient(to bottom, #000 0 14px, transparent 14px 30px);
  animation: sx-shimmer 1.2s linear infinite;
}
@keyframes sx-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* Busy button (ui.busy): spinner + text, not clickable */
.btn[aria-busy="true"] { cursor: progress; opacity: .85; }

/* Tabs that scroll sideways on phones instead of wrapping into several lines */
.tabs-scroll { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-scroll .nav-link { white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  [data-loading]::after { animation-duration: 4s; }
}

/* Partner storefront + directory (1e) */
.partner-hero { --partner-color: var(--sx-navy); background: linear-gradient(color-mix(in srgb, var(--partner-color) 88%, transparent), color-mix(in srgb, var(--partner-color) 88%, transparent)), var(--hero-image, none) center / cover, var(--partner-color); color: #fff; }
.partner-hero h1 { color: #fff; }
.partner-hero .hero-soft { color: #D5DEE8; }
.partner-logo { width: 56px; height: 56px; border-radius: 12px; background: #fff; color: var(--sx-navy); border: 1px solid var(--sx-line); font-weight: 800; display: inline-flex; align-items: center; justify-content: center; object-fit: contain; flex: none; }
.partner-logo-lg { width: 88px; height: 88px; border-radius: 16px; font-size: 1.8rem; border: 0; }
.partner-card { color: inherit; transition: border-color .15s; }
.partner-card:hover { border-color: var(--sx-navy-2); }
.avatar-lg { width: 48px; height: 48px; font-size: .95rem; object-fit: cover; }
.empty-note { padding: 1rem; border: 1px dashed var(--sx-line); border-radius: 12px; background: #fff; color: var(--sx-ink-3); margin: 0; }

/* Formatted-text editor <x-field.richtext> (2b) */
.richtext-toolbar { margin-bottom: .35rem; }
.richtext-toolbar .btn { min-height: 36px; min-width: 40px; }
.richtext-editor { min-height: 160px; max-height: 480px; overflow-y: auto; }
.richtext-editor:focus { border-color: #1D5FA8; box-shadow: 0 0 0 .2rem rgba(29, 95, 168, .2); outline: 0; }
.richtext-editor h3 { font-size: 1.15rem; }
.richtext-editor ul, .richtext-editor ol { padding-left: 1.4rem; }

/* Kurikulum (2b): drag-and-drop */
.drag-handle { cursor: grab; color: var(--sx-ink-3); user-select: none; padding: 0 .35rem; }
[draggable="true"].dragging { opacity: .45; }
.drop-before { box-shadow: 0 -3px 0 0 var(--sx-amber); }
.lesson-row { border-top: 1px solid var(--sx-line-2); }

/* Catalog and program page (2d) */
/* Program card = mockup .pcard: 120px coloured band (or the cover), chip bottom-left */
.program-card { position: relative; overflow: hidden; display: flex; flex-direction: column; }
.program-thumb { display: flex; align-items: flex-end; height: 120px; padding: 12px; background: var(--sx-navy) center / cover no-repeat; }
.program-card .card-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.program-card h3 { font-size: 1rem; margin: 0; }
.program-card h3 a { color: var(--sx-navy); }
.price { color: var(--sx-navy); font-weight: 800; font-size: 1.125rem; }
.steps { counter-reset: step; list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.steps li { counter-increment: step; background: #fff; border: 1px solid var(--sx-line); border-radius: 999px; padding: .3rem .8rem .3rem .35rem; font-size: .875rem; font-weight: 600; }
.steps li::before { content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--sx-navy); color: #fff; margin-right: .4rem; font-size: .75rem; }
.checklist { list-style: none; padding: 0; }
.checklist li { padding-left: 1.6rem; position: relative; margin-bottom: .35rem; }
.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--sx-good-ink); font-weight: 800; }
.richtext-view h3 { font-size: 1.2rem; margin-top: 1rem; }
.richtext-view ul, .richtext-view ol { padding-left: 1.4rem; }


/* Public pages: mockup layout helpers (2e design pass) */
.auto-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(var(--min, 260px), 100%), 1fr)); }
.public-section { margin-bottom: 40px; display: flex; flex-direction: column; gap: 16px; }
.public-section > h2, .public-section .section-head h2 { margin: 0; }
.hero-title { font-size: clamp(2rem, 5vw, 2.875rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.12; }
.hero-lead { font-size: 1.125rem; color: var(--sx-ink-2); max-width: 640px; }
.card-pad { padding: 20px; }
.on-dark { background: var(--sx-navy); border-color: var(--sx-navy); color: #fff; }
.on-dark h2 { color: #fff; }
.on-dark .form-label { color: #D5DEE8; }
.on-dark .text-secondary, .on-dark .muted { color: #D5DEE8 !important; }
.on-dark a { color: var(--sx-amber); }
.logo-tile { width: 56px; height: 56px; border-radius: 10px; color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; object-fit: contain; background: var(--sx-navy); }
img.logo-tile { background: #fff; border: 1px solid var(--sx-line); }

/* Storefront hero (design public/mitra.html): 88 px white logo tile on the partner colour */
.store-logo { width: 88px; height: 88px; border-radius: 14px; background: #fff; color: var(--sx-navy); font-size: 1.875rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none; object-fit: contain; }
.store-hero .hero-soft { color: #D5DEE8; }

/* Desainer template sertifikat (6a, M09-01): an A4-landscape canvas with draggable blocks */
.certificate-canvas { position: relative; width: 100%; aspect-ratio: 1754 / 1240; background: #fff; border: 1px solid var(--sx-line); border-radius: 8px; overflow: hidden; touch-action: none; }
.certificate-canvas > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.certificate-canvas-empty { position: absolute; inset: auto 8% 6% 8%; text-align: center; font-size: .8rem; color: var(--sx-ink-2); margin: 0; }
.certificate-block { position: absolute; transform: translate(-50%, -50%); cursor: grab; padding: 2px; border: 1px dashed transparent; line-height: 1.2; user-select: none; touch-action: none; }
.certificate-block:hover { border-color: var(--sx-line); }
.certificate-block.is-selected { border-color: var(--sx-amber); background: rgba(242, 169, 0, .08); }
.certificate-block:active { cursor: grabbing; }
.certificate-block > img { width: 100%; display: block; }
.certificate-block.is-qr { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; background: #EEF2F6; border: 1px solid var(--sx-line); border-radius: 4px; font-size: .7rem; color: var(--sx-ink-2); }
.certificate-block.is-signature { text-align: center; font-size: .7rem; color: var(--sx-ink-2); }
