*{
  box-sizing:border-box;
}

body{
  margin:0;
  font-family:Inter, Arial, Helvetica, sans-serif;
  background:#eef2f6;
  color:#0f172a;
}

.login-screen{
  min-height:100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  background:linear-gradient(135deg,#0b1d39,#123b6d);
}

.login-card{
  width:400px;
  background:#ffffff;
  border-radius:20px;
  padding:34px;
  box-shadow:0 22px 60px rgba(0,0,0,.24);
}

.login-brand h1{
  margin:0 0 6px 0;
  color:#0f172a;
}

.login-brand p{
  margin:0 0 24px 0;
  color:#64748b;
}

.login-card label{
  display:block;
  margin:12px 0 6px;
  font-size:14px;
  font-weight:600;
}

.login-card input{
  width:100%;
  padding:12px 14px;
  border:1px solid #cbd5e1;
  border-radius:12px;
  outline:none;
  font-size:14px;
}

.login-card input:focus{
  border-color:#0ea5e9;
}

.login-card button{
  width:100%;
  margin-top:18px;
  padding:13px;
  border:none;
  border-radius:12px;
  background:#0f172a;
  color:white;
  font-weight:700;
  cursor:pointer;
}

.error-box{
  margin-top:14px;
  color:#b91c1c;
  font-size:14px;
}

.dashboard-shell{
  display:flex;
  min-height:100vh;
  align-items:stretch;
}

.sidebar{
  width:210px;
  flex-shrink:0;
  background:linear-gradient(180deg,#081a33 0%, #0a2242 100%);
  color:#fff;
  padding:16px 10px;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
}

.main-area{
  flex:1;
  display:flex;
  flex-direction:column;
  min-width:0;
  min-height:100vh;
  padding:12px 18px 24px;
  background:#f3f6fb;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:16px;
  margin-bottom:18px;
  flex-shrink:0;
}

.topbar-left{
  min-width:0;
}

.topbar-left h1{
  margin:0;
  font-size:24px;
  font-weight:800;
  color:#0f172a;
}

.topbar-left p{
  margin:4px 0 0;
  font-size:14px;
  color:#64748b;
}

.topbar-right{
  display:flex;
  align-items:center;
  gap:12px;
  margin-left:auto;
}

.topbar-actions{
  position:relative;
  display:flex;
  align-items:center;
  gap:10px;
}

.top-action-btn{
  width:42px;
  height:42px;
  border:1px solid #d9e2ec;
  background:#fff;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:all 0.15s ease;
  padding:0;
}

.top-action-btn:hover{
  background:#f8fafc;
  border-color:#bfc9d4;
}

.top-action-icon{
  width:20px;
  height:20px;
  display:block;
}

.topbar-user-card{
  background:#fff;
  border-radius:14px;
  padding:10px 14px;
  box-shadow:0 4px 12px rgba(15,23,42,0.06);
  min-width:170px;
}

.topbar-user-name{
  font-size:14px;
  font-weight:700;
  color:#0f172a;
}

.topbar-user-role{
  font-size:13px;
  color:#64748b;
}

#page-content{
  display:block;
  width:100%;
  margin-top:0;
}

.sidebar-top{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:18px;
}

.logo-box{
  width:44px;
  height:44px;
  border-radius:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#15375f;
  font-size:22px;
}

.brand-text h2{
  margin:0;
  font-size:20px;
}

.brand-text span{
  display:inline-block;
  margin-top:4px;
  color:#93c5fd;
  font-size:12px;
  background:rgba(255,255,255,.08);
  padding:3px 8px;
  border-radius:999px;
}

.menu-section-title{
  margin:18px 8px 10px;
  font-size:11px;
  letter-spacing:.08em;
  color:#6fa0d6;
  font-weight:700;
}

.menu-list{
  list-style:none;
  padding:0;
  margin:0;
}

.menu-list li{
  display:flex;
  align-items:center;
  gap:10px;
  margin:6px 0;
  padding:12px 14px;
  border-radius:14px;
  cursor:pointer;
  color:#dce9f8;
  transition:.2s ease;
  font-weight:600;
}

.menu-list li:hover{
  background:rgba(255,255,255,.08);
}

.menu-list li.active{
  background:#1d4ed8;
  color:white;
  box-shadow:0 10px 24px rgba(29,78,216,.26);
}

.menu-icon-wrap{
  width:20px;
  height:20px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.menu-icon{
  width:18px;
  height:18px;
}

.sidebar-bottom{
  border-top:1px solid rgba(255,255,255,.08);
  padding-top:16px;
}

.status-box{
  background:rgba(59,130,246,.12);
  color:#93c5fd;
  border:1px solid rgba(134,239,172,.18);
  padding:10px 12px;
  border-radius:12px;
  font-size:13px;
  margin-bottom:14px;
}

.user-card{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:14px;
}

.user-avatar{
  width:42px;
  height:42px;
  border-radius:50%;
  background:#dbeafe;
  color:#1e3a8a;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
}

.user-name{
  font-weight:700;
  font-size:14px;
}

.user-role{
  font-size:12px;
  color:#a9c7ea;
}

.logout-btn{
  width:100%;
  padding:12px;
  border:none;
  border-radius:12px;
  background:#ffffff;
  color:#0b2545;
  font-weight:700;
  cursor:pointer;
}

.kpi-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:14px;
  margin-bottom:18px;
}

.kpi-card{
  background:#fff;
  border-radius:16px;
  padding:18px 16px;
  box-shadow:0 6px 16px rgba(15,23,42,0.06);
  border:1px solid #eef2f7;
}

.kpi-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
}

.kpi-value{
  font-size:28px;
  font-weight:800;
  color:#0f172a;
  line-height:1;
}

.kpi-label{
  margin-top:6px;
  font-size:14px;
  color:#64748b;
}

.kpi-icon-box{
  width:46px;
  height:46px;
  border-radius:12px;
  background:#f1f5f9;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.kpi-icon-svg{
  width:22px;
  height:22px;
  display:block;
}

svg{
  max-width:100%;
  max-height:100%;
}

.menu-icon,
.ui-icon,
.classroom-row-icon,
assignment-row-icon,
grade-row-icon,
message-row-icon,
kpi-icon-svg,
.top-action-icon{
  width:20px;
  height:20px;
  display:block;
  flex-shrink:0;
}

.dashboard-row{
  display:grid;
  grid-template-columns:1.1fr 1fr;
  gap:16px;
  margin-bottom:16px;
}

.panel{
  background:white;
  border-radius:16px;
  padding:16px;
  border:1px solid #e7edf5;
  box-shadow:0 2px 10px rgba(15,23,42,.05);
}

