:root {
  color-scheme: light;
  --sok-blue: #1d4ed8;
  --sok-blue-dark: #1e3a8a;
  --sok-line: #cbd5e1;
  --sok-soft: #f8fafc;
  --sok-text: #0f172a;
}

body {
  padding: 12px !important;
  overflow-x: hidden !important;
}

#sokAppWrapper .sok-shell {
  max-width: 1500px;
  margin: 0 auto;
}

#sokAppWrapper .sok-intro {
  background: linear-gradient(135deg, #eff6ff, #ffffff);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

#sokAppWrapper .sok-intro h1 {
  margin: 0 0 6px;
  color: var(--sok-blue-dark);
  font-size: clamp(20px, 4vw, 28px);
}

#sokAppWrapper .sok-intro p {
  margin: 0;
  color: #334155;
  line-height: 1.55;
}

#sokAppWrapper .sok-notice {
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 13px;
  line-height: 1.5;
}

#sokAppWrapper .sok-notice.info {
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e3a8a;
}

#sokAppWrapper .sok-notice.warn {
  background: #fffbeb;
  border: 1px solid #fbbf24;
  color: #854d0e;
}

#sokAppWrapper .sok-notice.error {
  background: #fef2f2;
  border: 1px solid #f87171;
  color: #991b1b;
}

#sokAppWrapper .sok-card {
  background: #fff;
  border: 1px solid var(--sok-line);
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .06);
  padding: 16px;
  margin-bottom: 14px;
}

#sokAppWrapper .sok-card h2 {
  font-size: 16px !important;
  margin: 0 0 14px !important;
}

#sokAppWrapper .sok-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

#sokAppWrapper .sok-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

#sokAppWrapper .sok-field {
  min-width: 0;
}

#sokAppWrapper .sok-field.span-2 {
  grid-column: span 2;
}

#sokAppWrapper .sok-field label {
  margin-bottom: 5px !important;
  color: #334155 !important;
  font-size: 12px !important;
}

#sokAppWrapper .sok-help {
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
  margin-top: 4px;
}

#sokAppWrapper .is-hidden {
  display: none !important;
}

#sokAppWrapper input,
#sokAppWrapper select,
#sokAppWrapper textarea {
  max-width: 100%;
}

#sokAppWrapper textarea.sok-long {
  min-height: 230px !important;
}

#sokAppWrapper .sok-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

#sokAppWrapper .sok-section-head h2 {
  margin: 0 !important;
  flex: 1 1 260px;
}

#sokAppWrapper .sok-table-wrap {
  overflow: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  width: 100%;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

#sokAppWrapper table.sok-edit-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 860px;
  font-size: 12px;
}

#sokAppWrapper table.sok-edit-table.student {
  min-width: 1840px;
}

#sokAppWrapper table.sok-edit-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e2e8f0;
  color: #1e293b;
  padding: 8px;
  text-align: left;
  white-space: nowrap;
}

#sokAppWrapper table.sok-edit-table td {
  border-top: 1px solid #e2e8f0;
  padding: 5px;
  vertical-align: top;
}

#sokAppWrapper table.sok-edit-table input,
#sokAppWrapper table.sok-edit-table select {
  min-width: 120px;
  min-height: 38px;
  font-size: 12px !important;
}

#sokAppWrapper .sok-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

#sokAppWrapper .sok-btn {
  border: 0;
  border-radius: 7px;
  min-height: 44px;
  padding: 10px 14px;
  font: 700 12px/1.2 "Segoe UI", sans-serif;
  cursor: pointer;
  color: #fff;
  background: var(--sok-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#sokAppWrapper .sok-btn:hover { filter: brightness(.94); }
#sokAppWrapper .sok-btn.primary { background: #2563eb; color: #ffffff; }
#sokAppWrapper .sok-btn.secondary { background: #475569; color: #ffffff; }
#sokAppWrapper .sok-btn.success { background: #15803d; color: #ffffff; }
#sokAppWrapper .sok-btn.danger { background: #dc2626; color: #ffffff; }
#sokAppWrapper .sok-btn.pdf { background: #0f172a; color: #ffffff; }
#sokAppWrapper .sok-btn.ghost { background: #e2e8f0; color: #1e293b; }
#sokAppWrapper .sok-btn.small { min-height: 36px; padding: 7px 10px; }

#sokAppWrapper .sok-export-bar {
  position: sticky;
  bottom: 8px;
  z-index: 20;
  background: rgba(255,255,255,.96);
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15,23,42,.16);
  padding: 10px;
  margin-top: 16px;
}

#sokAppWrapper .sok-preview-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  width: 100%;
  max-width: 1122px;
  padding: 0 4px;
}

