/* Screen presentation derived from the supplied desktop and phone references.
   The existing Google Sans family and A4 print layout are retained. */
:root {
  --ink: #142033;
  --muted: #68758a;
  --brand: #e60012;
  --brand-dark: #c90016;
  --mint: #fff0f2;
  --surface: #fff;
  --canvas: #f4f7fb;
  --line: #e5ebf2;
  --shadow: 0 5px 18px rgba(30, 48, 74, .055);
  --sidebar-width: 236px;
  --radius: 13px;
  --status-present: #27bd72;
  --status-late: #f7a31b;
  --status-absent: #f12c3a;
  --status-leave: #3289ee;
  --bs-primary: #e60012;
  --bs-primary-rgb: 230, 0, 18;
  --bs-body-color: #142033;
  --bs-secondary-color: #68758a;
}

@media screen {
  body { background: var(--canvas); color: var(--ink); font-family: "Google Sans", system-ui, -apple-system, "Segoe UI", sans-serif; }
  h1 { font-size: clamp(1.65rem, 2vw, 2.1rem); line-height: 1.2; letter-spacing: -.035em; color: #111b2b; }
  h2 { font-size: 1.08rem; line-height: 1.4; color: #172132; }
  h3 { color: #172132; }
  .app-sidebar { background: #fff; color: var(--ink); padding: 0 16px 20px; border-right: 1px solid var(--line); box-shadow: 4px 0 18px rgba(28, 46, 73, .025); }
  .sidebar-brand { min-height: 82px; display: flex; align-items: center; gap: 11px; padding: 11px 4px 13px; color: var(--ink); border-bottom: 1px solid var(--line); }
  .sidebar-brand:hover { color: var(--ink); }
  .brand-mark { display: grid; place-items: center; flex: 0 0 42px; height: 42px; color: var(--brand); }
  .brand-mark .ui-icon { width: 40px; height: 40px; }
  .brand-mark .ui-icon svg { fill: var(--brand); stroke: #fff; stroke-width: 1.2; }
  .brand-text { display: grid; min-width: 0; }
  .brand-name { margin: 0; color: #172132; font-size: 1rem; line-height: 1.3; font-weight: 700; letter-spacing: -.035em; white-space: nowrap; }
  .brand-caption { margin: 2px 0 0; color: var(--muted); font-size: .66rem; line-height: 1.35; }
  .sidebar-section-label { display: none; }
  .sidebar-nav { gap: 4px; padding-top: 18px; }
  .sidebar-link { min-height: 46px; gap: 13px; padding: 10px 13px; border-radius: 10px; color: #4f5d73; font-size: .91rem; font-weight: 600; }
  .sidebar-link .ui-icon { width: 20px; height: 20px; }
  .sidebar-link > .ui-icon:first-child { flex: 0 0 20px; align-self: center; }
  .sidebar-link:hover { background: #f5f7fa; color: var(--brand-dark); }
  .sidebar-link.active { background: #fff0f1; color: var(--brand); font-weight: 700; }
  .sidebar-link .nav-chevron { display: none; }
  .sidebar-link:focus-visible { outline-color: var(--brand); }
  .sidebar-footer { padding-top: 16px; }
  .sidebar-footer .sidebar-link { color: #607086; }
  .sidebar-institution { padding: 18px 9px 4px; margin-top: 14px; border-top: 1px solid var(--line); }
  .sidebar-institution img { display: block; width: 134px; max-width: 100%; opacity: .48; filter: grayscale(1); }
  .sidebar-institution p { margin: 13px 0 9px; color: #7c899b; font-size: .75rem; line-height: 1.6; }
  .sidebar-footer-accent { display: block; width: 32px; height: 3px; border-radius: 3px; background: var(--brand); }
  .app-topbar { height: 80px; gap: 22px; padding: 0 clamp(22px, 2.5vw, 38px); border-bottom: 1px solid var(--line); box-shadow: 0 2px 11px rgba(25, 42, 67, .025); }
  .topbar-mobile-brand { display: none; }
  .topbar-search { display: flex; align-items: center; gap: 10px; width: clamp(260px, 33vw, 410px); height: 42px; padding: 0 14px; background: #f7f9fb; border: 1px solid #e9eef3; border-radius: 100px; color: #617087; }
  .topbar-search:focus-within { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230, 0, 18, .09); }
  .topbar-search .ui-icon { width: 18px; height: 18px; align-self: center; }
  .topbar-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .85rem; }
  .topbar-search input::placeholder { color: #8b96a7; }
  .topbar-right { gap: 15px; }
  .topbar-date { display: flex; align-items: center; gap: 8px; padding: 0; border: 0; color: #66758b; font-size: .8rem; }
  .topbar-date .ui-icon { color: var(--brand); }
  .topbar-date time { display: block; color: #34445b; font-weight: 600; white-space: nowrap; }
  .topbar-divider { height: 32px; border-left: 1px solid #dce3eb; }
  .user-avatar { width: 39px; height: 39px; background: #fbe6e9; color: var(--brand-dark); font-size: .92rem; }
  .user-caption { font-size: .8rem; line-height: 1.35; white-space: nowrap; }
  .user-caption strong { color: #182436; font-weight: 700; }
  .user-caption span { color: #7c899b; }
  .app-main { max-width: 1740px; padding: 28px clamp(22px, 2.5vw, 38px) 54px !important; }
  .page-heading { margin-bottom: 23px; align-items: flex-start; }
  .page-description { color: #67758b; font-size: .88rem; margin-top: 4px; }
  .filter-bar { gap: 16px; padding: 17px 20px; background: #fff; border-color: var(--line); box-shadow: var(--shadow); border-radius: var(--radius); }
  .filter-bar > div { flex: 0 1 230px; min-width: 170px; }
  .form-label { color: #46556c; font-size: .8rem; font-weight: 700; margin-bottom: 6px; }
  .form-control, .form-select { min-height: 43px; border-color: #d9e1eb; border-radius: 8px; background-color: #fff; color: var(--ink); }
  .form-control::placeholder { color: #929dae; }
  .form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(230, 0, 18, .09); }
  input[type="file"].form-control { height: auto; min-height: 43px; padding: 4px 8px; line-height: 1.35; vertical-align: middle; }
  input[type="file"].form-control::file-selector-button { min-height: 32px; margin: 0 12px 0 0; padding: 6px 12px; border: 0; border-radius: 6px; background: #edf2f7; color: #43536a; font: inherit; line-height: 1.2; vertical-align: middle; transition: background-color .15s, color .15s; }
  input[type="file"].form-control:hover::file-selector-button { background: #e4ebf3; color: #24364e; }
  input[type="file"].form-control:focus-visible::file-selector-button { outline: 2px solid rgba(230, 0, 18, .35); outline-offset: 1px; }
  .btn { border-radius: 8px; }
  .btn-primary { background: var(--brand); border-color: var(--brand); }
  .btn-primary:hover, .btn-primary:focus-visible { background: var(--brand-dark); border-color: var(--brand-dark); }
  .btn-success { background: #fff; border-color: #f04d5b; color: var(--brand-dark); }
  .btn-success:hover { background: #fff0f1; border-color: var(--brand); color: var(--brand-dark); }
  .btn-outline-primary { --bs-btn-color: var(--brand); --bs-btn-border-color: #f1606d; --bs-btn-hover-bg: #fff0f1; --bs-btn-hover-color: var(--brand-dark); --bs-btn-hover-border-color: var(--brand); }
  .btn-light { --bs-btn-bg: #f7f9fb; --bs-btn-hover-bg: #edf2f6; --bs-btn-border-color: #e4eaf0; }
  .panel-card, .empty-card, .help-card, .admin-form-card { padding: 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
  .section-heading { gap: 14px; margin-bottom: 16px; }
  .section-heading h2 { display: flex; align-items: center; gap: 9px; margin-bottom: 2px; }
  .section-heading p { color: #8290a2; font-size: .78rem; }
  .heading-icon { display: inline-grid; place-items: center; width: 23px; height: 23px; color: var(--brand); }
  .heading-icon .ui-icon { width: 20px; height: 20px; }
  .text-action { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; min-height: 38px; padding: 8px 13px; border: 1px solid #f2b7bd; border-radius: 8px; background: #fff; color: var(--brand-dark); text-decoration: none; font-size: .8rem; font-weight: 700; line-height: 1.2; white-space: nowrap; transition: background-color .15s, border-color .15s, box-shadow .15s; }
  .text-action:hover { border-color: var(--brand); background: #fff2f4; color: var(--brand-dark); text-decoration: none; }
  .text-action:focus-visible { outline: 3px solid rgba(230, 0, 18, .18); outline-offset: 2px; }
  .empty-inline { background: #f7f9fc; color: #76859a; }
  .alert-warning { background: #fff7e9; border-color: #f9dfad; color: #875815; }
  .app-table th, .admin-data-table th { background: #f7f9fb; color: #617086; border-bottom-color: var(--line); font-weight: 700; }
  .app-table td, .admin-data-table td { border-color: #edf1f5; }
  .badge { border-radius: 7px; }
  .text-bg-success { background: #e7f8ed !important; color: #159451 !important; }
  .text-bg-warning { background: #fff3df !important; color: #af7000 !important; }
  .text-bg-danger { background: #fff0f1 !important; color: #d31a2b !important; }
  .text-bg-light { background: #f3f6f9 !important; color: #5d6a7d !important; }
  .text-success { color: #178b50 !important; }
  .history-status { display: inline-flex; align-items: center; justify-content: center; padding: 5px 9px; border-radius: 7px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
  .history-status.is-present, .student-status.is-present { background: #e6f8ed; color: #139555; }
  .history-status.is-late, .student-status.is-late { background: #fff3dd; color: #b67800; }
  .history-status.is-absent, .student-status.is-absent { background: #fff0f1; color: #d52232; }
  .history-status.is-leave, .student-status.is-leave { background: #e9f3ff; color: #2277d5; }
  .history-status.is-unchecked, .student-status { background: #f0f3f7; color: #6e7b8e; }
  .student-avatar { display: grid; place-items: center; flex: 0 0 38px; width: 38px; height: 38px; border-radius: 50%; background: #eaf0f7; color: #5a6b80; font-size: .9rem; font-weight: 700; }
  .avatar-tone-1 { background: #fbe9eb; color: #be4652; }
  .avatar-tone-2 { background: #e9f4f0; color: #409270; }
  .avatar-tone-3 { background: #fff1df; color: #bd8540; }
  .mini-progress { height: 6px; overflow: hidden; border-radius: 8px; background: #edf1f5; }
  .mini-progress > span { display: block; height: 100%; border-radius: inherit; background: currentColor; }

  /* Dashboard: five factual attendance measures followed by room work. */
  .dashboard-filter { align-items: end; }
  .dashboard-filter-context { margin-left: auto; color: #77869a; font-size: .8rem; align-self: center; }
  .dashboard-day-alert { margin: 16px 0 0; }
  .dashboard-stat-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; padding: 0; margin-top: 16px; background: transparent; border: 0; border-radius: 0; }
  .dashboard-stat-grid .stat-card { display: grid; grid-template-columns: minmax(0, 1fr) 40px; grid-template-areas: "copy icon"; align-content: center; align-items: start; column-gap: 12px; min-height: 125px; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
  .dashboard-stat-grid .stat-card + .stat-card { border-left: 1px solid var(--line); }
  .dashboard-stat-grid .stat-icon { grid-area: icon; display: grid; place-items: center; justify-self: end; width: 40px; height: 40px; border-radius: 12px; background: #f0f3f7; color: #68788c; }
  .dashboard-stat-grid .stat-copy { grid-area: copy; min-width: 0; display: grid; gap: 2px; }
  .dashboard-stat-grid .stat-label { color: #627186; font-size: .76rem; font-weight: 600; }
  .dashboard-stat-grid .stat-copy strong { display: block; margin: 0; color: #131e2f; font-size: 1.85rem; line-height: 1.16; font-weight: 700; }
  .dashboard-stat-grid .stat-copy strong small { display: inline; margin-left: 4px; color: #6b7788; font-size: .84rem; font-weight: 500; }
  .dashboard-stat-grid .stat-detail { color: #8b97a7; font-size: .72rem; line-height: 1.35; }
  .dashboard-stat-grid .stat-present .stat-icon { color: var(--status-present); background: #e6f8ed; }
  .dashboard-stat-grid .stat-late .stat-icon { color: var(--status-late); background: #fff2dc; }
  .dashboard-stat-grid .stat-absent .stat-icon { color: var(--status-absent); background: #fff0f1; }
  .dashboard-stat-grid .stat-leave .stat-icon { color: var(--status-leave); background: #e9f3ff; }
  .dashboard-layout { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, .84fr) minmax(0, 1.1fr); gap: 15px; margin-top: 15px; }
  .dashboard-layout > * { min-width: 0; }
  .dashboard-layout .dashboard-trend-card { grid-column: span 2; }
  .focus-room { display: flex; align-items: center; gap: 12px; padding: 16px; background: #fff5f6; border-radius: 11px; }
  .focus-room-icon { display: grid; place-items: center; flex: 0 0 46px; width: 46px; height: 46px; border-radius: 12px; background: #ffe4e7; color: var(--brand); }
  .focus-room-icon .ui-icon { width: 25px; height: 25px; }
  .focus-room > div > strong, .focus-room > div > span, .focus-advisor > div > strong, .focus-advisor > div > span { display: block; }
  .focus-room strong { color: #192437; font-size: 1.2rem; line-height: 1.25; }
  .focus-room div > span { color: #6c798e; font-size: .78rem; margin-top: 3px; }
  .focus-advisor { display: flex; align-items: center; gap: 11px; padding: 15px 4px 12px; }
  .focus-advisor span:not(.student-avatar) { color: #8190a2; font-size: .74rem; }
  .focus-advisor strong { color: #263349; font-size: .85rem; }
  .room-list-compact { max-height: 152px; overflow: auto; border-top: 1px solid var(--line); }
  .room-list-compact a { display: flex; align-items: center; gap: 8px; padding: 9px 2px; border-bottom: 1px solid #f0f3f6; color: #38475d; text-decoration: none; font-size: .76rem; }
  .room-list-compact a:hover { color: var(--brand); }
  .room-list-compact strong { font-weight: 700; }
  .room-list-compact a > span:nth-child(2) { margin-left: auto; color: #8793a3; }
  .room-list-compact .ui-icon { width: 14px; height: 14px; }
  .dashboard-quick-card { display: flex; flex-direction: column; }
  .quick-action-primary, .quick-action-secondary, .quick-action-talk { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 67px; border: 1px solid var(--brand); border-radius: 10px; text-align: left; text-decoration: none; transition: background-color .15s, border-color .15s, color .15s, box-shadow .15s; }
  .quick-action-primary { background: var(--brand); color: #fff; }
  .quick-action-primary:hover { background: var(--brand-dark); color: #fff; }
  .quick-action-secondary { margin-top: 11px; color: var(--brand); background: #fff; }
  .quick-action-secondary:hover { background: #fff4f5; color: var(--brand-dark); }
  .quick-action-talk { margin-top: 11px; color: var(--brand-dark); background: #fff7f8; border-color: #f3c5ca; }
  .quick-action-talk:hover { background: #fff0f2; border-color: #ed9ea7; color: #ad0010; box-shadow: 0 3px 10px rgba(230, 0, 18, .07); }
  .quick-action-primary > .ui-icon, .quick-action-secondary > .ui-icon, .quick-action-talk > .ui-icon { width: 22px; height: 22px; flex: 0 0 22px; }
  .quick-action-primary strong, .quick-action-secondary strong, .quick-action-talk strong { display: block; font-size: .93rem; line-height: 1.25; }
  .quick-action-primary small, .quick-action-secondary small, .quick-action-talk small { display: block; color: inherit; opacity: .78; font-size: .72rem; }
  .quick-action-talk:focus-visible { outline: 3px solid rgba(230, 0, 18, .18); outline-offset: 2px; }
  .quick-action-text { display: flex; justify-content: center; align-items: center; gap: 7px; min-height: 40px; margin-top: 11px; padding: 7px 12px; border: 1px solid #dce4ec; border-radius: 8px; background: #f8fafc; color: #46566d; text-decoration: none; font-size: .78rem; font-weight: 700; transition: background-color .15s, border-color .15s, color .15s; }
  .quick-action-text:hover { border-color: #f2b7bd; background: #fff2f4; color: var(--brand-dark); }
  .quick-action-text:focus-visible { outline: 3px solid rgba(230, 0, 18, .18); outline-offset: 2px; }
  .quick-action-text .ui-icon { width: 14px; height: 14px; }
  .attention-list { display: grid; }
  .dashboard-attention-list { max-height: 20rem; overflow-y: auto; overscroll-behavior: contain; padding-right: 8px; scrollbar-width: thin; scrollbar-color: #c5ced9 transparent; }
  .dashboard-attention-list::-webkit-scrollbar { width: 7px; }
  .dashboard-attention-list::-webkit-scrollbar-thumb { border-radius: 8px; background: #c5ced9; }
  .dashboard-attention-list:focus-visible { outline: 2px solid rgba(230, 0, 18, .22); outline-offset: 2px; border-radius: 8px; }
  .attention-list a { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid #edf1f5; color: var(--ink); text-decoration: none; }
  .attention-list a:last-child { border-bottom: 0; }
  .attention-list a:hover strong { color: var(--brand); }
  .attention-dot { flex: 0 0 11px; width: 11px; height: 11px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 5px #fff0f1; margin-left: 5px; }
  .attention-list a > span:nth-child(2) { display: grid; gap: 2px; min-width: 0; }
  .attention-list strong { font-size: .82rem; }
  .attention-list small { color: #8a96a5; font-size: .73rem; }
  .attention-list .ui-icon { width: 15px; height: 15px; margin-left: auto; color: #9aa5b2; }
  .attention-more { margin: 8px 0 0; color: #8290a2; font-size: .76rem; }
  .dashboard-all-clear { display: grid; place-items: center; gap: 6px; padding: 22px 0; text-align: center; color: #179756; }
  .dashboard-all-clear .ui-icon { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: #e6f8ed; }
  .dashboard-all-clear strong { color: #27384c; font-size: .88rem; }
  .dashboard-all-clear > span:last-child { color: #8794a4; font-size: .76rem; }
  .trend-chart { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 11px; align-items: end; height: 170px; padding: 9px 5px 2px; border-bottom: 1px solid #dfe5ec; }
  .trend-column { display: grid; grid-template-rows: 22px 1fr 22px; justify-items: center; align-self: stretch; min-width: 0; }
  .trend-value { color: #7a8799; font-size: .7rem; }
  .trend-track { display: flex; align-items: end; width: min(100%, 34px); height: 100%; background: #f7f9fb; border-radius: 6px 6px 0 0; overflow: hidden; }
  .trend-fill { display: block; width: 100%; background: linear-gradient(180deg, #f53a49, #e60012); border-radius: 6px 6px 0 0; }
  .trend-fill.is-empty { background: #dce3eb; }
  .trend-column small { color: #8794a5; font-size: .7rem; padding-top: 3px; }
  .talk-progress { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; align-items: baseline; margin: 6px 0 15px; }
  .talk-progress strong { color: var(--brand); font-size: 1.8rem; line-height: 1; }
  .talk-progress > span { color: #7c8a9d; font-size: .77rem; }
  .talk-progress .mini-progress { grid-column: 1/-1; color: var(--brand); }
  .talk-status-list > div { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; border-top: 1px solid #edf1f5; font-size: .77rem; }
  .dashboard-attendance { margin-top: 16px; }
  .dashboard-attendance .app-table td { padding: 11px 12px; }

  /* Attendance workspace: the room, four decisions, and the save action stay visible. */
  .attendance-shell { max-width: none; }
  .attendance-filter { margin-bottom: 15px; }
  .attendance-room-banner { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.25fr) minmax(250px, 1fr); align-items: center; gap: clamp(18px, 2.4vw, 36px); min-height: 142px; padding: 22px clamp(22px, 3vw, 40px); }
  .attendance-room-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
  .room-banner-icon { display: grid; place-items: center; flex: 0 0 54px; width: 54px; height: 54px; border-radius: 15px; color: var(--brand); background: #fff0f1; }
  .room-banner-icon .ui-icon { width: 28px; height: 28px; }
  .room-banner-caption { color: #8290a3; font-size: .76rem; }
  .attendance-room-identity h2 { font-size: 1.45rem; line-height: 1.25; margin: 3px 0 2px; }
  .attendance-room-identity p { margin: 0; color: #7c899a; font-size: .82rem; }
  .room-banner-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; gap: 14px; min-width: 0; }
  .room-banner-meta > div { display: flex; align-items: center; gap: 11px; min-width: 0; padding-left: clamp(12px, 1.5vw, 22px); border-left: 1px solid var(--line); }
  .room-banner-meta .ui-icon { flex: 0 0 20px; width: 20px; height: 20px; color: var(--brand); }
  .room-banner-meta > div > span:last-child { display: grid; gap: 3px; color: #8290a3; font-size: .76rem; line-height: 1.35; }
  .room-banner-meta strong { display: block; color: #24344b; font-size: .92rem; font-weight: 700; white-space: nowrap; }
  .attendance-banner-progress { display: grid; gap: 9px; min-width: 0; padding-left: clamp(18px, 2.2vw, 34px); border-left: 1px solid var(--line); }
  .attendance-banner-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: #6d7b90; font-size: .78rem; }
  .attendance-banner-progress-head strong { color: #24344b; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .attendance-banner-progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: #edf1f5; }
  .attendance-banner-progress-track > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--brand); transition: width .2s ease; }
  .attendance-banner-progress small { color: #8290a3; font-size: .75rem; }
  .attendance-summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 13px 0; }
  .attendance-summary-card { display: grid; grid-template-columns: minmax(0, 1fr) 38px; grid-template-rows: auto 1fr; grid-template-areas: "label icon" "value icon"; align-items: start; column-gap: 12px; row-gap: 8px; min-height: 104px; padding: 15px 17px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
  .attendance-summary-card .status-symbol { grid-area: icon; display: grid; place-items: center; justify-self: end; align-self: start; width: 38px; height: 38px; border-radius: 12px; background: #eef2f6; color: #718097; }
  .attendance-summary-card > span:nth-child(2) { grid-area: label; align-self: end; min-width: 0; color: #637187; font-size: .77rem; line-height: 1.3; }
  .attendance-summary-card strong { grid-area: value; display: flex; align-items: baseline; gap: 5px; min-width: 0; color: var(--ink); font-size: 1.65rem; font-weight: 700; line-height: 1.1; }
  .attendance-summary-card strong small { display: inline; color: #78869a; font-size: .76rem; font-weight: 500; }
  .summary-present .status-symbol { background: #e1f8e9; color: var(--status-present); }
  .summary-late .status-symbol { background: #fff1d8; color: var(--status-late); }
  .summary-absent .status-symbol { background: #ffe9ec; color: var(--status-absent); }
  .summary-leave .status-symbol { background: #e7f2ff; color: var(--status-leave); }
  .attendance-main-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(270px, 305px); align-items: start; gap: 14px; }
  .attendance-primary { min-width: 0; }
  .attendance-action-bar { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 0 0 13px; }
  .attendance-action-bar .save-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin: 0; padding: 0; border: 0; }
  .attendance-action-bar .save-row .btn { order: 1; }
  .attendance-action-bar .save-row > span { order: 2; }
  .attendance-action-bar .save-row .btn { min-width: 200px; }
  .attendance-roster-card { padding: 0; overflow: hidden; }
  .attendance-roster-card .roster-heading { padding: 17px 18px; margin: 0; border-bottom: 1px solid var(--line); }
  .roster-heading h2 { font-size: 1rem; }
  .status-counter { color: #8794a5; font-size: .8rem; }
  .status-counter span:first-child { color: var(--brand); font-size: 1.05rem; }
  .roster-search-wrap, .directory-search { display: flex; align-items: center; gap: 9px; background: #f7f9fb; border: 1px solid #e9eef3; border-radius: 8px; color: #8090a3; }
  .roster-search-wrap { height: 40px; margin: 13px 17px; padding: 0 10px; max-width: 340px; }
  .roster-search-wrap .ui-icon, .directory-search .ui-icon { width: 17px; height: 17px; }
  .roster-search-wrap input, .directory-search input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: .79rem; }
  .roster-search-wrap input::placeholder, .directory-search input::placeholder { color: #96a1b0; }
  .roster-column-head { display: grid; grid-template-columns: minmax(250px, 1.3fr) minmax(270px, 1fr) 92px; gap: 14px; padding: 9px 16px; background: #f7f9fb; color: #68778b; font-size: .72rem; font-weight: 700; }
  .roster-list { display: block; }
  .student-row { display: grid; grid-template-columns: minmax(250px, 1.3fr) minmax(270px, 1fr) 92px; align-items: center; gap: 9px 14px; padding: 10px 16px; border-bottom: 1px solid #edf1f5; }
  .student-row[hidden] { display: none !important; }
  .student-row:last-child { border-bottom: 0; }
  .student-row:hover { background: #fcfdfe; }
  .student-identity { min-width: 0; gap: 8px; }
  .student-number { flex: 0 0 25px; width: 25px; height: 25px; border-radius: 50%; background: #f0f3f6; color: #617086; font-size: .72rem; }
  .student-row .student-avatar { flex-basis: 32px; width: 32px; height: 32px; font-size: .77rem; }
  .student-name-wrap { min-width: 0; }
  .student-name { overflow: hidden; color: #1b293d; font-size: .82rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
  .student-name-button { display: block; width: 100%; max-width: 100%; padding: 0; border: 0; background: transparent; font-family: inherit; line-height: 1.4; text-align: left; cursor: pointer; }
  .student-name-button:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 2px; }
  .student-name-button:focus-visible { border-radius: 3px; outline: 2px solid rgba(230, 0, 18, .38); outline-offset: 2px; }
  .student-code { margin-top: 0; color: #8794a5; font-size: .7rem; }
  .student-status { margin-left: auto; font-size: .68rem; padding: 4px 7px; }
  .student-actions { gap: 5px; }
  .status-btn { min-height: 35px; border-color: #dce4ec; border-radius: 6px; background: #f8fafc; color: #68778a; font-size: .74rem; font-weight: 700; }
  .status-btn:hover { background: #edf2f6; border-color: #aebdca; }
  .status-btn.active[data-status="present"] { background: var(--status-present); border-color: var(--status-present); color: #fff; }
  .status-btn.active[data-status="late"] { background: var(--status-late); border-color: var(--status-late); color: #fff; }
  .status-btn.active[data-status="absent"] { background: var(--status-absent); border-color: var(--status-absent); color: #fff; }
  .status-btn.active[data-status="leave"] { background: var(--status-leave); border-color: var(--status-leave); color: #fff; }
  .student-note { grid-column: 3; margin: 0; display: flex; justify-content: center; }
  .note-toggle { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; padding: 0; border: 1px solid #dce4ec; border-radius: 8px; background: #f8fafc; color: #68778a; cursor: pointer; transition: background .15s, border-color .15s, color .15s; }
  .note-toggle svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
  .note-toggle:hover, .note-toggle.is-open { border-color: #eb0a1e; background: #fff5f6; color: #c8102e; }
  .note-toggle.has-note::after { content: ''; position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: #eb0a1e; }
  .note-toggle:focus-visible, .note-clear:focus-visible { outline: 3px solid rgba(235,10,30,.3); outline-offset: 2px; }
  .student-note-editor { grid-column: 1/-1; min-width: 0; width: 100%; padding: 4px 0 8px; }
  .student-note-editor[hidden] { display: none !important; }
  .note-input-wrap { position: relative; display: flex; align-items: center; width: 100%; }
  .student-note-editor input { display: block; width: 100%; max-width: none; min-height: 40px; padding-right: 45px; background: #fff; }
  .note-clear { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #64748b; font-family: inherit; font-size: 1.55rem; line-height: 1; cursor: pointer; }
  .note-clear:hover:not(:disabled) { background: #feecee; color: #c8102e; }
  .note-clear:disabled { color: #b9c3cf; cursor: default; }
  .swal2-popup.student-details-swal { width: min(820px, calc(100% - 24px)) !important; padding: 0; overflow: hidden; border: 1px solid #e3eaf2; border-radius: 18px; text-align: left; box-shadow: 0 22px 64px rgba(24, 40, 63, .2); }
  .student-details-swal .swal2-close { z-index: 2; width: 40px; height: 40px; margin: 10px 10px 0 0; border-radius: 10px; color: #68778b; font-size: 1.75rem; }
  .student-details-swal .swal2-close:hover { background: #f3f6f9; color: var(--brand); }
  .student-details-swal .swal2-html-container { margin: 0; padding: 0; overflow: auto; max-height: min(78vh, 760px); }
  .student-detail-modal { padding: 27px 28px 25px; color: var(--ink); }
  .student-detail-hero { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: center; gap: 17px; padding: 2px 36px 22px 0; border-bottom: 1px solid var(--line); }
  .student-detail-avatar { display: grid; place-items: center; width: 82px; height: 82px; overflow: hidden; border: 1px solid #e4eaf1; border-radius: 19px; background: #eef3f8; color: #53657d; font-size: 1.8rem; font-weight: 700; }
  .student-detail-avatar.has-photo { background: #fff; }
  .student-detail-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .student-detail-identity { min-width: 0; text-align: left; }
  .student-detail-eyebrow { color: #8290a3; font-size: .73rem; font-weight: 600; }
  .student-detail-identity h2 { margin: 2px 0 7px; color: #172338; font-size: 1.32rem; font-weight: 700; letter-spacing: -.02em; text-align: left; }
  .student-detail-meta { display: flex; flex-wrap: wrap; gap: 6px; }
  .student-detail-meta span { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 8px; border: 1px solid #e8edf3; border-radius: 7px; background: #f8fafc; color: #596980; font-size: .69rem; }
  .student-detail-advisor { margin-top: 7px; color: #8290a2; font-size: .72rem; }
  .student-detail-advisor strong { color: #485970; font-weight: 600; }
  .student-detail-today { display: grid; justify-items: end; gap: 6px; padding-left: 12px; text-align: right; }
  .student-detail-today > span { color: #8491a2; font-size: .69rem; }
  .student-detail-today small { color: #8491a2; font-size: .68rem; }
  .student-detail-today .student-detail-unsaved { color: #ad6900; }
  .student-detail-stats { display: grid; grid-template-columns: minmax(150px, 1.25fr) repeat(4, minmax(82px, 1fr)); gap: 9px; padding: 19px 0; }
  .student-detail-rate, .student-detail-stat { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; min-height: 118px; padding: 13px; border: 1px solid #e8edf3; border-radius: 12px; background: #fff; }
  .student-detail-rate { background: linear-gradient(145deg, #fff5f6, #fff 72%); border-color: #f4dadd; }
  .student-detail-rate > span, .student-detail-stat > span:not(.student-detail-stat-icon) { color: #748298; font-size: .72rem; font-weight: 600; }
  .student-detail-rate > strong { margin-top: 3px; color: #c90016; font-size: 1.55rem; line-height: 1.2; }
  .student-detail-rate > small { margin-top: 3px; color: #8995a5; font-size: .65rem; }
  .student-detail-rate-track { width: 100%; height: 5px; margin-top: auto; overflow: hidden; border-radius: 99px; background: #f4dfe1; }
  .student-detail-rate-track i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
  .student-detail-stat { gap: 5px; }
  .student-detail-stat-icon { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; background: #e7f8ed; color: #179755; }
  .student-detail-stat-icon svg { display: block; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .student-detail-stat.is-late .student-detail-stat-icon { background: #fff3dd; color: #c28208; }
  .student-detail-stat.is-absent .student-detail-stat-icon { background: #fff0f1; color: #d52232; }
  .student-detail-stat.is-leave .student-detail-stat-icon { background: #e9f3ff; color: #277bdd; }
  .student-detail-stat strong { color: #172338; font-size: 1.22rem; line-height: 1.1; }
  .student-detail-stat strong small { color: #8a96a6; font-size: .66rem; font-weight: 500; }
  .student-detail-history { padding-top: 1px; }
  .student-detail-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
  .student-detail-section-heading h3 { margin: 0 0 2px; color: #26354a; font-size: .92rem; font-weight: 700; }
  .student-detail-section-heading p { margin: 0; color: #8794a5; font-size: .7rem; }
  .student-detail-section-heading > span { flex: 0 0 auto; padding: 4px 8px; border-radius: 7px; background: #f1f4f8; color: #69778a; font-size: .68rem; }
  .student-detail-history-list { border-top: 1px solid #edf1f5; }
  .student-detail-history-row { display: grid; grid-template-columns: 120px 92px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 43px; border-bottom: 1px solid #edf1f5; }
  .student-detail-history-row time { color: #586981; font-size: .74rem; }
  .student-detail-history-note { min-width: 0; overflow: hidden; color: #8491a2; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }
  .student-detail-empty { padding: 18px 12px; border-radius: 9px; background: #f7f9fb; color: #7d8a9d; font-size: .76rem; text-align: center; }
  .attendance-aside { display: grid; gap: 13px; }
  .attendance-aside .panel-card { padding: 18px; }
  .attendance-donut-wrap { display: flex; align-items: center; gap: 14px; }
  .attendance-donut { display: grid; place-items: center; flex: 0 0 138px; width: 138px; height: 138px; border-radius: 50%; background: #e9eef3; }
  .attendance-donut::before { content: ""; grid-area: 1/1; width: 103px; height: 103px; border-radius: 50%; background: #fff; }
  .attendance-donut > span { grid-area: 1/1; z-index: 1; text-align: center; color: #8390a1; font-size: .68rem; line-height: 1.15; }
  .attendance-donut strong { display: block; color: #152136; font-size: 1.7rem; line-height: 1.15; }
  .attendance-legend { display: grid; flex: 1; gap: 5px; min-width: 0; }
  .attendance-legend > div { display: flex; align-items: center; gap: 6px; color: #5f6e82; font-size: .72rem; }
  .attendance-legend strong { margin-left: auto; color: #223149; }
  .legend-dot { display: inline-block; flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; }
  .legend-dot.is-present { background: var(--status-present); }
  .legend-dot.is-late { background: var(--status-late); }
  .legend-dot.is-absent { background: var(--status-absent); }
  .legend-dot.is-leave { background: var(--status-leave); }
  .legend-dot.is-unchecked { background: #c8d2dd; }
  .attention-students { display: grid; gap: 2px; }
  .attention-student { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #edf1f5; }
  .attention-student:last-child { border: 0; }
  .attention-student .student-avatar { flex-basis: 30px; width: 30px; height: 30px; font-size: .75rem; }
  .attention-student > span:nth-child(2) { display: grid; min-width: 0; }
  .attention-student strong { overflow: hidden; color: #233147; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
  .attention-student small { color: #8d99a8; font-size: .69rem; }
  .attention-student .history-status { margin-left: auto; }

  /* Student directory stays tied to existing enrollment and attendance data. */
  .student-directory { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(0, 1.35fr); gap: 15px; align-items: start; }
  .student-list-panel { padding: 15px 0 0; overflow: hidden; }
  .directory-filter { display: grid; grid-template-columns: 1fr auto; gap: 9px; padding: 0 15px 14px; }
  .directory-search { grid-column: 1/-1; height: 42px; padding: 0 12px; }
  .directory-filter .form-select { min-width: 0; }
  .directory-filter .btn { min-height: 42px; }
  .student-list-heading { display: flex; justify-content: space-between; gap: 10px; padding: 11px 16px; background: #f7f9fb; color: #24334a; font-size: .78rem; }
  .student-list-heading span { color: #8592a3; }
  .directory-list { max-height: 610px; overflow: auto; }
  .directory-student { display: flex; align-items: center; gap: 10px; min-height: 65px; padding: 8px 14px; border-bottom: 1px solid #edf1f5; color: var(--ink); text-decoration: none; }
  .directory-student:hover { background: #f8fafc; color: var(--ink); }
  .directory-student.active { background: #fff0f2; border-left: 3px solid var(--brand); padding-left: 11px; }
  .student-list-number { display: grid; place-items: center; flex: 0 0 23px; width: 23px; height: 23px; border-radius: 50%; background: #f0f3f7; color: #637288; font-size: .7rem; }
  .directory-student-copy { display: grid; min-width: 0; }
  .directory-student-copy strong { overflow: hidden; color: #1f2d42; font-size: .82rem; text-overflow: ellipsis; white-space: nowrap; }
  .directory-student-copy small { color: #8996a6; font-size: .7rem; }
  .directory-student > .ui-icon { width: 16px; height: 16px; margin-left: auto; color: #a4afbc; }
  .student-list-limit { padding: 12px 16px; color: #8390a1; font-size: .76rem; }
  .student-profile { display: grid; gap: 15px; min-width: 0; }
  .profile-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
  .profile-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
  .student-avatar.avatar-large { flex-basis: 84px; width: 84px; height: 84px; border-radius: 18px; font-size: 2rem; }
  .profile-overline { color: #7c8a9c; font-size: .72rem; }
  .profile-identity h2 { margin: 2px 0 4px; font-size: 1.42rem; }
  .profile-identity p { margin: 0; color: #718096; font-size: .82rem; line-height: 1.7; }
  .profile-header .btn { flex-shrink: 0; }
  .profile-rate { display: grid; color: #17a15a; font-size: 1.38rem; font-weight: 700; text-align: right; }
  .profile-rate small { color: #8794a5; font-size: .68rem; font-weight: 500; }
  .profile-stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; }
  .profile-stat { display: grid; grid-template-columns: minmax(0, 1fr) 29px; grid-template-rows: auto 1fr auto; grid-template-areas: "label icon" "value icon" "progress progress"; align-items: start; gap: 6px 10px; min-height: 112px; padding: 12px; border: 1px solid #ecf0f4; border-radius: 10px; color: #5e6d82; font-size: .73rem; }
  .profile-stat .status-symbol { grid-area: icon; display: grid; place-items: center; justify-self: end; align-self: start; width: 29px; height: 29px; border-radius: 10px; background: #e5f8ed; color: var(--status-present); }
  .profile-stat-late .status-symbol { background: #fff0d9; color: var(--status-late); }
  .profile-stat-absent .status-symbol { background: #ffebee; color: var(--status-absent); }
  .profile-stat-leave .status-symbol { background: #e8f2ff; color: var(--status-leave); }
  .profile-stat > span:nth-child(2) { grid-area: label; align-self: end; min-width: 0; color: #637187; font-size: .73rem; line-height: 1.3; }
  .profile-stat strong { grid-area: value; display: flex; align-items: baseline; gap: 4px; min-width: 0; color: #172338; font-size: 1.4rem; line-height: 1.1; }
  .profile-stat strong small { display: inline; color: #8290a2; font-size: .72rem; font-weight: 500; }
  .profile-stat .mini-progress { grid-area: progress; width: 100%; height: 5px; color: var(--status-present); }
  .profile-stat-late .mini-progress { color: var(--status-late); }
  .profile-stat-absent .mini-progress { color: var(--status-absent); }
  .profile-stat-leave .mini-progress { color: var(--status-leave); }
  .student-history { display: grid; }
  .history-entry { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #edf1f5; }
  .history-entry:last-child { border-bottom: 0; }
  .history-entry time { min-width: 150px; color: #53647b; font-size: .8rem; }
  .history-note { color: #8693a5; font-size: .76rem; }

  /* Reports, Morning Talk, import, and administration share the same surface language. */
  .report-toolbar { margin: 14px 0 18px; }
  .report-toolbar strong { color: #223149; }
  .report-toolbar .btn-primary { background: #fff; border-color: #f15b69; color: var(--brand); }
  .report-toolbar .btn-primary:hover { background: #fff0f1; color: var(--brand-dark); }
  .report-insights { margin-bottom: 18px; }
  .report-summary-grid { margin-top: 0; }
  .report-overview-grid { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.1fr); gap: 14px; margin-top: 14px; }
  .report-donut-layout { display: flex; align-items: center; gap: 28px; }
  .report-donut { display: grid; place-items: center; flex: 0 0 168px; width: 168px; height: 168px; border-radius: 50%; }
  .report-donut.is-empty { background: #e9eef3 !important; }
  .report-donut::before { content: ""; grid-area: 1/1; width: 121px; height: 121px; border-radius: 50%; background: #fff; }
  .report-donut > span { grid-area: 1/1; z-index: 1; color: #7c8999; text-align: center; font-size: .72rem; }
  .report-donut strong { display: block; color: #19253a; font-size: 1.85rem; line-height: 1.1; }
  .report-donut-legend { display: grid; flex: 1; gap: 9px; }
  .report-donut-legend > div { display: grid; grid-template-columns: 9px 1fr auto auto; align-items: center; gap: 7px; color: #516077; font-size: .78rem; }
  .report-donut-legend strong { color: #24334a; }
  .report-donut-legend small { min-width: 45px; color: #8794a5; text-align: right; }
  .report-followup-row { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 6px 0; border-bottom: 1px solid #edf1f5; }
  .report-followup-row:last-child { border-bottom: 0; }
  .report-followup-row > span:nth-child(3) { display: grid; min-width: 0; }
  .report-followup-row strong { overflow: hidden; color: #28364b; font-size: .78rem; text-overflow: ellipsis; white-space: nowrap; }
  .report-followup-row small { color: #8794a5; font-size: .7rem; }
  .report-followup-count { margin-left: auto; color: var(--brand); font-size: .73rem; white-space: nowrap; }
  .report-talk-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .report-talk-overview .panel-card { display: grid; justify-items: start; gap: 4px; min-height: 125px; }
  .report-talk-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #fff0f1; color: var(--brand); }
  .report-talk-overview .panel-card > span:nth-child(2) { color: #68778b; font-size: .77rem; }
  .report-talk-overview strong { color: #162237; font-size: 1.5rem; line-height: 1.2; }
  .report-talk-overview strong small { color: #7e8b9c; font-size: .82rem; font-weight: 500; }
  .report-talk-overview .report-talk-period { font-size: .88rem; line-height: 1.5; }
  .report-page { border-radius: var(--radius); box-shadow: var(--shadow); }
  .admin-tabs { align-items: stretch; gap: 5px; border-bottom: 1px solid var(--line); }
  .admin-tabs > .nav-item { display: flex; align-items: stretch; }
  .admin-tabs .nav-link { display: flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; padding: .65rem .9rem; line-height: 1.25; color: #657489; border-radius: 8px; font-weight: 700; }
  .admin-tabs .nav-link:hover { background: #f5f7fa; color: var(--brand); }
  .admin-tabs .nav-link.active { background: #fff0f2; color: var(--brand); }
  .admin-form-card h3 { margin-bottom: 19px; }
  .photo-import-panel { margin-bottom: 16px; }
  .photo-import-fields { display: grid; grid-template-columns: minmax(160px, .7fr) minmax(180px, .8fr) minmax(300px, 1.8fr); gap: 14px; align-items: end; }
  .photo-file-field { min-width: 0; }
  .photo-file-field small { display: block; margin-top: 7px; color: #7b899b; font-size: .75rem; line-height: 1.5; }
  .photo-import-actions { display: flex; align-items: center; gap: 14px; margin-top: 20px; }
  .photo-import-footer { justify-content: space-between; border-top: 1px solid var(--line); padding-top: 17px; }
  .photo-match-table { min-width: 640px; margin-bottom: 0; }
  .photo-match-table td { vertical-align: middle; }
  .photo-match-status { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 9px; border-radius: 7px; background: #f0f3f7; color: #5d6b7e; font-size: .74rem; font-weight: 700; white-space: nowrap; }
  .photo-match-status.is-ready, .photo-match-status.is-saved { background: #e6f8ed; color: #13854d; }
  .photo-match-status.is-ambiguous, .photo-match-status.is-duplicate { background: #fff3dd; color: #a36a00; }
  .photo-match-status.is-invalid, .photo-match-status.is-too_large, .photo-match-status.is-not_found, .photo-match-status.is-failed { background: #fff0f1; color: #c92032; }
  .individual-photo-editor { margin-top: 16px; }
  .individual-photo-fields { display: grid; grid-template-columns: minmax(150px, .8fr) minmax(170px, .9fr) minmax(250px, 1.4fr); gap: 14px; align-items: end; }
  .individual-photo-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-top: 20px; }
  .individual-current-photo { display: flex; align-items: center; gap: 14px; min-height: 126px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
  .individual-photo-frame { display: grid; place-items: center; flex: 0 0 92px; width: 92px; height: 92px; overflow: hidden; border: 1px solid #e4eaf1; border-radius: 12px; background: #fff; color: #8794a6; font-size: .72rem; text-align: center; }
  .individual-photo-frame img, .individual-new-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .individual-photo-frame strong, .individual-current-photo strong { color: #27364b; font-size: .9rem; }
  .individual-current-photo p { margin-top: 5px; line-height: 1.5; }
  .individual-new-photo { min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 12px; }
  .individual-new-photo > small { display: block; margin-top: 7px; color: #7b899b; font-size: .75rem; line-height: 1.5; }
  .individual-new-preview { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: #657489; font-size: .78rem; }
  .individual-new-preview img { width: 48px; height: 48px; flex: 0 0 48px; border: 1px solid var(--line); border-radius: 8px; }
  .individual-new-preview[hidden] { display: none; }
  .student-avatar.has-photo { overflow: hidden; }
  .student-avatar.has-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
  .help-card { background: #fff; }
  .help-icon { display: grid; place-items: center; color: var(--brand); }
  .callout { border-color: #f1d5d8; background: #fff7f8; color: #65515a; }
  .login-page { background: #f4f7fb; }
  .login-card { border: 1px solid var(--line); box-shadow: 0 18px 55px rgba(30, 46, 73, .1) !important; }
  .login-card::before { content: ""; display: block; width: 40px; height: 4px; margin-bottom: 23px; border-radius: 3px; background: var(--brand); }
  .mobile-bottom-nav { display: none; }
  .icon-button.sidebar-close { color: #59687d; background: #f5f7fa; border-color: var(--line); }
}

@media screen and (max-width: 1279px) {
  .dashboard-stat-grid .stat-card { grid-template-columns: minmax(0, 1fr) 34px; column-gap: 8px; padding: 13px; }
  .dashboard-stat-grid .stat-icon { width: 34px; height: 34px; }
  .dashboard-stat-grid .stat-copy strong { font-size: 1.55rem; }
  .dashboard-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-attention-card { grid-column: 1/-1; }
  .dashboard-layout .dashboard-trend-card { grid-column: 1; }
  .report-overview-grid { grid-template-columns: 1fr; }
  .attendance-main-grid { grid-template-columns: minmax(0, 1fr); }
  .attendance-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attendance-room-banner { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 18px 24px; }
  .attendance-banner-progress { grid-column: 1/-1; grid-template-columns: minmax(180px, .65fr) minmax(180px, 1fr) auto; align-items: center; gap: 16px; padding: 15px 0 0; border-top: 1px solid var(--line); border-left: 0; }
}

@media screen and (max-width: 991px) {
  .photo-import-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photo-file-field { grid-column: 1/-1; }
  .individual-photo-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .individual-photo-fields > :last-child { grid-column: 1/-1; }
  .app-sidebar { padding: 0 16px 18px; }
  .sidebar-brand { padding-top: 10px; }
  .icon-button.sidebar-close { right: 8px; top: 17px; }
  .app-topbar { height: 68px; }
  .topbar-mobile-brand { display: flex; align-items: center; gap: 6px; color: #1e2b3e; font-size: .88rem; font-weight: 700; }
  .topbar-mobile-brand .ui-icon { color: var(--brand); }
  .topbar-search { width: min(35vw, 300px); }
  .app-main { padding: 24px 22px 42px !important; }
  .dashboard-stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .attendance-summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .student-directory { grid-template-columns: minmax(250px, .85fr) minmax(0, 1.15fr); }
  .profile-header { align-items: flex-start; flex-direction: column; }
}

@media screen and (max-width: 767px) {
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .app-topbar { height: 60px; padding: 0 14px; gap: 10px; }
  .sidebar-toggle { width: 38px; height: 38px; border: 0; }
  .topbar-mobile-brand { min-width: 0; font-size: .78rem; }
  .topbar-mobile-brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-search, .topbar-divider, .topbar-date, .user-caption { display: none; }
  .topbar-right { gap: 0; }
  .user-avatar { width: 31px; height: 31px; }
  .app-main { padding: 18px 14px 92px !important; }
  .page-heading { gap: 10px; margin-bottom: 16px; }
  h1 { font-size: 1.48rem; }
  .page-description { font-size: .78rem; }
  .term-filter { align-self: stretch; }
  .term-filter-copy { flex: 1; max-width: none; }
  .term-filter .term-select { max-width: none; }
  .filter-bar { padding: 13px; gap: 10px; }
  .filter-bar > div { flex: 1 1 140px; min-width: min(100%, 140px); }
  .filter-bar > .btn { flex: 1 1 100%; }
  .dashboard-filter-context { display: none; }
  .dashboard-stat-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 7px; }
  .dashboard-stat-grid .stat-card { grid-column: span 2; min-height: 82px; padding: 10px; }
  .dashboard-stat-grid .stat-card:nth-last-child(-n+2) { grid-column: span 3; }
  .dashboard-stat-grid .stat-card { grid-template-columns: minmax(0, 1fr); grid-template-areas: "icon" "copy"; align-content: start; gap: 4px; }
  .dashboard-stat-grid .stat-icon { width: 27px; height: 27px; }
  .dashboard-stat-grid .stat-icon .ui-icon { width: 16px; height: 16px; }
  .dashboard-stat-grid .stat-label { font-size: .66rem; }
  .dashboard-stat-grid .stat-copy strong { font-size: 1.3rem; }
  .dashboard-stat-grid .stat-copy strong small { font-size: .64rem; }
  .dashboard-stat-grid .stat-detail { display: none; }
  .attendance-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .attendance-summary-grid .attendance-summary-card { grid-column: auto; grid-template-columns: minmax(0, 1fr) 30px; min-height: 92px; gap: 6px 8px; padding: 12px; }
  .attendance-summary-grid .attendance-summary-card > span:nth-child(2) { font-size: .7rem; }
  .attendance-summary-grid .attendance-summary-card .status-symbol { width: 30px; height: 30px; }
  .attendance-summary-grid .attendance-summary-card .status-symbol .ui-icon { width: 17px; height: 17px; }
  .attendance-summary-grid .attendance-summary-card strong { font-size: 1.32rem; }
  .attendance-summary-grid .attendance-summary-card strong small { font-size: .68rem; }
  .dashboard-layout { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .dashboard-attention-card, .dashboard-layout .dashboard-trend-card { grid-column: 1; }
  .panel-card, .empty-card, .help-card, .admin-form-card { padding: 17px 15px; }
  .dashboard-attendance { margin-top: 10px; }
  .admin-tabs { max-width: 100%; margin-right: 0; padding-right: 0; overflow-x: auto; }
  .report-talk-overview { grid-template-columns: 1fr 1fr; gap: 8px; }
  .report-talk-overview .panel-card:last-child { grid-column: 1/-1; }
  .report-donut-layout { gap: 12px; }
  .report-donut { flex-basis: 130px; width: 130px; height: 130px; }
  .report-donut::before { width: 96px; height: 96px; }
  .report-donut strong { font-size: 1.45rem; }
  .report-followup-count { font-size: .68rem; }
  .attendance-room-banner { grid-template-columns: minmax(0, 1fr); gap: 14px; padding: 16px; }
  .room-banner-meta { width: 100%; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
  .room-banner-meta > div { align-items: flex-start; gap: 8px; padding-left: 0; border-left: 0; }
  .room-banner-meta .ui-icon { width: 16px; height: 16px; }
  .room-banner-meta > div > span:last-child { font-size: .7rem; }
  .room-banner-meta strong { font-size: .82rem; }
  .attendance-banner-progress { grid-column: auto; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .attendance-banner-progress-track, .attendance-banner-progress small { grid-column: 1/-1; }
  .attendance-main-grid { display: block; }
  .attendance-aside { grid-template-columns: 1fr; gap: 10px; margin-top: 10px; }
  .attendance-action-bar { margin-bottom: 10px; }
  .attendance-action-bar > .btn { width: 100%; }
  .attendance-action-bar .save-row { position: fixed; z-index: 1021; left: 0; right: 0; bottom: calc(68px + env(safe-area-inset-bottom)); padding: 8px 12px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -5px 18px rgba(30, 48, 74, .06); }
  .attendance-action-bar .save-row > span { display: none; }
  .attendance-action-bar .save-row .btn { width: 100%; min-width: 0; }
  .attendance-roster-card { padding: 0; }
  .roster-column-head { display: none; }
  .roster-search-wrap { margin: 10px 13px; max-width: none; }
  .student-row { grid-template-columns: 1fr; gap: 7px; padding: 12px 13px; }
  .student-identity { gap: 7px; }
  .student-number { flex-basis: 23px; width: 23px; height: 23px; }
  .student-actions { margin-left: 30px; }
  .student-note { grid-column: 1; justify-content: flex-start; margin-left: 30px; }
  .student-note-editor { grid-column: 1; padding: 3px 0 5px; }
  .student-detail-modal { padding: 19px 15px 16px; }
  .student-detail-hero { grid-template-columns: 58px minmax(0, 1fr); gap: 11px; padding: 2px 31px 15px 0; }
  .student-detail-avatar { width: 58px; height: 58px; border-radius: 14px; font-size: 1.4rem; }
  .student-detail-identity h2 { font-size: 1.05rem; }
  .student-detail-meta { gap: 4px; }
  .student-detail-meta span { min-height: 23px; padding: 3px 6px; font-size: .63rem; }
  .student-detail-today { grid-column: 1/-1; display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 9px; background: #f7f9fb; text-align: left; }
  .student-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 14px 0; }
  .student-detail-rate { grid-column: 1/-1; min-height: 96px; }
  .student-detail-stat { min-height: 100px; padding: 11px; }
  .student-detail-history-row { grid-template-columns: minmax(76px, .8fr) minmax(66px, auto); gap: 6px; padding: 7px 0; }
  .student-detail-history-row time { font-size: .69rem; }
  .student-detail-history-row .history-status { justify-self: start; }
  .student-detail-history-note { grid-column: 1/-1; white-space: normal; overflow-wrap: anywhere; }
  .section-heading .btn { max-width: none; }
  .student-directory { grid-template-columns: 1fr; gap: 11px; }
  .directory-list { max-height: 350px; }
  .profile-header { flex-direction: row; align-items: flex-start; }
  .profile-header .btn { align-self: flex-start; }
  .student-avatar.avatar-large { flex-basis: 65px; width: 65px; height: 65px; font-size: 1.55rem; }
  .profile-identity h2 { font-size: 1.15rem; }
  .profile-stat-grid { gap: 5px; }
  .profile-stat { min-height: 102px; padding: 10px; }
  .history-entry time { min-width: 130px; }
  .mobile-bottom-nav { position: fixed; z-index: 1022; left: 0; right: 0; bottom: 0; display: flex; align-items: stretch; justify-content: space-around; height: calc(68px + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); background: #fff; border-top: 1px solid #e5ebf2; box-shadow: 0 -4px 16px rgba(30, 48, 74, .045); }
  .mobile-nav-link { display: grid; justify-items: center; align-content: center; gap: 2px; flex: 1; min-width: 0; border: 0; background: none; color: #738196; text-decoration: none; font-size: .64rem; font-weight: 600; }
  .mobile-nav-link .ui-icon { width: 20px; height: 20px; justify-self: center; }
  .mobile-nav-link.active { color: var(--brand); }
  .mobile-nav-link:hover { color: var(--brand-dark); }
}

@media screen and (max-width: 520px) {
  .photo-import-fields { grid-template-columns: 1fr; }
  .photo-file-field { grid-column: 1; }
  .individual-photo-fields, .individual-photo-workspace { grid-template-columns: 1fr; }
  .individual-photo-fields > :last-child { grid-column: 1; }
  .photo-import-actions { align-items: flex-start; flex-direction: column; }
  .photo-import-actions .btn { width: 100%; }
  .profile-header { flex-direction: column; }
  .profile-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .attendance-donut-wrap { justify-content: space-around; }
  .attendance-donut { flex-basis: 128px; width: 128px; height: 128px; }
  .attendance-donut::before { width: 95px; height: 95px; }
  .roster-heading { align-items: flex-start; }
}

@media print {
  .mobile-bottom-nav, .attendance-summary-grid, .report-insights { display: none !important; }
}

/* Student details should behave like a focused record view, not an input form. */
@media screen {
  .student-name-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    width: 100%;
    padding: 2px 3px 2px 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #1b293d;
    font-family: inherit;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
  }
  .student-name-wrap { flex: 1 1 0; }
  .student-name-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .student-name-affordance { display: grid; place-items: center; flex: 0 0 23px; width: 23px; height: 23px; border-radius: 6px; color: #8794a5; transition: color .15s, background-color .15s, transform .15s; }
  .student-name-affordance svg { display: block; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .student-name-button:hover { color: var(--brand-dark); text-decoration: none; }
  .student-name-button:hover .student-name-affordance { background: #fff0f2; color: var(--brand); transform: translateX(1px); }
  .student-name-button:focus-visible { outline: 2px solid rgba(230, 0, 18, .4); outline-offset: 2px; }

  .student-detail-link { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 6px; color: #26354a; font-weight: 600; text-decoration: none; transition: color .15s, background-color .15s; }
  .student-detail-link-icon { width: 14px; height: 14px; flex: 0 0 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: #8794a5; }
  .student-detail-link:hover { background: #fff0f2; color: var(--brand-dark); text-decoration: none; }
  .student-detail-link:hover .student-detail-link-icon { color: var(--brand); }

  .swal2-popup.student-details-swal { width: min(860px, calc(100% - 28px)) !important; max-height: min(86vh, 820px); border-color: #dfe6ee; border-radius: 20px; box-shadow: 0 24px 72px rgba(20, 32, 51, .24); }
  .student-details-swal .swal2-close { position: absolute; top: 11px; right: 11px; width: 38px; height: 38px; margin: 0; border: 1px solid #e5ebf2; border-radius: 10px; background: #fff; color: #64748b; font-size: 1.6rem; }
  .student-details-swal .swal2-close:hover { border-color: #f4c9ce; background: #fff5f6; color: var(--brand); }
  .student-details-swal .swal2-html-container { max-height: min(82vh, 770px); overscroll-behavior: contain; }
  .student-details-swal .select-enhanced,
  .student-details-swal .swal2-select,
  .student-details-swal .swal2-input,
  .attendance-confirm-popup .select-enhanced,
  .attendance-confirm-popup .swal2-select,
  .attendance-confirm-popup .swal2-input { display: none !important; }
  .student-detail-modal { padding: 28px 30px 27px; }
  .student-detail-hero { grid-template-columns: 76px minmax(0, 1fr) auto; gap: 18px; padding: 1px 38px 21px 0; }
  .student-detail-avatar { width: 76px; height: 76px; border-radius: 17px; }
  .student-detail-identity h2 { margin: 3px 0 8px; font-size: 1.28rem; letter-spacing: -.018em; }
  .student-detail-meta { gap: 7px; }
  .student-detail-meta span { min-height: 28px; padding: 5px 9px; border-radius: 8px; font-size: .71rem; }
  .student-detail-today { min-width: 126px; gap: 7px; padding: 10px 12px; border-left: 2px solid #e6ebf1; }
  .student-detail-today .history-status { font-size: .74rem; }
  .student-detail-stats { grid-template-columns: minmax(168px, 1.25fr) repeat(4, minmax(78px, 1fr)); gap: 10px; padding: 20px 0 17px; }
  .student-detail-rate, .student-detail-stat { min-height: 108px; padding: 13px; border-radius: 11px; }
  .student-detail-rate { padding-left: 15px; border-left: 3px solid var(--brand); background: #fffafb; }
  .student-detail-rate > strong { font-size: 1.48rem; }
  .student-detail-stat-icon { width: 30px; height: 30px; border-radius: 8px; }
  .student-detail-history { padding-top: 3px; }
  .student-detail-section-heading { margin-bottom: 9px; }
  .student-detail-section-heading h3 { font-size: .94rem; }
  .student-detail-section-heading p { margin-top: 2px; }
  .student-detail-history-row { min-height: 45px; }
  .student-detail-empty { padding: 22px 14px; }
}

@media screen and (max-width: 767px) {
  .student-details-swal .swal2-html-container { max-height: min(82vh, 720px); }
  .student-detail-modal { padding: 23px 18px 20px; }
  .student-detail-hero { grid-template-columns: 60px minmax(0, 1fr); gap: 12px; padding: 1px 31px 16px 0; }
  .student-detail-avatar { width: 60px; height: 60px; border-radius: 14px; }
  .student-detail-today { grid-column: 1/-1; min-width: 0; }
  .student-detail-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 16px 0; }
  .student-detail-rate { grid-column: 1/-1; min-height: 96px; }
  .student-detail-stat { min-height: 96px; padding: 11px; }
  .student-name-affordance { flex-basis: 21px; width: 21px; height: 21px; }
}

@media print {
  .student-detail-link-icon { display: none !important; }
}
