/* ============================================================
   ระบบสอบมาตรฐานฝีมือแรงงานแห่งชาติ - Main Stylesheet
   ============================================================ */

:root {
  --primary: #1e40af;          /* น้ำเงินเข้ม */
  --primary-dark: #1e3a8a;
  --primary-light: #3b82f6;
  --secondary: #dc2626;        /* แดง (สีธงไทย) */
  --secondary-dark: #991b1b;
  --accent: #fbbf24;           /* ทอง (โลโก้กลาง) */
  --neutral-50: #fafaf9;
  --neutral-100: #f5f5f4;
  --neutral-200: #e7e5e4;
  --neutral-300: #d6d3d1;
  --neutral-700: #44403c;
  --neutral-900: #1c1917;
  --success: #059669;
  --warning: #d97706;
  --error: #dc2626;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'TH Sarabun New', 'TH SarabunPSK', 'Sarabun', sans-serif;
  background: var(--neutral-100);
  color: var(--neutral-900);
  line-height: 1.6;
}

/* ============================================================
   PUBLIC HOMEPAGE
   ============================================================ */
.hero-section {
  background:
    linear-gradient(135deg, rgba(30, 64, 175, 0.92), rgba(30, 58, 138, 0.95)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='100' height='100'><pattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'><path d='M0 20 L40 20 M20 0 L20 40' stroke='rgba(255,255,255,0.05)' stroke-width='1'/></pattern><rect width='100' height='100' fill='url(%23p)'/></svg>");
  color: white;
  padding: 100px 0 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at center, rgba(251, 191, 36, 0.15) 0%, transparent 50%);
  animation: pulse 8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}
.hero-content { position: relative; z-index: 2; }
.hero-logo {
  width: 140px;
  height: 140px;
  margin: 0 auto 24px;
  background: white;
  border-radius: 50%;
  padding: 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.2);
  animation: float 3s ease-in-out infinite;
}
.hero-logo img { width: 100%; height: 100%; object-fit: contain; }
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.hero-title {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 400;
  margin-bottom: 8px;
  letter-spacing: 0.05em;
  opacity: 0.95;
}
.hero-subtitle {
  font-size: clamp(1.5rem, 4.5vw, 2.5rem);
  font-weight: 700;
  margin-bottom: 32px;
  line-height: 1.3;
}
.btn-hero {
  display: inline-block;
  padding: 14px 36px;
  background: var(--accent);
  color: var(--neutral-900);
  text-decoration: none;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(251, 191, 36, 0.4);
  transition: all 0.3s;
}
.btn-hero:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(251, 191, 36, 0.5); }

.services-section { padding: 80px 0; background: var(--neutral-100); }
.services-title {
  text-align: center;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 60px;
  color: var(--neutral-900);
  position: relative;
}
.services-title::after {
  content: '';
  display: block;
  width: 80px;
  height: 4px;
  background: var(--accent);
  margin: 16px auto 0;
  border-radius: 2px;
}
.service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
.service-card {
  background: white;
  padding: 32px 24px;
  border-radius: 16px;
  text-align: center;
  text-decoration: none;
  color: var(--neutral-900);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  transition: all 0.3s;
  border-top: 4px solid var(--primary);
}
.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 32px rgba(30, 64, 175, 0.15);
}
.service-card .icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
}
.service-card h3 { font-size: 1.25rem; font-weight: 700; margin: 0 0 8px; color: var(--primary); }
.service-card p { color: var(--neutral-700); font-size: 0.95rem; margin: 0; line-height: 1.6; }

/* ============================================================
   NAVBAR
   ============================================================ */
.navbar {
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.navbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 700;
  font-size: 1.05rem;
}
.navbar-brand img { width: 40px; height: 40px; object-fit: contain; }
.navbar-menu { display: flex; gap: 8px; align-items: center; }
.navbar-menu a {
  padding: 8px 16px;
  text-decoration: none;
  color: var(--neutral-700);
  border-radius: 6px;
  font-weight: 500;
  transition: all 0.2s;
}
.navbar-menu a:hover { background: var(--neutral-100); color: var(--primary); }
.navbar-menu a.active { background: var(--primary); color: white; }

.btn-login {
  background: var(--primary) !important;
  color: white !important;
  padding: 10px 24px !important;
  border-radius: 50px !important;
}
.btn-login:hover { background: var(--primary-dark) !important; }

/* ============================================================
   DASHBOARD LAYOUT
   ============================================================ */
.dash-wrap { display: flex; min-height: 100vh; }
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--primary-dark), var(--primary));
  color: white;
  padding: 24px 0;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}