#sokAppWrapper .sok-preview-stage {
  background: #334155;
  border-radius: 12px;
  padding: 14px;
  overflow: auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  -webkit-overflow-scrolling: touch;
}

#sokAppWrapper .sok-page-shell {
  transform-origin: top center;
  flex: none;
}

#sokAppWrapper .sok-doc-page {
  width: 210mm;
  height: 297mm;
  overflow: hidden;
  background: #fff;
  color: #000;
  padding: 14mm 16mm;
  box-shadow: 0 0 12px rgba(0,0,0,.35);
  box-sizing: border-box;
  font-family: "Times New Roman", Times, serif;
  font-size: 10pt;
  line-height: 1.32;
  position: relative;
}

#sokAppWrapper .sok-doc-page.landscape {
  width: 297mm;
  height: 210mm;
  padding: 11mm 12mm;
}

#sokAppWrapper .sok-doc-page.pdf-export {
  box-shadow: none;
}

#sokAppWrapper .doc-header {
  text-align: center;
  font-weight: 700;
  line-height: 1.35;
  font-size: 11pt;
  margin-bottom: 7mm;
}

#sokAppWrapper .doc-legal {
  font-size: 8.5pt;
  font-style: italic;
  font-weight: 400;
  margin-top: 2mm;
}

#sokAppWrapper .doc-title {
  text-align: center;
  font-weight: 700;
  font-size: 11pt;
  margin: 4mm 0 2.5mm;
}

#sokAppWrapper .doc-info,
#sokAppWrapper .doc-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

#sokAppWrapper .doc-info td {
  padding: 1.4mm 1.8mm;
  border: 1px solid #555;
  vertical-align: top;
}

#sokAppWrapper .doc-table th,
#sokAppWrapper .doc-table td {
  border: 1px solid #555;
  padding: 1.5mm;
  vertical-align: top;
  overflow-wrap: anywhere;
}

#sokAppWrapper .doc-table th {
  background: #e5e7eb;
  text-align: center;
  vertical-align: middle;
  font-weight: 700;
}

#sokAppWrapper .doc-table.compact { font-size: 8.3pt; line-height: 1.2; }
#sokAppWrapper .doc-table.compact th,
#sokAppWrapper .doc-table.compact td { padding: 1.2mm; }

#sokAppWrapper .doc-list,
#sokAppWrapper .doc-paragraph {
  margin: 0 0 2mm;
  text-align: justify;
}

#sokAppWrapper .doc-footer {
  position: absolute;
  bottom: 6mm;
  left: 16mm;
  right: 16mm;
  display: flex;
  justify-content: space-between;
  font-size: 8pt;
  color: #334155;
}

#sokAppWrapper .doc-approval {
  width: 45%;
  margin: 9mm 0 0 auto;
  text-align: center;
  line-height: 1.5;
}

#sokAppWrapper .privacy-note {
  font-size: 11px;
  color: #475569;
  line-height: 1.45;
  margin-top: 8px;
}

@media (max-width: 1000px) {
  #sokAppWrapper .sok-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  body { padding: 5px !important; }
  #sokAppWrapper .sok-card { padding: 12px; }
  #sokAppWrapper .sok-grid,
  #sokAppWrapper .sok-grid.two { grid-template-columns: 1fr; }
  #sokAppWrapper .sok-field.span-2 { grid-column: span 1; }
  #sokAppWrapper .sok-actions .sok-btn { width: 100%; }
  #sokAppWrapper .sok-export-bar { position: static; }
  #sokAppWrapper .sok-preview-stage { align-items: flex-start; padding: 8px; }
  #sokAppWrapper .sok-preview-toolbar { font-size: 11px; }
}

@page {
  size: A4 portrait;
  margin: 0;
}

@page sokLandscape {
  size: A4 landscape;
  margin: 0;
}

@media print {
  body { background: #fff !important; padding: 0 !important; }
  #sokAppWrapper .sok-card { border: 0; box-shadow: none; padding: 0; margin: 0; }
  #sokAppWrapper .no-print { display: none !important; }
  #sokAppWrapper .sok-preview-stage { display: block; background: #fff; padding: 0; overflow: visible; }
  #sokAppWrapper .sok-page-shell { transform: none !important; width: auto !important; height: auto !important; }
  #sokAppWrapper .sok-doc-page { box-shadow: none; transform: none !important; break-after: page; page-break-after: always; }
  #sokAppWrapper .sok-doc-page.landscape { page: sokLandscape; }
  #sokAppWrapper .sok-doc-page:last-child { break-after: auto; page-break-after: auto; }
}
