/* Adult Portal layout. Workbook artwork and learner viewers are not affected. */
.shell {grid-template-columns:245px minmax(0,1fr)}
.main,#portalContent,.stack,.panel,.filterbar,.field,.row,.row-actions,
.pw-panel,.pw-graph-grid,.pw-graph-card,.pw-table-wrap,.pw-grade-report {min-width:0;max-width:100%}
.stack {grid-template-columns:minmax(0,1fr)}
.panel,.page-head,.section-head,.row-title,.row-meta,.empty,.ybb-empty-prompt,
.account-name,.ybb-book>summary,.pw-drawer-body {overflow-wrap:anywhere}
.panel input,.panel select,.panel textarea,.modal input,.modal select {max-width:100%;box-sizing:border-box}
.portal-table-scroll,.pw-table-wrap,.pw-grade-report {max-width:100%;overflow-x:auto;overscroll-behavior-x:contain}
.portal-header-tools,#portalActionHome,#portalNotifications {display:flex;align-items:center;gap:10px;min-width:0}
.portal-header-tools {flex-wrap:wrap;justify-content:flex-end}
#portalMenuToggle,.portal-menu-heading,#portalCurrentSection {display:none}
.portal-menu-backdrop[hidden] {display:none}
.portal-menu-backdrop {position:fixed;inset:0;border:0;background:rgba(5,22,37,.58);z-index:3900}
.portal-overlay-open {overflow:hidden}
#viewTitle {scroll-margin-top:16px}
#viewTitle:focus {outline:none}
.history-filter-toggle {display:none}
.history-filter-options {display:block}
.history-filter-options>summary {list-style:none}
.history-filter-options>summary::-webkit-details-marker {display:none}
.history-filter-summary {font-size:14px;color:var(--muted);margin:10px 0;overflow-wrap:anywhere}
.history-applied-dates {font-weight:600}
.history-mobile-list {display:none}
.history-mobile-list article {border:1px solid var(--line);border-radius:12px;padding:16px;background:var(--surface);min-width:0;overflow-wrap:anywhere}
.history-card-head {display:flex;flex-wrap:wrap;align-items:center;gap:8px;justify-content:space-between}
.history-mobile-list time {font-size:14px;color:var(--muted)}
.history-mobile-list h3 {font-size:17px;line-height:1.4;margin:12px 0 4px}
.history-mobile-list p {margin:6px 0;font-size:16px;line-height:1.5}
.history-mobile-list summary {cursor:pointer;min-height:44px;display:flex;align-items:center;font-weight:700;color:var(--ink)}
.history-mobile-list dl {margin:0;display:grid;grid-template-columns:minmax(60px,.3fr) minmax(0,1fr);gap:8px}
.history-mobile-list dt {font-weight:700}.history-mobile-list dd {margin:0}
.modal-close,.pw-drawer-close {min-width:44px;min-height:44px;display:grid;place-items:center;color:var(--ink);background:var(--surface-soft);border-radius:8px}
.modal h2 {padding-right:38px}.modal-form {gap:12px}
.modal-copy,.modal-form label {font-size:16px;line-height:1.5}
.modal-form input {font-size:16px;min-height:44px}
.modal-backdrop {overflow-y:auto;overscroll-behavior:contain}
.modal,.pw-drawer {min-width:0;max-width:100%;overflow-y:auto;overscroll-behavior:contain;scroll-padding:20px}
.modal {max-height:90dvh}.pw-drawer {max-height:100dvh}
.modal :is(input,select,textarea),.pw-drawer :is(input,select,textarea) {scroll-margin:20px}
/* Wide settings tables keep whole words; narrow screens use the same values as cards. */
.effective-settings {min-width:0;max-width:100%;overflow-wrap:normal;word-break:normal}
.effective-settings .effective-table {min-width:1120px;table-layout:auto}
.effective-settings :is(th,td) {overflow-wrap:normal;word-break:normal}
.effective-settings .badge {white-space:normal;overflow-wrap:normal;word-break:normal}
.effective-cards {display:none}
.effective-card {border:1px solid var(--line);border-radius:12px;padding:16px;background:var(--surface);min-width:0}
.effective-card h3 {font-size:18px;line-height:1.4;margin:0 0 4px;overflow-wrap:anywhere}
.effective-workbook {font-size:16px;line-height:1.5;margin:0 0 14px;overflow-wrap:anywhere}
.effective-card dl {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin:0}
.effective-field {min-width:0;padding:12px;border:1px solid var(--line);border-radius:8px}
.effective-field.effective-active {background:var(--surface-soft);color:var(--ink)}
.effective-field.effective-stored {background:var(--surface);color:var(--muted)}
.effective-field dt {font-size:14px;font-weight:700;line-height:1.4;margin-bottom:6px;color:var(--ink)}
.effective-field dd {margin:0;font-size:16px;line-height:1.5;overflow-wrap:anywhere}
.effective-field .table-note {font-size:14px;line-height:1.4;margin-top:4px}
@media(max-width:1100px) {
 .effective-desktop-table {display:none}
 .effective-cards {display:grid;gap:14px}
}
@media(max-width:600px) {
 .effective-card dl {grid-template-columns:minmax(0,1fr)}
}
@media(max-width:1050px) and (min-width:761px) {
  .shell {grid-template-columns:190px minmax(0,1fr)}
}
@media(max-width:760px) {
  .topbar {padding:0}
  .topbar-inner {display:grid;grid-template-columns:minmax(0,1fr);gap:10px;padding:14px 16px;align-items:stretch}
  .brand {font-size:11px;letter-spacing:.4px}
  .product {font-size:18px;line-height:1.3;overflow-wrap:anywhere}
  .portal-header-tools {display:flex;flex-wrap:nowrap;justify-content:space-between;gap:12px}
  #portalActionHome:empty {display:none}
  #portalNotifications .top-link {font-size:14px;min-height:44px;max-width:100%;white-space:normal}
  #portalMenuToggle {display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:90px;min-height:44px}
  #portalCurrentSection {display:block;font-size:14px;color:#e3edf4;line-height:1.4}
  .shell {display:block;width:100%;min-width:0}
  #portalMenu {display:none}
  #portalMenu.is-open {display:block;position:fixed;z-index:4000;inset:var(--portal-visible-top,0px) auto auto 0;width:min(360px,calc(100% - 24px));height:var(--portal-visible-height,100dvh);max-height:100dvh;overflow-y:auto;overscroll-behavior:contain;padding:16px;padding-top:max(16px,env(safe-area-inset-top));padding-bottom:max(20px,env(safe-area-inset-bottom));box-shadow:8px 0 25px rgba(0,0,0,.25)}
  .portal-menu-heading {display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px}
  .portal-menu-heading h2 {font-size:20px;margin:0}
  #portalMenuClose {min-width:44px;min-height:44px;font-size:24px}
  #portalMenu .nav {grid-template-columns:minmax(0,1fr);gap:6px}
  #portalMenu .nav-item {font-size:16px;min-height:44px}
  #portalMenu .sidebar-note {display:none}
  #portalMenuActions {margin-top:20px;border-top:1px solid var(--line);padding-top:16px}
  #portalMenuActions .top-actions {display:grid;grid-template-columns:minmax(0,1fr);gap:10px;width:100%}
  #portalMenuActions .top-link {color:var(--ink);background:var(--surface-soft);border-color:var(--line);font-size:16px;white-space:normal}
  #portalMenuActions .ybb-theme {display:flex;justify-content:space-between;color:var(--ink);font-size:16px;padding:0}
  #portalMenuActions .ybb-theme select {background:var(--surface);color:var(--ink);max-width:150px;font-size:16px}
  .main {padding:18px 12px;padding-bottom:max(24px,env(safe-area-inset-bottom));width:100%}
  .panel {padding:16px}.stack {gap:16px}
  .page-head {display:flex;flex-direction:column;gap:12px;align-items:stretch}
  .page-sub {font-size:16px;line-height:1.5}.eyebrow {font-size:12px}
  .section-head {flex-wrap:wrap;align-items:flex-start}
  .section-head p,.row-meta,.help-grid p,.empty,.ybb-empty-prompt {font-size:14px;line-height:1.5}
  .field label,.field>span,.control-field>span {font-size:14px;line-height:1.4}
  .filterbar {display:grid;grid-template-columns:minmax(0,1fr);gap:14px}
  .filterbar .field {width:100%;min-width:0}
  .history-filter-toggle {display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:44px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;background:var(--surface-soft);color:var(--ink);cursor:pointer;font-weight:700}
  .history-filter-toggle:after {content:'+';font-size:20px}
  .history-filter-options[open]>.history-filter-toggle:after {content:'−'}
  .history-filter-options:not([open])>.history-filter-body {display:none}
  .history-filter-body {padding-top:16px}
  .ybb-history-paging {display:flex;flex-wrap:wrap;gap:12px;min-width:0}
  .history-filter-body .ybb-history-paging {display:grid;grid-template-columns:minmax(0,1fr);padding:14px}
  .ybb-history-paging>* {min-width:0;max-width:100%}
  .history-desktop-table {display:none}
  .history-mobile-list {display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
  .control-layout,.settings-grid,.scope-grid,.mode-choice {grid-template-columns:minmax(0,1fr)!important;min-width:0}
  .control-page-actions {gap:10px}.control-page-actions .btn {flex:1 1 120px}
  .controls-actions,.credential-buttons {display:grid;grid-template-columns:minmax(0,1fr);gap:12px}
  .controls-actions .btn,.credential-buttons .btn {width:100%;white-space:normal}
  .ybb-pager {flex-wrap:wrap;gap:10px;font-size:14px}
  .pw-tabs,.pw-filter-actions,.pw-graph-actions {flex-wrap:wrap;gap:10px}
  .pw-filter-grid {grid-template-columns:minmax(0,1fr)!important}
  .pw-graph-grid {grid-template-columns:minmax(0,1fr)!important}
  .pw-graph-card {min-width:0}.pw-graph-actions .btn {white-space:normal;flex:1 1 120px}
  .pw-dot-row,.pw-stacked-row {grid-template-columns:minmax(0,1fr) minmax(0,1fr) 44px;gap:8px}
  .pw-chart-row {grid-template-columns:minmax(75px,.8fr) minmax(0,1fr) 30px;gap:8px}
  .pw-dot-row>span,.pw-stacked-row>span,.pw-chart-label {white-space:normal;overflow-wrap:anywhere}
  .pw-donut-layout {grid-template-columns:minmax(0,1fr);gap:16px}
  .modal-copy,.modal-form label {font-size:16px!important}
  .modal-backdrop,.pw-drawer-backdrop {top:var(--portal-visible-top,0px);bottom:auto;height:var(--portal-visible-height,100dvh);padding:12px;align-items:flex-start}
  .modal-backdrop {place-items:start center}
  .modal,.pw-drawer {width:100%;max-width:100%;max-height:calc(var(--portal-visible-height,100dvh) - 24px);margin:0;padding:18px;overflow-y:auto}
  .pw-drawer-backdrop {justify-content:center}.pw-drawer {height:auto}
  .pw-drawer-head {gap:10px}.pw-drawer-head h2 {font-size:20px;overflow-wrap:anywhere}
  .pw-drawer-close {flex:0 0 44px}
}
@media print {
  .effective-desktop-table {display:none!important}
  .effective-cards {display:grid!important;gap:14px}
  .effective-card {break-inside:avoid}
  .portal-header-tools,.portal-menu-heading,.portal-menu-backdrop,#portalMenu,
  .history-filter-options,.history-filter-summary,.history-mobile-list {display:none!important}
  .history-desktop-table {display:block!important;overflow:visible!important}
  .history-table {min-width:0!important;width:100%!important;table-layout:fixed}
  .history-table td,.history-table th {overflow-wrap:anywhere}
  .shell {display:block}.main,.panel {width:100%;max-width:100%}
}