.sidebar-brand h2 { font-size: 1rem; margin: 8px 0 4px; font-weight: 700; }
.sidebar-brand p { font-size: 0.8rem; opacity: 0.7; margin: 0; }
.sidebar-menu { list-style: none; padding: 0; margin: 0; }
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.95rem;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-menu li a:hover {
  background: rgba(255,255,255,0.1);
  color: white;
  border-left-color: var(--accent);
}
.sidebar-menu li a.active {
  background: rgba(255,255,255,0.15);
  color: white;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-menu .section-title {
  padding: 16px 24px 8px;
  font-size: 0.75rem;
  text-transform: uppercase;
  opacity: 0.5;
  letter-spacing: 0.05em;
}

.dash-main { flex: 1; padding: 32px; max-width: calc(100% - 260px); }
.dash-header {
  background: white;
  padding: 20px 32px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.dash-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--neutral-900); }
.dash-header .breadcrumb { font-size: 0.85rem; color: var(--neutral-700); margin-top: 4px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  background: var(--neutral-100);
  border-radius: 50px;
}
.user-chip .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.user-chip span { font-weight: 600; font-size: 0.9rem; }
.user-chip a { color: var(--secondary); font-size: 0.85rem; text-decoration: none; }

/* ============================================================
   CARDS, TABLES, FORMS
   ============================================================ */
.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 24px;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: -24px -24px 20px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--neutral-200);
  border-radius: 12px 12px 0 0;
  background: var(--neutral-50);
}
.card-header h2 { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--primary); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 4px solid var(--primary);
}
.stat-card .label { color: var(--neutral-700); font-size: 0.85rem; margin-bottom: 8px; }
.stat-card .value { font-size: 1.75rem; font-weight: 700; color: var(--neutral-900); }
.stat-card.success { border-left-color: var(--success); }
.stat-card.warning { border-left-color: var(--warning); }
.stat-card.error { border-left-color: var(--error); }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data-table th {
  text-align: left;
  padding: 12px 14px;
  background: var(--neutral-100);
  color: var(--neutral-700);
  font-weight: 700;
  border-bottom: 2px solid var(--neutral-200);
  font-size: 0.85rem;
}
table.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--neutral-200);
}
table.data-table tr:hover { background: var(--neutral-50); }

.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--neutral-900);
}
.form-group label .req { color: var(--error); }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s;
  background: white;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.btn {
  display: inline-block;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--error); color: white; }
.btn-secondary { background: var(--neutral-200); color: var(--neutral-900); }
.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-block { display: block; width: 100%; text-align: center; }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: var(--neutral-200); color: var(--neutral-700); }