.panel h3{
  margin:0 0 16px 0;
  font-size:15px;
  font-weight:800;
}

.plan-chart{
  display:flex;
  align-items:flex-end;
  gap:18px;
  height:170px;
  padding:12px 8px 0;
}

.plan-bar-wrap{
  flex:1;
  text-align:center;
}

.plan-bar{
  width:100%;
  background:#bfdbfe;
  border-radius:10px 10px 0 0;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  color:#0f172a;
  font-weight:800;
  padding-top:8px;
}

.plan-label{
  margin-top:8px;
  font-size:13px;
  color:#64748b;
}

.activity-list{
  display:flex;
  flex-direction:column;
  gap:12px;
}

.activity-item{
  display:flex;
  justify-content:space-between;
  gap:12px;
  padding-bottom:12px;
  border-bottom:1px solid #edf2f7;
}

.activity-item:last-child{
  border-bottom:none;
  padding-bottom:0;
}

.activity-left{
  display:flex;
  gap:12px;
}

.activity-icon{
  width:36px;
  height:36px;
  border-radius:50%;
  background:#f3f4f6;
  display:flex;
  align-items:center;
  justify-content:center;
  color:#334155;
}

.activity-icon-svg{
  width:18px;
  height:18px;
}

.activity-title{
  font-weight:700;
  font-size:14px;
}

.activity-sub{
  font-size:13px;
  color:#64748b;
  margin-top:4px;
}

.activity-time{
  font-size:12px;
  color:#64748b;
  white-space:nowrap;
}

.large-panel{
  background:white;
  border-radius:16px;
  padding:16px;
  border:1px solid #e7edf5;
  box-shadow:0 2px 10px rgba(15,23,42,.05);
}

.large-panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom:12px;
}

.large-panel-header h3{
  margin:0;
  font-size:15px;
  font-weight:800;
}

.link-btn{
  border:1px solid #1d4ed8;
  color:#1d4ed8;
  background:white;
  padding:8px 14px;
  border-radius:999px;
  font-weight:700;
  cursor:pointer;
}

.table-wrap{
  overflow:auto;
}

table{
  width:100%;
  border-collapse:collapse;
}

th, td{
  text-align:left;
  padding:14px 12px;
  border-bottom:1px solid #edf2f7;
  font-size:14px;
}

th{
  color:#64748b;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  background:#f8fafc;
}

.school-name-cell{
  display:flex;
  align-items:center;
  gap:12px;
}

.school-logo-mini{
  width:34px;
  height:34px;
  border-radius:10px;
  background:#bfdbfe;
  color:#1e3a8a;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:13px;
}

.school-name-main{
  font-weight:700;
}

.school-name-sub{
  font-size:12px;
  color:#64748b;
  margin-top:2px;
}

.badge{
  display:inline-block;
  padding:5px 10px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
}

.badge-plan-standard{
  background:#dbeafe;
  color:#1d4ed8;
}

.badge-plan-starter{
  background:#fef3c7;
  color:#b45309;
}

.badge-plan-premium{
  background:#e9d5ff;
  color:#7e22ce;
}

.badge-status-active{
  background:#dcfce7;
  color:#15803d;
}

.badge-status-inactive{
  background:#fee2e2;
  color:#b91c1c;
}

.simple-panel{
  background:white;
  border-radius:16px;
  padding:16px;
  border:1px solid #e7edf5;
  box-shadow:0 2px 10px rgba(15,23,42,.05);
}

.simple-cards{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));
  gap:14px;
  margin-bottom:16px;
}

.simple-card{
  background:white;
  border:1px solid #e7edf5;
  border-radius:14px;
  padding:16px;
}

.option-list{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
}

.option-chip{
  background:#eff6ff;
  color:#1e3a8a;
  border:1px solid #a7f3d0;
  padding:8px 12px;
  border-radius:999px;
  font-size:13px;
  font-weight:700;
}

pre.json-box{
  background:#081529;
  color:#f8fafc;
  padding:16px;
  border-radius:12px;
  overflow:auto;
  font-size:13px;
}

@media (max-width:1200px){
  .kpi-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .dashboard-row{
    grid-template-columns:1fr;
  }
}

@media (max-width:900px){
  .dashboard-shell{
    flex-direction:column;
  }

  .sidebar{
    width:100%;
  }

  .topbar-right{
    width:100%;
    justify-content:space-between;
  }
}

.course-cell{
  display:flex;
  align-items:center;
  gap:12px;
}

.course-color-dot{
  width:14px;
  height:14px;
  border-radius:50%;
  flex-shrink:0;
}

.course-name-main{
  font-weight:700;
}

.course-name-sub{
  font-size:12px;
  color:#64748b;
  margin-top:2px;
}

