/* ==========================================================================
   Wisdom Ledger — shared portal components (student / instructor / admin)
   Loaded after tutor.css. Page-specific rules go in portal-<module>.css.
   ========================================================================== */

/* Wider working area for our pages */
body.wl-portal .tutor-dashboard-page:has(.wl-page) { max-width: 1240px; padding: 28px 40px 64px; }

.wl-page { display: flex; flex-direction: column; gap: 28px; font-family: var(--tutor-font-family-body); color: #14213D; }
.wl-page a { text-decoration: none; }

/* Page heading row */
.wl-ph { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid #E3E1DA; }
.wl-ph-title { font-family: var(--tutor-font-family-heading); font-size: 30px; line-height: 1.05; letter-spacing: -.03em; font-weight: 600; color: #0B1E3B; margin: 0; }
.wl-ph-sub { margin: 8px 0 0; font-size: 14.5px; color: #7C8696; max-width: 60ch; }
.wl-ph-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* Layout helpers */
.wl-cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px 48px; align-items: start; }
.wl-cols.is-wide-aside { grid-template-columns: minmax(0, 1fr) 380px; }
.wl-cols.is-equal { grid-template-columns: 1fr 1fr; }
.wl-stack { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.wl-stack.is-tight { gap: 14px; }
.wl-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.wl-row.is-between { justify-content: space-between; }
.wl-aside { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 24px; }
.wl-aside section { display: flex; flex-direction: column; gap: 12px; }
.wl-aside section + section { border-top: 1px solid #E3E1DA; padding-top: 22px; }

/* Panels & cards */
.wl-panel { background: #fff; border: 1px solid #E3E1DA; border-radius: 14px; padding: 22px 24px; }
.wl-panel.is-cream { background: #FBFAF7; }
.wl-panel.is-navy { background: #0B1E3B; color: #fff; border-color: #0B1E3B; }
.wl-panel.is-navy .wl-label { color: #E9D9B5; }
.wl-panel.is-navy p { color: #B7C0D0; }
.wl-panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.wl-panel-head .wl-h4 { margin: 0; }
.wl-h4 { font-family: var(--tutor-font-family-heading); font-size: 18px; letter-spacing: -.015em; font-weight: 600; color: #0B1E3B; }
.wl-h3 { font-family: var(--tutor-font-family-heading); font-size: 22px; letter-spacing: -.02em; font-weight: 600; color: #0B1E3B; line-height: 1.2; }
.wl-page p { margin: 0; }
.wl-page .wl-body { color: #4A5567; line-height: 1.6; }
.wl-muted { color: #7C8696; }
.wl-note { font-size: 13px; color: #7C8696; line-height: 1.5; }

/* KPI cards */
.wl-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.wl-kpis.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wl-kpi { display: flex; flex-direction: column; gap: 6px; padding: 18px 20px; border: 1px solid #E3E1DA; border-radius: 12px; background: #fff; }
.wl-kpi strong { font-family: var(--tutor-font-family-heading); font-size: 30px; line-height: 1; letter-spacing: -.03em; color: #0B1E3B; }
.wl-kpi .wl-small { color: #7C8696; }
.wl-kpi.is-ok strong { color: #1F7A6D; }
.wl-kpi.is-warn strong { color: #8F6F27; }
.wl-kpi.is-bad strong { color: #A9412E; }
.wl-kpi-bar { height: 4px; border-radius: 2px; background: #EFECE4; overflow: hidden; margin-top: 4px; }
.wl-kpi-bar i { display: block; height: 100%; background: #1F7A6D; }

/* Pills (filters / segmented controls) */
.wl-pillbar { display: flex; flex-wrap: wrap; gap: 8px; }
.wl-page .wl-pillbtn, .wl-pillbar .wl-pillbtn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid #CFCCC2; background: #fff; font: inherit; font-size: 13.5px; font-weight: 600; color: #4A5567; cursor: pointer; text-decoration: none; }
.wl-pillbar .wl-pillbtn:hover { border-color: #0B1E3B; color: #0B1E3B; }
.wl-pillbar .wl-pillbtn[aria-pressed="true"] { background: #0B1E3B; border-color: #0B1E3B; color: #fff; }
.wl-pill-n { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12px; font-weight: 500; opacity: .75; }

/* Search */
.wl-search { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid #CFCCC2; border-radius: 10px; background: #fff; min-width: 260px; }
.wl-search input { border: 0; outline: 0; font: inherit; font-size: 14px; flex: 1; background: transparent; color: #14213D; }
.wl-search svg { color: #7C8696; flex: none; }

/* Tables (grid rows) */
.wl-table { border: 1px solid #E3E1DA; border-radius: 14px; overflow: hidden; background: #fff; }
.wl-tr { display: grid; gap: 14px; align-items: center; padding: 13px 20px; border-top: 1px solid #EEECE6; font-size: 14px; color: #14213D; }
.wl-tr:first-child { border-top: 0; }
.wl-tr.is-head { background: #FBFAF7; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: #7C8696; padding: 11px 20px; }
a.wl-tr:hover, .wl-tr.is-link:hover { background: #FBFAF7; }
.wl-tr .r { text-align: right; }
.wl-tr .wl-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 12.5px; color: #7C8696; }
.wl-tr.is-muted { color: #7C8696; }
.wl-empty { padding: 36px 20px; text-align: center; color: #7C8696; font-size: 14.5px; }
.wl-tfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid #EEECE6; font-size: 13px; color: #7C8696; }
.wl-pager { display: flex; gap: 4px; }
.wl-pager a, .wl-pager span { min-width: 30px; height: 30px; padding: 0 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; border: 1px solid transparent; color: #4A5567; }
.wl-pager a:hover { border-color: #CFCCC2; }
.wl-pager [aria-current="page"] { background: #0B1E3B; color: #fff; }

/* People */
.wl-person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.wl-person > span:last-child { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.wl-person b { font-weight: 600; color: #14213D; }
.wl-person small { font-size: 12.5px; color: #7C8696; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-avatar-ini { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #EFECE4; color: #4A5567; font-weight: 600; flex: none; }
.wl-avatar-ini.is-navy { background: #0B1E3B; color: #fff; }
.wl-avatar-ini.is-teal { background: #E6F2EF; color: #1F7A6D; }
.wl-avatar-ini.is-gold { background: #FBF5E6; color: #8F6F27; }

/* Progress bar inline */
.wl-prog { display: flex; align-items: center; gap: 10px; }
.wl-prog i { flex: 1; height: 5px; border-radius: 3px; background: #EFECE4; position: relative; overflow: hidden; }
.wl-prog i b { position: absolute; left: 0; top: 0; height: 100%; background: #B8923E; border-radius: 3px; }
.wl-prog i b.is-ok { background: #1F7A6D; }
.wl-prog span { font-size: 12.5px; width: 40px; text-align: right; font-variant-numeric: tabular-nums; }

/* Buttons inside portal pages */
.wl-page .wl-btn { text-decoration: none; }
.wl-btn-danger { background: #A9412E; color: #fff; }
.wl-btn-danger:hover { background: #8E3423; }
.wl-iconbtn { width: 36px; height: 36px; border-radius: 8px; border: 1px solid #E3E1DA; background: #fff; display: inline-flex; align-items: center; justify-content: center; color: #4A5567; cursor: pointer; }
.wl-iconbtn:hover { border-color: #0B1E3B; color: #0B1E3B; }

/* Forms inside portal */
.wl-page .wl-form { margin-top: 0; }
.wl-page label.wl-fieldset, .wl-page .wl-form > label { display: flex; flex-direction: column; gap: 7px; font-size: 14px; font-weight: 600; color: #4A5567; }
.wl-page .wl-field { width: 100%; min-height: 46px; padding: 0 14px; border: 1px solid #CFCCC2; border-radius: 10px; background: #fff; font: inherit; font-size: 15px; color: #14213D; }
.wl-page textarea.wl-field { padding: 12px 14px; min-height: 120px; line-height: 1.5; }
.wl-page .wl-field:focus { outline: none; border-color: #0B1E3B; box-shadow: 0 0 0 3px rgba(11, 30, 59, .08); }
.wl-toggle { position: relative; width: 40px; height: 22px; border-radius: 11px; background: #CFCCC2; border: 0; cursor: pointer; transition: background .2s; flex: none; }
.wl-toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; }
.wl-toggle[aria-pressed="true"] { background: #1F7A6D; }
.wl-toggle[aria-pressed="true"]::after { transform: translateX(18px); }
.wl-dropzone { border: 1px dashed #CFCCC2; border-radius: 12px; padding: 26px; text-align: center; color: #7C8696; font-size: 14px; background: #FBFAF7; }
.wl-dropzone.is-over { border-color: #0B1E3B; background: #F6F5F1; }
.wl-dropzone input { display: none; }
.wl-filelist { display: flex; flex-direction: column; gap: 8px; }
.wl-file { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #E3E1DA; border-radius: 10px; font-size: 14px; }
.wl-file .wl-mono { margin-left: auto; }

/* Tabs */
.wl-tabs { display: flex; border-bottom: 1px solid #E3E1DA; gap: 4px; }
.wl-tabs a, .wl-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 10px 16px 12px; font: inherit; font-size: 14.5px; font-weight: 600; color: #7C8696; cursor: pointer; text-decoration: none; }
.wl-tabs [aria-selected="true"], .wl-tabs .is-on { color: #0B1E3B; border-bottom-color: #0B1E3B; }

/* Definition lists */
.wl-page .wl-dl { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; font-size: 14px; }
.wl-page .wl-dl dt { color: #7C8696; }
.wl-page .wl-dl dd { margin: 0; text-align: right; color: #14213D; }

/* Timeline / log */
.wl-log { display: flex; flex-direction: column; }
.wl-log-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 16px; padding: 13px 4px; border-bottom: 1px solid #EEECE6; font-size: 14.5px; align-items: baseline; }
.wl-log-row .wl-small { color: #7C8696; }

/* Notices */
.wl-page .wl-notice { margin: 0; }
.wl-banner { display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px; border-radius: 12px; background: #FBF5E6; border: 1px solid #E9D9B5; color: #4A5567; font-size: 14.5px; }
.wl-banner.is-ok { background: rgba(31, 122, 109, .08); border-color: rgba(31, 122, 109, .3); }
.wl-banner.is-bad { background: rgba(169, 65, 46, .08); border-color: rgba(169, 65, 46, .3); }
.wl-banner .wl-icon { flex: none; color: #8F6F27; margin-top: 2px; }

/* Modals */
.wl-modal { position: fixed; inset: 0; z-index: 10000; background: rgba(8, 21, 43, .55); display: flex; align-items: center; justify-content: center; padding: 24px; }
.wl-modal[hidden] { display: none; }
.wl-modal-card { width: 100%; max-width: 600px; background: #fff; border-radius: 16px; box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .5); max-height: calc(100vh - 48px); display: flex; flex-direction: column; font-family: var(--tutor-font-family-body); color: #14213D; }
.wl-modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 22px 26px 16px; border-bottom: 1px solid #E3E1DA; }
.wl-modal-head .wl-small { margin-top: 4px; }
.wl-modal-x { border: 0; background: transparent; color: #7C8696; cursor: pointer; padding: 4px; border-radius: 6px; }
.wl-modal-x:hover { color: #0B1E3B; background: #F6F5F1; }
.wl-modal-body { padding: 20px 26px 24px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
.wl-modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.wl-modal.is-danger .wl-modal-head { border-bottom-color: rgba(169, 65, 46, .3); }

/* Sidebar role box (added by portal.js) */
.wl-rolebox { margin: 8px 10px 0; padding: 12px 12px 10px; border: 1px solid #E9D9B5; background: #FBF5E6; border-radius: 10px; display: flex; flex-direction: column; gap: 6px; }
.wl-rolebox .wl-label { color: #8F6F27; font-size: 11px; }
.wl-rolebox select { font: inherit; font-size: 13.5px; font-weight: 600; color: #14213D; border: 0; background: transparent; padding: 0; cursor: pointer; }

/* Certificate document */
.wl-cert { background: #FBF8F0; border: 1px solid #E3E1DA; border-radius: 14px; padding: 48px 56px; position: relative; color: #14213D; font-family: var(--tutor-font-family-body); }
.wl-cert::before { content: ""; position: absolute; inset: 14px; border: 1px solid #B8923E; border-radius: 8px; pointer-events: none; }
.wl-cert-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.wl-cert-title { font-family: var(--tutor-font-family-heading); font-size: 40px; letter-spacing: -.03em; color: #0B1E3B; margin: 36px 0 8px; }
.wl-cert-name { font-family: var(--tutor-font-family-heading); font-size: 34px; letter-spacing: -.02em; color: #8F6F27; margin: 14px 0; }
.wl-cert-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-top: 40px; padding-top: 20px; border-top: 1px solid #E3E1DA; font-size: 13px; color: #4A5567; }
.wl-cert .wl-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
@media print {
	body.wl-portal .tutor-dashboard-sidebar, body.wl-portal .tutor-dashboard-header, .wl-noprint, .wl-nav, .wl-footer { display: none !important; }
	body.wl-portal .tutor-dashboard-layout { display: block; }
	.wl-cert { border: 0; border-radius: 0; }
}

@media (max-width: 1100px) {
	.wl-cols, .wl-cols.is-wide-aside, .wl-cols.is-equal { grid-template-columns: 1fr; }
	.wl-aside { position: static; }
	.wl-kpis, .wl-kpis.is-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
	.wl-kpis, .wl-kpis.is-3 { grid-template-columns: 1fr; }
	.wl-ph { flex-direction: column; align-items: flex-start; }
	.wl-tr { grid-template-columns: 1fr !important; gap: 6px; }
	.wl-tr.is-head { display: none; }
	.wl-tr .r { text-align: left; }
}