.alert {
  padding: 14px 18px;
  border-radius: 8px;
  border-left: 4px solid;
  margin-bottom: 16px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(30, 64, 175, 0.85), rgba(30, 58, 138, 0.9)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='80'><pattern id='p' width='40' height='40' patternUnits='userSpaceOnUse'><path d='M0 20 L40 20 M20 0 L20 40' stroke='rgba(255,255,255,0.08)' stroke-width='1'/></pattern><rect width='80' height='80' fill='url(%23p)'/></svg>");
}
.login-card {
  background: white;
  border-radius: 24px;
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 25px 60px rgba(0,0,0,0.2);
}
.login-logo {
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
  display: block;
}
.login-card h1 {
  text-align: center;
  font-size: 1.4rem;
  margin: 0 0 8px;
  color: var(--primary);
}
.login-card .subtitle {
  text-align: center;
  color: var(--neutral-700);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

/* ============================================================
   SCORING UI (สำหรับครู)
   ============================================================ */
.score-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.score-btn {
  padding: 14px 8px;
  border: 2px solid var(--neutral-300);
  background: white;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.score-btn:hover { border-color: var(--primary); background: var(--neutral-50); }
.score-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
}
.score-display {
  font-size: 3rem;
  font-weight: 800;
  color: var(--primary);
  text-align: center;
  padding: 16px 0;
  letter-spacing: -0.02em;
}

@media (max-width: 768px) {
  .dash-wrap { flex-direction: column; }
  .sidebar { width: 100%; }
  .dash-main { max-width: 100%; padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   PRINT STYLES (เอกสารราชการ)
   ============================================================ */
@media print {
  .no-print { display: none !important; }
  body { background: white; }
  .print-doc {
    width: 21cm;
    min-height: 29.7cm;
    padding: 2cm;
    margin: 0 auto;
    background: white;
    page-break-after: always;
  }
}
.print-doc {
  width: 21cm;
  min-height: 29.7cm;
  padding: 2cm;
  margin: 24px auto;
  background: white;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  font-size: 14pt;
}
.print-header { text-align: center; margin-bottom: 24px; }
.print-header img { width: 80px; height: 80px; }
.print-header h1 { font-size: 1.4rem; margin: 8px 0 4px; }
.print-header p { margin: 0; font-size: 1rem; }


/* ============================================================
   PASSWORD EYE TOGGLE - GLOBAL
   ============================================================ */
.password-wrapper {
  position: relative !important;
  width: 100% !important;
}
.password-wrapper > input[type="password"],
.password-wrapper > input[type="text"] {
  width: 100% !important;
  padding-right: 52px !important;
}
.password-toggle {
  position: absolute !important;
  top: 50% !important;
  right: 14px !important;
  transform: translateY(-50%) !important;
  width: 34px !important;
  height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(15, 23, 42, .06) !important;
  color: #0f172a !important;
  cursor: pointer !important;
  z-index: 20 !important;
  font-size: 18px !important;
  line-height: 1 !important;
  user-select: none !important;
  transition: .18s ease !important;
}
.password-toggle:hover {
  background: rgba(37, 99, 235, .14) !important;
  color: var(--primary, #2563eb) !important;
  transform: translateY(-50%) scale(1.04) !important;
}
.password-toggle:focus {
  outline: 2px solid rgba(37, 99, 235, .35) !important;
  outline-offset: 2px !important;
}
.login-card .password-toggle { right: 12px !important; }


/* ============================================================
   MOBILE RESPONSIVE FULL PATCH
   ใช้กับ frontend + backend + forms + tables
   ============================================================ */
img, video, canvas, svg { max-width: 100%; height: auto; }
button, input, select, textarea { max-width: 100%; }

.mobile-topbar,
.mobile-backdrop,
.nav-burger { display: none; }

.card, .stat-card, .service-card, .login-card {
  overflow-wrap: anywhere;
}

.table-responsive,
.card:has(table),
.data-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table,
table {
  max-width: 100%;
}

@media (max-width: 1024px) {
  .navbar { padding: 10px 14px; }
  .navbar-inner { gap: 10px; }
  .navbar-brand { min-width: 0; font-size: .95rem; }
  .navbar-brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 58vw; }

  .dash-main { padding: 20px; }
  .dash-header { padding: 18px 20px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

  .navbar { position: sticky; top: 0; z-index: 300; }
  .navbar-inner { position: relative; }
  .nav-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 22px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
  }
  .navbar-menu {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: #fff;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(0,0,0,.18);
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    z-index: 400;
  }
  .navbar-menu.open { display: flex; }
  .navbar-menu a,
  .navbar-menu .btn-login {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px 14px !important;
    border-radius: 12px !important;
  }

  .hero-section { padding: 56px 16px 48px; }
  .hero-logo { width: 96px; height: 96px; }
  .services-section { padding: 42px 0; }
  .services-title { margin-bottom: 28px; padding: 0 16px; }
  .service-grid { grid-template-columns: 1fr; gap: 16px; }
  footer { padding: 24px 16px !important; }

  .login-wrap { padding: 14px; align-items: flex-start; }
  .login-card {
    max-width: 100%;
    padding: 26px 18px;
    border-radius: 20px;
    margin: 10px 0;
  }
  .login-logo { width: 76px; height: 76px; }

  .dash-wrap { display: block; min-height: 100vh; }
  .mobile-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    border-radius: 16px;
    padding: 10px 12px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(15,23,42,.08);
    position: sticky;
    top: 8px;
    z-index: 120;
  }
  .menu-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    font-size: 23px;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(30,64,175,.24);
  }
  .mobile-title {
    font-weight: 800;
    color: var(--neutral-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.48);
    backdrop-filter: blur(2px);
    z-index: 190;
  }
  body.sidebar-open .mobile-backdrop { display: block; }
  body.sidebar-open { overflow: hidden; }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: min(86vw, 310px);
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transform: translateX(-105%);
    transition: transform .25s ease;
    padding-top: 18px;
    box-shadow: 22px 0 60px rgba(0,0,0,.28);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-brand { padding: 0 18px 18px; }
  .sidebar-menu li a { padding: 12px 18px; font-size: .94rem; }
  .sidebar-menu .section-title { padding: 14px 18px 7px; }

  .dash-main {
    max-width: 100%;
    width: 100%;
    padding: 12px;
  }
  .dash-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    border-radius: 16px;
  }
  .dash-header h1 { font-size: 1.15rem; }
  .user-chip {
    width: 100%;
    border-radius: 14px;
    justify-content: flex-start;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 16px;
  }
  .card-header {
    margin: -16px -16px 16px;
    padding: 14px 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .card-header h2 { font-size: 1rem; }
  .card-header .btn,
  .card-header a.btn,
  .card-header button { width: 100%; text-align: center; }

  .stat-grid { grid-template-columns: 1fr; gap: 12px; }
  .stat-card { padding: 16px; }
  .stat-card .value { font-size: 1.45rem; }

  .form-row { grid-template-columns: 1fr !important; gap: 12px; }
  .form-group { margin-bottom: 14px; }
  .form-control,
  input, select, textarea {
    font-size: 16px !important; /* กัน iOS zoom */
  }
  .btn,
  button.btn,
  a.btn {
    min-height: 42px;
    padding: 10px 14px;
    text-align: center;
  }

  table.data-table,
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
  table.data-table th,
  table.data-table td,
  table th,
  table td { padding: 10px 12px; }

  .score-pad { grid-template-columns: repeat(3, 1fr); }
  .score-display { font-size: 2.2rem; }
}

@media (max-width: 480px) {
  .navbar-brand img { width: 34px; height: 34px; }
  .navbar-brand span { max-width: 48vw; font-size: .86rem; }
  .hero-subtitle { font-size: 1.45rem; }
  .hero-title { font-size: 1rem; }
  .btn-hero { width: 100%; max-width: 260px; padding: 12px 18px; }
  .service-card { padding: 22px 16px; }

  .dash-main { padding: 10px; }
  .mobile-topbar { top: 6px; border-radius: 14px; }
  .menu-burger { width: 42px; height: 42px; }
  .sidebar { width: 88vw; }
  .login-card h1 { font-size: 1.2rem; }
  .login-card .subtitle { margin-bottom: 22px; }
  .card { padding: 14px; }
  .card-header { margin: -14px -14px 14px; padding: 12px 14px; }
  .score-pad { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================
   BALANCED FONT PATCH 2026-05-27
   ปรับขนาดตัวหนังสือทั้งเว็บให้พอดี: ไม่เล็กเกิน/ไม่ใหญ่เกิน
   ============================================================ */
:root{
  --ui-font-base: 18px;
  --ui-font-small: 16px;
  --ui-font-menu: 18px;
  --ui-font-title: 26px;
  --ui-font-card-title: 20px;
}
html{ font-size: var(--ui-font-base) !important; }
body{ font-size: var(--ui-font-base) !important; line-height:1.55 !important; }

/* เมนูซ้าย */
.sidebar{ font-size: var(--ui-font-menu) !important; }
.sidebar-brand h2{ font-size: 20px !important; line-height:1.35 !important; }
.sidebar-brand p{ font-size: 17px !important; }
.sidebar-menu li a{ font-size: 20px !important; line-height:1.35 !important; padding: 13px 20px !important; }
.sidebar-menu .section-title, .section-title{ font-size: 18px !important; }

/* หัวหน้า / breadcrumb */
.dash-header h1{ font-size: var(--ui-font-title) !important; line-height:1.25 !important; }
.dash-header .breadcrumb{ font-size: 16px !important; }
.user-chip span{ font-size: 16px !important; }
.user-chip a{ font-size: 15px !important; }

/* Card / Dashboard */
.card-header h2, .card h2, .panel h2{ font-size: var(--ui-font-card-title) !important; }
.stat-card .label{ font-size: 16px !important; }
.stat-card .value{ font-size: 30px !important; }
.card, .panel, .alert, .badge{ font-size: 18px !important; }

/* ตาราง */
table, .data-table{ font-size: 17px !important; }
th, td{ font-size: 17px !important; line-height:1.45 !important; }
th{ font-weight:700 !important; }

/* ฟอร์ม */
label{ font-size: 17px !important; }
input, select, textarea{ font-size: 17px !important; line-height:1.4 !important; }
button, .btn{ font-size: 17px !important; line-height:1.35 !important; }
.btn-sm{ font-size: 15px !important; }

/* ป้องกัน patch เก่าที่ขยายเกินไป */
.scoring-sheet,
.score-paper,
.paper-preview{ transform:none !important; max-width:100% !important; }
.score-total{ font-size: 32px !important; }
.score-summary{ font-size: 18px !important; }

@media (max-width: 768px){
  html, body{ font-size: 17px !important; }
  .sidebar-menu li a{ font-size: 19px !important; }
  .dash-header h1{ font-size: 22px !important; }
  table, .data-table, th, td{ font-size: 16px !important; }
}
