/* Shared type scale. rem follows browser text preferences; layout may reflow. */
/* Fluid 14–16px at the usual browser default, with relative bounds so user
   font preferences still scale it. Never use zoom/transform to shrink UI. */
html { font-size:clamp(87.5%,calc(.825rem + .2vw),100%); -webkit-text-size-adjust:100%; text-size-adjust:100%; }
:root { --type-caption:.75rem; --type-control:.875rem; }
.brand-version,.brand-sub,.sidebar-version,.nav-group-title,.nav-section,
.user-class,.hc-school,.hc-status,.stat-chip-lbl,.stat-mini-label,.stat-lbl,
.form-hint,.field-hint,.custom-hint,.pwd-strength-txt,.security-note,.u-sub,
.quick-txt p,.schedule-conflict-notice,.ip-tag,.ip-state,.ip-reason,.ip-removed-note,
.ip-edit-grid label,.ip-row-actions .btn,.slot-note,.slot-mini,
.course-teacher,.course-room,.course-weeks,.course-notes,
.schedule-th-date,.schedule-th-lunar,.schedule-th-status,.schedule-th-today {
  font-size:var(--type-caption)!important; line-height:1.5; overflow-wrap:anywhere;
}
.btn,.btn-login,.nav-item,.today-chip,.mode-chip,.topbar-command,
.form-label,.form-group>label,.course-name,.quick-txt h4 {
  font-size:var(--type-control)!important; line-height:1.5;
}
.tab-bar button,.tab-bar button span { font-size:var(--type-caption)!important; line-height:1.4; }
.tab-bar button i { font-size:1.2rem; }
th { font-size:.8125rem!important; line-height:1.5; }
input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]):not([type=hidden]),
select,textarea,.course-tools-dialog .form-control {
  font-size:max(1rem,16px)!important; line-height:1.5; min-width:0;
}
.form-group,.config-grid>div,.ip-edit-grid>*,.course-tools-panel { min-width:0; }
.btn,.btn-login,.course-tools-dialog button { white-space:normal; overflow-wrap:anywhere; height:auto; }
.today-chip,.mode-chip { height:auto; white-space:normal; }
.stat-chip { min-width:0; flex-wrap:wrap; }
.tab-bar { min-height:calc(3.75rem + env(safe-area-inset-bottom,0px)); height:auto; }
.tab-bar button { min-height:3.25rem; }
.course-tools-dialog label { overflow-wrap:anywhere; }
.course-tools-header { flex-shrink:0; flex-wrap:wrap; }
.course-tools-tabs button { font-size:var(--type-control)!important; }
.course-tools-dialog [role=status] { flex-shrink:0; max-height:25%; }
.search-input { max-width:100%; }
@media(max-width:600px) {
  .btn,.btn-login,.search-input,.today-chip,.mode-chip { min-height:2.75rem; }
  .ip-edit-grid,.config-grid { grid-template-columns:minmax(0,1fr); }
  .course-tools-dialog .form-control { min-height:2.75rem; }
  .schedule-controls,.table-head { flex-wrap:wrap; }
  .card { padding:1.25rem; }
}
/* At enlarged default text sizes, keep tab content clear of the fixed bar. */
:root { --tab-h:calc(3.75rem + env(safe-area-inset-bottom,0px)); }

/* Shared control hierarchy, including native selects and their options. */
button,input,select,textarea { font-family:inherit; }
button { font-size:var(--type-control); }
option,optgroup { font:inherit; }
.week-nav { flex-wrap:wrap; overflow-x:visible; white-space:normal; }
.week-select-wrap { min-width:0; max-width:100%; }
.week-select,.today-chip,.mode-chip,.view-toggle-chip {
  font-size:var(--type-control)!important; line-height:1.4; min-height:2.5rem;
  height:auto; max-width:100%;
}
.week-select { width:6.5rem; padding:.35rem 1.5rem .35rem .5rem; }
.mode-chip,.view-toggle-chip { flex-shrink:1; white-space:normal; overflow-wrap:anywhere; }
.week-nav-btn { width:2.5rem; height:2.5rem; }
.login-prompt-title { font-size:1rem; font-weight:700; line-height:1.5; color:var(--text); }
.login-prompt-text { font-size:.875rem; line-height:1.7; max-width:28ch; color:var(--muted); overflow-wrap:anywhere; }
/* Text must be allowed to grow inside front-end and administration controls. */
.form-inp,.form-control,.search-input { height:auto; min-height:2.75rem; }
.nav-item,.tab-item { height:auto; min-height:2.75rem; }
.tab-item { font-size:var(--type-caption); white-space:normal; overflow-wrap:anywhere; }
.table-head,.card-header,.modal-header,.sheet-title { min-width:0; flex-wrap:wrap; }
.modal-title,.card-title,.page-title { overflow-wrap:anywhere; }