.assignment-cell{
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.assignment-icon-box{
  width:34px;
  height:34px;
  border-radius:10px;
  background:#eef2ff;
  color:#4338ca;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.assignment-row-icon{
  width:18px;
  height:18px;
}

.assignment-name-main{
  font-weight:700;
}

.assignment-name-sub{
  font-size:12px;
  color:#64748b;
  margin-top:2px;
  max-width:420px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.grade-cell{
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.grade-icon-box{
  width:34px;
  height:34px;
  border-radius:10px;
  background:#eff6ff;
  color:#1d4ed8;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.grade-row-icon{
  width:18px;
  height:18px;
}

.grade-name-main{
  font-weight:700;
}

.grade-name-sub{
  font-size:12px;
  color:#64748b;
  margin-top:2px;
}

.performance-chart{
  display:flex;
  align-items:flex-end;
  gap:18px;
  height:170px;
  padding:12px 8px 0;
}

.performance-high{
  background:#bbf7d0;
}

.performance-mid{
  background:#fde68a;
}

.performance-low{
  background:#fecaca;
}

.message-cell{
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.message-icon-box{
  width:34px;
  height:34px;
  border-radius:10px;
  background:#ecfeff;
  color:#0f766e;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.message-row-icon{
  width:18px;
  height:18px;
}

.message-subject-main{
  font-weight:700;
}

.message-subject-sub{
  font-size:12px;
  color:#64748b;
  margin-top:2px;
  max-width:420px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.message-summary-grid{
  display:grid;
  gap:12px;
}

.message-summary-item{
  padding:12px;
  border:1px solid #e7edf5;
  border-radius:12px;
  background:#f8fafc;
}

.message-summary-label{
  font-size:12px;
  color:#64748b;
  margin-bottom:6px;
}

.message-summary-value{
  font-weight:700;
  color:#0f172a;
}

.classroom-cell{
  display:flex;
  align-items:flex-start;
  gap:12px;
}

.classroom-icon-box{
  width:34px;
  height:34px;
  border-radius:10px;
  background:#eff6ff;
  color:#166534;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-shrink:0;
}

.classroom-row-icon{
  width:18px;
  height:18px;
}

.classroom-name-main{
  font-weight:700;
}

.classroom-name-sub{
  font-size:12px;
  color:#64748b;
  margin-top:2px;
}

.empty-state{
  background:white;
  border-radius:16px;
  padding:40px;
  text-align:center;
  color:#64748b;
  border:1px solid #e7edf5;
}

.modal-open {
  overflow: hidden;
}

.modal-sm {
  max-width: 420px;
}

.modal-md {
  max-width: 680px;
}

.modal-lg {
  max-width: 860px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #e7edf5;
}

.modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: #0f172a;
}

.modal-close-btn {
  border: none;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
  overflow-y: auto;
}

.modal-card {
  width: 100%;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  border: 1px solid #e7edf5;
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-body {
  padding: 22px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

.gogga-form {
  display: grid;
  gap: 16px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.form-grid.two-cols {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: #334155;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #dbe4ee;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #123b6d;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-error-box {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.primary-btn,
.secondary-btn,
.danger-btn {
  border: none;
  border-radius: 12px;
  min-height: 44px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 600;
}

.primary-btn {
  background: #123b6d;
  color: white;
}

.secondary-btn {
  background: #eef2f7;
  color: #0f172a;
}

.danger-btn {
  background: #dc2626;
  color: white;
}

.toast-box {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 10px;
  z-index: 10000;
}

.toast-item {
  min-width: 240px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  color: white;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  font-size: 14px;
}

.toast-success {
  background: #16a34a;
}

.toast-error {
  background: #dc2626;
}

@media (max-width: 1024px) {
  .form-grid.two-cols {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    flex-direction: column;
  }
}

.form-grid.three-cols {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 900px) {
  .form-grid.three-cols {
    grid-template-columns: 1fr;
  }
}

.clickable-message-row {
  cursor: pointer;
}

.clickable-message-row:hover {
  background: #f8fafc;
}

.message-detail-box {
  display: grid;
  gap: 16px;
}

.message-detail-meta {
  padding: 14px;
  border: 1px solid #e7edf5;
  border-radius: 12px;
  background: #f8fafc;
}

.message-detail-meta p {
  margin: 0 0 8px 0;
}

.message-detail-meta p:last-child {
  margin-bottom: 0;
}

.message-detail-body {
  min-height: 120px;
  padding: 16px;
  border: 1px solid #e7edf5;
  border-radius: 12px;
  background: white;
  color: #0f172a;
  line-height: 1.6;
}

.helper-text {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

.small-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.clickable-notification-row:hover {
  background: #f8fafc;
}

.clickable-classroom-row {
  cursor: pointer;
}

.clickable-classroom-row:hover {
  background: #f8fafc;
}

.clickable-course-row {
  cursor: pointer;
}

.clickable-course-row:hover {
  background: #f8fafc;
}

.clickable-assignment-row {
  cursor: pointer;
}

.clickable-assignment-row:hover {
  background: #f8fafc;
}

.clickable-student-row {
  cursor: pointer;
}

.clickable-student-row:hover {
  background: #f8fafc;
}

.search-user-row,
.search-classroom-row,
.search-course-row {
  cursor: pointer;
}

.search-user-row:hover,
.search-classroom-row:hover,
.search-course-row:hover {
  background: #f8fafc;
}

.clickable-user-row {
  cursor: pointer;
}

.clickable-user-row:hover,
.clickable-user-row:focus-visible {
  background: #f8fafc;
}

.clickable-user-row:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.login-extra-actions {
  margin-top: 10px;
  text-align: right;
}

.text-link-btn{
  background:none;
  border:none;
  color:#123b6d;
  cursor:pointer;
  font-size:14px;
  padding:0;
}

.text-link-btn:hover{
  text-decoration:underline;
}

.panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title h3 {
  margin: 0;
}

.panel-subtitle {
  font-size: 13px;
  color: #123b6d;
}

.table-actions {
  display: flex;
  gap: 8px;
}

.table-wrap a {
  color: #123b6d;
  text-decoration: none;
}

.table-wrap a:hover {
  text-decoration: underline;
}

.course-page-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  flex-wrap: wrap;
}

.course-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.view-toggle-group {
  display: inline-flex;
  border: 1px solid #d9e2ec;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.view-toggle-btn {
  border: none;
  background: #fff;
  min-width: 44px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
  padding: 0 12px;
}

.view-toggle-btn.active {
  background: #0f6cbd;
  color: #fff;
}

.course-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.course-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.course-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}

.course-card-banner {
  height: 120px;
  position: relative;
}

.course-card-menu-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  border-radius: 8px;
  width: 36px;
  height: 36px;
}

.course-card-body {
  padding: 14px 16px 10px;
}

.course-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 4px;
}

.course-card-code {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 8px;
}

.course-card-meta {
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 5px;
}

.course-card-footer {
  padding: 0 16px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.media-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.media-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.media-card-thumb {
  height: 140px;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 12px;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.media-type-video {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

.media-type-audio {
  background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

.media-type-document {
  background: linear-gradient(135deg, #059669, #047857);
}

.media-type-link {
  background: linear-gradient(135deg, #ea580c, #c2410c);
}

.media-card-type-label {
  font-size: 12px;
  background: rgba(255,255,255,0.18);
  padding: 4px 8px;
  border-radius: 999px;
}

.media-card-body {
  padding: 14px;
}

.media-card-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 6px;
}

.media-card-desc {
  font-size: 13px;
  color: #4b5563;
  min-height: 38px;
}

.media-card-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 8px;
}

.media-card-footer {
  padding: 0 14px 14px;
}

.modal-container {
  max-width: 900px;
  width: 90%;
  margin: auto;
}

.modal-container.modal-lg {
  max-width: 900px;
}

.modal-container.modal-xl {
  max-width: min(1180px, calc(100vw - 32px));
}

.modal-container.modal-md {
  max-width: 700px;
}

.pdf-preview-frame {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  height: min(76vh, 900px);
  overflow: hidden;
}

.pdf-preview-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
}

.conduct-print-frame {
  width: 100%;
  height: min(76vh, 900px);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}

.classroom-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.classroom-card {
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.classroom-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}

.classroom-card-banner {
  height: 110px;
  background: linear-gradient(135deg, #0f6cbd, #1d4ed8);
  position: relative;
  padding: 14px 16px;
  display: flex;
  align-items: flex-end;
}

.classroom-card-banner-title {
  color: #fff;
  font-size: 22px;
  font-weight: 700;
}

.classroom-card-menu-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  border-radius: 8px;
  width: 36px;
  height: 36px;
}

.classroom-card-body {
  padding: 14px 16px 10px;
}

.classroom-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 6px;
}

.classroom-card-meta {
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 5px;
}

.classroom-card-footer {
  padding: 0 16px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.content-area{
  flex:1;
  display:flex;
  flex-direction:column;
  justify-content:flex-start;
  align-items:stretch;
  min-width:0;
  min-height:0;
  padding:0;
}

#page-content {
  display: block;
  width: 100%;
  margin-top: 18px;
}

.announcement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.announcement-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.announcement-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.10);
}

.announcement-card-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.announcement-card-title {
  font-size: 18px;
  font-weight: 700;
  color: #111827;
}

.announcement-card-meta {
  font-size: 12px;
  color: #6b7280;
  margin-top: 4px;
}

.announcement-card-date {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}

.announcement-card-body {
  font-size: 14px;
  color: #374151;
  min-height: 72px;
}

.announcement-card-footer {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.announcement-author {
  font-size: 12px;
  color: #6b7280;
}

.announcement-popover{
  position:absolute;
  top:52px;
  right:0;
  width:360px;
  max-height:480px;
  overflow-y:auto;
  background:#fff;
  border:1px solid #d9e2ec;
  border-radius:14px;
  box-shadow:0 12px 30px rgba(15,23,42,0.14);
  z-index:50;
  padding:12px;
}

.announcement-popover.hidden{
  display:none;
}

.announcement-popover-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
}

.announcement-popover-title{
  font-size:16px;
  font-weight:700;
  color:#111827;
}

.announcement-popover-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.announcement-popover-item{
  border:1px solid #eef2f7;
  border-radius:12px;
  padding:10px;
  cursor:pointer;
  transition:background 0.15s ease;
}

.announcement-popover-item:hover{
  background:#f8fafc;
}

.announcement-popover-item-title{
  font-size:14px;
  font-weight:700;
  color:#111827;
  margin-bottom:4px;
}

.announcement-popover-item-meta{
  font-size:12px;
  color:#6b7280;
  margin-bottom:6px;
}

.announcement-popover-item-body{
  font-size:13px;
  color:#374151;
}

.announcement-empty{
  padding:18px 10px;
  text-align:center;
  color:#6b7280;
}

.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 10px;
  font-weight: 700;
  color: #475569;
}

.calendar-grid-header > div {
  background: #eef2f7;
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.calendar-day {
  min-height: 130px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.calendar-day.empty {
  background: transparent;
  border: none;
  box-shadow: none;
}

.calendar-day.today {
  border: 2px solid #0f6cbd;
}

.calendar-day-number {
  font-weight: 800;
  margin-bottom: 8px;
  color: #0f172a;
}

.calendar-day-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calendar-event-pill {
  font-size: 12px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 6px 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-more {
  font-size: 12px;
  color: #64748b;
}

.calendar-upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.calendar-upcoming-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
}

.calendar-upcoming-item:hover {
  background: #f8fafc;
}

.calendar-upcoming-title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 4px;
}

.calendar-upcoming-meta {
  font-size: 12px;
  color: #6b7280;
}
/* ━━━ SCHOOL BRANDING VARIABLES ━━━ */
:root {
  --school-primary: #1d4ed8;
}

/* ━━━ LOGIN IMPROVEMENTS ━━━ */
.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  background: none;
  color: #fff;
  font-weight: 800;
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
}

.login-logo.login-user-photo {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: #eff6ff;
  border: 3px solid #dbeafe;
  overflow: hidden;
}

.login-logo.login-user-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.login-preview-initials {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  font-weight: 800;
  font-size: 24px;
}

.login-brand {
  text-align: center;
}

.login-brand p {
  margin: -2px 0 18px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.35;
}

.login-user-preview {
  margin: 8px 0 4px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.35;
}

.login-user-preview strong {
  display: block;
  color: #0f172a;
  font-size: 13px;
}

.login-user-preview span {
  color: #475569;
}

.login-submit-btn {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--school-primary);
  color: white;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.login-submit-btn:hover {
  opacity: 0.9;
}

.login-extra-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.link-btn {
  background: none;
  border: none;
  color: #3b82f6;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.install-app-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e5e7eb;
}

.install-app-btn {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 12px !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  cursor: pointer;
}

.install-app-btn:hover {
  background: #eef2ff !important;
  border-color: #93c5fd !important;
}

.install-app-help {
  margin-top: 8px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

/* ━━━ ATTENDANCE STYLES ━━━ */
.att-status-P { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.att-status-A { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.att-status-R { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.att-status-E { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

.att-radio-group {
  display: flex;
  gap: 8px;
}

.att-radio-group label {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

/* ━━━ PAYMENT BADGES ━━━ */
.badge-plan-standard {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
}

/* ━━━ MOBILE RESPONSIVE ━━━ */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  margin-right: 12px;
}

@media (max-width: 1024px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 240px;
  }

  .sidebar.sidebar-open,
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
  }

  .sidebar-overlay.active {
    display: block;
  }

  .main-area {
    width: 100%;
  }

  .mobile-menu-btn {
    display: block;
  }

  .topbar-user-card {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .form-grid.two-cols {
    grid-template-columns: 1fr !important;
  }

  .dashboard-row {
    flex-direction: column !important;
  }

  .modal-card {
    width: 95% !important;
    max-width: 95% !important;
    margin: 10px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .large-panel-header {
    flex-direction: column;
    gap: 10px;
    align-items: flex-start !important;
  }

  .course-toolbar-actions,
  .panel-actions {
    width: 100%;
    display: flex;
    gap: 8px;
  }

  .classroom-card-grid,
  .course-card-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ━━━ TOAST IMPROVEMENTS ━━━ */
.toast-box {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast-item {
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  animation: toastSlideIn 0.3s ease;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  max-width: 400px;
}

.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }

@keyframes toastSlideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ━━━ FORM ERROR BOX ━━━ */
.form-error-box {
  background: #fee2e2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin: 12px 0;
}

/* ━━━ GOGGA TABLE (standardized) ━━━ */
.gogga-table {
  width: 100%;
  border-collapse: collapse;
}

.gogga-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748b;
  font-weight: 600;
  border-bottom: 2px solid #e2e8f0;
  background: #f8fafc;
}

.gogga-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #e2e8f0;
  font-size: 13.5px;
}

.gogga-table tr:hover td {
  background: #eff6ff;
}

.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.table-empty {
  text-align: center;
  color: #94a3b8;
  padding: 20px;
}

/* ━━━ GOGGA FORM ━━━ */
.gogga-form input,
.gogga-form select,
.gogga-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.gogga-form input:focus,
.gogga-form select:focus,
.gogga-form textarea:focus {
  border-color: var(--school-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.1);
}

.gogga-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}

.gogga-form .form-group {
  margin-bottom: 16px;
}

.form-grid.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ━━━ CALENDAR IMPROVEMENTS ━━━ */
.calendar-grid-header {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: #e2e8f0;
}

.calendar-day {
  background: #fff;
  min-height: 80px;
  padding: 6px;
  position: relative;
}

.calendar-day.empty {
  background: #f8fafc;
}

.calendar-day.today {
  background: #eff6ff;
}

.calendar-day.today .calendar-day-number {
  background: var(--school-primary);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calendar-day-number {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.calendar-event-pill {
  background: var(--school-primary);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  margin-bottom: 2px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-more {
  font-size: 10px;
  color: #64748b;
}

.calendar-upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.calendar-upcoming-item {
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}

.calendar-upcoming-item:hover {
  background: #eff6ff;
}

.calendar-upcoming-title {
  font-weight: 600;
  font-size: 13px;
}

.calendar-upcoming-meta {
  font-size: 11px;
  color: #64748b;
}

/* ━━━ MEDIA CARDS ━━━ */
.media-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.media-card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
}

.media-card-thumb {
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
}

.media-type-document { background: #3b82f6; }
.media-type-video { background: #ef4444; }
.media-type-audio { background: #8b5cf6; }
.media-type-link { background: #f59e0b; }

.media-card-type-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 11px;
}

.media-card-body {
  padding: 10px;
}

.media-card-title {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 4px;
}

.media-card-desc {
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
}

.media-card-meta {
  font-size: 10px;
  color: #94a3b8;
}

.media-card-footer {
  padding: 8px 10px;
  border-top: 1px solid #e2e8f0;
}

/* ━━━ VIEW TOGGLE ━━━ */
.view-toggle-group {
  display: flex;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
}

.view-toggle-btn {
  padding: 6px 12px;
  border: none;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s;
}

.view-toggle-btn.active {
  background: var(--school-primary);
  color: #fff;
}

/* ━━━ CLASSROOM CARDS ━━━ */
.classroom-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.classroom-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.classroom-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.classroom-card-banner {
  background: var(--school-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.classroom-card-banner-title {
  font-weight: 700;
  font-size: 15px;
}

.classroom-card-menu-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.classroom-card-body {
  padding: 14px 16px;
}

.classroom-card-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 8px;
}

.classroom-card-meta {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 3px;
}

.classroom-card-footer {
  padding: 10px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ━━━ COURSE CARDS ━━━ */
.course-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.course-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s;
}

.course-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.course-card-banner {
  color: #fff;
  padding: 18px 16px;
  position: relative;
}

.course-card-banner-icon {
  font-size: 28px;
  margin-bottom: 6px;
}

.course-card-banner-name {
  font-weight: 700;
  font-size: 16px;
}

.course-card-banner-sub {
  font-size: 12px;
  opacity: 0.8;
}

.course-card-menu-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 16px;
}

.course-card-body {
  padding: 14px 16px;
}

.course-card-footer {
  padding: 10px 16px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ━━━ COURSE PAGE TOOLBAR ━━━ */
.course-page-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.course-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ━━━ MESSAGE DETAIL ━━━ */
.message-detail-box {
  padding: 0;
}

.message-detail-meta p {
  margin-bottom: 6px;
  font-size: 13px;
  color: #475569;
}

.message-detail-body {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.6;
}

/* ━━━ MESSAGE SUMMARY GRID ━━━ */
.message-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.message-summary-item {
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px;
}

.message-summary-label {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}

.message-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--school-primary);
}

/* ━━━ MODAL IMPROVEMENTS ━━━ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}

.modal-sm { max-width: 400px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 780px; }

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 24px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

body.modal-open {
  overflow: hidden;
}

/* ━━━ CONFIRM BOX ━━━ */
.confirm-box p {
  margin-bottom: 16px;
  font-size: 14px;
}

/* ━━━ ANNOUNCEMENT POPOVER ━━━ */
.announcement-popover {
  position: absolute;
  top: 50px;
  right: 0;
  width: 320px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.12);
  z-index: 50;
  max-height: 400px;
  overflow-y: auto;
  padding: 16px;
}

.announcement-popover.hidden {
  display: none;
}

/* ━━━ SCROLLBAR ━━━ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }


.password-input-wrap { position: relative; display: flex; align-items: center; }
.password-input-wrap input { width: 100%; padding-right: 48px; }
.password-toggle-btn { position: absolute; right: 10px; border: 0; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; opacity: 0.8; }

/* ━━━ PROFILE & SCHOOL SETTINGS CLICKABLE ELEMENTS ━━━ */
#user-avatar,
#sidebar-user-name,
#sidebar-user-role {
  cursor: pointer;
  transition: opacity 0.15s;
}

#user-avatar:hover,
#sidebar-user-name:hover {
  opacity: 0.75;
}

#sidebar-school-name {
  cursor: pointer;
  transition: opacity 0.15s;
}

#sidebar-school-name:hover {
  opacity: 0.75;
}

/* Tooltip hint */
#user-avatar::after {
  content: "Voir profil";
  position: absolute;
  left: 52px;
  background: #0f172a;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 200;
}

#user-avatar:hover::after {
  opacity: 1;
}

.user-card {
  position: relative;
}

/* ━━━ MOBILE TOPBAR + SIDEBAR FIXES ━━━ */
@media (max-width: 1024px) {
  .dashboard-shell {
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    width: 240px;
    max-width: 82vw;
    height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start;
  }

  .sidebar.sidebar-open,
  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-top {
    flex-shrink: 0;
  }

  .menu-section-title,
  .menu-list,
  .sidebar-bottom {
    flex-shrink: 0;
  }

  .sidebar-bottom {
    margin-top: auto;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .main-area {
    width: 100%;
    min-width: 0;
    padding: 10px 12px 20px;
  }

  .topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .topbar-left {
    min-width: 0;
    flex: 1 1 auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .topbar-left > div {
    min-width: 0;
  }

  .topbar-left h1 {
    font-size: 20px;
    line-height: 1.15;
  }

  .topbar-left p {
    font-size: 12px;
  }

  .topbar-right {
    width: auto;
    min-width: auto;
    margin-left: auto;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 8px;
  }

  .topbar-actions {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-left: auto;
  }

  .top-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    flex: 0 0 36px;
  }

  .top-action-icon {
    width: 18px;
    height: 18px;
  }

  .topbar-user-card {
    display: none;
  }

  .announcement-popover {
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    width: min(320px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: min(60vh, 420px);
    overflow-y: auto;
    border-radius: 12px;
  }

  .toast-box {
    right: 12px;
    left: 12px;
    bottom: 12px;
  }

  .toast-item {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE FIXES — 2026-04-24 (v2, minimal)
   ═══════════════════════════════════════════════════════════════════
   The inline <style> in index.html is the primary source of truth for
   layout: sidebar is position:fixed with width var(--sidebar-width),
   and .main-content has margin-left: var(--sidebar-width).
   Here we only add small safety overrides and legacy cleanup.
   ═══════════════════════════════════════════════════════════════════ */

/* Global box-sizing — cheap insurance */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; width: 100%; min-height: 100vh; }

/* The legacy .dashboard-shell flex wrapper is unused when sidebar is
   position:fixed. Make sure it doesn't fight the inline layout. */
.dashboard-shell {
  display: block;      /* was flex — but .sidebar is fixed, flex is useless */
  min-height: 100vh;
  width: 100%;
}

/* Ensure page content can shrink properly on narrow screens */
#page-content {
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
#page-content > * { max-width: 100%; }
#page-content > div[style*="max-width"],
#page-content > section[style*="max-width"],
#page-content [style*="max-width:900px"],
#page-content [style*="max-width:1100px"],
#page-content [style*="max-width:820px"] {
  width: 100% !important;
  max-width: none !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}
#page-content table {
  max-width: 100%;
  width: 100%;
  display: table;
}
#page-content .table-wrap,
#page-content [style*="overflow-x:auto"],
#page-content [style*="overflow-x: auto"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
}

.gogga-table-scroll {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: scroll !important;
  overflow-y: visible;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-gutter: stable;
  scroll-behavior: auto;
  touch-action: pan-x pan-y;
  cursor: grab;
  padding-bottom: 10px;
  will-change: scroll-position;
  scrollbar-width: thin;
}

.gogga-table-scroll > table {
  width: 100%;
  max-width: none;
  min-width: var(--gogga-table-min-width, 720px);
}

.gogga-table-scroll.is-dragging,
.gogga-table-scroll.is-drag-ready {
  cursor: grabbing;
  user-select: none;
}

.gogga-table-scroll::-webkit-scrollbar {
  height: 10px;
}

.gogga-table-scroll::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 999px;
}

.gogga-table-scroll::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.finance-filter-card,
.finance-results-card {
  border: 1px solid #e2e8f0;
}

.finance-filter-grid {
  align-items: end;
}

.finance-field {
  min-width: 0;
}

.finance-helper {
  line-height: 1.45;
}

.finance-quick-actions .secondary-btn {
  justify-content: center;
}

@media (max-width: 1024px) {
  .topbar {
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding-right: max(12px, env(safe-area-inset-right)) !important;
  }
  .topbar-left {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    max-width: calc(100% - 154px) !important;
    overflow: hidden !important;
  }
  .topbar-left .mobile-menu-btn {
    position: relative !important;
    z-index: 5 !important;
    flex: 0 0 40px !important;
  }
  .topbar-left > div {
    min-width: 0 !important;
    overflow: hidden !important;
  }
  .topbar-left h1,
  .topbar-left p {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .topbar-right {
    flex: 0 0 auto !important;
    margin-left: auto !important;
    align-self: flex-start !important;
    justify-content: flex-end !important;
    max-width: 154px !important;
    position: relative !important;
    z-index: 4 !important;
  }
  .topbar-actions {
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    margin-left: auto !important;
    max-width: 154px !important;
  }
}

@media (max-width: 1024px) and (orientation: landscape) {
  .topbar-left {
    max-width: calc(100% - 160px) !important;
  }
  .topbar-right,
  .topbar-actions {
    max-width: 160px !important;
  }
}

@media (max-width: 900px) {
  .parent-dashboard > div:first-child {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 560px) {
  .parent-dashboard > div:first-child,
  .parent-dashboard [style*="grid-template-columns:repeat(3"] {
    grid-template-columns: 1fr !important;
  }
}

/* Extra-small phones — pad less, let modals fill */
@media (max-width: 480px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .modal-card, .modal-md, .modal-lg {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Phone-first polish for dense school workflows.  Most Gogga pages are built
   from shared panels, inline grids and tables, so these rules improve the
   whole app without having to rewrite every role-specific view. */
@media (max-width: 680px) {
  html,
  body {
    overflow-x: hidden;
  }

  .main-content,
  .main-area {
    width: 100% !important;
    min-width: 0 !important;
  }

  #page-content {
    padding: 10px !important;
    overflow-x: hidden;
  }

  #page-content > * {
    min-width: 0 !important;
  }

  .topbar {
    flex-wrap: nowrap !important;
    gap: 8px !important;
    padding: 10px max(10px, env(safe-area-inset-right)) 10px max(10px, env(safe-area-inset-left)) !important;
    min-height: 58px;
  }

  .topbar-left {
    max-width: calc(100% - 126px) !important;
    gap: 8px !important;
  }

  .topbar-left h1 {
    font-size: clamp(17px, 5vw, 20px) !important;
    line-height: 1.15 !important;
  }

  .topbar-left p {
    display: none !important;
  }

  .topbar-right,
  .topbar-actions {
    max-width: 118px !important;
    gap: 4px !important;
  }

  .topbar-actions .top-action-btn,
  .topbar-actions .btn-selector,
  .topbar-actions .impersonation-widget,
  .top-action-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    flex-basis: 34px !important;
  }

  .mobile-menu-btn {
    width: 38px !important;
    height: 38px !important;
    flex-basis: 38px !important;
  }

  .large-panel,
  .simple-panel,
  .simple-card,
  .stat-card,
  .course-card,
  .classroom-card,
  .media-card,
  .announcement-card,
  .calendar-upcoming-item {
    border-radius: 10px !important;
    padding: 12px !important;
  }

  .large-panel-header,
  .course-page-toolbar {
    align-items: stretch !important;
    flex-direction: column !important;
    gap: 10px !important;
  }

  .panel-actions,
  .course-toolbar-actions,
  .modal-actions,
  .table-actions,
  .option-list {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  .panel-actions > *,
  .course-toolbar-actions > *,
  .modal-actions > *,
  .table-actions > * {
    flex: 1 1 140px;
    min-width: 0;
  }

  button,
  .link-btn,
  .primary-btn,
  .secondary-btn,
  .text-link-btn,
  .view-toggle-btn,
  .logout-button {
    min-height: 42px;
  }

  input,
  select,
  textarea {
    max-width: 100%;
    min-width: 0;
  }

  .kpi-grid,
  .simple-cards,
  .course-card-grid,
  .classroom-card-grid,
  .media-card-grid,
  .announcement-grid,
  .message-summary-grid,
  #page-content [style*="grid-template-columns:repeat(auto-fit"],
  #page-content [style*="grid-template-columns: repeat(auto-fit"],
  #page-content [style*="grid-template-columns:repeat(2"],
  #page-content [style*="grid-template-columns: repeat(2"],
  #page-content [style*="grid-template-columns:repeat(3"],
  #page-content [style*="grid-template-columns: repeat(3"],
  #page-content [style*="grid-template-columns:1fr 1fr"],
  #page-content [style*="grid-template-columns: 1fr 1fr"],
  #page-content [style*="grid-template-columns:minmax"] {
    grid-template-columns: 1fr !important;
  }

  .calendar-grid,
  .calendar-grid-header {
    min-width: 680px;
  }

  .calendar-day {
    min-height: 96px;
    padding: 8px;
  }

  .modal-overlay {
    padding: 8px !important;
    align-items: flex-start !important;
  }

  .modal-card,
  .modal-container,
  .modal-sm,
  .modal-md,
  .modal-lg,
  .modal-xl {
    width: 100% !important;
    max-width: 100% !important;
    max-height: calc(100dvh - 16px) !important;
    border-radius: 12px !important;
  }

  .modal-body {
    max-height: calc(100dvh - 130px) !important;
  }

  .gogga-table-scroll.gogga-mobile-card-wrapper {
    overflow-x: visible !important;
    padding-bottom: 0 !important;
    cursor: default !important;
  }

  table.gogga-mobile-card-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }

  table.gogga-mobile-card-table thead {
    display: none !important;
  }

  table.gogga-mobile-card-table tbody {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    width: 100% !important;
  }

  table.gogga-mobile-card-table tr {
    display: block !important;
    width: 100% !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 10px !important;
    background: #fff !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
    overflow: hidden !important;
  }

  table.gogga-mobile-card-table td {
    display: grid !important;
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 38px !important;
    padding: 9px 10px !important;
    border-bottom: 1px solid #edf2f7 !important;
    font-size: 13px !important;
    word-break: break-word !important;
  }

  table.gogga-mobile-card-table td:last-child {
    border-bottom: 0 !important;
  }

  table.gogga-mobile-card-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
  }

  table.gogga-mobile-card-table td[data-label=""],
  table.gogga-mobile-card-table td:not([data-label]) {
    grid-template-columns: 1fr !important;
  }

  table.gogga-mobile-card-table td[data-label=""]::before,
  table.gogga-mobile-card-table td:not([data-label])::before {
    display: none !important;
  }

  table.gogga-mobile-card-table .table-actions,
  table.gogga-mobile-card-table td:last-child > div {
    justify-content: stretch !important;
  }

  .finance-page-shell {
    gap: 12px !important;
  }

  .finance-filter-card {
    padding: 14px !important;
    border-radius: 14px !important;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.08) !important;
  }

  .finance-filter-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .finance-field label {
    color: #334155 !important;
    font-size: 12.5px !important;
    line-height: 1.35 !important;
  }

  .finance-field input,
  .finance-field select {
    min-height: 46px !important;
    padding: 12px 13px !important;
    border-radius: 10px !important;
    border-color: #cbd5e1 !important;
    background: #fff !important;
    color: #0f172a !important;
    font-size: 16px !important;
  }

  .finance-field input:focus,
  .finance-field select:focus {
    border-color: var(--school-primary, #1d4ed8) !important;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.12) !important;
  }

  .finance-helper {
    margin-top: 12px !important;
    padding: 10px 12px !important;
    border-radius: 10px !important;
    background: #f8fafc !important;
    color: #475569 !important;
    font-size: 12.5px !important;
  }

  .finance-quick-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }

  .finance-quick-actions .secondary-btn {
    width: 100% !important;
    min-height: 48px !important;
    padding: 10px 9px !important;
    border-radius: 12px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    font-size: 13px !important;
  }

  #econResults.finance-results-card {
    padding: 0 !important;
    text-align: left !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    box-shadow: 0 6px 22px rgba(15, 23, 42, 0.07) !important;
  }

  #econResults.finance-results-card > div[style*="text-align:center"] {
    padding: 24px 16px !important;
    text-align: center !important;
  }

  .finance-balance-header {
    padding: 14px !important;
  }

  .finance-status-row {
    align-items: stretch !important;
    padding: 12px !important;
  }

  .finance-status-pills {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .finance-status-pill {
    width: 100% !important;
    min-height: 38px !important;
    padding: 7px 8px !important;
    border-radius: 999px !important;
    font-size: 12.5px !important;
  }

  .finance-results-card table.gogga-mobile-card-table tr {
    border-radius: 12px !important;
  }

  .finance-results-card table.gogga-mobile-card-table td {
    grid-template-columns: minmax(86px, 34%) minmax(0, 1fr) !important;
    text-align: left !important;
  }

  .finance-results-card table.gogga-mobile-card-table td:last-child {
    padding: 10px !important;
  }

  .finance-results-card table.gogga-mobile-card-table td:last-child .primary-btn,
  .finance-results-card table.gogga-mobile-card-table td:last-child .secondary-btn,
  .finance-results-card table.gogga-mobile-card-table td:last-child button {
    width: 100% !important;
    min-height: 40px !important;
    margin: 4px 0 0 !important;
  }
}

