/* Portal layout */
.aam-app { display: flex; min-height: 100vh; }
.aam-sidebar { width: 268px; flex: none; background: var(--aam-primary); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.aam-sidebar-brand { padding: 18px 18px 12px; border-bottom: 1px solid rgba(255,255,255,.1); }
.aam-sidebar-brand .aam-logo, .aam-sidebar-brand .aam-logo-text strong { color: #fff !important; }
.aam-sidebar-brand .aam-logo-text small { color: rgba(255,255,255,.65); }
.aam-sidebar-brand .aam-logo-mark { background: rgba(255,255,255,.14); }
.aam-nav { display: flex; flex-direction: column; padding: 10px 12px; gap: 2px; flex: 1; }
.aam-nav-section { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.5); padding: 14px 10px 4px; }
.aam-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: rgba(255,255,255,.85) !important; font-size: 14px; font-weight: 500; }
.aam-nav a:hover { background: rgba(255,255,255,.08); color: #fff !important; }
.aam-nav a.active { background: rgba(255,255,255,.16); color: #fff !important; font-weight: 600; }
.aam-nav a .dashicons { opacity: .9; }
.aam-nav-badge { margin-inline-start: auto; background: var(--aam-accent); color: #fff; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; font-style: normal; }
.aam-sidebar-foot { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.aam-sidebar-foot a { color: rgba(255,255,255,.75) !important; display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.aam-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.aam-topbar { display: flex; align-items: center; gap: 14px; padding: 10px 24px; background: var(--aam-surface); border-bottom: 1px solid var(--aam-line); position: sticky; top: 0; z-index: 20; min-height: 62px; }
.aam-topbar-simple { justify-content: space-between; }
.aam-topbar-tools { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.aam-nav-toggle { display: none; }
.aam-program-switch { display: flex; align-items: center; gap: 8px; margin: 0; }
.aam-program-switch select { min-width: 260px; max-width: 420px; font-weight: 600; }
.aam-bell em { position: absolute; top: 2px; inset-inline-end: 2px; background: var(--aam-red); color: #fff; font-size: 10px; font-weight: 700; min-width: 17px; height: 17px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-style: normal; }
.aam-user { position: relative; }
.aam-user-btn { display: flex; align-items: center; gap: 10px; border: 0; background: transparent; cursor: pointer; font: inherit; padding: 4px 6px; border-radius: 10px; }
.aam-user-btn:hover { background: var(--aam-bg); }
.aam-user-name { display: flex; flex-direction: column; line-height: 1.25; text-align: start; }
.aam-user-name strong { font-size: 14px; }
.aam-user-name small { font-size: 12px; color: var(--aam-muted); }
.aam-dropdown { display: none; position: absolute; top: calc(100% + 6px); inset-inline-end: 0; background: #fff; border: 1px solid var(--aam-line); border-radius: 10px; box-shadow: var(--aam-shadow-lg); min-width: 220px; padding: 6px; z-index: 30; }
[data-dropdown].open .aam-dropdown { display: block; }
.aam-dropdown a { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 8px; font-size: 14px; }
.aam-dropdown a:hover { background: var(--aam-bg); }
.aam-content { padding: 24px; max-width: 1400px; width: 100%; }
.aam-page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.aam-page-head h1 { font-size: 22px; margin: 0; }
.aam-page-head p { margin: 4px 0 0; color: var(--aam-muted); font-size: 14px; }
.aam-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.aam-respondent .aam-content { margin: 0 auto; max-width: 900px; }

@media (max-width: 1000px) {
	.aam-sidebar { position: fixed; inset-inline-start: 0; top: 0; transform: translateX(var(--aam-hide, -100%)); transition: .2s; z-index: 50; }
	[dir="rtl"] .aam-sidebar { --aam-hide: 100%; }
	.aam-sidebar.open { transform: none; box-shadow: var(--aam-shadow-lg); }
	.aam-nav-toggle { display: inline-flex; }
	.aam-content { padding: 16px; }
	.aam-program-switch select { min-width: 160px; }
	.aam-user-name { display: none; }
}

/* Auth */
.aam-auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.aam-auth { width: 100%; max-width: 440px; }
.aam-auth-wide { max-width: 820px; }
.aam-auth-card { background: #fff; border-radius: 16px; box-shadow: var(--aam-shadow-lg); padding: 32px; }
.aam-auth-brand { display: flex; justify-content: center; margin-bottom: 16px; }
.aam-auth-card h1 { font-size: 20px; text-align: center; }
.aam-auth-card .aam-lang-switch { display: flex; width: max-content; margin: 0 auto 18px; }

/* Dashboard widgets */
.aam-phases { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 4px; margin-bottom: 8px; }
.aam-phase { padding: 10px 6px; border-radius: 8px; background: #eef1f5; text-align: center; font-size: 11.5px; line-height: 1.3; color: var(--aam-muted); position: relative; }
.aam-phase strong { display: block; font-size: 16px; margin-bottom: 2px; color: var(--aam-text); }
.aam-phase.done { background: #e4f5ee; color: #0d5c42; }
.aam-phase.active { background: var(--aam-primary); color: #fff; }
.aam-phase.active strong { color: #fff; }
@media (max-width: 900px) { .aam-phases { grid-template-columns: repeat(3, 1fr); } }
.aam-readiness { display: flex; flex-direction: column; gap: 12px; }
.aam-readiness-item { display: grid; grid-template-columns: 1fr 180px 60px; gap: 12px; align-items: center; font-size: 14px; }
.aam-readiness-item a { font-weight: 600; }
.aam-readiness-item small { display: block; color: var(--aam-muted); font-size: 12.5px; }
@media (max-width: 700px) { .aam-readiness-item { grid-template-columns: 1fr 100px 50px; } }
.aam-notif-list { list-style: none; margin: 0; padding: 0; }
.aam-notif-list li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--aam-line); align-items: flex-start; }
.aam-notif-list li.unread { font-weight: 600; }
.aam-notif-list li .dashicons { color: var(--aam-primary); margin-top: 3px; }
.aam-notif-list small { display: block; font-weight: 400; color: var(--aam-muted); font-size: 12px; }
.aam-timeline { list-style: none; margin: 0; padding: 0; }
.aam-timeline li { padding: 8px 0 8px 18px; border-inline-start: 2px solid var(--aam-line); position: relative; margin-inline-start: 6px; font-size: 13.5px; }
[dir="rtl"] .aam-timeline li { padding: 8px 18px 8px 0; }
.aam-timeline li::before { content: ""; position: absolute; inset-inline-start: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--aam-accent); }
.aam-timeline small { color: var(--aam-muted); display: block; font-size: 12px; }

/* Matrices */
.aam-matrix { font-size: 12.5px; }
.aam-matrix th, .aam-matrix td { text-align: center; padding: 6px 8px; }
.aam-matrix th:first-child, .aam-matrix td:first-child { text-align: start; white-space: nowrap; font-weight: 600; }
.aam-matrix .m-I { background: #e6f0fc; color: var(--aam-blue); font-weight: 700; }
.aam-matrix .m-P { background: #fff1e0; color: var(--aam-orange); font-weight: 700; }
.aam-matrix .m-M { background: #e4f5ee; color: var(--aam-green); font-weight: 700; }
.aam-matrix .m-x { background: var(--aam-primary-soft); color: var(--aam-primary); font-weight: 700; }
.aam-matrix-form td input[type="checkbox"] { width: 18px; height: 18px; }
.aam-matrix-form td select { min-height: 30px !important; padding: 2px 4px !important; font-size: 12px !important; width: 58px; }

/* Grades editor */
.aam-grades { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.aam-grade { text-align: center; border: 1px solid var(--aam-line); border-radius: 10px; padding: 8px 6px; background: #fafbfd; }
.aam-grade strong { display: block; font-size: 16px; }
.aam-grade input { text-align: center; margin: 6px 0 4px; }
.aam-grade small { color: var(--aam-muted); font-size: 12px; }
.aam-grade-total { font-weight: 700; margin-top: 10px; }

/* Standards tree */
.aam-standard { border: 1px solid var(--aam-line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.aam-standard-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fafbfd; font-weight: 600; }
.aam-standard-head .aam-progress { width: 140px; }
.aam-standard-item { display: grid; grid-template-columns: 70px 1fr 120px 110px 110px; gap: 10px; align-items: center; padding: 9px 16px; border-top: 1px solid var(--aam-line); font-size: 13.5px; }
.aam-standard-item code { font-size: 12px; color: var(--aam-primary); }
@media (max-width: 900px) { .aam-standard-item { grid-template-columns: 60px 1fr; } .aam-standard-item > :nth-child(n+3) { display: none; } }

/* Likert */
.aam-likert { display: flex; gap: 6px; flex-wrap: wrap; }
.aam-likert label { border: 1px solid var(--aam-line-strong); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.aam-likert label.checked, .aam-likert label:has(input:checked) { background: var(--aam-primary); color: #fff; border-color: var(--aam-primary); }
.aam-likert input { position: absolute; opacity: 0; width: 0; height: 0; }
.aam-survey-item { padding: 14px 0; border-bottom: 1px solid var(--aam-line); }
.aam-survey-item p { margin: 0 0 8px; font-weight: 600; }
.aam-token-box { display: flex; gap: 8px; align-items: center; background: #fafbfd; border: 1px dashed var(--aam-line-strong); padding: 8px 12px; border-radius: 8px; font-size: 13px; direction: ltr; }
.aam-token-box code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.is-copied { background: #e4f5ee !important; }

/* Kanban-ish task list */
.aam-task { display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--aam-line); font-size: 14px; }
.aam-task small { display: block; color: var(--aam-muted); font-size: 12.5px; }
.aam-task.overdue small.due { color: var(--aam-red); font-weight: 600; }
.aam-doc-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

/* Embedded in wp-admin */
.aam-admin-screen #wpcontent { padding-inline-start: 0; }
.aam-admin-screen .aam-app-embedded .aam-sidebar { display: none; }
.aam-admin-wrap { margin: 0; }
.aam-app-embedded .aam-content { max-width: none; }

/* Students module: wide statistics row editors */
.aam-rows-scroll { overflow-x: auto; }
.aam-rows-scroll .aam-rows-table { min-width: 1080px; }
.aam-rows-scroll .aam-rows-table input[type="number"] { min-width: 70px; padding-inline: 6px; text-align: center; }

/* Courses module: wide row editors (CLOs) */
.aam-rows-wide { min-width: 0; max-width: 100%; }
.aam-rows-wide .aam-rows { overflow-x: auto; }
.aam-rows-wide .aam-rows-table { min-width: 1500px; }
.aam-rows-wide .aam-rows-table textarea { min-width: 170px; }
.aam-rows-wide .aam-rows-table select[multiple] { min-width: 100px; }
.aam-clo-rows .aam-rows-table th:first-child, .aam-clo-rows .aam-rows-table td:first-child { display: none; }

/* Outcomes module: matrix totals row */
.aam-matrix tfoot td { background: #fafbfd; border-top: 2px solid var(--aam-line-strong); }

/* KPIs module */
.aam-kpi-edit input[type="number"] { width: 100%; min-width: 84px; text-align: center; }
.aam-kpi-edit td.aam-kpi-name, .aam-agg-table td.aam-kpi-name { min-width: 260px; vertical-align: middle; font-size: 13.5px; }

/* Surveys module */
.aam-likert { align-items: center; }
.aam-likert-end { font-size: 12.5px; color: var(--aam-muted); }
.aam-survey-form textarea { width: 100%; }
.aam-survey-axis { font-size: 15px; margin: 22px 0 0; padding: 8px 12px; background: var(--aam-primary-soft); border-radius: 8px; color: var(--aam-primary); }
.aam-survey-intro { margin: 0 0 10px; line-height: 1.8; }
.aam-survey-privacy { display: flex; gap: 6px; align-items: center; margin: 0 0 6px; }
.aam-survey-thanks .dashicons { color: var(--aam-green); }
.aam-dist { display: flex; height: 14px; min-width: 150px; border-radius: 7px; overflow: hidden; background: #eef1f5; }
.aam-dist span { display: block; height: 100%; }
.aam-dist-hi2 { background: var(--aam-green); }
.aam-dist-hi { background: #6cc3a2; }
.aam-dist-mid { background: #d9dee6; }
.aam-dist-lo { background: #eda79f; }
.aam-dist-lo2 { background: var(--aam-red); }
.aam-dist-text { display: block; margin-top: 3px; font-size: 11.5px; white-space: nowrap; direction: ltr; text-align: start; }
.aam-mini-progress { max-width: 120px; margin-top: 4px; }
.aam-comments { list-style: none; margin: 0; padding: 0; max-height: 520px; overflow: auto; }
.aam-comments li { padding: 10px 14px; margin-bottom: 8px; background: #fafbfd; border: 1px solid var(--aam-line); border-inline-start: 3px solid var(--aam-accent); border-radius: 8px; font-size: 14px; }
.aam-agg-table input[type="number"] { width: 100%; min-width: 64px; text-align: center; }
.aam-agg-yesno { display: flex; gap: 16px; flex-wrap: wrap; }
.aam-agg-yesno label { display: inline-flex; gap: 8px; align-items: center; font-weight: 400; }
.aam-agg-yesno input { width: 90px !important; }

/* Committees module */
.aam-prose { line-height: 1.9; font-size: 14.5px; overflow-wrap: anywhere; }
.aam-attendees { margin: 0; padding-inline-start: 22px; columns: 2; font-size: 14px; }
@media (max-width: 700px) { .aam-attendees { columns: 1; } }
.aam-print-only { display: none; }
.aam-signatures { justify-content: space-between; gap: 40px; margin-top: 60px; }
.aam-signatures div { flex: 1; border-top: 1px solid var(--aam-text); padding-top: 8px; text-align: center; font-size: 13px; }
@media print {
	.aam-print-only { display: block; }
	.aam-signatures.aam-print-only { display: flex; }
	.aam-tabs, .aam-inline-form { display: none !important; }
}

/* Evidence module */
.aam-evidence-links { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; }
.aam-evidence-links code { font-size: 12px; color: var(--aam-primary); }

/* Improvements module */
.aam-status-select { min-height: 32px !important; padding: 3px 8px !important; font-size: 13px !important; max-width: 150px; }
.aam-overdue { color: var(--aam-red); font-weight: 600; }
.aam-improve-progress { display: flex; align-items: center; gap: 12px; }
.aam-improve-progress .aam-progress { flex: 1; }

/* ---------- Module: cycles ---------- */
.aam-task-group { font-size: 14.5px; margin: 20px 0 4px; padding-bottom: 6px; border-bottom: 2px solid var(--aam-line); display: flex; align-items: center; gap: 8px; scroll-margin-top: 80px; }
.aam-task-group small { font-weight: 500; margin-inline-start: auto; }
.aam-task.is-done > div > a { color: var(--aam-muted); text-decoration: line-through; }
.aam-task > span:last-child { min-width: 96px; text-align: end; }
.aam-details { margin-top: 10px; }
.aam-details > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--aam-primary); padding: 4px 0; }
.aam-details[open] > summary { margin-bottom: 8px; }
@media (max-width: 700px) { .aam-task { grid-template-columns: 1fr auto; } .aam-task > span:last-child { grid-column: 1 / -1; text-align: start; } }

/* ---------- Module: selfstudy ---------- */
.aam-standard-head code { font-size: 13px; color: var(--aam-primary); background: var(--aam-primary-soft); padding: 2px 8px; border-radius: 6px; }
.aam-standard-title { flex: 1; min-width: 0; }
.aam-standard-item.overdue small.due { color: var(--aam-red); font-weight: 600; }
.aam-standard-assign { border-top: 1px solid var(--aam-line); padding: 8px 16px; background: #fafbfd; }
.aam-standard-assign > summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--aam-muted); }
.aam-standard-assign[open] > summary { margin-bottom: 10px; color: var(--aam-primary); }
.aam-standard-assign .aam-form-actions { margin-top: 10px; padding-top: 10px; }
.aam-ss-overall { display: inline-flex; align-items: center; min-width: 220px; }
.aam-data-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.aam-data-link { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--aam-line); border-radius: var(--aam-radius-sm); background: #fafbfd; font-size: 13.5px; }
.aam-data-link:hover { border-color: var(--aam-primary-line); background: var(--aam-primary-soft); }
.aam-data-link .dashicons { color: var(--aam-primary); margin-top: 2px; }
.aam-data-link strong { display: block; font-weight: 600; }
.aam-data-link small { display: block; color: var(--aam-muted); font-size: 12px; }
.aam-evidence-mini { margin: 0; padding-inline-start: 18px; }
.aam-sep { border: 0; border-top: 1px solid var(--aam-line); margin: 16px 0; }

/* ---------- Module: documents ---------- */
.aam-doc-gen-list { display: flex; flex-direction: column; }
.aam-doc-gen { display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(200px, 1fr) auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--aam-line); margin: 0; }
.aam-doc-gen:last-child { border-bottom: 0; }
.aam-doc-gen-title { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.aam-doc-gen-title .dashicons { color: var(--aam-primary); }
.aam-doc-gen-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 900px) { .aam-doc-gen { grid-template-columns: 1fr; } .aam-doc-gen-actions { justify-content: flex-start; } }
.aam-doc-frame { width: 100%; height: 75vh; min-height: 420px; border: 1px solid var(--aam-line-strong); border-radius: var(--aam-radius-sm); background: #e9edf1; display: block; }

/* ---------- Module: reports ---------- */
.aam-bars-target .aam-bar-track { position: relative; }
.aam-bar-target { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--aam-text); opacity: .75; }
.aam-bar-gray { background: var(--aam-gray); }

/* ---------- Module: users ---------- */
.aam-user-cell { display: flex; gap: 10px; align-items: center; }
.aam-perm-yes .dashicons { color: var(--aam-green); }

/* ---------- Module: settings ---------- */
.aam-app-body textarea.aam-code, .aam-admin-wrap textarea.aam-code { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 13px; line-height: 1.5; }
.aam-logo-preview { padding: 10px; border: 1px dashed var(--aam-line-strong); border-radius: var(--aam-radius-sm); background: #fafbfd; }
.aam-logo-preview img { max-height: 64px; width: auto; }