/* Dense timetable text has its own hierarchy; do not treat it as form labels.
   Both grid renderers retain normal wrapping and grow vertically as needed. */
.schedule-table .course-name,.editor-matrix-course strong {
  font-size:clamp(.8rem,calc(.74rem + .15vw),.9rem)!important;
  line-height:1.35; overflow-wrap:anywhere;
}
.schedule-table :is(.course-teacher,.course-room,.course-weeks,.course-notes),
.editor-matrix-course span {
  font-size:clamp(.72rem,calc(.68rem + .1vw),.8rem)!important;
  line-height:1.4; overflow-wrap:anywhere;
}
.schedule-table th { font-size:.75rem!important; }
.schedule-table :is(.schedule-th-date,.schedule-th-lunar,.schedule-th-status,.schedule-th-today) {
  font-size:.7rem!important; line-height:1.35;
}
/* Mouse-driven admin forms may be compact. Touch text inputs keep the 16px
   floor above to avoid focus zoom; that exception does not enlarge labels. */
@media (hover:hover) and (pointer:fine) {
  input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]):not([type=hidden]),
  select,textarea,.course-tools-dialog .form-control { font-size:.875rem!important; }
}
@media (pointer:coarse) {
  .week-nav-btn,.week-select,.today-chip,.mode-chip,.view-toggle-chip { min-height:44px; }
  .week-nav-btn { min-width:44px; }
  .btn-icon,.btn-sm,.pg-btn,.dbp-expand-btn,.announce-user-result { min-width:44px;min-height:44px; }
}
/* Admin helper copy remains readable without making dense data tables enormous. */
.form-hint,.u-sub,.u-school-sub,.dbp-tree-node-meta,.session-device-meta,
.editor-diagnostic,.editor-course-conflict-hint { font-size:.8125rem!important;line-height:1.55; }
.page :is(.card,.org-body,.major-section,.modal-title,.builtin-item-info),
.settings-panel :is(.form-group,.class-info-card){min-width:0;overflow-wrap:anywhere}
.dc-row :is(input,select),.add-row input{min-width:0;max-width:100%}
.announce-user-result{display:flex;align-items:center;flex-wrap:wrap;gap:.4rem;width:100%;padding:.6rem .7rem;text-align:left;border:0;border-bottom:1px solid var(--border);background:transparent;color:var(--text);font:inherit;cursor:pointer}
.announce-user-result span{color:var(--muted);overflow-wrap:anywhere}
.nav-item:focus-visible,.quick-card:focus-visible,.pg-btn:focus-visible,.announce-user-result:focus-visible{outline:3px solid var(--accent,var(--sky2));outline-offset:2px}
@media(max-width:600px){
  .sched-editor-foot>.form-group{min-width:0!important;flex-basis:100%!important}
  .org-school-head,.major-head,.add-row{gap:.55rem}
  .major-head .btn-actions{flex-wrap:wrap}
}

/* Default configuration responds to its usable form width, not a phone guess.
   Seasons never keep two cramped columns inside a narrow sidebar/window. */
