@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

  :root {
    --primary: #155eef;
    --primary-dark: #0b46b8;
    --primary-soft: #eef4ff;
    --ink: #17233c;
    --muted: #667085;
    --line: #e4e7ec;
    --surface: #ffffff;
    --background: #f5f7fb;
    --success: #027a48;
    --warning: #b54708;
    --danger: #b42318;
    --shadow: 0 14px 40px rgba(16, 24, 40, 0.10);
    --sidebar-width: 292px;
  }

  * { box-sizing: border-box; }

  html, body {
    margin: 0;
    min-height: 100%;
    font-family: 'Sarabun', sans-serif;
    background: var(--background);
    color: var(--ink);
  }

  body { min-height: 100vh; }

  button, input, select, textarea {
    font: inherit;
  }

  button { cursor: pointer; }

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

  .eyebrow {
    display: inline-block;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  /* Loading */
  .loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #edf4ff, #f8fbff);
  }

  .loading-card {
    width: min(360px, calc(100vw - 40px));
    padding: 30px;
    text-align: center;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
  }

  .loading-logo { width: 84px; height: 84px; object-fit: contain; }

  .loading-spinner {
    width: 38px;
    height: 38px;
    margin: 18px auto;
    border: 4px solid #d9e6ff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
  }

  @keyframes spin { to { transform: rotate(360deg); } }

  /* Login */
  .login-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.06fr) minmax(420px, 0.94fr);
  }

  .login-brand-panel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 72px;
    color: #ffffff;
    background:
      radial-gradient(circle at 18% 18%, rgba(255,255,255,0.18), transparent 30%),
      linear-gradient(140deg, #0847b0, #155eef 58%, #4d8dff);
    overflow: hidden;
  }

  .login-brand-panel::after {
    content: '';
    position: absolute;
    width: 440px;
    height: 440px;
    right: -170px;
    bottom: -180px;
    border-radius: 50%;
    background: rgba(255,255,255,0.10);
  }

  .login-logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    padding: 12px;
    border-radius: 30px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 20px 45px rgba(0,0,0,0.16);
  }

  .login-brand-text { position: relative; z-index: 1; }

  .login-brand-text .eyebrow { color: #d9e9ff; }

  .login-brand-text h1 {
    margin: 10px 0 4px;
    font-size: clamp(3rem, 6vw, 5.6rem);
    line-height: 0.96;
    letter-spacing: -0.06em;
  }

  .login-full-name {
    margin: 14px 0;
    font-weight: 600;
    line-height: 1.55;
  }

  .brand-divider { width: 78px; height: 3px; margin: 24px 0; background: #ffffff; opacity: 0.74; }

  .login-form-panel {
    display: grid;
    place-items: center;
    padding: 36px;
    background: #f9fbff;
  }

  .login-form-card {
    width: min(470px, 100%);
    padding: 34px;
    border: 1px solid #edf0f5;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: var(--shadow);
  }

  .form-heading h2 { margin: 8px 0 4px; font-size: 2rem; }
  .form-heading p { margin: 0 0 24px; color: var(--muted); }

  .field-label {
    display: block;
    margin: 16px 0 7px;
    font-size: 0.92rem;
    font-weight: 700;
  }

  .field-control {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    border: 1px solid #d0d5dd;
    border-radius: 11px;
    background: #ffffff;
    color: var(--ink);
    outline: none;
    transition: 0.18s ease;
  }

  textarea.field-control { min-height: 96px; resize: vertical; }

  .field-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21,94,239,0.12);
  }

  .password-wrap { position: relative; }
  .password-wrap .field-control { padding-right: 64px; }

  .password-toggle {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 700;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    min-height: 42px;
    padding: 9px 17px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-weight: 700;
    transition: 0.18s ease;
  }

  .primary-button { background: var(--primary); color: #ffffff; }
  .primary-button:hover { background: var(--primary-dark); }
  .secondary-button { background: var(--primary-soft); color: var(--primary); }
  .ghost-button { border-color: var(--line); background: #ffffff; color: var(--ink); }
  .danger-button { background: #fff1f0; color: var(--danger); }
  .full-width { width: 100%; margin-top: 22px; }
  .login-help { margin-top: 18px; text-align: center; color: var(--muted); font-size: 0.86rem; }

  /* App layout */
  .app-shell { min-height: 100vh; }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    width: var(--sidebar-width);
    flex-direction: column;
    background: #0d2758;
    color: #ffffff;
    box-shadow: 8px 0 30px rgba(16,24,40,0.10);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
  }

  .sidebar-brand img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    padding: 4px;
    border-radius: 10px;
    background: #ffffff;
  }

  .sidebar-brand strong { display: block; font-size: 1.18rem; }
  .sidebar-brand span { display: block; color: #b8d1ff; font-size: 0.72rem; }

  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.10);
  }

  .avatar {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    background: #dce9ff;
    color: #10449d;
    font-weight: 700;
  }

  .avatar-small { width: 34px; height: 34px; }

  .sidebar-user-text { min-width: 0; }
  .sidebar-user-text strong,
  .sidebar-user-text span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sidebar-user-text span { color: #c6d8f8; font-size: 0.78rem; }

  .sidebar-menu { flex: 1; overflow-y: auto; padding: 0 10px 14px; }

  .menu-button {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 10px;
    margin: 3px 0;
    padding: 10px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #d7e4fb;
    text-align: left;
  }

  .menu-button:hover,
  .menu-button.is-active { background: rgba(255,255,255,0.14); color: #ffffff; }
  .menu-icon { width: 20px; text-align: center; }

  .sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255,255,255,0.12);
    color: #b8c9e7;
    line-height: 1.45;
  }

  .sidebar-logout {
    width: 100%;
    margin-bottom: 12px;
    padding: 9px;
    border: 1px solid rgba(255,255,255,0.20);
    border-radius: 9px;
    background: rgba(255,255,255,0.08);
    color: #ffffff;
  }

  .app-main { min-height: 100vh; margin-left: var(--sidebar-width); }

  .topbar {
    display: flex;
    min-height: 76px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--line);
    background: rgba(255,255,255,0.94);
    backdrop-filter: blur(14px);
  }

  .topbar-left,
  .topbar-right,
  .topbar-user { display: flex; align-items: center; gap: 12px; }
  .topbar h2 { margin: 0; font-size: 1.28rem; }
  .topbar p { margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; }
  .topbar-user strong,
  .topbar-user span { display: block; }
  .topbar-user span { color: var(--muted); font-size: 0.76rem; }

  .icon-button {
    display: none;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-size: 1.35rem;
  }

  .role-badge,
  .status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 700;
  }

  .page-content { padding: 24px; }

  .page-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
  }

  .page-heading h1 { margin: 0; font-size: 1.7rem; }
  .page-heading p { margin: 4px 0 0; color: var(--muted); }

  .card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
  }

  .stat-card,
  .content-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: #ffffff;
    box-shadow: 0 4px 18px rgba(16,24,40,0.04);
  }

  .stat-card span { display: block; color: var(--muted); font-size: 0.86rem; }
  .stat-card strong { display: block; margin-top: 5px; font-size: 1.7rem; color: #123b81; }
  .stat-card small { display: block; margin-top: 3px; color: var(--muted); }

  .section-title { margin: 0 0 12px; font-size: 1.08rem; }

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

  .profile-grid .span-2 { grid-column: span 2; }

  .readonly-box {
    min-height: 43px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #f6f8fb;
    color: #475467;
  }

  .deputy-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.45fr) auto;
    gap: 10px;
    margin: 10px 0;
  }

  .button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }

  .empty-state {
    padding: 36px 22px;
    border: 1px dashed #cfd5df;
    border-radius: 15px;
    background: #ffffff;
    text-align: center;
    color: var(--muted);
  }

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

  .toast {
    min-width: 260px;
    max-width: 420px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #101828;
    color: #ffffff;
    box-shadow: var(--shadow);
  }

  .toast.success { background: #027a48; }
  .toast.error { background: #b42318; }

  @media (max-width: 980px) {
    .login-layout { grid-template-columns: 1fr; }
    .login-brand-panel { padding: 34px; }
    .login-logo { width: 100px; height: 100px; }

    .sidebar { transform: translateX(-102%); transition: transform 0.2s ease; }
    .sidebar.is-open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .icon-button { display: inline-flex; }
  }

  @media (max-width: 680px) {
    .login-brand-panel { display: block; padding: 28px; }
    .login-brand-text h1 { font-size: 3.4rem; }
    .login-logo { margin-bottom: 18px; }
    .login-form-panel { padding: 18px; }
    .login-form-card { padding: 22px; }
    .page-content { padding: 16px; }
    .topbar { padding: 11px 15px; }
    .topbar-user { display: none; }
    .profile-grid { grid-template-columns: 1fr; }
    .profile-grid .span-2 { grid-column: auto; }
    .deputy-row { grid-template-columns: 1fr; padding: 12px; border: 1px solid var(--line); border-radius: 10px; }
  }

    /* =====================================================
     PHASE 3: SCHOOL FORMS PART 1-3 + EVIDENCE
     ===================================================== */

  .smarted-form-section {
    margin-top: 16px;
  }

  .smarted-progress-wrap {
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: var(--shadow);
  }

  .smarted-progress-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
  }

  .smarted-progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f6;
  }

  .smarted-progress-bar {
    height: 100%;
    border-radius: inherit;
    background:
      linear-gradient(
        90deg,
        #1570ef,
        #12b76a
      );
    transition: width 0.2s ease;
  }

  .smarted-indicator-card,
  .smarted-sub-card,
  .smarted-dynamic-card {
    margin-top: 14px;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: #fbfcfe;
  }

  .smarted-indicator-card h4,
  .smarted-sub-card h4,
  .smarted-dynamic-card h4 {
    margin: 0 0 12px;
    line-height: 1.55;
  }

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

  .smarted-textarea {
    resize: vertical;
    min-height: 96px;
  }

  .smarted-radio-row,
  .smarted-check-grid,
  .smarted-evidence-actions,
  .smarted-inline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  .smarted-check-grid {
    margin: 10px 0 6px;
  }

  .smarted-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
  }

  .smarted-help {
    margin: 4px 0 10px;
    color: var(--muted);
    font-size: 0.93rem;
  }

  .smarted-dynamic-row {
    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      auto;
    gap: 8px;
    align-items: start;
    margin: 9px 0;
  }

  .smarted-evidence-box {
    margin-top: 13px;
    padding: 12px;
    border: 1px dashed #b8c2cf;
    border-radius: 11px;
    background: #ffffff;
  }

  .smarted-evidence-list {
    margin: 8px 0;
  }

  .smarted-evidence-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom:
      1px solid #edf0f3;
  }

  .smarted-evidence-item:last-child {
    border-bottom: 0;
  }

  .smarted-file-label {
    cursor: pointer;
  }

  .smarted-file-label input {
    display: none;
  }

  .link-button {
    border: 0;
    background: transparent;
    color: #175cd3;
    cursor: pointer;
    font: inherit;
    padding: 2px 4px;
  }

  .danger-text {
    color: #b42318;
  }

  .smarted-rating-guide {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #eff8ff;
    color: #1849a9;
  }

  .smarted-table-wrap {
    overflow-x: auto;
  }

  .smarted-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
  }

  .smarted-table th,
  .smarted-table td {
    padding: 10px;
    border: 1px solid var(--line);
    vertical-align: top;
  }

  .smarted-table th:not(:first-child),
  .smarted-table td:not(:first-child) {
    text-align: center;
    width: 62px;
  }

  .smarted-sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 30;
    justify-content: flex-end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
      rgba(
        255,
        255,
        255,
        0.95
      );
    box-shadow: var(--shadow);
  }

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

  @media (max-width: 760px) {
    .smarted-text-grid {
      grid-template-columns: 1fr;
    }

    .smarted-evidence-item {
      align-items: flex-start;
      flex-direction: column;
    }

    .smarted-sticky-actions {
      bottom: 6px;
    }
  }

    /* =====================================================
     SMART-ED THEME PATCH
     ปรับหน้าตาให้ใกล้เคียง Style ชุดแรก
     ให้วางต่อท้าย CSS เดิม ก่อน 
     ===================================================== */

  :root {
    --primary: #1d4ed8;
    --primary-dark: #123b9c;
    --primary-strong: #123b9c;
    --primary-soft: #eaf1ff;

    --success: #0f9d58;
    --success-soft: #e9f8ef;

    --warning: #d97706;
    --warning-soft: #fff4df;

    --danger: #dc2626;
    --danger-soft: #fdeaea;

    --info: #0284c7;
    --info-soft: #e7f5fd;

    --purple: #7c3aed;
    --purple-soft: #f0eaff;

    --muted: #64748b;
    --muted-soft: #eef2f7;

    --ink: #0f172a;
    --ink-soft: #475569;

    --line: #dbe4ef;
    --surface: #ffffff;
    --background: #f4f7fb;
    --canvas: #f4f7fb;

    --sidebar-width: 284px;

    --shadow:
      0 16px 40px rgba(15, 23, 42, 0.08);

    --shadow-soft:
      0 8px 22px rgba(15, 23, 42, 0.06);

    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 10px;
  }

  html,
  body {
    background: var(--canvas);
    color: var(--ink);
  }

  /* =====================================================
     LOADING SCREEN
     ===================================================== */

  .loading-overlay {
    padding: 24px;
    background:
      radial-gradient(
        circle at 20% 20%,
        rgba(59, 130, 246, 0.20),
        transparent 30%
      ),
      radial-gradient(
        circle at 80% 80%,
        rgba(124, 58, 237, 0.16),
        transparent 30%
      ),
      linear-gradient(
        140deg,
        #eff6ff,
        #f8fafc 55%,
        #eef2ff
      );
  }

  .loading-card {
    width: min(420px, calc(100vw - 40px));
    padding: 34px;
    border: 1px solid rgba(255, 255, 255, 0.88);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.90);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
  }

  .loading-logo {
    width: 86px;
    height: 86px;
    margin-bottom: 14px;
  }

  .loading-spinner {
    width: 36px;
    height: 36px;
    margin: 0 auto 14px;
    border: 4px solid #dce8ff;
    border-top-color: var(--primary);
  }

  .loading-card h2 {
    margin: 0;
    color: var(--primary-strong);
    font-size: 24px;
  }

  .loading-card p {
    margin: 6px 0 0;
    color: var(--ink-soft);
  }

  /* =====================================================
     LOGIN PAGE
     ===================================================== */

  .login-layout {
    min-height: 100vh;
    grid-template-columns:
      minmax(0, 1.1fr)
      minmax(420px, 0.9fr);
    background: #eef4ff;
  }

  .login-brand-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    min-height: 100vh;
    overflow: hidden;
    padding:
      72px
      clamp(32px, 6vw, 100px);
    background:
      radial-gradient(
        circle at 15% 15%,
        rgba(147, 197, 253, 0.42),
        transparent 30%
      ),
      radial-gradient(
        circle at 80% 85%,
        rgba(167, 139, 250, 0.38),
        transparent 30%
      ),
      linear-gradient(
        145deg,
        #0d3f9d 0%,
        #1d4ed8 52%,
        #312e81 100%
      );
  }

  .login-brand-panel::before,
  .login-brand-panel::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border:
      1px solid
      rgba(255, 255, 255, 0.16);
    background: transparent;
  }

  .login-brand-panel::before {
    width: 540px;
    height: 540px;
    top: -160px;
    right: -180px;
  }

  .login-brand-panel::after {
    width: 360px;
    height: 360px;
    left: -130px;
    bottom: -150px;
  }

  .login-logo {
    position: relative;
    z-index: 1;
    width: 126px;
    height: 126px;
    margin-bottom: 28px;
    padding: 10px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
  }

  .login-brand-text {
    position: relative;
    z-index: 1;
    max-width: 760px;
  }

  .login-brand-text .eyebrow {
    color: #cfe2ff;
    font-size: 14px;
    letter-spacing: 0.16em;
  }

  .login-brand-text h1 {
    margin: 12px 0 0;
    color: #ffffff;
    font-size: clamp(54px, 7vw, 92px);
    line-height: 0.98;
    letter-spacing: -0.04em;
  }

  .login-full-name {
    max-width: 760px;
    margin: 24px 0 12px;
    color: #eff6ff;
    font-size: clamp(20px, 2.2vw, 30px);
    font-weight: 500;
    line-height: 1.42;
  }

  .brand-divider {
    width: 86px;
    height: 3px;
    margin: 24px 0;
    background: #ffffff;
    opacity: 0.72;
  }

  .login-brand-text p:last-child {
    margin: 0;
    color: #dbeafe;
    font-size: 18px;
    line-height: 1.65;
  }

  .login-form-panel {
    min-height: 100vh;
    padding: 44px;
    background:
      radial-gradient(
        circle at 95% 5%,
        rgba(191, 219, 254, 0.50),
        transparent 26%
      ),
      linear-gradient(
        160deg,
        #f8fbff,
        #eef4ff
      );
  }

  .login-form-card {
    width: min(470px, 100%);
    padding: 32px;
    border: 1px solid #e5edfa;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
  }

  .form-heading h2 {
    margin: 8px 0 4px;
    color: var(--primary-strong);
    font-size: 28px;
  }

  .form-heading p {
    color: var(--ink-soft);
    line-height: 1.55;
  }

  .field-control {
    border-color: var(--line);
    border-radius: var(--radius-sm);
  }

  .field-control:focus {
    border-color: #8ab4ff;
    box-shadow:
      0 0 0 4px
      rgba(59, 130, 246, 0.12);
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .danger-button {
    border-radius: 11px;
  }

  .primary-button {
    background:
      linear-gradient(
        135deg,
        var(--primary),
        #2563eb
      );
    box-shadow:
      0 8px 18px
      rgba(29, 78, 216, 0.22);
  }

  .primary-button:hover {
    background:
      linear-gradient(
        135deg,
        var(--primary-strong),
        var(--primary)
      );
    transform: translateY(-1px);
  }

  .secondary-button {
    color: var(--primary-strong);
    background: var(--primary-soft);
  }

  .danger-button {
    color: var(--danger);
    background: var(--danger-soft);
  }

  /* =====================================================
     SIDEBAR
     ===================================================== */

  .sidebar {
    width: var(--sidebar-width);
    padding: 16px;
    color: #eaf2ff;
    background:
      radial-gradient(
        circle at top left,
        rgba(96, 165, 250, 0.25),
        transparent 30%
      ),
      linear-gradient(
        180deg,
        #123b86 0%,
        #0f2d68 60%,
        #11275b 100%
      );
    box-shadow: none;
  }

  .sidebar-brand {
    gap: 12px;
    padding: 4px 2px 18px;
    border-bottom: 0;
  }

  .sidebar-brand img {
    width: 58px;
    height: 58px;
    padding: 5px;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: var(--shadow-soft);
  }

  .sidebar-brand strong {
    font-size: 23px;
    line-height: 1;
  }

  .sidebar-brand span {
    margin-top: 5px;
    color: #bdd7ff;
    font-size: 12px;
  }

  .sidebar-user {
    margin: 2px 0 16px;
    padding: 12px;
    border:
      1px solid
      rgba(255, 255, 255, 0.10);
    border-radius: 14px;
    background:
      rgba(255, 255, 255, 0.07);
  }

  .avatar {
    color: #123b86;
    background: #eaf2ff;
  }

  .sidebar-menu {
    padding: 0;
  }

  .menu-button {
    gap: 11px;
    margin: 2px 0;
    padding: 10px 11px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #d9e8ff;
  }

  .menu-button:hover,
  .menu-button.is-active {
    border-color:
      rgba(255, 255, 255, 0.12);
    color: #ffffff;
    background:
      rgba(255, 255, 255, 0.11);
  }

  .menu-icon {
    color: #bcd8ff;
    font-size: 18px;
  }

  .sidebar-footer {
    margin-top: 16px;
    padding: 14px 0 0;
    border-top:
      1px solid
      rgba(255, 255, 255, 0.10);
    color: #bdd7ff;
    font-size: 12px;
    line-height: 1.55;
  }

  .sidebar-logout {
    border:
      1px solid
      rgba(255, 255, 255, 0.14);
    border-radius: 11px;
    background:
      rgba(255, 255, 255, 0.10);
  }

  /* =====================================================
     MAIN WORKSPACE
     ===================================================== */

  .app-main {
    min-height: 100vh;
    margin-left: var(--sidebar-width);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 76px;
    padding: 12px 24px;
    border-bottom:
      1px solid
      rgba(219, 228, 239, 0.86);
    background:
      rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(14px);
  }

  .page-content {
    padding: 24px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading h1 {
    color: var(--ink);
    font-size: 25px;
  }

  .page-heading p {
    color: var(--ink-soft);
  }

  .role-badge,
  .status-badge {
    color: var(--primary-strong);
    background: var(--primary-soft);
  }

  /* =====================================================
     DASHBOARD AND GENERAL CARDS
     ===================================================== */

  .card-grid {
    gap: 14px;
  }

  .stat-card,
  .content-card,
  .empty-state {
    border: 1px solid #e4ebf4;
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
  }

  .stat-card {
    position: relative;
    overflow: hidden;
    padding: 17px;
  }

  .stat-card::after {
    content: '';
    position: absolute;
    right: -18px;
    bottom: -24px;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background:
      rgba(29, 78, 216, 0.10);
  }

  .stat-card span,
  .stat-card strong,
  .stat-card small {
    position: relative;
    z-index: 1;
  }

  .stat-card span {
    color: var(--ink-soft);
  }

  .stat-card strong {
    color: var(--ink);
    font-size: 28px;
  }

  .content-card {
    padding: 18px;
  }

  .empty-state {
    border-style: solid;
  }

  /* =====================================================
     SCHOOL PROFILE
     ===================================================== */

  .readonly-box {
    border: 1px solid #e8eef6;
    border-radius: 11px;
    background: #f8fafc;
  }

  .deputy-row {
    padding: 10px;
    border: 1px solid #e8eef6;
    border-radius: 12px;
    background: #fbfdff;
  }

  /* =====================================================
     SCHOOL FORMS PART 1-3
     ===================================================== */

  .smarted-form-section {
    margin-top: 16px;
  }

  .smarted-progress-wrap {
    margin: 0 0 16px;
    padding: 14px 16px;
    border: 1px solid #e4ebf4;
    border-radius: var(--radius-md);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
  }

  .smarted-progress-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
  }

  .smarted-progress-track {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
  }

  .smarted-progress-bar {
    height: 100%;
    border-radius: inherit;
    background:
      linear-gradient(
        90deg,
        var(--primary),
        var(--success)
      );
    transition: width 0.2s ease;
  }

  .smarted-indicator-card,
  .smarted-sub-card,
  .smarted-dynamic-card {
    margin-top: 14px;
    padding: 15px;
    border: 1px solid #e4ebf4;
    border-radius: var(--radius-md);
    background: #fbfcfe;
  }

  .smarted-indicator-card h4,
  .smarted-sub-card h4,
  .smarted-dynamic-card h4 {
    margin: 0 0 12px;
    color: var(--ink);
    line-height: 1.55;
  }

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

  .smarted-textarea {
    min-height: 96px;
    resize: vertical;
  }

  .smarted-radio-row,
  .smarted-check-grid,
  .smarted-evidence-actions,
  .smarted-inline-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .smarted-check-grid {
    margin: 10px 0 6px;
  }

  .smarted-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    cursor: pointer;
  }

  .smarted-option:hover {
    border-color: #8ab4ff;
    background: #f8fbff;
  }

  .smarted-help {
    margin: 4px 0 10px;
    color: var(--muted);
    font-size: 0.93rem;
  }

  .smarted-dynamic-row {
    display: grid;
    grid-template-columns:
      minmax(0, 1fr)
      auto;
    align-items: start;
    gap: 8px;
    margin: 9px 0;
  }

  .smarted-evidence-box {
    margin-top: 13px;
    padding: 12px;
    border:
      1px dashed
      #b8c2cf;
    border-radius: 11px;
    background: #ffffff;
  }

  .smarted-evidence-list {
    margin: 8px 0;
  }

  .smarted-evidence-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom:
      1px solid
      #edf0f3;
  }

  .smarted-evidence-item:last-child {
    border-bottom: 0;
  }

  .smarted-file-label {
    cursor: pointer;
  }

  .smarted-file-label input {
    display: none;
  }

  .link-button {
    padding: 2px 4px;
    border: 0;
    color: #175cd3;
    background: transparent;
    cursor: pointer;
    font: inherit;
  }

  .danger-text {
    color: var(--danger);
  }

  .smarted-rating-guide {
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #1849a9;
    background: #eff8ff;
  }

  .smarted-table-wrap {
    overflow-x: auto;
  }

  .smarted-table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
  }

  .smarted-table th,
  .smarted-table td {
    padding: 10px;
    border: 1px solid var(--line);
    vertical-align: top;
  }

  .smarted-table th {
    color: var(--primary-strong);
    background: #f5f8ff;
  }

  .smarted-table th:not(:first-child),
  .smarted-table td:not(:first-child) {
    width: 62px;
    text-align: center;
  }

  .smarted-sticky-actions {
    position: sticky;
    bottom: 12px;
    z-index: 30;
    justify-content: flex-end;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background:
      rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
  }

  /* =====================================================
     RESPONSIVE
     ===================================================== */

  @media (max-width: 1100px) {
    .login-layout {
      grid-template-columns: 1fr;
    }

    .login-brand-panel {
      display: none;
    }

    .login-form-panel {
      padding: 24px;
    }
  }

  @media (max-width: 900px) {
    .sidebar {
      transform: translateX(-100%);
    }

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

    .app-main {
      margin-left: 0;
    }

    .page-content {
      padding: 16px;
    }

    .role-badge {
      display: none;
    }
  }

  @media (max-width: 760px) {
    .smarted-text-grid {
      grid-template-columns: 1fr;
    }

    .smarted-evidence-item {
      align-items: flex-start;
      flex-direction: column;
    }

    .smarted-sticky-actions {
      bottom: 6px;
    }
  }

    /* =====================================================
     PHASE 4A: SUBMISSION + UNLOCK APPROVAL
     ===================================================== */

  .smarted-p4-status-summary,
  .smarted-p4-status-card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
  }

  .smarted-p4-status-summary h2 {
    margin: 4px 0 0;
  }

  .smarted-p4-label {
    color: var(--muted);
    font-size: 13px;
  }

  .smarted-p4-status-grid {
    display: grid;
    grid-template-columns:
      repeat(
        3,
        minmax(0, 1fr)
      );
    gap: 14px;
    margin-top: 16px;
  }

  .smarted-p4-status-card
  .smarted-progress-wrap {
    margin: 12px 0 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .smarted-p4-notice {
    padding: 14px;
    border-left:
      4px solid
      var(--warning);
    border-radius: 11px;
    background:
      var(--warning-soft);
  }

  .smarted-p4-notice p {
    margin: 7px 0;
    color: var(--ink-soft);
  }

  .smarted-p4-unlock-table
  th:last-child,
  .smarted-p4-unlock-table
  td:last-child {
    min-width: 190px;
  }

  @media (max-width: 900px) {
    .smarted-p4-status-grid {
      grid-template-columns:
        1fr;
    }
  }

    /* =====================================================
     PHASE 4B: COMMITTEE REVIEW + URGENCY
     ===================================================== */

  .smarted-review-section {
    margin-top: 16px;
  }

  .smarted-review-school-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
  }

  .smarted-review-school-summary h2 {
    margin: 3px 0 6px;
  }

  .smarted-review-school-summary p {
    margin: 0;
    color: var(--muted);
  }

  .smarted-review-details {
    margin-top: 11px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #ffffff;
  }

  .smarted-review-details summary {
    padding: 13px 15px;
    color: var(--ink);
    background: #f8fbff;
    cursor: pointer;
    font-weight: 700;
    line-height: 1.55;
  }

  .smarted-review-details[open] summary {
    color: var(--primary-strong);
    border-bottom: 1px solid var(--line);
    background: #eef4ff;
  }

  .smarted-review-detail-body {
    padding: 14px;
  }

  .smarted-school-snapshot {
    margin: 10px 0;
    padding: 12px;
    border: 1px solid #e8eef6;
    border-radius: 11px;
    background: #f8fafc;
  }

  .smarted-school-snapshot p {
    margin: 5px 0 11px;
    color: var(--ink-soft);
    line-height: 1.6;
    white-space: pre-wrap;
  }

  .smarted-school-snapshot p:last-child {
    margin-bottom: 0;
  }

  .smarted-school-snapshot ul {
    margin: 6px 0 0;
    padding-left: 22px;
    color: var(--ink-soft);
  }

  .smarted-review-warning {
    margin-top: 14px;
    padding: 13px 15px;
    border-left: 4px solid var(--warning);
    border-radius: 10px;
    color: #854d0e;
    background: var(--warning-soft);
  }

  .smarted-suggestion-box {
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #b8d4ff;
    border-radius: 12px;
    color: #1849a9;
    background: #eff8ff;
  }

  .smarted-suggestion-box pre {
    margin: 8px 0 0;
    color: var(--ink-soft);
    font-family: 'Sarabun', sans-serif;
    line-height: 1.65;
    white-space: pre-wrap;
  }

  .smarted-urgency-badge {
    display: inline-flex;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
  }

  .urgency-normal {
    color: #067647;
    background: #ecfdf3;
  }

  .urgency-followup {
    color: #b54708;
    background: #fffaeb;
  }

  .urgency-urgent {
    color: #b42318;
    background: #fef3f2;
  }

  .urgency-no-review {
    color: #475467;
    background: #f2f4f7;
  }

  @media (max-width: 760px) {
    .smarted-review-school-summary {
      align-items: flex-start;
      flex-direction: column;
    }

    .smarted-review-details summary {
      padding: 11px 12px;
    }

    .smarted-review-detail-body {
      padding: 11px;
    }
  }

    /* =====================================================
     PART 1 REVIEW: GROUP HEADINGS
     ===================================================== */

  .smarted-review-group {
    margin-top: 18px;
    padding: 14px;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: #fbfdff;
  }

  .smarted-review-group-title {
    margin: 0 0 10px;
    padding: 10px 13px;
    border-left: 5px solid var(--primary);
    border-radius: 8px;
    color: var(--primary-strong);
    background: var(--primary-soft);
    font-size: 17px;
    line-height: 1.55;
  }

    /* =====================================================
     PHASE 5: SUPERVISION PHOTO ALBUM
     ===================================================== */

  .smarted-photo-create-card {
    overflow: hidden;
  }

  .smarted-photo-file-zone {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    padding: 14px;
    border: 1px dashed #b8c2cf;
    border-radius: 12px;
    background: #fbfdff;
  }

  .smarted-photo-file-label {
    cursor: pointer;
  }

  .smarted-photo-file-label input {
    display: none;
  }

  .smarted-photo-preview-grid,
  .smarted-photo-gallery-grid {
    display: grid;
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(180px, 1fr)
      );
    gap: 12px;
    margin-top: 14px;
  }

  .smarted-pending-photo-card,
  .smarted-photo-card {
    overflow: hidden;
    border: 1px solid #e4ebf4;
    border-radius: 13px;
    background: #ffffff;
    box-shadow:
      0 6px 16px
      rgba(15, 23, 42, 0.05);
  }

  .smarted-pending-photo-card img,
  .smarted-photo-frame {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #eef4ff;
  }

  .smarted-pending-photo-card > div,
  .smarted-photo-card-body {
    display: grid;
    gap: 6px;
    padding: 10px;
  }

  .smarted-pending-photo-card strong,
  .smarted-photo-card strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .smarted-pending-photo-card small,
  .smarted-photo-card small {
    color: var(--muted);
  }

  .smarted-photo-album-card {
    margin-top: 14px;
    padding: 0;
  }

  .smarted-photo-album-card summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 15px;
    cursor: pointer;
  }

  .smarted-photo-album-card summary small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
  }

  .smarted-photo-album-body {
    padding: 0 15px 15px;
    border-top: 1px solid #edf0f3;
  }

  .smarted-photo-frame {
    display: grid;
    place-items: center;
    overflow: hidden;
  }

  .smarted-photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  .smarted-photo-preview-button {
    padding: 8px 12px;
    border: 1px solid #b8d4ff;
    border-radius: 9px;
    color: var(--primary-strong);
    background: #ffffff;
    font-family: 'Sarabun', sans-serif;
    cursor: pointer;
  }

  .smarted-photo-preview-button:hover {
    background: var(--primary-soft);
  }

  .smarted-photo-select-label {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--ink-soft);
    font-size: 13px;
  }

  .smarted-review-summary-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
  }

  @media (max-width: 760px) {
    .smarted-photo-preview-grid,
    .smarted-photo-gallery-grid {
      grid-template-columns:
        repeat(
          2,
          minmax(0, 1fr)
        );
    }

    .smarted-review-summary-actions {
      justify-content: flex-start;
    }
  }

  @media (max-width: 480px) {
    .smarted-photo-preview-grid,
    .smarted-photo-gallery-grid {
      grid-template-columns:
        1fr;
    }
  }

    /* =====================================================
     FINAL PATCH: PART 1 REVIEW GROUP HEADINGS
     ===================================================== */

  .smarted-review-group {
    margin-top: 20px;
    padding: 14px;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: #fbfdff;
  }

  .smarted-review-group-title {
    margin: 0 0 12px;
    padding: 11px 14px;
    border-left: 5px solid var(--primary);
    border-radius: 9px;
    color: var(--primary-strong);
    background: var(--primary-soft);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.55;
  }

    /* =====================================================
     PATCH: MAIN TOPIC HEADINGS
     ===================================================== */

  .smarted-review-group {
    margin-top: 20px;
    padding: 14px;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: #fbfdff;
  }

  .smarted-review-group-title {
    margin: 0 0 12px;
    padding: 11px 14px;
    border-left: 5px solid var(--primary);
    border-radius: 9px;
    color: var(--primary-strong);
    background: var(--primary-soft);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.55;
  }

  .smarted-parent-topic-card {
    margin-top: 16px;
    border-left:
      6px solid
      var(--primary);
    background:
      linear-gradient(
        135deg,
        #eef4ff,
        #f8fbff
      );
  }

  .smarted-parent-topic-card
  .section-title {
    margin: 0;
    color: var(--primary-strong);
    line-height: 1.7;
  }

  .smarted-review-parent-topic {
    margin: 18px 0 10px;
    padding: 13px 15px;
    border-left:
      6px solid
      var(--primary);
    border-radius: 10px;
    background:
      var(--primary-soft);
  }

  .smarted-review-parent-topic h4 {
    margin: 0;
    color:
      var(--primary-strong);
    font-size: 17px;
    line-height: 1.7;
  }

    /* =====================================================
     PHASE 6: DASHBOARD + REAL HEAT MAP + OVERALL SUMMARY
     ===================================================== */

  .smarted-dashboard-grid {
    display: grid;
    grid-template-columns:
      repeat(
        auto-fit,
        minmax(180px, 1fr)
      );
    gap: 14px;
    margin-top: 16px;
  }

  .smarted-dashboard-card {
    display: grid;
    gap: 7px;
    min-height: 125px;
    padding: 16px;
    overflow: hidden;
    border: 1px solid #e4ebf4;
    border-radius: 16px;
    background: #ffffff;
    box-shadow:
      0 8px 20px
      rgba(15, 23, 42, 0.06);
  }

  .smarted-dashboard-card span {
    color: var(--muted);
    font-size: 14px;
  }

  .smarted-dashboard-card strong {
    color: var(--ink);
    font-size: 28px;
    line-height: 1.2;
  }

  .smarted-dashboard-card small {
    color: var(--ink-soft);
  }

  .smarted-dashboard-card-blue {
    border-top: 4px solid #2563eb;
  }

  .smarted-dashboard-card-indigo {
    border-top: 4px solid #4f46e5;
  }

  .smarted-dashboard-card-green {
    border-top: 4px solid #16a34a;
  }

  .smarted-dashboard-card-orange {
    border-top: 4px solid #ea580c;
  }

  .smarted-dashboard-card-yellow {
    border-top: 4px solid #d97706;
  }

  .smarted-dashboard-card-red {
    border-top: 4px solid #dc2626;
  }

  .smarted-dashboard-card-purple {
    border-top: 4px solid #7c3aed;
  }

  .smarted-dashboard-two-columns {
    display: grid;
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );
    gap: 14px;
    margin-top: 16px;
  }

  .smarted-dashboard-bar {
    margin-top: 13px;
  }

  .smarted-dashboard-bar-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    color: var(--ink-soft);
  }

  .smarted-dashboard-bar-track {
    height: 11px;
    overflow: hidden;
    border-radius: 999px;
    background: #eef2f7;
  }

  .smarted-dashboard-bar-fill {
    height: 100%;
    border-radius: inherit;
  }

  .smarted-dashboard-bar-normal {
    background: #16a34a;
  }

  .smarted-dashboard-bar-followup {
    background: #d97706;
  }

  .smarted-dashboard-bar-urgent {
    background: #dc2626;
  }

  .smarted-dashboard-bar-no-review {
    background: #64748b;
  }

  .smarted-shortcut-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .smarted-map-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
  }

  .smarted-map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--ink-soft);
    font-size: 13px;
  }

  .smarted-map-legend i {
    width: 12px;
    height: 12px;
    border-radius: 50%;
  }

  .smarted-map-filter-grid {
    display: grid;
    grid-template-columns:
      repeat(
        auto-fit,
        minmax(170px, 1fr)
      );
    gap: 12px;
  }

  .smarted-map-card {
    padding: 14px;
  }

  .smarted-map-summary {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--ink-soft);
  }

  #smartEdRealMap {
    width: 100%;
    height: 560px;
    overflow: hidden;
    border: 1px solid #dbe4ef;
    border-radius: 14px;
    background: #eef4ff;
  }

  .smarted-map-popup {
    min-width: 190px;
    font-family:
      'Sarabun',
      sans-serif;
  }

  .smarted-map-popup strong {
    color: var(--primary-strong);
    font-size: 14px;
  }

  .smarted-map-popup p {
    margin: 5px 0;
    color: var(--ink-soft);
  }

  .smarted-map-detail-button {
    margin-top: 5px;
    padding: 7px 10px;
    border: 0;
    border-radius: 8px;
    color: #ffffff;
    background: var(--primary);
    cursor: pointer;
    font-family:
      'Sarabun',
      sans-serif;
  }

  .smarted-summary-count-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom:
      1px solid
      #edf0f3;
  }

  .smarted-summary-count-row:last-child {
    border-bottom: 0;
  }

  .smarted-summary-count-row span {
    color: var(--ink-soft);
  }

  .smarted-summary-count-row strong {
    color: var(--primary-strong);
    text-align: right;
  }

  .smarted-inclusive-score-grid {
    display: grid;
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );
    gap: 14px;
  }

  .smarted-inclusive-score-grid div {
    display: grid;
    gap: 7px;
    padding: 16px;
    border: 1px solid #e4ebf4;
    border-radius: 13px;
    background: #f8fbff;
  }

  .smarted-inclusive-score-grid span,
  .smarted-inclusive-score-grid small {
    color: var(--ink-soft);
  }

  .smarted-inclusive-score-grid strong {
    color: var(--primary-strong);
    font-size: 32px;
  }

  .smarted-summary-detail-grid {
    display: grid;
    grid-template-columns:
      repeat(
        auto-fit,
        minmax(190px, 1fr)
      );
    gap: 12px;
  }

  .smarted-summary-detail-grid div {
    display: grid;
    gap: 5px;
    padding: 12px;
    border: 1px solid #e8eef6;
    border-radius: 11px;
    background: #f8fafc;
  }

  .smarted-summary-detail-grid span {
    color: var(--muted);
    font-size: 13px;
  }

  .smarted-summary-detail-grid strong {
    color: var(--ink);
  }

  @media (max-width: 900px) {
    .smarted-dashboard-two-columns {
      grid-template-columns:
        1fr;
    }

    #smartEdRealMap {
      height: 460px;
    }
  }

  @media (max-width: 560px) {
    #smartEdRealMap {
      height: 390px;
    }

    .smarted-inclusive-score-grid {
      grid-template-columns:
        1fr;
    }

    .smarted-map-legend {
      justify-content:
        flex-start;
    }
  }

    /* =====================================================
     PHASE 7: AI INSIGHT WITH GEMINI API
     ===================================================== */

  .smarted-ai-warning {
    margin-top: 16px;
    padding: 14px 16px;
    border-left:
      5px solid
      var(--warning);
    border-radius: 11px;
    color: #854d0e;
    background:
      var(--warning-soft);
  }

  .smarted-ai-warning p {
    margin: 6px 0 0;
  }

  .smarted-ai-control-card {
    margin-top: 16px;
  }

  .smarted-ai-result-card {
    overflow: hidden;
  }

  .smarted-ai-result-head {
    display: flex;
    justify-content:
      space-between;
    align-items:
      flex-start;
    gap: 16px;
  }

  .smarted-ai-result-head h3 {
    margin: 3px 0;
    color:
      var(--primary-strong);
  }

  .smarted-ai-draft-box {
    margin-top: 15px;
    padding: 14px;
    border:
      1px solid
      #b8d4ff;
    border-radius: 12px;
    color:
      var(--primary-strong);
    background:
      #f4f8ff;
  }

  .smarted-ai-draft-box pre {
    margin: 10px 0 0;
    color:
      var(--ink-soft);
    font-family:
      'Sarabun',
      sans-serif;
    font-size: 14px;
    line-height: 1.75;
    white-space:
      pre-wrap;
  }

  .smarted-ai-final-text {
    min-height: 340px;
    resize: vertical;
    line-height: 1.75;
  }

  @media (max-width: 760px) {
    .smarted-ai-result-head {
      flex-direction:
        column;
    }
  }

    /* =====================================================
     PHASE 8: SCHOOL PDF REPORT
     ===================================================== */

  .smarted-pdf-control-card {
    margin-top: 16px;
  }

  .smarted-pdf-checkbox-wrap {
    display: flex;
    align-items: flex-end;
    padding-bottom: 2px;
  }

  .smarted-pdf-control-card
  .smarted-option {
    border-radius: 12px;
    line-height: 1.55;
  }

  @media (max-width: 760px) {
    .smarted-pdf-checkbox-wrap {
      align-items: flex-start;
    }
  }

    /* =====================================================
     PHASE 9: COMPLETE SCHOOL SUMMARY PAGE
     ===================================================== */

  .smarted-school-selector-card {
    margin-top: 16px;
  }

  .smarted-school-selector-card
  .field-label {
    margin-top: 0;
  }

  .smarted-school-summary-header {
    display: flex;
    justify-content:
      space-between;
    align-items:
      flex-start;
    gap: 16px;
    margin-top: 16px;
  }

  .smarted-school-summary-header h2 {
    margin: 4px 0 6px;
    color:
      var(--primary-strong);
  }

  .smarted-school-summary-header p {
    margin: 0;
    color:
      var(--muted);
  }

  .smarted-summary-action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content:
      flex-end;
    gap: 9px;
  }

  .smarted-summary-access-note {
    margin-top: 14px;
    padding: 13px 15px;
    border-left:
      5px solid
      var(--warning);
    border-radius: 10px;
    color:
      #854d0e;
    background:
      var(--warning-soft);
    line-height: 1.65;
  }

  .smarted-school-summary-review-grid {
    display: grid;
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );
    gap: 12px;
    margin-top: 14px;
  }

  .smarted-school-summary-review-grid
  > div {
    padding: 13px;
    border:
      1px solid
      #e8eef6;
    border-radius: 11px;
    background:
      #f8fafc;
  }

  .smarted-school-summary-review-grid
  strong {
    color:
      var(--primary-strong);
  }

  .smarted-school-summary-review-grid
  p {
    margin: 7px 0 0;
    color:
      var(--ink-soft);
    line-height: 1.65;
    white-space:
      pre-wrap;
  }

  .smarted-policy-status {
    display:
      inline-flex;
    padding:
      4px 9px;
    border-radius:
      999px;
    font-size:
      12px;
    font-weight:
      700;
  }

  .smarted-policy-status-yes {
    color:
      #067647;
    background:
      #ecfdf3;
  }

  .smarted-policy-status-no {
    color:
      #b42318;
    background:
      #fef3f2;
  }

  .smarted-policy-status- {
    color:
      #475467;
    background:
      #f2f4f7;
  }

  .smarted-p9-mini-card {
    margin-top: 14px;
    padding: 14px;
    border:
      1px solid
      #e4ebf4;
    border-radius: 13px;
    background:
      #fbfdff;
  }

  .smarted-p9-mini-card h4 {
    margin:
      0 0 10px;
    color:
      var(--primary-strong);
  }

  .smarted-p9-mini-card p {
    color:
      var(--ink-soft);
    line-height:
      1.65;
  }

  .smarted-p9-tag-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .smarted-p9-tag {
    display:
      inline-flex;
    padding:
      5px 10px;
    border-radius:
      999px;
    color:
      var(--primary-strong);
    background:
      var(--primary-soft);
    font-size:
      13px;
    font-weight:
      600;
  }

  .smarted-p9-ai-preview {
    max-height:
      330px;
    padding:
      13px;
    overflow-y:
      auto;
    border:
      1px solid
      #dbeafe;
    border-radius:
      11px;
    color:
      var(--ink-soft);
    background:
      #f8fbff;
    line-height:
      1.75;
    white-space:
      pre-wrap;
  }

  @media (max-width: 760px) {
    .smarted-school-summary-header {
      flex-direction:
        column;
    }

    .smarted-summary-action-buttons {
      justify-content:
        flex-start;
    }

    .smarted-school-summary-review-grid {
      grid-template-columns:
        1fr;
    }
  }

    /* PART 2 SUMMARY TABLE */
  .smarted-part2-summary-table {
    width: 100%;
    table-layout: fixed;
  }

  .smarted-part2-summary-table .col-order {
    width: 70px;
  }

  .smarted-part2-summary-table .col-title {
    width: auto;
  }

  .smarted-part2-summary-table .col-status {
    width: 110px;
  }

  .smarted-part2-summary-table th:nth-child(1),
  .smarted-part2-summary-table td:nth-child(1) {
    width: 70px;
    text-align: center;
    white-space: nowrap;
  }

  .smarted-part2-summary-table th:nth-child(2),
  .smarted-part2-summary-table td:nth-child(2) {
    width: auto;
  }

  .smarted-part2-summary-table th:nth-child(3),
  .smarted-part2-summary-table td:nth-child(3) {
    width: 110px;
    text-align: center;
    white-space: nowrap;
  }

    /* =====================================================
     PHASE 10: ADMIN CENTER
     ===================================================== */

  .smarted-admin-readiness-card {
    margin-top: 16px;
  }

  .smarted-admin-readiness-head {
    display: flex;
    justify-content:
      space-between;
    align-items:
      flex-start;
    gap: 16px;
  }

  .smarted-admin-readiness-score {
    color:
      var(--primary-strong);
    font-size: 34px;
    line-height: 1;
  }

  .smarted-admin-issue-card {
    margin-top: 14px;
    padding: 14px;
    border-radius: 12px;
    border:
      1px solid
      #e4ebf4;
  }

  .smarted-admin-issue-card h4 {
    margin: 0;
  }

  .smarted-admin-issue-card ul {
    margin:
      10px 0 0;
    padding-left:
      20px;
    color:
      var(--ink-soft);
    line-height:
      1.65;
  }

  .smarted-admin-issue-card.has-issue {
    border-left:
      5px solid
      #d97706;
    background:
      #fffbeb;
  }

  .smarted-admin-issue-card.no-issue {
    border-left:
      5px solid
      #16a34a;
    background:
      #f0fdf4;
  }

  .smarted-admin-toolbar {
    margin:
      12px 0;
  }

  .smarted-admin-assignment-table
  th:nth-child(1) {
    min-width:
      240px;
  }

  .smarted-admin-assignment-table
  th:nth-child(4) {
    min-width:
      240px;
  }

  .smarted-admin-member-form {
    display: grid;
    grid-template-columns:
      repeat(
        4,
        minmax(0, 1fr)
      );
    gap: 12px;
    margin:
      12px 0 18px;
    padding: 14px;
    border:
      1px solid
      #dbeafe;
    border-radius:
      13px;
    background:
      #f8fbff;
  }

  .smarted-admin-member-form-actions {
    display: flex;
    align-items:
      flex-end;
    flex-wrap: wrap;
    gap: 8px;
    grid-column:
      1 / -1;
  }

  .smarted-admin-member-table
  th:nth-child(2) {
    min-width:
      220px;
  }

  @media (max-width: 980px) {
    .smarted-admin-member-form {
      grid-template-columns:
        repeat(
          2,
          minmax(0, 1fr)
        );
    }
  }

  @media (max-width: 600px) {
    .smarted-admin-readiness-head {
      flex-direction:
        column;
    }

    .smarted-admin-member-form {
      grid-template-columns:
        1fr;
    }
  }

    /* =====================================================
     PHASE 11: UNLOCK WORKFLOW + EDIT HISTORY + AUDIT LOG
     ===================================================== */

  .smarted-unlock-request-card {
    margin-top: 16px;
  }

  .smarted-unlock-pending {
    border-left:
      5px solid
      #d97706;
    background:
      #fffbeb;
  }

  .smarted-unlock-approved {
    border-left:
      5px solid
      #16a34a;
    background:
      #f0fdf4;
  }

  .smarted-history-dialog-p11 {
    width:
      min(
        1200px,
        94vw
      );
    max-height:
      90vh;
    padding:
      18px;
    overflow:
      auto;
    border:
      0;
    border-radius:
      16px;
    box-shadow:
      0 24px 70px
      rgba(
        15,
        23,
        42,
        0.24
      );
  }

  .smarted-history-dialog-p11::backdrop {
    background:
      rgba(
        15,
        23,
        42,
        0.55
      );
  }

  .smarted-history-dialog-head-p11 {
    display:
      flex;
    justify-content:
      space-between;
    align-items:
      center;
    gap:
      12px;
  }

  .smarted-history-dialog-head-p11 h3 {
    margin:
      0;
    color:
      var(--primary-strong);
  }

  .smarted-history-dialog-p11 pre,
  .smarted-audit-table-p11 pre {
    max-height:
      420px;
    padding:
      12px;
    overflow:
      auto;
    border:
      1px solid
      #e4ebf4;
    border-radius:
      10px;
    color:
      var(--ink-soft);
    background:
      #f8fafc;
    font-family:
      Consolas,
      monospace;
    font-size:
      12px;
    line-height:
      1.55;
    white-space:
      pre-wrap;
  }

  .smarted-audit-table-p11
  th:nth-child(1) {
    min-width:
      145px;
  }

  .smarted-audit-table-p11
  th:nth-child(7) {
    min-width:
      100px;
  }

  @media (max-width: 760px) {
    .smarted-history-dialog-p11 {
      width:
        96vw;
      padding:
        12px;
    }
  }

    /* =====================================================
     PHASE 12: ROUND MANAGEMENT
     ===================================================== */

  .smarted-current-round-card-p12 {
    margin-top: 16px;
    border-left:
      6px solid
      var(--primary);
    background:
      linear-gradient(
        135deg,
        #eef4ff,
        #f8fbff
      );
  }

  .smarted-current-round-card-p12 h2 {
    margin:
      5px 0 8px;
    color:
      var(--primary-strong);
  }

  .smarted-current-round-card-p12 p {
    margin:
      5px 0;
    color:
      var(--ink-soft);
  }

  .smarted-round-form-card-p12 {
    margin-top:
      16px;
  }

  .smarted-round-form-grid-p12 {
    display:
      grid;
    grid-template-columns:
      repeat(
        3,
        minmax(
          0,
          1fr
        )
      );
    gap:
      12px;
  }

  .smarted-round-status-p12 {
    display:
      inline-flex;
    padding:
      5px 10px;
    border-radius:
      999px;
    font-size:
      12px;
    font-weight:
      700;
  }

  .smarted-round-status-draft {
    color:
      #475467;
    background:
      #f2f4f7;
  }

  .smarted-round-status-open {
    color:
      #067647;
    background:
      #ecfdf3;
  }

  .smarted-round-status-closed {
    color:
      #b54708;
    background:
      #fffaeb;
  }

  .smarted-round-status-archived {
    color:
      #6941c6;
    background:
      #f4f3ff;
  }

  .smarted-round-table-p12
  th:nth-child(1) {
    min-width:
      260px;
  }

  .smarted-round-table-p12
  th:nth-child(3) {
    min-width:
      190px;
  }

  .smarted-round-table-p12
  th:last-child {
    min-width:
      260px;
  }

  @media (max-width: 900px) {
    .smarted-round-form-grid-p12 {
      grid-template-columns:
        repeat(
          2,
          minmax(
            0,
            1fr
          )
        );
    }
  }

  @media (max-width: 600px) {
    .smarted-round-form-grid-p12 {
      grid-template-columns:
        1fr;
    }
  }

    /* =====================================================
     PHASE 13: ROUND-BASED SCHOOL FORM ACCESS CONTROL
     ===================================================== */

  .smarted-round-access-banner-p13 {
    margin-bottom:
      16px;
    padding:
      14px 16px;
    border-radius:
      12px;
    line-height:
      1.65;
  }

  .smarted-round-access-banner-p13
  strong {
    display:
      block;
    margin-bottom:
      4px;
  }

  .smarted-round-access-banner-p13
  p {
    margin:
      0;
  }

  .smarted-round-access-locked-p13 {
    border-left:
      5px solid
      #d97706;
    color:
      #854d0e;
    background:
      #fffbeb;
  }

  .smarted-round-access-approved-p13 {
    border-left:
      5px solid
      #16a34a;
    color:
      #166534;
    background:
      #f0fdf4;
  }

  [data-smarted-locked-by-round="true"] {
    cursor:
      not-allowed;
    opacity:
      0.68;
  }

    /* =====================================================
     PHASE 13: ROUND-BASED SCHOOL FORM ACCESS CONTROL
     ===================================================== */

  .smarted-round-access-banner-p13 {
    margin-bottom:
      16px;
    padding:
      14px 16px;
    border-radius:
      12px;
    line-height:
      1.65;
  }

  .smarted-round-access-banner-p13
  strong {
    display:
      block;
    margin-bottom:
      4px;
  }

  .smarted-round-access-banner-p13
  p {
    margin:
      0;
  }

  .smarted-round-access-locked-p13 {
    border-left:
      5px solid
      #d97706;
    color:
      #854d0e;
    background:
      #fffbeb;
  }

  .smarted-round-access-approved-p13 {
    border-left:
      5px solid
      #16a34a;
    color:
      #166534;
    background:
      #f0fdf4;
  }

  [data-smarted-locked-by-round="true"] {
    cursor:
      not-allowed;
    opacity:
      0.68;
  }

    /* ปรับความกว้างตารางรายชื่อกรรมการ ก.ต.ป.น. */
  .smarted-admin-member-table {
    width: 100%;
    table-layout: auto;
  }

  .smarted-admin-member-table
  th:nth-child(1),
  .smarted-admin-member-table
  td:nth-child(1) {
    width: 130px;
    min-width: 130px;
    max-width: 130px;
    white-space: nowrap;
  }

    /* =====================================================
     BUTTON HOVER: PRIMARY BUTTON
     ปุ่มสีฟ้า → สีเหลืองเมื่อชี้เมาส์
     ===================================================== */

  .primary-button:hover:not(:disabled),
  .primary-button:focus-visible:not(:disabled) {
    background:
      #facc15 !important;
    border-color:
      #facc15 !important;
    color:
      #1e3a8a !important;
  }

    /* รองผู้อำนวยการ: ชื่อ / เบอร์โทร / กลุ่มบริหารงาน / ปุ่มลบ */
  .deputy-row {
    display:
      grid;
    grid-template-columns:
      minmax(240px, 1.8fr)
      minmax(150px, 0.8fr)
      minmax(240px, 1.4fr)
      auto;
    gap:
      10px;
    align-items:
      center;
    margin-bottom:
      10px;
  }

  @media (max-width: 900px) {
    .deputy-row {
      grid-template-columns:
        1fr;
    }

    .deputy-row
    .danger-button {
      justify-self:
        start;
    }
  }
  
    /* =====================================================
     FINAL SUBMIT AND FORM NOTICE
     ===================================================== */

  .smarted-form-submit-notice {
    margin:
      0 0 16px;
    padding:
      14px 16px;
    border-left:
      5px solid
      #2563eb;
    border-radius:
      12px;
    color:
      #1e3a8a;
    background:
      #eff6ff;
    line-height:
      1.65;
  }

  .smarted-form-submit-notice strong {
    display:
      block;
    margin-bottom:
      4px;
  }

  .smarted-form-submit-notice p {
    margin:
      0;
  }

  .smarted-final-submit-card {
    border-left:
      5px solid
      #16a34a;
  }

  .smarted-submit-progress-list {
    display:
      grid;
    grid-template-columns:
      repeat(
        3,
        minmax(0, 1fr)
      );
    gap:
      10px;
    margin:
      12px 0 14px;
  }

  .smarted-submit-progress-item {
    display:
      flex;
    justify-content:
      space-between;
    align-items:
      center;
    gap:
      10px;
    padding:
      10px 12px;
    border:
      1px solid
      #dbeafe;
    border-radius:
      10px;
    background:
      #f8fbff;
  }

  .smarted-submit-progress-item span {
    color:
      var(--ink-soft);
  }

  .smarted-submit-progress-item strong {
    color:
      var(--primary-strong);
  }

  @media (max-width: 760px) {
    .smarted-submit-progress-list {
      grid-template-columns:
        1fr;
    }
  }

    /* =====================================================
     PRINT REPORT FONT NORMALIZATION
     จัดตัวอักษรในหน้าพิมพ์รายงานให้สม่ำเสมอ
     ===================================================== */

  @media print {
    @page {
      size: A4 portrait;
      margin: 12mm;
    }

    body {
      background: #ffffff !important;
      color: #111827 !important;
      font-family: 'Sarabun', 'TH Sarabun New', sans-serif !important;
      font-size: 14pt !important;
      line-height: 1.45 !important;
    }

    .sidebar,
    .app-sidebar,
    .topbar,
    .app-header,
    .no-print,
    button,
    .button-row {
      display: none !important;
    }

    #pageContent,
    .page-content,
    .report-page,
    .smarted-report-page,
    .print-area,
    .smarted-print-area {
      width: 100% !important;
      max-width: none !important;
      margin: 0 !important;
      padding: 0 !important;
      background: #ffffff !important;
      box-shadow: none !important;
      border: none !important;
    }

    #pageContent *,
    .report-page *,
    .smarted-report-page *,
    .print-area *,
    .smarted-print-area * {
      font-family: 'Sarabun', 'TH Sarabun New', sans-serif !important;
      letter-spacing: 0 !important;
      word-spacing: 0 !important;
      box-sizing: border-box !important;
    }

    .report-page,
    .smarted-report-page,
    .print-area,
    .smarted-print-area {
      font-size: 14pt !important;
      line-height: 1.45 !important;
    }

    .report-page p,
    .smarted-report-page p,
    .print-area p,
    .smarted-print-area p,
    .report-page li,
    .smarted-report-page li,
    .print-area li,
    .smarted-print-area li,
    .report-page td,
    .smarted-report-page td,
    .print-area td,
    .smarted-print-area td {
      font-size: 14pt !important;
      line-height: 1.45 !important;
      font-weight: 400 !important;
      text-align: justify !important;
      text-justify: inter-character !important;
    }

    .report-page h1,
    .smarted-report-page h1,
    .print-area h1,
    .smarted-print-area h1 {
      font-size: 18pt !important;
      line-height: 1.35 !important;
      font-weight: 700 !important;
      text-align: center !important;
    }

    .report-page h2,
    .smarted-report-page h2,
    .print-area h2,
    .smarted-print-area h2,
    .report-page h3,
    .smarted-report-page h3,
    .print-area h3,
    .smarted-print-area h3 {
      font-size: 15pt !important;
      line-height: 1.4 !important;
      font-weight: 700 !important;
    }

    .report-page table,
    .smarted-report-page table,
    .print-area table,
    .smarted-print-area table {
      width: 100% !important;
      border-collapse: collapse !important;
      table-layout: fixed !important;
      page-break-inside: auto !important;
    }

    .report-page th,
    .smarted-report-page th,
    .print-area th,
    .smarted-print-area th {
      font-size: 14pt !important;
      line-height: 1.4 !important;
      font-weight: 700 !important;
      text-align: center !important;
      vertical-align: middle !important;
      padding: 6px 8px !important;
    }

    .report-page td,
    .smarted-report-page td,
    .print-area td,
    .smarted-print-area td {
      vertical-align: top !important;
      padding: 6px 8px !important;
      overflow-wrap: break-word !important;
      word-break: normal !important;
    }

    .report-page td div,
    .smarted-report-page td div,
    .print-area td div,
    .smarted-print-area td div {
      font-size: 14pt !important;
      line-height: 1.45 !important;
      font-weight: 400 !important;
      white-space: pre-wrap !important;
    }

    .report-page b,
    .report-page strong,
    .smarted-report-page b,
    .smarted-report-page strong,
    .print-area b,
    .print-area strong,
    .smarted-print-area b,
    .smarted-print-area strong {
      font-size: inherit !important;
    }
  }

    @media print {
    .report-page td b,
    .report-page td strong,
    .smarted-report-page td b,
    .smarted-report-page td strong,
    .print-area td b,
    .print-area td strong,
    .smarted-print-area td b,
    .smarted-print-area td strong {
      font-weight: 400 !important;
    }
  }

  .smarted-report-answer-text,
.smarted-report-answer-text * {
  font-family: 'Sarabun', 'TH Sarabun New', sans-serif !important;
  font-size: 14pt !important;
  line-height: 1.45 !important;
  font-weight: 400 !important;
  color: #111827 !important;
  text-align: justify !important;
  margin: 0 !important;
  padding: 0 !important;
}

@media print {
  .smarted-report-answer-text,
  .smarted-report-answer-text * {
    font-family: 'Sarabun', 'TH Sarabun New', sans-serif !important;
    font-size: 14pt !important;
    line-height: 1.45 !important;
    font-weight: 400 !important;
    color: #111827 !important;
  }
}
