/* ==========================================================================
   SorobanDojo — Admin Panel styles
   Reuses the CSS variables defined in style.css (--navy, --gold, --red, …)
   ========================================================================== */

.admin-body{
  background: var(--cream);
  min-height: 100vh;
}

/* ---------- Shell / Sidebar ------------------------------------------- */
.admin-shell{
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.admin-sidebar{
  background: var(--navy);
  color: #fff;
  padding: 22px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-brand{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--line-dark);
}
.admin-brand .logo-mark{ width: 34px; height: 34px; flex-shrink: 0; }
.admin-brand-text .name{
  font-family: 'Shippori Mincho', serif;
  font-size: 14.5px;
  letter-spacing: .03em;
  color: #fff;
}
.admin-brand-text .tag{
  font-size: 10.5px;
  color: var(--gold);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-top: 2px;
}

.admin-nav{
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.admin-nav a{
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.72);
  font-size: 14px;
  font-weight: 500;
  transition: background .15s ease, color .15s ease;
}
.admin-nav a svg{ width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.admin-nav a:hover{ background: rgba(255,255,255,.06); color: #fff; }
.admin-nav a.active{ background: var(--red); color: #fff; }
.admin-nav a.active svg{ opacity: 1; }
.admin-nav a.admin-logout{ margin-top: 10px; border-top: 1px solid var(--line-dark); padding-top: 16px; }

/* ---------- Main / Topbar ---------------------------------------------- */
.admin-main{ display: flex; flex-direction: column; min-width: 0; }

.admin-topbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.admin-topbar h1{
  font-family: 'Shippori Mincho', serif;
  font-size: 20px;
  color: var(--navy);
  flex: 1;
}
.admin-topbar-user{ display: flex; align-items: center; gap: 10px; }
.admin-user-name{ font-size: 13.5px; font-weight: 600; color: var(--ink); }
.admin-user-avatar{
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--gold); color: var(--navy-deep);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.admin-burger{ display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.admin-burger span{ display: block; width: 22px; height: 2px; background: var(--navy); margin: 4px 0; border-radius: 2px; }

.admin-content{ padding: 26px 28px 60px; flex: 1; }

/* ---------- Stat cards --------------------------------------------------- */
.admin-stats{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.stat-card{
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before{
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--bar-color, var(--gold));
}
.stat-card .stat-label{
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600; margin-bottom: 8px;
}
.stat-card .stat-value{ font-size: 30px; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-card .stat-sub{ font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.stat-card.c-green{ --bar-color: #2E9E5B; }
.stat-card.c-blue{ --bar-color: #2E6FE0; }
.stat-card.c-orange{ --bar-color: var(--gold); }
.stat-card.c-red{ --bar-color: var(--red); }

/* ---------- Panels / cards ------------------------------------------------ */
.admin-panel{
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 22px;
}
.admin-panel-head{
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px; flex-wrap: wrap;
}
.admin-panel-head h2{ font-size: 16px; color: var(--navy); font-family: 'Shippori Mincho', serif; }
.admin-panel-head .view-all{ font-size: 13px; color: var(--red); font-weight: 600; }

/* ---------- Tables --------------------------------------------------------- */
.admin-table-wrap{ overflow-x: auto; }
table.admin-table{ width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.admin-table th{
  text-align: left; padding: 10px 12px; color: var(--muted);
  font-weight: 600; text-transform: uppercase; font-size: 11.5px; letter-spacing: .04em;
  border-bottom: 2px solid var(--line); white-space: nowrap;
}
table.admin-table td{ padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.admin-table tr:last-child td{ border-bottom: none; }
table.admin-table tr:hover td{ background: var(--cream-2); }
table.admin-table td.nowrap, table.admin-table th.nowrap{ white-space: nowrap; }
.admin-table .muted{ color: var(--muted); }

/* status pills */
.pill{
  display: inline-block; padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; text-transform: capitalize; letter-spacing: .01em;
}
.pill-new{ background: #FDECEC; color: var(--red-dark); }
.pill-contacted, .pill-read{ background: #FFF3DC; color: #9A6B10; }
.pill-enrolled, .pill-replied{ background: #E4F6EA; color: #1E7A44; }
.pill-archived{ background: #EDEDF2; color: var(--muted); }
.pill-active{ background: #E4F6EA; color: #1E7A44; }
.pill-suspended{ background: #FDECEC; color: var(--red-dark); }

.role-badge{
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.role-badge.role-admin{ background: #FFF3DC; color: #9A6B10; }
.role-badge.role-teacher{ background: #E7EEFB; color: #2E4E9E; }
.role-badge.role-parent{ background: #EAF6EC; color: #237A44; }

/* ---------- Parent panel: student switcher (sidebar) -------------------- */
.student-switcher{
  padding: 14px 18px 16px; margin: 0 0 6px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.student-switcher label{
  display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: rgba(255,255,255,.5); margin-bottom: 6px;
}
.student-switcher select{
  width: 100%; padding: 9px 10px; border-radius: 7px; border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.08); color: #fff; font-family: 'Poppins', sans-serif;
  font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.student-switcher select option{ color: var(--ink); }

.nav-badge{
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
  margin-left: auto;
}

.belt-chip{
  display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 10px;
  border-radius: 999px; background: #F3EFE6; color: var(--navy); white-space: nowrap;
}
.belt-icon{ width: 16px; height: 16px; object-fit: contain; vertical-align: -3px; margin-right: 5px; }

/* ---------- Modal (Prompt 02/17: teacher registration dialog) ---------- */
.modal-overlay{
  position: fixed; inset: 0; background: rgba(20,24,38,.55); backdrop-filter: blur(2px);
  display: none; align-items: flex-start; justify-content: center; z-index: 1000;
  padding: 5vh 16px; overflow-y: auto;
}
.modal-overlay.open{ display: flex; }
.modal-card{
  background: var(--paper, #fff); border-radius: 12px; width: 100%; max-width: 560px;
  padding: 26px 26px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); position: relative;
  animation: modal-pop .16s ease-out;
}
@keyframes modal-pop{ from{ opacity:0; transform: translateY(-8px) scale(.98);} to{ opacity:1; transform: translateY(0) scale(1);} }
.modal-card .admin-panel-head{ margin-bottom: 18px; padding: 0; border: none; }
.modal-close{
  position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--cream-2); color: var(--ink); font-size: 18px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover{ background: var(--line); }
.modal-trigger-row{ display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.assign-list{
  max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; background: var(--cream-2);
}
.assign-list label{
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500;
  padding: 6px 2px; margin: 0; cursor: pointer;
}
.assign-list label input{ width: auto; margin: 0; accent-color: var(--red); cursor: pointer; }
.assign-list .muted-row{ color: var(--muted); font-size: 13px; padding: 4px 2px; }

/* ---------- Mascots (Soro & Sora) & readiness bars -------------------- */
.mascot-banner{
  display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 10px;
  background: linear-gradient(135deg, #FFF7E8, #FDEFE0); border: 1px solid #F0D9A8; margin-bottom: 16px;
}
.mascot-pair{ display: flex; gap: -8px; flex-shrink: 0; }
.mascot-pair svg:last-child{ margin-left: -10px; }
.mascot-message{ font-size: 14px; font-weight: 600; color: var(--navy); }

.readiness-bars{ display: flex; flex-direction: column; gap: 12px; }
.readiness-row{ display: grid; grid-template-columns: 130px 1fr 46px; align-items: center; gap: 10px; }
.readiness-label{ font-size: 12.5px; font-weight: 600; color: var(--ink); }
.readiness-track{ height: 9px; border-radius: 5px; background: #EDE7D9; overflow: hidden; }
.readiness-fill{ height: 100%; border-radius: 5px; background: var(--gold); }
.readiness-fill.pass{ background: #3EA26B; }
.readiness-fill.low{ background: var(--red); }
.readiness-value{ font-size: 12px; font-weight: 700; color: var(--muted); text-align: right; }

/* ---------- Checkbox groups (e.g. lesson "Components covered") --------- */
.admin-form .field-row-2{ margin-bottom: 16px; }
.checkbox-row{ display: flex; gap: 10px; flex-wrap: wrap; }
.checkbox-pill{
  display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13.5px;
  color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; padding: 9px 14px 9px 12px; cursor: pointer; user-select: none;
  transition: border-color .15s, background .15s;
}
.checkbox-pill:hover{ border-color: var(--gold); background: var(--cream-2); }
.checkbox-pill input[type=checkbox]{
  width: 17px; height: 17px; margin: 0; accent-color: var(--red); cursor: pointer; flex-shrink: 0;
}
.checkbox-pill:has(input:checked){ border-color: var(--red); background: #FDF2F1; color: var(--red-dark); }

/* ---------- Forms ------------------------------------------------------ */
.admin-form .field{ margin-bottom: 16px; }
.admin-form label{ display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 6px; }
.admin-form input[type=text],
.admin-form input[type=search],
.admin-form input[type=password],
.admin-form input[type=email],
.admin-form input[type=date],
.admin-form input[type=time],
.admin-form input[type=url],
.admin-form input[type=number],
.admin-form input[type=datetime-local],
.admin-form input[type=file],
.admin-form select,
.admin-form textarea{
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 6px; background: var(--paper); font-family: 'Poppins', sans-serif;
  font-size: 14px; color: var(--ink);
}
.admin-form textarea{ min-height: 96px; resize: vertical; }
.admin-form input:focus, .admin-form select:focus, .admin-form textarea:focus{
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(227,168,59,.18);
}
/* Consistent search-box treatment across every admin filter bar (parents,
   registrations, students, teachers, audit log, ...) — a plain magnifying-
   glass icon so search inputs no longer render with mismatched browser
   default styling on pages that used a differently-named wrapper. */
.admin-form input[type=search]{
  padding-left: 38px;
  background-repeat: no-repeat;
  background-position: 13px center;
  background-size: 15px 15px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8578' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>");
}
.admin-form input[type=search]::-webkit-search-cancel-button{ -webkit-appearance: none; }
.admin-filter-bar{ display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.admin-filter-bar .field{ margin-bottom: 0; min-width: 180px; }
.admin-filter-bar .field.grow{ flex: 1; min-width: 220px; }

/* ---------- Detail view ------------------------------------------------- */
.detail-grid{ display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px 22px; }
.detail-item .dt-label{ font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.detail-item .dt-value{ font-size: 14.5px; color: var(--ink); font-weight: 500; word-break: break-word; }
.detail-item .dt-value.empty{ color: var(--muted); font-weight: 400; font-style: italic; }

/* ---------- Buttons (admin-scoped extras) ------------------------------- */
.btn-sm{ padding: 8px 16px; font-size: 12.5px; }
.btn-ghost{ background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost:hover{ background: var(--cream-2); }
.btn-danger{ background: var(--red); color: #fff; border: none; }
.btn-danger:hover{ background: var(--red-dark); }
.admin-form .btn{ border: none; cursor: pointer; }

.flash-banner.admin{ margin-bottom: 20px; }

/* pagination */
.admin-pagination{ display: flex; gap: 6px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.admin-pagination a, .admin-pagination span{
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--line); font-size: 13px; color: var(--ink);
}
.admin-pagination a:hover{ background: var(--cream-2); }
.admin-pagination .current{ background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Login page --------------------------------------------------- */
.admin-login-wrap{
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--navy) 0%, var(--navy-deep) 100%);
  padding: 24px;
}
.admin-login-card{
  background: var(--paper); border-radius: 10px; padding: 40px 36px;
  width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.admin-login-card .admin-login-logo{ display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 22px; }
.admin-login-card .admin-login-logo .name{ font-family: 'Shippori Mincho', serif; font-size: 18px; color: var(--navy); letter-spacing: .04em; }
.admin-login-card .admin-login-logo .tag{ font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.admin-login-card h2{ text-align: center; font-size: 15px; color: var(--muted); font-weight: 500; margin-bottom: 26px; }
.admin-login-card .btn{ width: 100%; text-align: center; justify-content: center; padding: 12px; font-size: 14.5px; }
.admin-hint{ margin-top: 18px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }

/* ---------- Settings: sub-tabs ------------------------------------------- */
.settings-tabs{
  display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.settings-tabs a{
  padding: 10px 16px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.settings-tabs a:hover{ color: var(--ink); }
.settings-tabs a.active{ color: var(--red); border-bottom-color: var(--red); }

/* ---------- Settings: logo uploader -------------------------------------- */
.logo-uploader{ display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.logo-preview{
  width: 84px; height: 84px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--cream-2); display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.logo-preview img{ max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-uploader .hint{ font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Settings: repeatable rows (contact numbers / social links) --- */
.repeat-rows{ display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.repeat-row{
  display: grid; gap: 10px; align-items: end;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) 40px;
  background: var(--cream-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px;
}
.repeat-row .field{ margin-bottom: 0; }
.repeat-row .remove-row{
  width: 36px; height: 36px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--paper); color: var(--red); font-size: 18px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.repeat-row .remove-row:hover{ background: #FDECEC; }
.add-row-btn{
  display: inline-flex; align-items: center; gap: 6px; background: none;
  border: 1px dashed var(--line); color: var(--ink); font-size: 13px; font-weight: 600;
  border-radius: 6px; padding: 9px 14px; cursor: pointer;
}
.add-row-btn:hover{ border-color: var(--gold); color: var(--red); }

/* ---------- Settings: toggle switch --------------------------------------- */
.toggle-field{ display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.toggle-switch{ position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle-switch input{ opacity: 0; width: 0; height: 0; }
.toggle-switch .slider{
  position: absolute; inset: 0; background: #D8D3C8; border-radius: 999px; cursor: pointer;
  transition: background .15s ease;
}
.toggle-switch .slider::before{
  content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: transform .15s ease;
}
.toggle-switch input:checked + .slider{ background: #2E9E5B; }
.toggle-switch input:checked + .slider::before{ transform: translateX(18px); }
.toggle-field .toggle-label{ font-size: 13.5px; font-weight: 600; color: var(--ink); }

.field-hint{ font-size: 12px; color: var(--muted); margin-top: 5px; }
.field-with-select{ display: grid; grid-template-columns: 130px 1fr; gap: 8px; }
.api-block{ border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 18px; }
.api-block:last-child{ margin-bottom: 0; }
.api-block-head{ display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.api-block-head h3{ font-size: 14.5px; color: var(--navy); font-family: 'Shippori Mincho', serif; }

/* ---------- Responsive --------------------------------------------------- */
@media (max-width: 900px){
  .admin-shell{ grid-template-columns: 1fr; }
  .admin-sidebar{
    position: fixed; left: 0; top: 0; width: 240px; height: 100vh;
    transform: translateX(-100%); transition: transform .2s ease; z-index: 40;
  }
  .admin-shell.sidebar-open .admin-sidebar{ transform: translateX(0); }
  .admin-burger{ display: block; }
  .admin-content{ padding: 20px 16px 50px; }
  .admin-topbar{ padding: 14px 16px; }
}

/* ==========================================================================
   Compact typography pass — smaller, denser fonts across the whole staff
   panel (dashboard, tables, forms). Placed last so it overrides the base
   sizes above without touching each rule.
   ========================================================================== */
.admin-body{ font-size: 13px; }
.admin-nav a{ font-size: 13px; padding: 9px 11px; gap: 10px; }
.admin-nav a svg{ width: 16px; height: 16px; }
.admin-sidebar{ gap: 20px; padding: 18px 14px; }
.admin-topbar{ padding: 12px 24px; }
.admin-topbar h1{ font-size: 17px; }
.admin-user-name{ font-size: 12.5px; }
.admin-user-avatar{ width: 30px; height: 30px; font-size: 13px; }
.admin-content{ padding: 20px 24px 56px; }
.admin-stats{ grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-card{ padding: 14px 16px; }
.stat-card .stat-label{ font-size: 10.5px; margin-bottom: 6px; }
.stat-card .stat-value{ font-size: 24px; }
.stat-card .stat-value small{ font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.stat-card .stat-sub{ font-size: 11.5px; }
.admin-panel{ padding: 16px 18px; margin-bottom: 18px; }
.admin-panel-head{ margin-bottom: 12px; }
.admin-panel-head h2{ font-size: 15px; }
table.admin-table{ font-size: 12.5px; }
table.admin-table th{ font-size: 10.5px; padding: 8px 10px; }
table.admin-table td{ padding: 9px 10px; }
.pill{ font-size: 10.5px; padding: 3px 9px; }
.role-badge{ font-size: 10px; }
.admin-form .field{ margin-bottom: 13px; }
.admin-form label{ font-size: 12px; margin-bottom: 5px; }
.admin-form input[type=text], .admin-form input[type=search], .admin-form input[type=password],
.admin-form input[type=email], .admin-form input[type=date], .admin-form input[type=time],
.admin-form input[type=url], .admin-form input[type=number], .admin-form input[type=datetime-local],
.admin-form input[type=file], .admin-form select, .admin-form textarea{ padding: 8px 11px; font-size: 13px; }
.admin-form input[type=search]{ padding-left: 34px; background-position: 11px center; background-size: 14px 14px; }
.admin-form textarea{ min-height: 80px; }
.admin-body .btn{ font-size: 13px; padding: 9px 18px; }
.admin-body .btn-sm{ padding: 7px 13px; font-size: 12px; }
.admin-body .btn-xs, .btn-xs{ padding: 5px 10px; font-size: 11.5px; border-radius: 5px; line-height: 1.2; }
.detail-item .dt-label{ font-size: 10.5px; }
.detail-item .dt-value{ font-size: 13.5px; }
.settings-tabs a{ font-size: 12.5px; padding: 8px 13px; }
.checkbox-pill{ font-size: 12.5px; padding: 7px 12px 7px 10px; }
.assign-list label{ font-size: 12.5px; padding: 5px 2px; }
.field-hint{ font-size: 11.5px; }
.flash-banner.admin{ font-size: 13px; }
.admin-body .muted, .muted{ color: var(--muted); }
.small{ font-size: 11.5px; }

/* ==========================================================================
   Papers & Marks
   ========================================================================== */
.page-head-row{ display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head-actions{ display: flex; gap: 6px; flex-wrap: wrap; }
.back-link{ font-size: 12.5px; font-weight: 600; color: var(--muted); }
.back-link:hover{ color: var(--red); }

.paper-create-cards{ display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.paper-create-card{ display: flex; align-items: center; gap: 12px; background: var(--paper); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; transition: border-color .15s, box-shadow .15s, transform .15s; }
.paper-create-card:hover{ border-color: var(--gold); box-shadow: 0 6px 18px rgba(16,30,66,.08); transform: translateY(-1px); }
.pcc-icon{ width: 40px; height: 40px; border-radius: 10px; background: var(--navy); color: var(--gold); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.pcc-icon svg{ width: 22px; height: 22px; }
.pcc-text{ display: flex; flex-direction: column; flex: 1; min-width: 0; }
.pcc-text strong{ font-size: 13.5px; color: var(--navy); }
.pcc-text small{ font-size: 11.5px; color: var(--muted); }
.pcc-go{ width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.tool-chip{ display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 7px; border-radius: 4px; vertical-align: 1px; }
.tool-chip.tool-abacus{ background: #E7EEFB; color: #2E4E9E; }
.tool-chip.tool-mental{ background: #F4E9FB; color: #7A3E9E; }
.pill-xs{ font-size: 9.5px; padding: 2px 7px; vertical-align: 1px; }
.cell-title{ font-weight: 600; color: var(--ink); }
.cell-sub{ font-size: 11.5px; margin-top: 2px; display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }

.row-actions{ display: flex; gap: 5px; flex-wrap: wrap; align-items: center; }
.row-actions form{ display: inline; margin: 0; }
.row-more{ position: relative; }
.row-more summary{ list-style: none; cursor: pointer; }
.row-more summary::-webkit-details-marker{ display: none; }
.row-more-menu{ position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; background: var(--paper); border: 1px solid var(--line);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(16,30,66,.15); padding: 5px; min-width: 150px; }
.row-more-menu form{ display: block; }
.row-more-menu button{ display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; font: 500 12.5px 'Poppins', sans-serif; color: var(--ink); border-radius: 5px; cursor: pointer; }
.row-more-menu button:hover{ background: var(--cream-2); }
.row-more-menu button.danger{ color: var(--red); }

/* Create / setup page */
.tool-tabs{ margin-bottom: 14px; }
.paper-builder{ display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.pb-frame-wrap{ background: #EFE8D9; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pb-frame-wrap iframe{ display: block; width: 100%; height: calc(100vh - 190px); min-height: 560px; border: 0; background: #EFE8D9; }
.pb-setup{ position: sticky; top: 70px; }
.pb-setup .admin-panel{ margin-bottom: 0; }
.pb-summary{ font-size: 12px; background: var(--cream-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 12px; line-height: 1.6; }
.pb-bad{ color: var(--red-dark); font-weight: 600; }
.keep-pill{ margin-bottom: 13px; align-items: flex-start !important; }
.keep-pill small{ display: block; color: var(--muted); font-weight: 400; font-size: 11px; }
.marks-table{ border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.mt-row{ display: grid; grid-template-columns: minmax(0, 1fr) auto 64px 66px; gap: 6px; align-items: center; padding: 6px 9px; border-bottom: 1px solid var(--line); font-size: 12px; }
.mt-row:last-child{ border-bottom: 0; }
.mt-row .mt-sec{ overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-row .mt-q{ color: var(--muted); white-space: nowrap; }
.mt-row .mt-max{ text-align: right; font-weight: 600; white-space: nowrap; }
.admin-form .mt-row input[type=number]{ padding: 5px 7px; font-size: 12.5px; }
.mt-total{ background: var(--cream-2); font-weight: 700; }
.pb-errors{ background: #FDECEC; color: var(--red-dark); border: 1px solid #F3C9C5; border-radius: 8px; padding: 9px 11px; font-size: 12px; margin-bottom: 12px; }
.pb-save-row .btn{ width: 100%; justify-content: center; }

/* Summary card on assign / marks */
.paper-summary-card{ background: var(--navy); color: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; display: flex; gap: 14px 22px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.psc-title{ font-family: 'Shippori Mincho', serif; font-size: 16px; font-weight: 700; }
.psc-meta{ font-size: 11.5px; color: rgba(255,255,255,.75); display: flex; gap: 5px; flex-wrap: wrap; align-items: center; margin-top: 4px; }
.psc-sections{ display: flex; gap: 6px; flex-wrap: wrap; }
.psc-sec{ background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 7px; padding: 6px 10px; font-size: 11.5px; display: flex; flex-direction: column; min-width: 92px; }
.psc-sec b{ color: var(--gold); }
.psc-sec small{ color: rgba(255,255,255,.65); font-size: 10.5px; }
.note-box{ background: #FFF7E8; border: 1px solid #F0D9A8; border-radius: 8px; padding: 10px 13px; font-size: 12.5px; margin-bottom: 16px; }
.admin-stats.compact .stat-value{ font-size: 21px; }

.two-col{ display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.label-row{ display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.label-tools{ font-size: 11.5px; color: var(--muted); }
.link-btn{ background: none; border: 0; padding: 0; color: var(--red); font: 600 11.5px 'Poppins', sans-serif; cursor: pointer; }
.admin-form input.assign-search{ margin-bottom: 8px; }
.assign-list.tall{ max-height: 320px; }
.inline-check{ display: inline-flex !important; align-items: center; gap: 7px; font-size: 12px !important; font-weight: 500 !important; margin: 0 !important; }
.inline-check input{ accent-color: var(--red); }

/* Marks sheet */
table.marks-sheet td.num, table.marks-sheet th.num{ text-align: center; }
.th-sub{ font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); }
.admin-form table.marks-sheet input.mk-in{ width: 64px; padding: 6px 6px; text-align: center; font-size: 13px; }
.admin-form table.marks-sheet input.mk-in.over{ border-color: var(--red); background: #FDF2F1; }
.admin-form table.marks-sheet input.mk-rem{ min-width: 120px; padding: 6px 8px; font-size: 12.5px; }
table.marks-sheet tr.is-absent td{ opacity: .6; }
.ms-pct{ font-size: 11px; }
.tick-btn.ticked{ border-color: #2E9E5B; color: #1E7A44; background: #E4F6EA; }
.marks-save-bar{ display: flex; justify-content: flex-end; align-items: center; gap: 14px; flex-wrap: wrap; padding-top: 14px; margin-top: 4px; border-top: 1px solid var(--line); }

/* Tick sheet modal */
.modal-card.wide{ max-width: 860px; padding: 20px 20px 16px; }
.tick-sec{ margin-bottom: 14px; }
.tick-sec-head{ font-size: 12.5px; margin-bottom: 6px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.tick-sec-score{ margin-left: auto; font-weight: 700; color: var(--navy); }
.tick-grid{ display: grid; grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 5px; }
.tq{ display: flex; flex-direction: column; align-items: center; gap: 1px; border-radius: 7px; padding: 5px 3px; cursor: pointer; border: 1.5px solid; font-family: 'Poppins', sans-serif; transition: background .1s; min-height: 44px; justify-content: center; }
.tq.ok{ background: #E4F6EA; border-color: #8FD3A8; color: #1E7A44; }
.tq.bad{ background: #FDECEC; border-color: #F0A8A2; color: var(--red-dark); }
.tq-n{ font-size: 10px; font-weight: 700; opacity: .75; }
.tq-a{ font-size: 12px; font-weight: 600; word-break: break-all; text-align: center; line-height: 1.15; }
b.ok{ color: #1E7A44; } b.bad{ color: var(--red-dark); }
.tick-foot{ position: sticky; bottom: -16px; background: var(--paper); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 12px 0 2px; margin-top: 6px; }
.tick-total{ font-weight: 700; font-size: 13px; color: var(--navy); }

/* ==========================================================================
   Mobile — the whole staff panel
   ========================================================================== */
.admin-backdrop{ display: none; }
@media (max-width: 1100px){
  .paper-builder{ grid-template-columns: 1fr; }
  .pb-setup{ position: static; }
  .two-col{ grid-template-columns: 1fr; }
}
@media (max-width: 900px){
  .admin-backdrop{ position: fixed; inset: 0; background: rgba(10,21,49,.45); z-index: 35; }
  .admin-shell.sidebar-open .admin-backdrop{ display: block; }
  .admin-topbar{ padding: 10px 14px; gap: 10px; }
  .admin-topbar h1{ font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .admin-user-name{ display: none; }
  .admin-content{ padding: 14px 12px 70px; }
  .admin-panel{ padding: 14px 13px; border-radius: 8px; }
  .admin-stats{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card{ padding: 11px 12px; }
  .stat-card .stat-value{ font-size: 20px; }
  .settings-tabs{ flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .settings-tabs::-webkit-scrollbar{ display: none; }
  .settings-tabs a{ white-space: nowrap; }
  .admin-filter-bar{ gap: 8px; }
  .admin-filter-bar .field, .admin-filter-bar .field.grow{ min-width: 0; flex: 1 1 140px; }
  .admin-filter-bar .btn{ flex: 1 1 100%; justify-content: center; }
  .detail-grid{ grid-template-columns: 1fr 1fr; }
  .modal-overlay{ padding: 0; align-items: flex-end; }
  .modal-card, .modal-card.wide{ max-width: 100%; border-radius: 14px 14px 0 0; max-height: 92vh; overflow-y: auto; padding: 18px 14px 14px; }
  .repeat-row{ grid-template-columns: 1fr 40px; }
  .field-with-select{ grid-template-columns: 110px 1fr; }
  .readiness-row{ grid-template-columns: 96px 1fr 40px; }
  .pb-frame-wrap iframe{ height: 78vh; min-height: 480px; }
  .page-head-actions{ width: 100%; }
  .page-head-actions .btn{ flex: 1; justify-content: center; }
  .paper-summary-card{ padding: 12px 13px; }
  .marks-save-bar{ position: sticky; bottom: 0; background: var(--paper); margin: 0 -13px -14px; padding: 10px 13px; box-shadow: 0 -6px 16px rgba(16,30,66,.08); z-index: 4; }
  .marks-save-bar .btn{ flex: 1; justify-content: center; }
}
/* Tables marked .stack-mobile turn each row into a card on phones. */
@media (max-width: 720px){
  table.stack-mobile, table.stack-mobile tbody, table.stack-mobile tr, table.stack-mobile td{ display: block; width: 100%; }
  table.stack-mobile thead{ display: none; }
  table.stack-mobile tr{ border: 1px solid var(--line); border-radius: 9px; margin-bottom: 10px; padding: 6px 10px; background: var(--paper); }
  table.stack-mobile tr:hover td{ background: transparent; }
  table.stack-mobile td{ border: 0 !important; padding: 5px 0; display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 3px 6px; text-align: right; white-space: normal !important; }
  table.stack-mobile td::before{ margin-right: auto; content: attr(data-label); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); text-align: left; flex-shrink: 0; }
  table.stack-mobile td[data-label=""]::before{ content: none; }
  table.stack-mobile td:first-child{ display: block; text-align: left; border-bottom: 1px solid var(--line) !important; padding-bottom: 7px; margin-bottom: 3px; }
  table.stack-mobile td:first-child::before{ content: none; }
  table.stack-mobile td.actions-cell{ display: block; text-align: left; padding-top: 8px; }
  table.stack-mobile td.actions-cell::before{ content: none; }
  table.stack-mobile .row-actions{ justify-content: flex-start; }
  .admin-table-wrap:has(> table.stack-mobile){ overflow: visible; }
  .admin-table-wrap{ max-width: 100%; -webkit-overflow-scrolling: touch; }
  /* marks sheet: inputs line up as a compact grid inside each card */
  table.marks-sheet tbody tr{ display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 4px 10px; }
  table.marks-sheet td{ flex-direction: column; align-items: stretch; text-align: left; gap: 3px; justify-content: flex-start; }
  table.marks-sheet td.ms-student{ grid-column: 1 / -1; }
  table.marks-sheet td[data-label="Remarks"]{ grid-column: 1 / -1; }
  table.marks-sheet td[data-label=""]{ grid-column: 1 / -1; }
  table.marks-sheet td[data-label=""] .tick-btn{ width: 100%; justify-content: center; padding: 9px; }
  .admin-form table.marks-sheet input.mk-in{ width: 100%; font-size: 15px; padding: 8px 6px; }
  .admin-form table.marks-sheet input.mk-rem{ width: 100%; font-size: 14px; }
  .row-more-menu{ right: auto; left: 0; }
  .tick-grid{ grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); }
}
@media (max-width: 420px){
  .admin-stats{ grid-template-columns: 1fr 1fr; }
  .detail-grid{ grid-template-columns: 1fr; }
  .admin-topbar .role-badge{ display: none; }
  .paper-create-cards{ grid-template-columns: 1fr; }
}
.admin-form .field select{ padding-right: 32px; background-position: right 10px center; background-size: 14px; }
.admin-filter-bar .field, .admin-form.admin-filter-bar .field{ margin-bottom: 0; }