.dc-season-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,26rem),1fr));gap:1rem;align-items:start}
.dc-season-grid>section{min-width:0}
.dc-row.dc-editor-card{display:block!important;border:1px solid var(--border);border-radius:10px;padding:.8rem;background:var(--card,#fff);min-width:0}
.dc-editor-head{display:flex;align-items:center;justify-content:space-between;gap:.65rem;flex-wrap:wrap;margin-bottom:.7rem}
.dc-editor-head strong{font-size:.875rem;line-height:1.5;overflow-wrap:anywhere;flex:1 1 8rem}
.dc-editor-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,11rem),1fr));gap:.65rem}
.dc-editor-field{display:flex;flex-direction:column;gap:.3rem;min-width:0;max-width:100%;color:var(--text2,var(--text));font-size:.8125rem;line-height:1.5}
.dc-editor-field>span:first-child{font-weight:600;overflow-wrap:anywhere}
.dc-editor-field small{font-size:.75rem;color:var(--muted);line-height:1.5;overflow-wrap:anywhere}
.dc-editor-field .dc-input{min-height:44px;width:100%;box-sizing:border-box;max-width:100%}
.dc-editor-field .dc-check-field{display:flex;align-items:center;gap:.45rem;min-height:44px;font-weight:400;flex-wrap:wrap}
.dc-check-field input{width:1.1rem;height:1.1rem;flex:none}
.dc-remove-btn{display:inline-flex;align-items:center;justify-content:center;min-width:4.5rem;min-height:44px;padding:.4rem .75rem;color:var(--red,#b73939);border:1px solid currentColor;background:transparent;flex:none;white-space:nowrap}
.dc-remove-btn:hover{background:var(--bg);color:var(--red,#b73939)}
.dc-remove-btn:focus-visible{outline:3px solid var(--accent);outline-offset:2px}
.dc-actionbar{display:flex;align-items:center;gap:.6rem;flex-wrap:wrap;padding:.8rem;background:var(--card,#fff);border:1px solid var(--border);border-radius:10px;position:sticky;bottom:0;z-index:2}
.dc-undo-notice{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex-wrap:wrap;flex-basis:100%;font-size:.8125rem;line-height:1.5}
.dc-undo-notice[hidden]{display:none!important}
.dc-save-note{margin:0;flex-basis:100%;color:var(--muted);font-size:.75rem;line-height:1.5;overflow-wrap:anywhere}

/* Compact actions use local SVG rather than increasing every destructive label. */
.action-text-btn{width:auto!important;height:auto!important;min-width:44px;min-height:44px;padding:.3rem .6rem!important;display:inline-flex;align-items:center;justify-content:center;gap:.25rem;white-space:nowrap;flex-shrink:0;font-size:var(--type-control)!important;line-height:1.5}
.entity-item{gap:.65rem}
.entity-item>span{min-width:0;overflow-wrap:anywhere;flex:1}
.entity-item{flex-wrap:wrap}
.entity-name{min-width:0;flex:1 1 12rem;overflow-wrap:anywhere}
.course-card{flex-wrap:wrap}
.course-card-body{flex:1 1 12rem}
.course-card-actions{margin-left:auto}
.course-card-actions,.row-actions{flex-wrap:wrap;max-width:100%}
.course-actions{max-width:100%;box-sizing:border-box;flex-wrap:wrap;justify-content:flex-end}
.course:focus-within .course-actions{opacity:1}
.course-card:focus-within .course-card-actions{opacity:1;pointer-events:auto}
.class-chips .chip{max-width:100%;min-width:0;height:auto;white-space:normal;flex-wrap:wrap;overflow-wrap:anywhere}
.editor-revision-entry{display:flex;align-items:center;justify-content:space-between;gap:.5rem;flex-wrap:wrap;padding:.38rem 0;border-top:1px dashed var(--border)}
.editor-revision-info{min-width:0;flex:1 1 14rem;overflow-wrap:anywhere}
.editor-revision-actions{display:flex;gap:.3rem;flex-wrap:wrap;max-width:100%;min-width:0}
.ai-card-head{flex-wrap:wrap}
.ai-card-actions{flex-wrap:wrap;max-width:100%}
.ai-edit-form-row{grid-template-columns:repeat(auto-fit,minmax(min(100%,10rem),1fr))}
.sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important}
.control-icon{display:inline-flex;align-items:center;justify-content:center;flex:none;vertical-align:middle;color:inherit}
.nav-item .control-icon{width:1.1rem}.topbar-more-menu .control-icon{width:1.75rem}

/* A single consistent icon affordance, with explicit title/accessible label.
   Critical irreversible confirmation buttons intentionally retain their text. */
.zhike-action-icon{width:1.1rem;height:1.1rem;min-width:1.1rem;display:block;flex:none;pointer-events:none}
.action-icon-btn{display:inline-flex!important;align-items:center;justify-content:center;flex:none;gap:0;width:2.25rem!important;height:2.25rem!important;min-width:2.25rem;min-height:2.25rem;padding:.4rem!important;line-height:1;border:1px solid var(--border,var(--sky-border));border-radius:.55rem;background:transparent;cursor:pointer;color:var(--muted)}
.action-icon-btn.del,.dc-remove-btn{color:var(--red,#dc2626)}
.action-icon-btn:hover:not(:disabled){background:var(--sky-light,var(--bg));color:var(--sky2,var(--accent))}
.action-icon-btn.del:hover:not(:disabled),.dc-remove-btn:hover:not(:disabled){background:#fef2f2;color:#b91c1c}
.action-icon-btn:disabled{opacity:.4;cursor:not-allowed}
.action-icon-btn:focus-visible{outline:3px solid var(--accent,var(--sky2));outline-offset:2px}
.action-icon-btn.dc-remove-btn{min-width:2.25rem;min-height:2.25rem}
.course .course-actions,.course:hover .course-actions,.course:focus-within .course-actions{position:absolute;top:.25rem;right:.25rem;z-index:4;display:flex;gap:.15rem;flex-wrap:nowrap;background:var(--card,#fff);padding:.2rem;margin:0;border:1px solid var(--sky-border,#bae6fd);border-radius:.5rem;box-shadow:0 2px 8px rgba(15,70,100,.16);opacity:0;pointer-events:none;max-width:calc(100% - .5rem)}
.course .course-action-btn{width:1.9rem!important;height:1.9rem!important;min-width:1.9rem;min-height:1.9rem;padding:.3rem!important;border:0;background:transparent}
.course .course-action-btn .zhike-action-icon{width:1rem;height:1rem;min-width:1rem}
.course.actions-visible .course-actions,.course:focus-visible .course-actions,.course:has(.course-action-btn:focus-visible) .course-actions{opacity:1;pointer-events:auto}
.course:focus-visible{outline:2px solid var(--sky2);outline-offset:2px}
@media(hover:hover) and (pointer:fine){.course:hover .course-actions,.course:focus-within .course-actions{opacity:1;pointer-events:auto}}
@media(pointer:coarse){
  .action-icon-btn,.action-icon-btn.dc-remove-btn,.course .course-action-btn{width:44px!important;height:44px!important;min-width:44px;min-height:44px}
}

/* Control boxes grow with text settings; dynamic commands follow the exact
   same icon + label structure. A menu never lets a label become vertical. */
:root{--header-h:calc(max(58px,3.75rem) + var(--safe-top,0px))}
.topbar{gap:.5rem}
.topbar-actions{flex-shrink:1;max-width:100%;gap:.35rem}
.topbar-btn,.topbar-menu-btn{white-space:nowrap;overflow-wrap:normal;flex:none;min-height:2.75rem;height:2.75rem;min-width:2.75rem}
.topbar-more-menu .topbar-btn{white-space:nowrap;overflow-wrap:normal}
.topbar-more-menu .topbar-more-label{width:auto;height:auto;flex:none;background:none;color:inherit}
.topbar-more-menu .zhike-action-icon{margin:0 .2rem;width:1.1rem;height:1.1rem}
.term-schedule-select{flex:0 1 auto;min-width:6.5rem!important;max-width:15rem!important}
@media(min-width:1100px){
  .topbar-more-menu .topbar-btn{height:2.75rem;min-height:2.75rem;min-width:2.75rem}
}
@media(min-width:1100px) and (max-width:1439px){
  .topbar-more-menu .topbar-btn{width:2.75rem;padding:0}
  .topbar-more-menu .topbar-more-label{display:none}
  .term-schedule-select{max-width:11rem!important}
}
@media(max-width:599px){
  .topbar{gap:.25rem;padding-right:max(.4rem,var(--safe-right));padding-left:max(.4rem,var(--safe-left))}
  .topbar-title{flex:1 1 3rem}
  .topbar-actions{gap:.2rem;flex:0 1 auto}
  .term-schedule-select{width:clamp(6.5rem,30vw,8.5rem)!important;max-width:8.5rem!important}
}
/* The collapsed command menu may wrap at larger text sizes. The desktop
   inline command bar keeps its own single-line presentation. */
@media(max-width:1099px){
  .topbar-more-menu .topbar-btn{height:auto;min-height:44px;white-space:normal;overflow-wrap:anywhere;flex-shrink:0}
  .topbar-more-menu .topbar-more-label{min-width:0;flex:1 1 auto;white-space:normal;overflow-wrap:anywhere}
}
@media(pointer:coarse){
  .sidebar-nav .nav-item,.sidebar-logout{min-height:44px}
  .topbar-actions>.topbar-btn,.topbar-menu-btn{min-width:44px;min-height:44px;height:auto}
}
/* Icon-only controls do not need an 88px-wide box when text is doubled.
   Preserve touch targets; leave labels in the expandable, wrapping menu. */
@media(max-width:1099px){
  .topbar-actions>.topbar-btn,.topbar-menu-btn{width:clamp(44px,2.75rem,48px);min-width:clamp(44px,2.75rem,48px);padding-inline:0}
  .topbar .topbar-actions .term-picker{min-width:64px}
  .topbar .term-picker .term-picker-trigger{padding-inline:clamp(7px,.5rem,10px);gap:clamp(3px,.3rem,5px)}
  .topbar .term-picker-chevron{width:clamp(14px,1rem,20px);height:clamp(14px,1rem,20px);min-width:clamp(14px,1rem,20px)}
}
@media(max-width:599px){
  .topbar{gap:clamp(3px,.25rem,4px);padding-inline:max(clamp(6px,.4rem,8px),var(--safe-left)) max(clamp(6px,.4rem,8px),var(--safe-right))}
  .topbar-title{flex:1 1 0}
  .topbar-actions{gap:clamp(3px,.2rem,4px)}
}