@media (max-width: 380px) {
  .topbar-left {
    max-width: calc(100% - 112px) !important;
  }

  .topbar-right,
  .topbar-actions {
    max-width: 106px !important;
  }

  .topbar-actions .top-action-btn,
  .topbar-actions .btn-selector,
  .topbar-actions .impersonation-widget,
  .top-action-btn {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    flex-basis: 32px !important;
  }

  table.gogga-mobile-card-table td {
    grid-template-columns: 1fr !important;
    gap: 4px !important;
  }

  .finance-quick-actions,
  .finance-status-pills {
    grid-template-columns: 1fr !important;
  }
}

.gogga-offline-banner {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 100000;
  width: min(680px, calc(100vw - 24px));
  transform: translate(-50%, 18px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
  color: #78350f;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  transition: opacity 160ms ease, transform 160ms ease;
}

.gogga-offline-banner.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.gogga-offline-banner.online {
  border-color: #22c55e;
  background: #ecfdf5;
  color: #065f46;
}

.gogga-offline-drafts-btn {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 100001;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
  padding: 0 16px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.gogga-offline-drafts-modal {
  position: fixed;
  inset: 0;
  z-index: 100002;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.58);
  padding: 48px 18px;
}

.gogga-offline-drafts-card {
  width: min(820px, 100%);
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

.gogga-offline-drafts-head,
.gogga-offline-drafts-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e7eb;
}

.gogga-offline-drafts-head h2 {
  margin: 0;
  font-size: 20px;
  color: #0f172a;
}

.gogga-offline-drafts-head p {
  margin: 6px 0 0;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.gogga-offline-close {
  border: 0;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

.gogga-offline-drafts-card [data-offline-drafts-body] {
  display: grid;
  gap: 10px;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  padding: 16px 20px;
}

.gogga-offline-draft {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.gogga-offline-draft strong {
  color: #0f172a;
}

.gogga-offline-draft p {
  margin: 4px 0;
  color: #334155;
  font-size: 13px;
}

.gogga-offline-draft small {
  color: #64748b;
}

.gogga-offline-draft-error {
  margin-top: 8px;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 700;
}

.gogga-offline-draft-actions {
  display: flex;
  gap: 8px;
}

.gogga-offline-drafts-foot {
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid #e5e7eb;
  border-bottom: 0;
}

body.has-gogga-offline-drafts .gogga-offline-banner {
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 58px);
}

.gogga-offline-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  padding: 20px;
  text-align: center;
}

@media (max-width: 640px) {
  .gogga-offline-drafts-btn {
    left: 12px;
    right: 12px;
    justify-content: center;
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .gogga-offline-banner {
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + 54px);
  }
  .gogga-offline-draft {
    grid-template-columns: 1fr;
  }
  .gogga-offline-draft-actions {
    flex-wrap: wrap;
  }
}

/* ── Mobile polish pass (phones) ──────────────────────────────────────────────
   Most users are on phones. App-like finishing touches applied globally, without
   editing the per-view inline styles. */
@media (max-width: 640px) {
  /* 16px on form controls stops iOS Safari from ZOOMING the page when a field is
     focused (the SPA's inline styles use 13–14px) and gives a comfortable target.
     The single most noticeable phone-UX fix for a form-heavy app. */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),
  select, textarea {
    font-size: 16px !important;
    max-width: 100%;
  }
  /* Comfortable thumb targets for the app's labelled action buttons (the tiny
     inline icon chips use bare <button style=…> and are left untouched). */
  .primary-btn, .secondary-btn, .danger-btn, button.btn, .btn-primary {
    min-height: 42px;
  }
  /* Modals: use nearly the full width on a phone. */
  .modal-card { width: calc(100vw - 20px) !important; max-width: calc(100vw - 20px) !important; }
  /* Breathing room above the phone gesture bar so the last control isn't clipped. */
  #page-content { padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* Printable briefs (national dashboard "Imprimer" + any print view): drop the
   app chrome and interactive-only controls so a clean one-page brief prints. */
.print-only { display: none; }
@media print {
  .no-print, .sidebar, .topbar, #login-screen { display: none !important; }
  .print-only { display: block !important; }
  .gogga-seal { border-bottom: 2px solid #0f2d52; margin-bottom: 16px; padding-bottom: 8px; }
  #app, .dashboard-shell, #page-content { margin: 0 !important; padding: 0 !important; box-shadow: none !important; }
  body { background: #fff !important; }
}

/* ── Top-bar actions collapse into a single ⋮ menu on the responsive shell ──
   Mirrors how the left sidebar collapses behind the ☰ button: on phones/tablets
   (≤1024px — the same breakpoint the sidebar uses) the action icons hide behind
   a single ⋮ button and open as a dropdown, freeing the title row so the icons
   no longer block the view. High specificity + !important so these win over the
   earlier .topbar rules regardless of stylesheet source order. */
.topbar-more-btn { display: none; }

@media (max-width: 1024px) {
  .topbar-right > .topbar-more-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px; height: 38px;
    flex: 0 0 38px;
    padding: 0;
    border: 1px solid #d9e2ec;
    background: #fff;
    border-radius: 10px;
    color: #334155;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
  }
  .topbar-right > .topbar-more-btn:hover { background: #f8fafc; border-color: #bfc9d4; }

  /* The icon cluster becomes a dropdown anchored under the ⋮ button. */
  .topbar-right { position: relative !important; }
  .topbar-right > .topbar-actions {
    display: none !important;
    position: absolute !important;
    top: calc(100% + 8px) !important;
    right: 0 !important;
    left: auto !important;
    width: auto !important;
    max-width: none !important;
    min-width: 58px !important;
    margin: 0 !important;
    padding: 8px !important;
    background: #fff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 14px 32px rgba(15, 23, 42, 0.18) !important;
    z-index: 70 !important;
  }
  .topbar-right > .topbar-actions.open {
    display: inline-flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    grid-auto-flow: row !important;
    gap: 8px !important;
    align-items: stretch !important;
  }
  .topbar-right > .topbar-actions.open .top-action-btn,
  .topbar-right > .topbar-actions.open .btn-selector {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    flex-basis: 42px !important;
  }
  /* The role/impersonation widget (4th control for recteur/préfet/promoteur)
     is injected inside .topbar-actions, so it collapses into the dropdown too. */
  .topbar-right > .topbar-actions.open .impersonation-widget {
    width: 42px !important;
    min-width: 42px !important;
    flex: 0 0 auto !important;
    align-self: flex-start !important;
  }
  /* Keep the announcements popover anchored within/near the dropdown. */
  .topbar-right > .topbar-actions .announcement-popover {
    right: 0 !important;
    left: auto !important;
  }
  /* When the year selector is shown for a role, render it full-width as the
     last row of the open ⋮ dropdown (it stays hidden otherwise — we don't force
     its display, so inactive roles never see it). */
  .topbar-right > .topbar-actions.open #year-selector-wrap {
    width: 100% !important;
    margin: 4px 0 0 !important;
    gap: 6px !important;
    justify-content: space-between !important;
  }
  .topbar-right > .topbar-actions.open #year-selector {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: 100% !important;
  }
}

/* Course « Cotes » action bar (Exporter / Valider / Soumettre / Saisir une cote).
   Desktop: content-sized, right-aligned. Phone: equal-width buttons that fill the
   row evenly (2 per row, a lone odd one spans full width) instead of wrapping
   raggedly. */
.course-action-bar {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.course-action-bar > button { white-space: nowrap; }

@media (max-width: 680px) {
  .course-action-bar {
    width: 100%;
    justify-content: stretch;
  }
  .course-action-bar > button {
    flex: 1 1 140px;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }
}
