* { box-sizing: border-box; }

:root {
  --bg: #eef4fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --primary-700: #1d4ed8;
  --success: #16a34a;
  --warning: #f97316;
  --danger: #dc2626;
  --shadow: 0 22px 55px rgba(15, 23, 42, 0.09);
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .12), transparent 34%),
    radial-gradient(circle at top right, rgba(20, 184, 166, .14), transparent 30%),
    var(--bg);
  color: var(--ink);
}

a { color: inherit; }

.page {
  min-height: 100vh;
  max-width: 980px;
  margin: 0 auto;
  padding: 38px 20px;
}

.page.wide { max-width: 1280px; }

.auth-page { min-height: 100vh; display: grid; place-items: center; }
.auth-shell { width: min(560px, 92vw); }
.auth-card { background: var(--surface); border-radius: 32px; padding: 34px; box-shadow: var(--shadow); border: 1px solid rgba(226, 232, 240, .8); }

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(226, 232, 240, .9);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-area { display: flex; align-items: center; gap: 14px; }
.brand-area h1 { margin: 0; font-size: 20px; }
.brand-area p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.brand-mark {
  width: 64px;
  height: 64px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  color: #fff;
  font-weight: 900;
  font-size: 24px;
  box-shadow: 0 16px 34px rgba(37, 99, 235, .24);
  margin-bottom: 18px;
}
.brand-mark.small { width: 48px; height: 48px; font-size: 18px; margin-bottom: 0; }
.header-actions, .actions, .dashboard-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.progress-line { height: 4px; background: #dbeafe; }
.progress-line > div { height: 4px; width: 0%; background: linear-gradient(90deg, #2563eb, #14b8a6); transition: width .2s ease; }

.card {
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(226, 232, 240, .9);
  border-radius: 28px;
  padding: 26px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.hero-card { margin-top: 44px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #dbeafe;
  color: var(--primary-700);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 14px;
}
.badge.green { background: #dcfce7; color: #15803d; }
.badge.orange { background: #ffedd5; color: #c2410c; }

h1, h2, h3 { margin: 0 0 10px; letter-spacing: -.02em; }
h1 { font-size: clamp(28px, 5vw, 42px); }
h2 { font-size: 24px; }

.muted { color: var(--muted); line-height: 1.65; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }
.hidden { display: none !important; }

.btn {
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
  transition: .15s ease;
  font-size: 14px;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .58; cursor: not-allowed; transform: none; }
.btn.primary { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: white; box-shadow: 0 14px 26px rgba(37, 99, 235, .22); }
.btn.success { background: linear-gradient(135deg, #16a34a, #15803d); color: white; }
.btn.secondary { background: #e2e8f0; color: #0f172a; }
.btn.ghost { background: white; border: 1px solid var(--line); color: #334155; }
.btn.danger { background: #fee2e2; color: #b91c1c; }
.full-btn { width: 100%; }

.message {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 14px;
  line-height: 1.5;
}
.message.subtle { background: #f8fafc; color: #334155; }

.profile {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  background: #f8fafc;
  border-radius: 20px;
  margin: 14px 0;
}
.profile img { width: 56px; height: 56px; border-radius: 50%; background: #e2e8f0; }
.profile h2 { margin: 0; font-size: 18px; }
.profile p { margin: 3px 0; font-size: 13px; }
.role { font-weight: 800; color: var(--primary); }

.student-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 22px;
  align-items: start;
}
.side-card { position: sticky; top: 92px; }
.form-page { max-width: 1280px; }
.form-card { min-height: 540px; }
.form-head { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 850; color: #334155; }
.field label.required::after { content: " *"; color: var(--danger); }
.field input, .field select, .field textarea, .toolbar-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 15px;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  background: white;
  color: var(--ink);
}
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .toolbar-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.step-nav { display: grid; gap: 8px; margin-top: 18px; }
.step-button {
  border: 1px solid transparent;
  background: transparent;
  border-radius: 16px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
}
.step-button:hover { background: #f8fafc; }
.step-button.active { background: #eff6ff; border-color: #bfdbfe; }
.step-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: #e2e8f0; color: #475569; display: grid; place-items: center; font-weight: 900;
}
.step-button.active .step-num { background: linear-gradient(135deg, #2563eb, #0f766e); color: white; }
.step-title { font-size: 13px; font-weight: 850; }
.step-small { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }
.step-check { font-size: 12px; color: var(--success); font-weight: 900; }

.progress-box { margin: 18px 0; padding: 14px; border-radius: 18px; background: #f8fafc; border: 1px solid var(--line); }
.progress-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.progress-track { height: 10px; background: #dbeafe; border-radius: 999px; overflow: hidden; margin: 12px 0 6px; }
.progress-track > div { height: 100%; width: 0%; background: linear-gradient(90deg, #2563eb, #14b8a6); transition: width .2s ease; }

.repeat-list { display: grid; gap: 14px; grid-column: 1 / -1; }
.repeat-card { border: 1px solid var(--line); border-radius: 20px; background: #f8fafc; padding: 16px; position: relative; }
.repeat-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.form-actions .btn:nth-child(2) { margin-left: auto; }

.dashboard-hero { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: white; border-radius: 22px; padding: 18px; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(15, 23, 42, .06); }
.stat span { display: block; color: var(--muted); font-size: 13px; font-weight: 750; }
.stat strong { display: block; font-size: 30px; margin-top: 8px; }

.filter-panel {
  display: grid;
  grid-template-columns: 1.5fr 180px 230px 160px 160px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.filter-main { min-width: 240px; }
.toolbar-label { display: block; font-size: 12px; font-weight: 850; color: #475569; margin-bottom: 7px; }
.filter-button { height: 44px; }
.table-meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 13px; font-weight: 750; margin: 8px 0 12px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; min-width: 980px; border-collapse: collapse; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: middle; }
th { background: #f8fafc; font-size: 12px; text-transform: uppercase; color: #64748b; letter-spacing: .04em; }
.status {
  display: inline-block; padding: 6px 10px; border-radius: 999px;
  background: #dbeafe; color: #1d4ed8; font-size: 12px; font-weight: 900;
}
.status.verified { background: #dcfce7; color: #15803d; }
.status.need_revision { background: #ffedd5; color: #c2410c; }
.status.rejected { background: #fee2e2; color: #b91c1c; }
.status.draft { background: #f1f5f9; color: #475569; }

.action-group { display: flex; flex-wrap: wrap; gap: 6px; }
.btn-mini {
  border: none;
  border-radius: 11px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  background: #e2e8f0;
  color: #0f172a;
}
.btn-mini.primary { background: #dbeafe; color: #1d4ed8; }
.btn-mini.success { background: #dcfce7; color: #15803d; }
.btn-mini.warning { background: #ffedd5; color: #c2410c; }
.btn-mini.danger { background: #fee2e2; color: #b91c1c; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .62);
  z-index: 50;
  padding: 24px;
  overflow-y: auto;
}
.modal-card {
  max-width: 980px;
  margin: 0 auto;
  background: white;
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 18px; }
.modal-body { display: grid; gap: 18px; }
.detail-section { border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: #f8fafc; }
.detail-section h3 { margin: 0 0 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-item { background: white; border: 1px solid var(--line); border-radius: 14px; padding: 11px; }
.detail-item small { display: block; color: var(--muted); font-weight: 850; font-size: 11px; text-transform: uppercase; margin-bottom: 5px; }
.detail-item span { font-weight: 750; word-break: break-word; }
.modal-actions { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 16px; }

.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: grid; gap: 10px; }
.toast {
  width: min(360px, calc(100vw - 36px));
  background: white;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
  animation: toastIn .18s ease-out;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast strong { display: block; margin-bottom: 4px; }
.toast p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 980px) {
  .student-layout { grid-template-columns: 1fr; }
  .side-card { position: static; }
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-hero, .header-inner { flex-direction: column; align-items: stretch; }
}

@media (max-width: 680px) {
  .page { padding: 20px 12px; }
  .card { padding: 18px; border-radius: 22px; }
  .auth-card { padding: 24px; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .filter-panel { grid-template-columns: 1fr; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1 1 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
  .modal-head, .modal-actions { flex-direction: column; align-items: stretch; }
}

/* Production refinements */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #dbe3ef;
  --primary: #2563eb;
  --primary-700: #1d4ed8;
  --success: #16a34a;
  --warning: #f97316;
  --danger: #dc2626;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

body {
  background: var(--bg);
}

.auth-card,
.card,
.stat,
.profile,
.progress-box,
.repeat-card,
.detail-section,
.detail-item,
.modal-card,
.toast,
.table-wrap,
.field input,
.field select,
.field textarea,
.toolbar-input,
.btn,
.btn-mini,
.message,
.badge,
.step-button,
.step-num,
.status,
.check-panel {
  border-radius: 8px;
}

.auth-card,
.card {
  background: var(--surface);
}

.brand-mark {
  border-radius: 8px;
  margin-bottom: 14px;
}

.btn {
  min-height: 42px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 12px;
}

.section-head h2 {
  margin: 0;
}

.admin-filter-panel {
  grid-template-columns: minmax(240px, 1.4fr) repeat(5, minmax(135px, 1fr)) minmax(180px, auto);
}

.inline-check,
.check-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 750;
  color: #334155;
}

.inline-check input,
.check-label input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.filter-check {
  align-self: end;
  min-height: 44px;
}

.check-panel {
  grid-column: 1 / -1;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.full {
  grid-column: 1 / -1;
}

.field-error {
  min-height: 16px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.field.has-error input,
.field.has-error select,
.field.has-error textarea {
  border-color: var(--danger);
  box-shadow: 0 0 0 4px rgba(220, 38, 38, .1);
}

.step-button.gray .step-num { background: #e2e8f0; color: #475569; }
.step-button.orange .step-num { background: #ffedd5; color: #c2410c; }
.step-button.red .step-num { background: #fee2e2; color: #b91c1c; }
.step-button.green .step-num { background: #dcfce7; color: #15803d; }
.step-button.active .step-num { background: var(--primary); color: #fff; }

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.step-badge.gray,
.badge.gray { background: #f1f5f9; color: #475569; }
.step-badge.orange,
.badge.orange { background: #ffedd5; color: #c2410c; }
.step-badge.red,
.badge.red { background: #fee2e2; color: #b91c1c; }
.step-badge.green,
.badge.green { background: #dcfce7; color: #15803d; }

.validation-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.validation-item {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
}

.validation-item strong,
.validation-item span {
  display: block;
}

.validation-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.toast-root {
  right: 18px;
  top: 18px;
  bottom: auto;
}

.toast {
  position: relative;
  padding-right: 42px;
}

.toast.warning { border-left-color: var(--warning); }
.toast.info { border-left-color: var(--primary); }

.toast-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  color: #475569;
  font-size: 18px;
  line-height: 1;
}

.toast-out {
  opacity: 0;
  transform: translateY(-8px);
  transition: .16s ease;
}

.app-modal .modal-body p:first-child {
  margin-top: 0;
}

.detail-modal-card {
  max-width: 1120px;
}

.staff-modal-card {
  max-width: 640px;
}

.modal-actions-stack {
  align-items: stretch;
  display: grid;
  grid-template-columns: 1fr 220px auto;
}

.modal-note-field textarea {
  min-height: 74px;
}

.mini-progress {
  width: 96px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 4px;
}

.mini-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2563eb, #14b8a6);
}

.flag-text {
  color: var(--warning);
  font-weight: 800;
}

.action-group-wide {
  min-width: 340px;
}

.btn-mini.danger-soft {
  background: #fee2e2;
  color: #991b1b;
}

.status.review { background: #dbeafe; color: #1d4ed8; }
.status.submitted { background: #ede9fe; color: #6d28d9; }
.status.role-status { background: #f1f5f9; color: #334155; }

.empty-state {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.avatar-fallback {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #dbeafe;
  color: var(--primary-700);
  font-weight: 900;
  font-size: 22px;
}

.repeat-detail-block {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.repeat-detail-block h4 {
  margin: 0;
}

@media (max-width: 1180px) {
  .admin-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .section-head,
  .modal-actions-stack {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .admin-filter-panel {
    grid-template-columns: 1fr;
  }

  .step-button {
    grid-template-columns: 34px 1fr;
  }

  .step-badge {
    grid-column: 2;
    justify-self: start;
  }

  .toast-root {
    left: 12px;
    right: 12px;
    top: 12px;
  }

  .toast {
    width: 100%;
  }
}


/* Patch: production mobile, pagination, action menu, staff, avatar */
.avatar-shell {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 50%;
  overflow: hidden;
  background: #dbeafe;
  display: grid;
  place-items: center;
}
.avatar-shell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.btn.warning {
  background: #ffedd5;
  color: #9a3412;
}
.btn.success {
  background: #dcfce7;
  color: #15803d;
}
.btn.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 16px;
  flex-wrap: wrap;
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.page-size-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.toolbar-input.small {
  width: auto;
  min-width: 82px;
  padding: 9px 10px;
}
.page-number,
.pagination-info {
  font-size: 13px;
  color: var(--muted);
  font-weight: 800;
}

.action-menu-trigger {
  min-width: 84px;
}
.action-menu-summary {
  display: grid;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}
.action-menu-summary p {
  margin: 0;
}

.staff-toolbar {
  margin: 8px 0 14px;
}
.staff-actions {
  min-width: 230px;
}
.staff-table-wrap table {
  min-width: 760px;
}

@media (max-width: 760px) {
  .header-actions {
    width: 100%;
  }
  .header-actions .btn {
    flex: 1 1 140px;
  }
  .brand-area {
    align-items: flex-start;
  }
  .profile {
    align-items: flex-start;
  }
  .side-card {
    padding: 16px;
  }
  .step-nav {
    max-height: none;
  }
  .table-wrap {
    border-radius: 10px;
  }
  table {
    min-width: 860px;
  }
  .pagination-bar,
  .pagination-controls {
    align-items: stretch;
    flex-direction: column;
  }
  .pagination-controls .btn,
  .page-size-label,
  .toolbar-input.small {
    width: 100%;
  }
  .page-number {
    text-align: center;
    padding: 6px 0;
  }
  .modal-card {
    padding: 16px;
  }
}

/* Wizard and field settings release patch */
.step-button.blue .step-num { background: #dbeafe; color: #1d4ed8; }
.step-badge.blue,
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.step-button.locked { opacity: .72; }
.read-only-step {
  position: relative;
  padding-top: 58px;
}
.read-only-step input,
.read-only-step select,
.read-only-step textarea,
.read-only-step button {
  cursor: not-allowed;
}
.step-lock-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  padding: 13px 14px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1e3a8a;
  box-shadow: 0 10px 24px rgba(37, 99, 235, .12);
  font-size: 14px;
  font-weight: 850;
}
.field-settings-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(220px, 300px);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}
.field-settings-table-wrap table {
  min-width: 980px;
}
code {
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
}
.detail-summary {
  background: #eff6ff;
}

@media (max-width: 760px) {
  .step-nav {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding-bottom: 6px;
  }
  .step-button {
    min-width: 220px;
    grid-template-columns: 34px 1fr;
  }
  .field-settings-toolbar {
    grid-template-columns: 1fr;
  }
  .detail-modal-card {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
}

/* Detail modal status editor polish */
.detail-modal-card .modal-actions-stack {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 190px max-content;
  gap: 12px;
  align-items: end;
  justify-content: stretch;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-top: 18px;
}

.detail-modal-card .modal-actions-stack .field {
  gap: 7px;
}

.detail-modal-card .modal-actions-stack .field > span {
  display: block;
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.detail-modal-card .modal-note-field textarea {
  min-height: 58px;
  max-height: 118px;
  padding: 11px 12px;
}

.detail-modal-card .modal-status-field select {
  height: 46px;
  min-height: 46px;
}

.detail-modal-card #btn-save-modal-status {
  min-height: 46px;
  height: 46px;
  align-self: end;
  white-space: nowrap;
  padding-left: 18px;
  padding-right: 18px;
}

@media (max-width: 760px) {
  .detail-modal-card .modal-actions-stack {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .detail-modal-card #btn-save-modal-status {
    width: 100%;
  }
}

/* Wizard preview overlay action */
.step-lock-overlay {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.step-lock-overlay .btn-mini {
  flex: 0 0 auto;
  min-height: 34px;
}
@media (max-width: 680px) {
  .step-lock-overlay {
    align-items: stretch;
    flex-direction: column;
  }
  .step-lock-overlay .btn-mini {
    width: 100%;
  }
}

/* Non-blocking amber preview notice */
.read-only-step {
  padding-top: 0;
}
.step-lock-overlay {
  position: static;
  grid-column: 1 / -1;
  z-index: auto;
  margin-bottom: 2px;
  padding: 12px 14px;
  border: 1px solid #fdba74;
  background: #fff7ed;
  color: #9a3412;
  box-shadow: 0 8px 20px rgba(249, 115, 22, .10);
}
.step-lock-overlay .btn-mini.primary {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.step-lock-overlay .btn-mini.primary:hover {
  background: #fed7aa;
}

/* Mobile-first form sidebar drawer patch */
.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: #0f172a;
  cursor: pointer;
  font-size: 22px;
  font-weight: 900;
  line-height: 1;
  transition: .16s ease;
}
.icon-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(15, 23, 42, .08); }
.mobile-menu-btn,
.form-sidebar-close,
.mobile-progress-pill,
.form-sidebar-header,
.sidebar-footer,
.sidebar-backdrop { display: none; }

@media (max-width: 1023px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body.form-sidebar-open {
    overflow: hidden;
    touch-action: none;
  }

  .app-header {
    z-index: 60;
  }

  .header-inner {
    padding: 10px 12px;
    gap: 10px;
  }

  .brand-area {
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px;
  }

  .brand-mark.small {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    font-size: 15px;
  }

  .mobile-menu-btn {
    display: inline-grid;
    flex: 0 0 44px;
  }

  .mobile-form-title {
    min-width: 0;
  }

  .mobile-form-title h1 {
    font-size: 15px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 48vw;
  }

  .mobile-form-title p {
    display: none;
  }

  .desktop-header-actions {
    display: none !important;
  }

  .mobile-progress-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 52px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    background: #eff6ff;
    color: var(--primary-700);
    font-size: 13px;
    font-weight: 900;
    border: 1px solid #bfdbfe;
  }

  .progress-line,
  .progress-line > div {
    height: 5px;
  }

  .form-page {
    max-width: none;
    min-height: calc(100dvh - 64px);
    padding: 14px 12px 96px;
  }

  .student-layout {
    display: block;
  }

  .form-card {
    min-height: auto;
    border-radius: 22px;
    padding: 16px;
    margin-bottom: 0;
  }

  .form-head {
    display: block;
    margin-bottom: 14px;
  }

  .form-head .badge {
    margin-bottom: 10px;
  }

  .form-head h2 {
    font-size: 21px;
  }

  .form-grid,
  .repeat-card .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .field input,
  .field select,
  .field textarea,
  .toolbar-input {
    min-height: 46px;
    font-size: 16px;
    border-radius: 14px;
  }

  .field textarea {
    min-height: 104px;
  }

  .form-actions {
    position: sticky;
    bottom: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: minmax(76px, .8fr) minmax(104px, 1fr) minmax(92px, 1fr);
    gap: 8px;
    margin: 20px -16px -16px;
    padding: 10px 12px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(14px);
    border-top: 1px solid rgba(226, 232, 240, .92);
    border-radius: 0 0 22px 22px;
  }

  .form-actions .btn {
    min-height: 44px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 13px;
  }

  .form-actions .btn.hidden {
    display: none !important;
  }

  .form-actions #btn-submit:not(.hidden) {
    grid-column: 3;
  }

  .form-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0;
    bottom: 0;
    width: min(86vw, 340px);
    height: 100dvh;
    z-index: 90;
    transform: translateX(-110%);
    transition: transform .22s ease;
    margin: 0;
    border-radius: 0 24px 24px 0;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 26px 0 70px rgba(15, 23, 42, .26);
  }

  body.form-sidebar-open .form-sidebar {
    transform: translateX(0);
  }

  .form-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }

  .form-sidebar-header strong,
  .form-sidebar-header span {
    display: block;
  }

  .form-sidebar-header strong {
    font-size: 17px;
  }

  .form-sidebar-header span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .form-sidebar-close {
    display: inline-grid;
    flex: 0 0 44px;
    font-size: 28px;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: block;
    background: rgba(15, 23, 42, .46);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }

  body.form-sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .form-sidebar .profile {
    padding: 11px;
    gap: 10px;
    border-radius: 18px;
    align-items: center;
  }

  .form-sidebar .avatar-shell,
  .form-sidebar .avatar-fallback,
  .form-sidebar .profile img {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    font-size: 18px;
  }

  .form-sidebar .profile h2 {
    font-size: 15px;
    margin-bottom: 2px;
  }

  .form-sidebar .profile p {
    font-size: 12px;
    word-break: break-word;
  }

  .form-sidebar .progress-box {
    margin: 12px 0;
    padding: 12px;
    border-radius: 16px;
  }

  .form-sidebar .message {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
  }

  .form-sidebar .step-nav {
    display: grid !important;
    gap: 8px;
    overflow: visible !important;
    padding: 0;
    max-height: none;
  }

  .form-sidebar .step-button {
    width: 100%;
    min-width: 0 !important;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 9px;
    padding: 10px;
  }

  .form-sidebar .step-badge {
    grid-column: 2;
    justify-self: start;
    min-width: auto;
  }

  .form-sidebar .step-title {
    font-size: 12px;
  }

  .form-sidebar .step-small {
    font-size: 11px;
  }

  .sidebar-footer {
    display: grid;
    gap: 10px;
    position: sticky;
    bottom: -16px;
    margin: 16px -16px -16px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    border-radius: 0 0 24px 0;
  }

  .read-only-step {
    opacity: .98;
  }

  .step-lock-overlay {
    border-radius: 14px;
  }
}

@media (max-width: 420px) {
  .mobile-form-title h1 {
    max-width: 42vw;
  }

  .brand-mark.small {
    display: none;
  }

  .form-actions {
    grid-template-columns: .82fr 1fr 1fr;
  }

  .form-actions .btn {
    font-size: 12px;
    padding-left: 8px;
    padding-right: 8px;
  }
}

@media (min-width: 1024px) {
  .mobile-menu-btn,
  .mobile-progress-pill,
  .form-sidebar-header,
  .sidebar-footer,
  .sidebar-backdrop {
    display: none !important;
  }

  body.form-sidebar-open {
    overflow: auto;
  }

  .form-sidebar {
    transform: none !important;
  }
}

/* Admin separated shell: sidebar + topbar */
.admin-body {
  min-height: 100vh;
}

.admin-login-page:has(#login-panel.hidden) {
  display: none;
}

.admin-app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, .10), transparent 34%),
    radial-gradient(circle at top right, rgba(20, 184, 166, .12), transparent 32%),
    #eef4fb;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: rgba(15, 23, 42, .98);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 18px 0 46px rgba(15, 23, 42, .12);
  z-index: 40;
}

.admin-sidebar-head,
.admin-sidebar-foot {
  flex: 0 0 auto;
}

.admin-brand-mini {
  display: flex;
  align-items: center;
  gap: 12px;
}

.admin-brand-mini > span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  font-size: 14px;
  font-weight: 950;
  box-shadow: 0 16px 30px rgba(37, 99, 235, .32);
}

.admin-brand-mini strong,
.admin-brand-mini small {
  display: block;
}

.admin-brand-mini strong {
  font-size: 16px;
}

.admin-brand-mini small {
  margin-top: 2px;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 750;
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, .10);
}

.admin-sidebar-close {
  display: none;
  color: #e2e8f0;
  background: rgba(255, 255, 255, .08);
  border-color: rgba(255, 255, 255, .12);
}

.admin-menu {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  align-content: start;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.admin-menu-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 11px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
  cursor: pointer;
  transition: .16s ease;
}

.admin-menu-item:hover,
.admin-menu-item.active {
  background: rgba(255, 255, 255, .09);
  border-color: rgba(255, 255, 255, .12);
  color: #fff;
}

.admin-menu-item.active {
  box-shadow: inset 3px 0 0 #38bdf8;
}

.admin-menu-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, .08);
  color: #bfdbfe;
  font-size: 19px;
  font-weight: 900;
}

.admin-menu-item strong,
.admin-menu-item small {
  display: block;
}

.admin-menu-item strong {
  font-size: 14px;
  line-height: 1.2;
}

.admin-menu-item small {
  margin-top: 3px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 750;
}

.admin-sidebar-foot {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .10);
}

.admin-sidebar-foot .role {
  min-height: 20px;
  margin: 0;
  color: #bfdbfe;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.admin-main {
  min-width: 0;
  padding: 22px;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: -22px -22px 20px;
  padding: 16px 22px;
  background: rgba(238, 244, 251, .88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(226, 232, 240, .85);
}

.admin-topbar-left {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.admin-menu-toggle {
  display: none;
  flex: 0 0 auto;
}

.admin-topbar h1 {
  margin: 0;
  font-size: clamp(23px, 3vw, 34px);
  line-height: 1.08;
}

.admin-topbar .badge {
  margin-bottom: 8px;
}

.admin-topbar .muted {
  margin: 6px 0 0;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-view {
  animation: adminViewIn .16s ease-out;
}

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

.admin-hero-card {
  margin-bottom: 18px;
}

.admin-card-grid,
.verification-grid,
.export-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-mini-card {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-bottom: 0;
}

.admin-mini-card .btn {
  justify-self: start;
  margin-top: 6px;
}

.verification-card {
  display: grid;
  gap: 10px;
  min-height: 168px;
  padding: 18px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, .07);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: .16s ease;
}

.verification-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 44px rgba(15, 23, 42, .10);
}

.verification-card strong {
  font-size: 38px;
  letter-spacing: -.04em;
}

.verification-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 750;
}

.status.warning {
  background: #ffedd5;
  color: #c2410c;
}

.export-panel {
  grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr);
  align-items: stretch;
}

.export-summary-card,
.export-tips {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: #f8fafc;
  padding: 18px;
}

.export-summary-card span,
.export-summary-card small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.export-summary-card strong {
  display: block;
  margin: 8px 0;
  font-size: 44px;
  letter-spacing: -.04em;
}

.export-tips h3 {
  margin-bottom: 6px;
}

.admin-backdrop {
  display: none;
}

.desktop-only {
  display: inline-flex;
}

@media (max-width: 1180px) {
  .admin-app {
    grid-template-columns: 260px minmax(0, 1fr);
  }

  .admin-main {
    padding: 18px;
  }

  .admin-topbar {
    margin: -18px -18px 18px;
    padding: 14px 18px;
  }

  .admin-card-grid,
  .verification-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1023px) {
  body.admin-sidebar-open {
    overflow: hidden;
  }

  .admin-app {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 340px);
    height: 100dvh;
    transform: translateX(-110%);
    transition: transform .22s ease;
    border-radius: 0 24px 24px 0;
    box-shadow: 26px 0 70px rgba(15, 23, 42, .28);
    z-index: 90;
  }

  body.admin-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-close,
  .admin-menu-toggle {
    display: inline-grid;
  }

  .admin-backdrop {
    position: fixed;
    inset: 0;
    display: block;
    opacity: 0;
    pointer-events: none;
    z-index: 80;
    background: rgba(15, 23, 42, .48);
    transition: opacity .2s ease;
  }

  body.admin-sidebar-open .admin-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .admin-main {
    padding: 14px 12px 26px;
  }

  .admin-topbar {
    margin: -14px -12px 14px;
    padding: 10px 12px;
    align-items: flex-start;
  }

  .admin-topbar-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .admin-topbar h1 {
    font-size: 20px;
  }

  .admin-topbar .badge {
    display: none;
  }

  .admin-topbar .muted {
    display: none;
  }

  .admin-topbar-actions {
    flex: 0 0 auto;
    gap: 7px;
  }

  .admin-topbar-actions .btn {
    min-height: 40px;
    padding: 9px 11px;
    border-radius: 12px;
    font-size: 12px;
  }

  .desktop-only {
    display: none !important;
  }

  .dashboard-hero.admin-hero-card {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-card-grid,
  .verification-grid,
  .export-panel {
    grid-template-columns: 1fr;
  }

  .admin-filter-panel,
  .field-settings-toolbar,
  .staff-toolbar {
    grid-template-columns: 1fr !important;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat {
    border-radius: 18px;
    padding: 14px;
  }

  .stat strong {
    font-size: 24px;
  }

  .card {
    border-radius: 22px;
    padding: 16px;
  }

  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-bar,
  .pagination-controls,
  .table-meta {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-controls .btn,
  .page-size-label,
  .pagination-controls .toolbar-input.small {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .admin-topbar-actions [data-admin-action="export"] {
    display: none !important;
  }

  .admin-main {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .admin-menu-item {
    padding: 10px;
  }

  .admin-sidebar {
    width: min(90vw, 330px);
    padding: 14px;
  }

  .admin-brand-mini > span {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }
}

/* Stable patch: grouped travel-time inputs */
.field-group.full {
  grid-column: 1 / -1;
}

.field-group-title {
  margin-bottom: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 850;
}

.compact-time-row {
  width: min(100%, 360px);
}

.compact-time-row .field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(92px, 132px));
  gap: 12px;
  align-items: start;
}

.compact-time-row .field {
  min-width: 0;
}

.compact-time-row .field input {
  text-align: center;
}

.compact-hint {
  margin: 8px 0 0;
}

@media (max-width: 1023px) {
  .compact-time-row {
    width: min(100%, 320px);
  }

  .compact-time-row .field-pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Stable field controls, submit success, and edit lock */
.field-help {
  display: block;
  margin-top: 6px;
  color: #64748b;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
  cursor: not-allowed;
  color: #475569;
  background: #f1f5f9;
  border-color: #dbe3ee;
  opacity: 1;
}

.submission-success {
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 34px 22px;
  text-align: center;
}

.submission-success.hidden {
  display: none !important;
}

.success-icon {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 26px;
  background: linear-gradient(145deg, #dcfce7, #bbf7d0);
  color: #15803d;
  font-size: 38px;
  font-weight: 950;
  box-shadow: 0 18px 42px rgba(22, 163, 74, .16);
}

.submission-success h2 {
  margin: 0;
  font-size: clamp(25px, 4vw, 38px);
  letter-spacing: -.035em;
}

.submission-success > .muted {
  max-width: 680px;
  margin: 0;
}

.submission-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  width: min(100%, 760px);
  margin-top: 6px;
}

.submission-summary-grid > div {
  display: grid;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
  text-align: left;
}

.submission-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.submission-summary-grid strong {
  color: var(--ink);
  font-size: 16px;
}

.submission-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 4px;
}

#edit-request-status {
  width: min(100%, 760px);
  text-align: left;
}

.student-summary {
  display: grid;
  gap: 16px;
  max-height: min(68vh, 720px);
  overflow-y: auto;
  padding-right: 4px;
}

.summary-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
}

.summary-section h3,
.summary-repeat h4 {
  margin: 0 0 12px;
}

.summary-repeat + .summary-repeat {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.summary-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
}

.summary-item small {
  color: var(--muted);
  font-weight: 750;
}

.summary-item span {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-weight: 750;
}

.edit-policy-card {
  display: grid;
  grid-template-columns: minmax(220px, .72fr) minmax(0, 1.28fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #fed7aa;
  border-radius: 22px;
  background: linear-gradient(145deg, #fff7ed, #fff);
}

.edit-policy-card h3 {
  margin: 7px 0 5px;
}

.edit-policy-grid {
  display: grid;
  gap: 10px;
}

.setting-switch {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 15px;
  background: rgba(255,255,255,.9);
  cursor: pointer;
}

.setting-switch input,
.compact-switch input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--primary);
}

.setting-switch span {
  display: grid;
  gap: 3px;
}

.setting-switch small {
  color: var(--muted);
  line-height: 1.4;
}

.field-settings-table {
  min-width: 1040px;
}

.field-settings-table td {
  vertical-align: top;
}

.field-label-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
}

.field-label-input:focus {
  outline: 3px solid rgba(37, 99, 235, .13);
  border-color: #60a5fa;
}

.field-setting-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.auto-field-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 7px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 11px;
  font-weight: 850;
}

.compact-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 92px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.field-row-inactive {
  opacity: .66;
  background: #f8fafc;
}

.edit-access-panel {
  display: grid;
  gap: 12px;
  width: 100%;
  padding: 15px;
  border: 1px solid #bfdbfe;
  border-radius: 18px;
  background: #eff6ff;
}

.edit-access-copy {
  display: grid;
  gap: 4px;
}

.edit-access-copy small {
  color: var(--muted);
}

.edit-access-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.edit-request-admin {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #fde68a;
  border-radius: 14px;
  background: #fffbeb;
}

.edit-request-admin p,
.edit-request-admin small {
  margin: 0;
}

.lock-flag {
  color: #b45309;
}

.unlock-flag {
  color: #15803d;
}

.request-flag {
  color: #7c3aed;
}

@media (max-width: 1023px) {
  .edit-policy-card {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .submission-success {
    padding: 24px 4px 110px;
  }

  .submission-summary-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .submission-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .submission-actions .btn {
    width: 100%;
  }

  .success-icon {
    width: 66px;
    height: 66px;
    border-radius: 22px;
    font-size: 32px;
  }

  .edit-access-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .edit-access-actions .btn {
    width: 100%;
  }
}

/* Patch: toggle controls for admin field settings and edit policy */
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.toggle-track {
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, .65);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.toggle-thumb {
  display: block;
  width: 18px;
  height: 18px;
  margin: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .22);
  transition: transform .18s ease;
}

.toggle-switch input:checked + .toggle-track {
  background: #2563eb;
  border-color: #2563eb;
}

.toggle-switch input:checked + .toggle-track .toggle-thumb {
  transform: translateX(18px);
}

.toggle-switch input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .18);
}

.compact-switch {
  min-width: 118px;
  font-size: 12px;
  font-weight: 850;
}

.compact-switch .toggle-text {
  min-width: 58px;
}

.setting-switch.setting-toggle {
  align-items: center;
}

.setting-switch.setting-toggle > input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.setting-switch .setting-copy {
  display: grid;
  gap: 3px;
}

.field-year select {
  max-width: 220px;
}

@media (max-width: 760px) {
  .compact-switch {
    min-width: 108px;
  }

  .toggle-track {
    width: 39px;
    height: 22px;
    flex-basis: 39px;
  }

  .toggle-thumb {
    width: 16px;
    height: 16px;
  }

  .toggle-switch input:checked + .toggle-track .toggle-thumb {
    transform: translateX(17px);
  }
}


/* Stable button-based toggles: no hidden checkbox dependency */
button.toggle-button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  font: inherit;
  text-align: left;
  background: transparent;
}

button.toggle-button:not(:disabled) {
  cursor: pointer;
}

button.setting-switch.setting-toggle.toggle-button {
  width: 100%;
  background: rgba(255,255,255,.9);
}

button.toggle-switch.compact-switch.toggle-button {
  padding: 0;
  color: inherit;
}

button.toggle-button .toggle-track {
  display: block;
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 42px;
  border-radius: 999px;
  background: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, .65);
  transition: background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

button.toggle-button .toggle-thumb {
  display: block;
  width: 18px;
  height: 18px;
  margin: 2px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .22);
  transition: transform .18s ease;
}

button.toggle-button.is-on .toggle-track {
  background: #2563eb;
  border-color: #2563eb;
}

button.toggle-button.is-on .toggle-thumb {
  transform: translateX(18px);
}

button.toggle-button:focus-visible .toggle-track {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .18);
}

button.toggle-button:disabled {
  opacity: .58;
  cursor: not-allowed;
}

@media (max-width: 760px) {
  button.toggle-button .toggle-track {
    width: 39px;
    height: 22px;
    flex-basis: 39px;
  }
  button.toggle-button .toggle-thumb {
    width: 16px;
    height: 16px;
  }
  button.toggle-button.is-on .toggle-thumb {
    transform: translateX(17px);
  }
}


/* Ultra-stable toggle visual fallback: works for button toggles and ignores hidden checkbox conflicts */
button.toggle-button[data-toggle-state="on"] .toggle-track,
button.toggle-button[aria-pressed="true"] .toggle-track {
  background: #2563eb !important;
  border-color: #2563eb !important;
}

button.toggle-button[data-toggle-state="on"] .toggle-thumb,
button.toggle-button[aria-pressed="true"] .toggle-thumb {
  transform: translateX(18px) !important;
}

button.toggle-button[data-toggle-state="off"] .toggle-track,
button.toggle-button[aria-pressed="false"] .toggle-track {
  background: #cbd5e1 !important;
  border-color: rgba(148, 163, 184, .65) !important;
}

button.toggle-button[data-toggle-state="off"] .toggle-thumb,
button.toggle-button[aria-pressed="false"] .toggle-thumb {
  transform: translateX(0) !important;
}

button.toggle-button {
  border: 0 !important;
  outline: none;
}

button.toggle-button:focus-visible .toggle-track {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .18) !important;
}
