@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');
:root{
  --brand1:#7c3aed;--brand2:#2563eb;--brand3:#06b6d4;--warn:#fbbf24;
  --ink:#0f172a;--muted:#64748b;--line:#e2e8f0;--soft:#f8fafc;--soft2:#eef6ff;
  --radius:24px;
}
*{font-family:'Sarabun',sans-serif}
html{scroll-behavior:smooth}
body{background:linear-gradient(180deg,#eef6ff 0,#f8fafc 35%,#fff 100%);color:var(--ink);min-height:100vh}
.app-nav{background:linear-gradient(120deg,var(--brand1),var(--brand2),var(--brand3));box-shadow:0 12px 30px rgba(37,99,235,.18)}
.text-white-75{color:rgba(255,255,255,.75)}
.brand-mark,.logo-badge{display:inline-flex;align-items:center;justify-content:center;background:linear-gradient(135deg,#facc15,#fb7185);color:#111827;font-weight:800;border-radius:16px;box-shadow:0 8px 22px rgba(251,191,36,.22)}
.brand-mark{width:42px;height:42px;margin-right:10px}.logo-badge{width:72px;height:72px;font-size:28px}
.btn-nav-soft{background:rgba(255,255,255,.15);border:1px solid rgba(255,255,255,.3);color:#fff}.btn-nav-soft:hover{background:#fff;color:var(--brand2)}
.hero{background:linear-gradient(135deg,#7c3aed 0%,#2563eb 52%,#06b6d4 100%);border-radius:30px;color:#fff;box-shadow:0 26px 70px rgba(37,99,235,.25);position:relative;overflow:hidden}.hero:after{content:'';position:absolute;right:-80px;top:-80px;width:300px;height:300px;border-radius:50%;background:rgba(255,255,255,.16)}.hero:before{content:'';position:absolute;left:40%;bottom:-90px;width:220px;height:220px;border-radius:50%;background:rgba(255,255,255,.08)}.hero-content{position:relative;z-index:2;padding:28px 30px}.hero-kicker{font-size:.92rem;font-weight:800;background:rgba(15,23,42,.2);display:inline-flex;align-items:center;gap:.4rem;border-radius:999px;padding:.35rem .75rem;margin-bottom:.8rem}.hero-title{font-size:clamp(1.65rem,3.3vw,2.8rem);font-weight:800;letter-spacing:-.02em;margin:0 0 .45rem}.hero-subtitle{font-size:1.05rem;opacity:.94;margin:0;max-width:960px}.app-card{border-radius:var(--radius);overflow:hidden}.stat-card{border:0;border-radius:24px;box-shadow:0 18px 45px rgba(15,23,42,.08);overflow:hidden;background:linear-gradient(135deg,#fff,#f8fbff)}.stat-icon{width:54px;height:54px;border-radius:18px;display:flex;align-items:center;justify-content:center;font-size:25px;background:#eff6ff;color:#2563eb}.stat-card .h3{letter-spacing:-.03em}
.filter-panel{background:linear-gradient(135deg,#f8fbff,#fff);border:1px solid var(--line);border-radius:22px;padding:14px}.form-control,.form-select,.input-group-text{border-radius:14px;border-color:#dbe4f0;padding:.7rem .95rem}.input-group>.form-control{border-top-left-radius:0;border-bottom-left-radius:0}.input-group>.input-group-text{border-top-right-radius:0;border-bottom-right-radius:0}.form-control:focus,.form-select:focus{border-color:#60a5fa;box-shadow:0 0 0 .22rem rgba(37,99,235,.12)}.big-textarea{line-height:1.7}.btn{font-weight:700}.rounded-pill{border-radius:999px!important}.data-table-wrap{border-top:1px solid var(--line);border-bottom:1px solid var(--line)}.modern-data-table{--bs-table-hover-bg:#f8fbff}.modern-data-table thead th{font-size:.82rem;text-transform:uppercase;letter-spacing:.04em;color:#64748b;background:#f8fafc;white-space:nowrap;padding:14px 16px;border-bottom:1px solid var(--line)}.modern-data-table tbody td{padding:15px 16px;border-bottom:1px solid #f1f5f9}.course-title{font-weight:800;color:#0f172a}.course-sub{color:#64748b;font-size:.85rem;margin-top:.18rem}.course-code-badge{font-weight:800;background:#eff6ff;color:#1d4ed8;border:1px solid #bfdbfe;border-radius:999px;padding:.2rem .55rem;margin-right:.4rem;display:inline-flex}.badge-status{border:1px solid transparent;border-radius:999px;padding:.45rem .65rem;font-weight:800}.status-new{background:#f1f5f9;color:#475569;border-color:#e2e8f0}.status-in-progress{background:#fff7ed;color:#c2410c;border-color:#fed7aa}.status-ready{background:#ecfdf5;color:#047857;border-color:#bbf7d0}.status-completed,.status-done{background:#eef2ff;color:#4338ca;border-color:#c7d2fe}.tiny-count{font-weight:800;background:#f8fafc;border:1px solid var(--line);border-radius:12px;padding:.28rem .55rem;display:inline-flex;min-width:38px;justify-content:center}.action-btns{display:flex;justify-content:flex-end;gap:6px;flex-wrap:wrap}.empty-state{padding:50px 16px;text-align:center;color:#64748b}.empty-state i{font-size:3rem;color:#cbd5e1}.nice-list{padding-left:0;list-style:none}.nice-list li{padding:.45rem 0 .45rem 2rem;position:relative}.nice-list li:before{content:'✓';position:absolute;left:0;top:.35rem;background:#dcfce7;color:#16a34a;width:24px;height:24px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:800}.modal-content{border-radius:26px;border:0;box-shadow:0 30px 90px rgba(15,23,42,.28)}.modal-pretty .modal-header{background:linear-gradient(135deg,#f5f3ff,#eff6ff);border-bottom:0;padding:22px 26px}.modal-kicker{font-size:.72rem;letter-spacing:.14em;text-transform:uppercase;font-weight:800;color:#6366f1;margin-bottom:3px}.ai-modal-head{background:linear-gradient(135deg,#fff7ed,#eef2ff)!important}.bg-soft-blue{background:linear-gradient(135deg,#f8fbff,#fff)}.workspace-head{background:linear-gradient(135deg,#eef2ff,#ecfeff);border-bottom:1px solid #dbeafe}.summary-tile{background:rgba(255,255,255,.82);border:1px solid rgba(255,255,255,.75);border-radius:18px;padding:15px}.summary-tile .label{color:#64748b;font-size:.8rem}.summary-tile .value{font-size:1.3rem;font-weight:800}.nav-pills .nav-link{border-radius:999px;font-weight:800;color:#475569}.nav-pills .nav-link.active{background:linear-gradient(135deg,#4f46e5,#2563eb);box-shadow:0 10px 24px rgba(37,99,235,.18)}.mini-table{width:100%;border-collapse:separate;border-spacing:0;overflow:hidden;border:1px solid var(--line);border-radius:18px}.mini-table th{background:#f8fafc;color:#64748b;font-size:.85rem;padding:10px;border-bottom:1px solid var(--line)}.mini-table td{padding:10px;border-bottom:1px solid #f1f5f9}.mini-table tr:last-child td{border-bottom:0}.doc-link{border:1px solid #dbeafe;background:#fff;border-radius:16px;padding:12px 14px;text-decoration:none;color:#1d4ed8;font-weight:800;display:flex;align-items:center;gap:10px}.doc-link:hover{background:#eff6ff;color:#1e40af}.pagination .page-link{border-radius:10px;margin:0 2px;font-weight:700;color:#2563eb}.pagination .active .page-link{background:#2563eb;border-color:#2563eb}.loading-overlay{position:fixed;inset:0;background:rgba(15,23,42,.55);z-index:9999;display:none;align-items:center;justify-content:center;backdrop-filter:blur(5px)}.loading-box{background:#fff;border-radius:24px;padding:28px;box-shadow:0 30px 80px rgba(0,0,0,.25);text-align:center;min-width:320px}.auth-bg{min-height:100vh;background:radial-gradient(circle at top left,#a78bfa,transparent 35%),radial-gradient(circle at bottom right,#67e8f9,transparent 35%),linear-gradient(135deg,#eef2ff,#ecfeff)}.glass{border:1px solid rgba(255,255,255,.72);background:rgba(255,255,255,.82);backdrop-filter:blur(14px);border-radius:28px;box-shadow:0 28px 80px rgba(15,23,42,.18)}
@media(max-width:768px){.hero-content{padding:22px 18px}.modern-data-table thead{display:none}.modern-data-table tbody tr{display:block;border-bottom:12px solid #f8fafc}.modern-data-table tbody td{display:flex;justify-content:space-between;gap:12px}.modern-data-table tbody td:before{content:attr(data-label);font-weight:800;color:#64748b}.modern-data-table tbody td:first-child{display:block}.modern-data-table tbody td:first-child:before{display:none}.action-btns{justify-content:flex-start}}

/* ==========================================================
   V6 AI Workspace Styles
========================================================== */
.modal-xxl{max-width: min(1500px, calc(100vw - 32px));}
.workspace-v6{border:0;border-radius:28px;overflow:hidden;background:#f8fbff;}
.workspace-v6-head{background:linear-gradient(135deg,#7c3aed 0%,#2563eb 50%,#06b6d4 100%);color:#fff;border:0;padding:1.35rem 1.6rem;}
.workspace-v6 .btn-close-white{filter:invert(1) grayscale(100%) brightness(200%);opacity:.9;}
.ws-alert-strip{display:flex;flex-wrap:wrap;gap:.75rem;padding:.9rem 1.3rem;background:#eef6ff;border-bottom:1px solid #dbeafe;color:#1e3a8a;font-size:.92rem;font-weight:700;}
.ws-alert-strip span{display:inline-flex;align-items:center;gap:.35rem;background:#fff;border:1px solid #dbeafe;border-radius:999px;padding:.35rem .75rem;box-shadow:0 4px 16px rgba(37,99,235,.08)}
.ws-pills .nav-link{border-radius:999px;background:#fff;color:#475569;font-weight:800;border:1px solid #e2e8f0;box-shadow:0 4px 14px rgba(15,23,42,.04)}
.ws-pills .nav-link.active{background:linear-gradient(135deg,#2563eb,#7c3aed);color:#fff;border-color:transparent;box-shadow:0 8px 22px rgba(37,99,235,.25)}
.ws-tab-content{background:#fff;border:1px solid #e2e8f0;border-radius:24px;padding:1rem;box-shadow:0 16px 42px rgba(15,23,42,.08)}
.ws-card{background:#fff;border:1px solid #e2e8f0;border-radius:22px;padding:1rem;box-shadow:0 10px 28px rgba(15,23,42,.07)}
.ws-card-title{display:flex;align-items:center;gap:.45rem;font-weight:900;color:#0f172a;margin-bottom:.8rem;font-size:1.03rem}.ws-card-title i{color:#2563eb}.ws-code-area{font-family:Consolas,'Sarabun',sans-serif;font-size:.95rem;line-height:1.55;border-radius:16px;background:#fbfdff}.ws-edit-table-wrap{max-height:62vh;border-radius:18px;border:1px solid #e2e8f0;background:#fff}.ws-edit-table{min-width:1350px;margin:0}.ws-edit-table th{position:sticky;top:0;background:#eff6ff!important;color:#1e3a8a;z-index:2;text-align:center;white-space:nowrap}.ws-edit-table td{vertical-align:top}.ws-edit-table textarea{min-height:56px;resize:vertical}.ws-edit-table input,.ws-edit-table textarea,.ws-edit-table select{border-radius:10px}.ws-plan-list{display:flex;flex-direction:column;gap:.55rem;max-height:62vh;overflow:auto}.ws-plan-item{width:100%;text-align:left;border:1px solid #e2e8f0;background:#fff;border-radius:16px;padding:.75rem .85rem;display:flex;flex-direction:column;gap:.15rem;transition:.16s;box-shadow:0 6px 18px rgba(15,23,42,.04)}.ws-plan-item:hover{border-color:#93c5fd;background:#eff6ff;transform:translateY(-1px)}.ws-plan-item span:last-child{font-size:.85rem;color:#64748b;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.mini-table{width:100%;border-collapse:separate;border-spacing:0;border:1px solid #e2e8f0;border-radius:16px;overflow:hidden}.mini-table th{background:#f1f5f9;color:#334155;font-weight:800}.mini-table th,.mini-table td{padding:.75rem;border-bottom:1px solid #e2e8f0}.mini-table tr:last-child td{border-bottom:0}
@media(max-width: 768px){.ws-tab-content{padding:.75rem}.workspace-v6-head{padding:1rem}.ws-alert-strip{padding:.75rem}.ws-pills{overflow-x:auto;flex-wrap:nowrap}.ws-pills .nav-link{white-space:nowrap}.modal-xxl{max-width:100%;}}

/* ==========================================================
   V7 Legacy AI Full Restore UI
   คืน UX/UI และเงื่อนไข AI ตามระบบเดิม: Prompt 7 ส่วน, Review First, Sync Lock
========================================================== */
.legacy-ai-card{background:linear-gradient(135deg,#ffffff 0%,#eef7ff 45%,#f7edff 100%);border:1px solid rgba(99,102,241,.16)!important}
.legacy-ai-icon{width:56px;height:56px;border-radius:18px;background:linear-gradient(135deg,#7c3aed,#06b6d4);color:#fff;display:flex;align-items:center;justify-content:center;font-size:28px;box-shadow:0 12px 30px rgba(124,58,237,.26)}
.legacy-checks{display:grid;gap:.55rem;padding:.85rem;border-radius:1rem;background:rgba(255,255,255,.78);border:1px solid rgba(148,163,184,.22)}
.legacy-checks label{font-size:.83rem;font-weight:700;color:#334155;display:flex;align-items:flex-start;gap:.45rem;line-height:1.35}
.legacy-checks input{margin-top:.15rem;accent-color:#7c3aed}.legacy-prompt-card{background:linear-gradient(180deg,#fff,#fbfdff)}
.legacy-prompt-input{font-size:.82rem;line-height:1.55;min-height:124px;border-radius:14px;border-color:#dbe3ef;background:#fff}.legacy-prompt-input:focus{border-color:#7c3aed;box-shadow:0 0 0 .18rem rgba(124,58,237,.12)}
.workspace-v6 .form-select,.workspace-v6 .form-control{border-radius:14px}.workspace-v6 .alert-info{border:0;background:linear-gradient(135deg,#eff6ff,#f5f3ff);color:#334155}.workspace-v6-head{background:linear-gradient(135deg,#6d28d9,#2563eb 55%,#06b6d4)!important;color:#fff}.workspace-v6-head .modal-kicker{color:rgba(255,255,255,.86)}
