/* ==========================================================
   Modern UI for CIS Project Database
   - Design: clean, card-based, gradient accents, glassmorphism
   - Font: Prompt (Google Fonts)
   - Color: sky / blue / navy (สีประจำสาขา)
   ========================================================== */

:root {
  /* ฟ้าอ่อน → น้ำเงิน → กรมท่า */
  --brand-50:  #eff6ff;   /* ฟ้าอ่อนมาก */
  --brand-100: #dbeafe;   /* ฟ้าอ่อน */
  --brand-200: #bfdbfe;
  --brand-300: #93c5fd;   /* ฟ้าสว่าง */
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;   /* น้ำเงิน */
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;   /* น้ำเงินเข้ม */
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;   /* กรมท่า */
  --accent:    #0ea5e9;   /* sky accent */
  --gradient:      linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 45%, #0ea5e9 100%);
  --gradient-soft: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);

  --text:      #0f172a;
  --text-soft: #64748b;
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --success:   #10b981;
  --danger:    #ef4444;
  --warning:   #f59e0b;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 4px 16px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 40px rgba(30,58,138,.22);

  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 22px;
}

* { box-sizing: border-box; }

html, body {
  font-family: 'Prompt', 'Sarabun', 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}
body { min-height: 100vh; padding-top: 76px; }

/* -------- Top Navigation -------- */
.app-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1030;
  height: 68px;
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.app-nav .container { display: flex; align-items: center; gap: 12px; }
.app-nav .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 1.05rem;
  color: var(--text); text-decoration: none;
}
.app-nav .brand .logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--gradient);
  display: grid; place-items: center; color: #fff; font-weight: 700;
  box-shadow: var(--shadow);
}
.app-nav .nav-links {
  display: flex; gap: 4px; margin-left: 16px;
}
.app-nav .nav-links a {
  padding: 8px 14px; border-radius: 10px;
  color: var(--text-soft); text-decoration: none; font-weight: 500;
  transition: .2s;
}
.app-nav .nav-links a:hover { background: var(--brand-50); color: var(--brand-700); }
.app-nav .nav-links a.active { background: var(--brand-100); color: var(--brand-700); }
.app-nav .nav-links .dropdown { display: inline-block; }
.app-nav .nav-links .dropdown-menu { font-size: .92rem; padding: 8px; min-width: 220px; }
.app-nav .nav-links .dropdown-item { border-radius: 8px; padding: 8px 12px; }
.app-nav .nav-links .dropdown-item:hover { background: var(--brand-50); color: var(--brand-700); }
.app-nav .nav-links .dropdown-item i { color: var(--brand-500); margin-right: 4px; }

.app-nav .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.app-nav .nav-btn {
  padding: 8px 16px; border-radius: 10px; border: 1px solid var(--border);
  background: #fff; color: var(--text); text-decoration: none; font-weight: 500;
  transition: .2s;
}
.app-nav .nav-btn:hover { border-color: var(--brand-500); color: var(--brand-700); }
.app-nav .nav-btn.primary {
  background: var(--gradient); color: #fff; border: none;
  box-shadow: 0 4px 14px rgba(99,102,241,.4);
}
.app-nav .nav-btn.primary:hover { transform: translateY(-1px); }

.user-menu { position: relative; }
.user-menu .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--gradient); color: #fff;
  display: grid; place-items: center; font-weight: 600; cursor: pointer;
  border: none;
}
.user-menu .menu {
  position: absolute; right: 0; top: 50px; min-width: 200px;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; display: none;
}
.user-menu.open .menu { display: block; }
.user-menu .menu a {
  display: block; padding: 10px 14px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 14px;
}
.user-menu .menu a:hover { background: var(--brand-50); color: var(--brand-700); }
.user-menu .menu hr { margin: 6px 0; border-color: var(--border); }

/* -------- Hero (homepage) -------- */
.hero {
  background: var(--gradient);
  padding: 90px 0 110px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(800px 400px at 80% 20%, rgba(255,255,255,.18), transparent),
              radial-gradient(600px 300px at 10% 90%, rgba(255,255,255,.15), transparent);
}
.hero .container { position: relative; }
.hero h1 {
  font-size: clamp(28px, 4vw, 48px); font-weight: 700;
  margin-bottom: 16px; letter-spacing: -.5px;
}
.hero p { font-size: 1.1rem; opacity: .92; margin-bottom: 32px; max-width: 720px; }
.hero .search-wrap {
  background: #fff; border-radius: 999px; padding: 6px;
  display: flex; align-items: center; gap: 8px;
  box-shadow: 0 20px 40px rgba(0,0,0,.18);
  max-width: 720px;
}
.hero .search-wrap input {
  flex: 1; border: none; outline: none;
  padding: 14px 22px; border-radius: 999px;
  font-size: 16px; color: var(--text);
  background: transparent;
}
.hero .search-wrap button {
  padding: 12px 28px; border-radius: 999px;
  background: var(--gradient); color: #fff; border: none;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.hero .search-wrap button:hover { filter: brightness(1.05); }

.hero-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px; margin-top: 40px; max-width: 720px;
}
.hero-stat {
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
  padding: 16px 20px; border-radius: var(--radius);
  backdrop-filter: blur(8px);
  display: block;
}
.hero-stat .num { font-size: 1.6rem; font-weight: 700; }
.hero-stat .lbl { font-size: .85rem; opacity: .85; }

/* clickable variant */
.hero-stat-link {
  text-decoration: none;
  color: #fff;
  cursor: pointer;
  transition: .2s;
}
.hero-stat-link:hover {
  background: rgba(255,255,255,.22);
  border-color: rgba(255,255,255,.4);
  transform: translateY(-2px);
  color: #fff;
}
.hero-stat-link:hover .lbl { opacity: 1; }
.hero-stat-link .lbl .bi-arrow-right {
  transition: transform .2s;
  margin-left: 4px;
}
.hero-stat-link:hover .lbl .bi-arrow-right {
  transform: translateX(4px);
}

/* -------- Section / Card -------- */
.section { padding: 60px 0; }
.section h2 { font-weight: 600; letter-spacing: -.3px; margin-bottom: 8px; }
.section .lead { color: var(--text-soft); margin-bottom: 32px; }

.card-modern {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: .25s;
}
.card-modern:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

/* clickable card-modern variant */
a.card-modern,
.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  cursor: pointer;
  transition: .2s;
}
a.card-modern:hover,
.stat-card-link:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}
.stat-card-link .bi-arrow-right {
  transition: transform .2s;
  margin-left: 4px;
}
.stat-card-link:hover .bi-arrow-right {
  transform: translateX(4px);
  opacity: 1 !important;
}

/* -------- User picker (autocomplete) -------- */
.user-picker {
  position: relative;
}
.user-picker .up-chip-wrap:empty {
  display: none;
}
.user-picker .up-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 6px 8px 14px;
  background: var(--brand-100);
  color: var(--brand-800);
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 500;
  margin-bottom: 4px;
}
.user-picker .up-chip-remove {
  background: rgba(0,0,0,.08);
  border: none;
  color: var(--brand-800);
  width: 22px; height: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}
.user-picker .up-chip-remove:hover {
  background: var(--danger);
  color: #fff;
}
.user-picker .up-results {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 280px;
  overflow-y: auto;
  z-index: 50;
}
.user-picker .up-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: .12s;
}
.user-picker .up-item:last-child { border-bottom: none; }
.user-picker .up-item:hover {
  background: var(--brand-50);
}
.user-picker .up-empty {
  padding: 16px;
  text-align: center;
  color: var(--text-soft);
  font-size: .9rem;
}

/* -------- Proposal form -------- */
.section-title {
  font-weight: 600;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.repeat-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.repeat-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.repeat-label {
  min-width: 50px;
  font-weight: 600;
  color: var(--brand-700);
  font-size: .92rem;
}
.repeat-row .form-control { flex: 1; }
.repeat-remove {
  background: rgba(239,68,68,.1);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.3);
  width: 36px; height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 600;
  flex-shrink: 0;
}
.repeat-remove:hover:not(:disabled) {
  background: var(--danger);
  color: #fff;
}
.repeat-remove:disabled { opacity: .3; cursor: not-allowed; }

/* Quill editor */
.quill-editor { background: #fff; min-height: 200px; }
.ql-toolbar.ql-snow { border-radius: 10px 10px 0 0; border-color: var(--border); }
.ql-container.ql-snow {
  border-radius: 0 0 10px 10px;
  border-color: var(--border);
  font-family: 'Prompt', 'Sarabun', sans-serif;
  font-size: 15px;
}
.ql-editor { min-height: 180px; max-height: 500px; }

.rich-content {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: 8px;
  line-height: 1.7;
}
.rich-content p:last-child { margin-bottom: 0; }
.rich-content table { border-collapse: collapse; }
.rich-content td, .rich-content th { border: 1px solid var(--border); padding: 6px 10px; }

/* Tool tree (Hardware/Software → main → bullets) */
.tool-section {
  background: var(--brand-50);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.tool-section-title {
  font-weight: 700;
  font-size: 1.02rem;
  color: var(--brand-700);
  margin-bottom: 12px;
}
.tool-mains {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.tool-main {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.tool-main-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-num {
  min-width: 60px;
  font-weight: 600;
  color: var(--brand-700);
  font-size: .92rem;
}
.tool-main-input { flex: 1; }
.tool-bullets {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
  margin-left: 60px;
}
.tool-bullet {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tool-bullet-dot {
  color: var(--brand-500);
  font-weight: 700;
  font-size: 1.2rem;
}
.tool-bullet-input { flex: 1; padding: 6px 10px; font-size: .9rem; }

/* Scope tree (nested 3 levels) */
.scope-tree { display: flex; flex-direction: column; gap: 6px; }
.scope-node {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.scope-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scope-num {
  min-width: 60px;
  font-weight: 600;
  color: var(--brand-700);
  font-size: .92rem;
}
.scope-input { flex: 1; }
.scope-children {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-left: 32px;
  padding-left: 16px;
  border-left: 2px solid var(--brand-100);
}
.scope-node[data-level="2"] > .scope-row .scope-num { color: var(--brand-600); font-size: .88rem; }
.scope-node[data-level="3"] > .scope-row .scope-num { color: var(--brand-500); font-size: .85rem; }
.scope-add-child {
  white-space: nowrap;
}

/* Schedule (Gantt) */
.schedule-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.schedule-row {
  display: grid;
  grid-template-columns: 280px 220px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.schedule-row.dynamic {
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.8fr) minmax(220px, 1.4fr);
}
.schedule-name { font-size: .92rem; font-weight: 500; }
.sched-name-input { font-size: .9rem; }
.sched-remove { flex: 0 0 auto; }
.schedule-bar { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.schedule-range-text { min-width: 0; }

/* Gantt header (row above schedule table) — ยังใช้ใน advisor review */
.schedule-header {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(180px, 0.8fr) minmax(220px, 1.4fr);
  gap: 12px;
  padding: 4px 12px;
  margin-bottom: 6px;
}
.schedule-header-track {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  height: auto;
}
.bar-head {
  background: var(--brand-50);
  border-radius: 4px;
  padding: 4px 2px;
  text-align: center;
  font-size: .65rem;
  line-height: 1.1;
  color: var(--brand-700);
  border: 1px solid var(--border);
}
.bar-head-month { font-weight: 700; font-size: .68rem; }
.bar-head-year  { font-size: .6rem; opacity: .8; margin-top: 1px; }

@media (max-width: 900px) {
  .schedule-header { display: none; }
}

/* ====================================================================
   Section 11: Form กรอกข้อมูลกิจกรรม (one row per activity)
   ==================================================================== */
.sched-form-section {
  padding: 12px;
  background: var(--brand-50);
  border-radius: var(--radius);
  margin-bottom: 8px;
}
.sched-form-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sched-form-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}
.sched-form-row .sched-num {
  min-width: 32px;
  text-align: center;
  font-weight: 600;
  color: var(--brand-700);
  font-size: .9rem;
}
.sched-form-row .sched-name-input {
  flex: 1;
  min-width: 200px;
  font-size: .92rem;
}
.sched-form-row .form-control.sched-start-m,
.sched-form-row .form-control.sched-end-m {
  width: auto;
  min-width: 100px;
  font-size: .9rem;
}
.sched-form-row .sched-arrow {
  color: var(--text-soft);
  font-weight: 600;
}
.sched-form-row .sched-remove {
  flex: 0 0 auto;
  background: rgba(239,68,68,.1);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.3);
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: all .15s;
}
.sched-form-row .sched-remove:hover { background: var(--danger); color: #fff; }

@media (max-width: 720px) {
  .sched-form-row { flex-wrap: wrap; }
  .sched-form-row .sched-name-input { flex: 1 1 100%; }
}

/* ====================================================================
   Section 11: Gantt Chart visualization (read-only, ด้านล่าง form)
   ==================================================================== */
.sched-chart-section {
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.sched-chart-wrapper {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  overflow-x: auto;
}
.sched-chart-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(360px, 2.4fr) minmax(170px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 6px 4px;
  border-bottom: 1px dashed var(--border);
}
.sched-chart-row:last-child { border-bottom: none; }
.sched-chart-head {
  font-weight: 600;
  color: var(--brand-700);
  background: var(--brand-50);
  border-radius: 8px;
  padding: 8px 6px;
  margin-bottom: 6px;
  border-bottom: none;
}
.sched-chart-label {
  font-size: .88rem;
  color: var(--text);
  word-break: break-word;
}
.sched-num-mini {
  display: inline-block;
  min-width: 24px;
  font-weight: 600;
  color: var(--brand-700);
}
.sched-chart-track {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  height: 22px;
  min-width: 360px;
}
.sched-chart-head .sched-chart-track {
  height: auto;
}
.sched-chart-range {
  font-size: .8rem;
  color: var(--text-soft);
  text-align: right;
}
.sched-chart-empty {
  padding: 20px;
  text-align: center;
  font-style: italic;
}

@media (max-width: 900px) {
  .sched-chart-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .sched-chart-range { text-align: left; }
}
.schedule-pickers { display: flex; align-items: center; gap: 6px; }
.schedule-pickers .form-control { padding: 6px 10px; font-size: .88rem; }
.schedule-bar-track {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  height: 24px;
}
.bar-cell {
  background: var(--brand-50);
  border-radius: 3px;
}
.bar-cell.on { background: var(--brand-500); }
@media (max-width: 900px) {
  .schedule-row { grid-template-columns: 1fr; }
}

/* Sticky action bar */
.sticky-actions {
  position: sticky;
  bottom: 16px;
  background: #fff;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 5;
}

/* -------- Tag chip input -------- */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  min-height: 48px;
  transition: .15s;
}
.tag-input:focus-within {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(59,130,246,.12);
}
.tag-input .chips {
  display: contents;
}
.tag-input .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 12px;
  background: var(--brand-100);
  color: var(--brand-800);
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 500;
}
.tag-input .chip button {
  background: rgba(0,0,0,.08);
  border: none;
  color: var(--brand-800);
  width: 20px; height: 20px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  line-height: 1;
}
.tag-input .chip button:hover { background: var(--danger); color: #fff; }
.tag-input input {
  flex: 1;
  min-width: 140px;
  border: none;
  outline: none;
  padding: 6px 8px;
  font-size: 14px;
  font-family: inherit;
  background: transparent;
}

/* -------- Inline search bar (ไม่ใช่ hero) -------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
}
.search-bar input[type=text] {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  padding: 12px 18px;
}
.search-bar button {
  background: var(--gradient);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.search-bar button:hover { filter: brightness(1.05); }

/* tag cloud area */
#tags { min-height: 320px; }
.tags-container {
  background: var(--gradient-soft);
  border-radius: var(--radius-lg);
  padding: 32px;
  border: 1px solid var(--border);
}
.tags-empty {
  text-align: center; padding: 80px 20px; color: var(--text-soft);
}

/* บังคับฟอนต์ในภายใน jQCloud ให้ใช้ Prompt เหมือนระบบ */
#tags,
#tags *,
.jqcloud,
.jqcloud * {
  font-family: 'Prompt', 'Sarabun', 'Segoe UI', sans-serif !important;
  font-weight: 500;
}
#tags a,
.jqcloud a {
  text-decoration: none;
  transition: opacity .15s, transform .15s;
  display: inline-block;
}
#tags a:hover,
.jqcloud a:hover {
  opacity: .8;
  transform: translateY(-2px);
}

/* -------- Advisor cards -------- */
.advisor-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  height: 100%;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  transition: .2s;
}
.advisor-card:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}
.advisor-card .title {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text);
  line-height: 1.35;
}
.advisor-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: .88rem;
  color: var(--text-soft);
}
.advisor-card .meta i { color: var(--brand-500); }

.advisor-avatar {
  width: 52px; height: 52px;
  border-radius: 14px;
  background: var(--gradient);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 1.2rem;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.advisor-avatar.avatar-img,
.advisor-avatar-lg.avatar-img {
  background: var(--brand-100);
  padding: 0;
}
.advisor-avatar img,
.advisor-avatar-lg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

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

.advisor-header {
  background: var(--gradient);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 32px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: var(--shadow-lg);
}
.advisor-header h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0;
}
.advisor-avatar-lg {
  width: 96px; height: 96px;
  border-radius: 24px;
  background: rgba(255,255,255,.2);
  border: 2px solid rgba(255,255,255,.4);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 2.2rem;
  flex-shrink: 0;
  backdrop-filter: blur(8px);
}
@media (max-width: 600px) {
  .advisor-header { flex-direction: column; text-align: center; }
}

/* -------- Capacity badge -------- */
.capacity-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 600;
  margin-top: auto;
}
.capacity-badge i {
  font-size: 1.1rem;
}

/* -------- Project list cards -------- */
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 14px;
  transition: .2s;
  display: block; text-decoration: none; color: inherit;
}
.project-card:hover {
  border-color: var(--brand-300);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}
.project-card .title {
  font-weight: 600; font-size: 1.05rem; color: var(--text);
  margin-bottom: 4px; line-height: 1.4;
}
.project-card .title-en {
  color: var(--text-soft); font-size: .92rem; font-style: italic;
  margin-bottom: 14px; line-height: 1.4;
}
.project-card .meta {
  display: flex; flex-wrap: wrap; gap: 16px; font-size: .9rem;
  color: var(--text-soft);
  border-top: 1px dashed var(--border); padding-top: 12px;
}
.project-card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.project-card .meta i { color: var(--brand-500); }
.hightlight, .highlight {
  background: linear-gradient(180deg, transparent 60%, #fde68a 60%);
  font-weight: 600;
}

/* -------- Form / Auth pages -------- */
.auth-wrap {
  max-width: 480px; margin: 40px auto;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.6rem; font-weight: 600; margin-bottom: 6px; }
.auth-card p.sub { color: var(--text-soft); margin-bottom: 28px; font-size: .95rem; }

.form-modern .field { margin-bottom: 18px; }
.form-modern label {
  display: block; font-size: .9rem; font-weight: 500;
  margin-bottom: 6px; color: var(--text);
}
.form-modern .form-control,
.form-modern input[type=text],
.form-modern input[type=email],
.form-modern input[type=password],
.form-modern input[type=number],
.form-modern textarea,
.form-modern select {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: #fff; color: var(--text);
  font-size: 15px; font-family: inherit;
  transition: .15s;
}
.form-modern .form-control:focus,
.form-modern input:focus, .form-modern textarea:focus, .form-modern select:focus {
  outline: none; border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}
.form-modern textarea { resize: vertical; min-height: 100px; }
.form-modern .help { font-size: .8rem; color: var(--text-soft); margin-top: 4px; }
.form-modern .row-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 600px) {
  .form-modern .row-fields { grid-template-columns: 1fr; }
}

/* -------- Buttons -------- */
.btn-modern {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 22px; border-radius: 10px; border: none;
  font-weight: 600; font-family: inherit; font-size: 15px; cursor: pointer;
  transition: .15s; text-decoration: none;
}
.btn-modern.primary { background: var(--gradient); color: #fff; }
.btn-modern.primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-modern.secondary { background: #fff; color: var(--text); border: 1.5px solid var(--border); }
.btn-modern.secondary:hover { border-color: var(--brand-500); color: var(--brand-700); }
.btn-modern.danger { background: var(--danger); color: #fff; }
.btn-modern.danger:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-modern.success { background: var(--success); color: #fff; }
.btn-modern.success:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-modern.info { background: #3b82f6; color: #fff; }
.btn-modern.info:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-modern.ghost  { background: transparent; color: var(--brand-700); }
.btn-modern.block { width: 100%; }

/* -------- Bootstrap nav-pills override (สำหรับ tabs) -------- */
.nav-pills {
  gap: 4px;
  padding: 4px;
  background: var(--brand-50);
  border-radius: 12px;
  display: inline-flex;
}
.nav-pills .nav-link {
  color: var(--text-soft);
  border: none;
  border-radius: 9px;
  font-weight: 500;
  padding: 8px 18px;
  transition: .15s;
  background: transparent;
}
.nav-pills .nav-link:hover {
  background: rgba(255,255,255,.6);
  color: var(--brand-700);
}
.nav-pills .nav-link.active,
.nav-pills .show > .nav-link {
  background: var(--surface);
  color: var(--brand-700);
  box-shadow: var(--shadow-sm);
}

/* -------- Pills / Badges -------- */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--brand-50); color: var(--brand-700);
  font-size: .8rem; font-weight: 500; margin: 2px 4px 2px 0;
  text-decoration: none;
}
.pill:hover { background: var(--brand-100); color: var(--brand-800); }
.pill.tag { background: #e0f2fe; color: #075985; }

/* -------- Project detail -------- */
.project-detail .header {
  background: var(--gradient);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 36px;
  margin-bottom: 28px;
  box-shadow: var(--shadow-lg);
}
.project-detail .header h1 {
  font-size: 1.7rem; font-weight: 700; margin-bottom: 8px;
}
.project-detail .header .en { font-style: italic; opacity: .9; }

.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
}
.info-box h3 {
  font-size: 1rem; font-weight: 600; margin-bottom: 14px;
  color: var(--brand-700); display: flex; align-items: center; gap: 8px;
}
.info-box .row-info { display: flex; gap: 6px; padding: 8px 0; font-size: .94rem; }
.info-box .row-info .lbl { color: var(--text-soft); min-width: 110px; }
.info-box .row-info .val { color: var(--text); flex: 1; }

.file-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border);
  margin-bottom: 6px; text-decoration: none; color: var(--text);
  background: #fff; transition: .15s;
  font-size: .92rem;
}
.file-item:hover { border-color: var(--brand-500); background: var(--brand-50); color: var(--brand-700); }
.file-item .pdf-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: linear-gradient(135deg, #ef4444, #f97316);
  color: #fff; display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
}
.file-item .name { flex: 1; word-break: break-all; }

/* -------- Status stepper -------- */
.status-stepper {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  position: relative;
}
.status-stepper::before {
  content: '';
  position: absolute;
  top: 18px;
  left: 8%;
  right: 8%;
  height: 2px;
  background: var(--border);
  z-index: 0;
}
.status-stepper .step {
  position: relative;
  z-index: 1;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.status-stepper .dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border);
}
.status-stepper .step.current .dot {
  box-shadow: 0 0 0 4px rgba(59,130,246,.18);
  transform: scale(1.05);
}
.status-stepper .lbl {
  font-size: .75rem;
  line-height: 1.3;
  color: var(--text-soft);
  max-width: 110px;
}
@media (max-width: 768px) {
  .status-stepper {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .status-stepper::before { display: none; }
  .status-stepper .step { flex-direction: row; text-align: left; gap: 12px; }
  .status-stepper .lbl { max-width: none; }
}

/* -------- Pagination -------- */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: #fff;
  color: var(--text); text-decoration: none; font-size: .9rem; font-weight: 500;
}
.pager a:hover { border-color: var(--brand-500); color: var(--brand-700); }
.pager .active { background: var(--gradient); color: #fff; border-color: transparent; }
.pager .disabled { opacity: .4; pointer-events: none; }

/* -------- Footer -------- */
.app-footer {
  margin-top: 80px;
  padding: 32px 0;
  background: #fff;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-soft);
  font-size: .9rem;
}
.app-footer a { color: var(--brand-700); text-decoration: none; font-weight: 500; }

/* -------- Validation error -------- */
label.error, .error-msg {
  color: var(--danger); font-size: .82rem; margin-top: 4px; display: block;
}
.form-modern .form-control.error { border-color: var(--danger); }

/* -------- Toast / SweetAlert overrides -------- */
.swal2-popup { border-radius: var(--radius-lg) !important; }
.swal2-confirm { background: var(--gradient) !important; border: none !important; }

/* -------- Misc -------- */
.text-soft { color: var(--text-soft); }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* hide scroll bar overflow on hero */
.hero, .hero-stat { color: #fff; }

/* Responsive nav (simple) */
@media (max-width: 768px) {
  .app-nav .nav-links { display: none; }
  .hero { padding: 60px 0 80px; }
  body { padding-top: 68px; }
}

/* ============ Mobile Responsiveness Fixes ============ */
@media (max-width: 768px) {
  /* Tables — horizontal scroll */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }
  .table-responsive table {
    min-width: 600px;
    font-size: .85rem;
  }

  /* Workflow queue cards: 1 column on mobile */
  .info-box .row.g-2 > [class^="col-md-"],
  .info-box .row.g-3 > [class^="col-md-"] {
    flex: 0 0 100%;
    max-width: 100%;
  }

  /* Notification dropdown */
  .notif-dropdown {
    position: fixed !important;
    top: 60px !important;
    right: 8px !important;
    left: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  /* Stepper marker + body — keep side-by-side but smaller */
  .student-stepper .step-row {
    padding: 10px 12px 16px 12px !important;
    gap: 10px !important;
  }
  .student-stepper .step-marker {
    width: 30px !important;
    height: 30px !important;
    font-size: .8rem !important;
  }
  .student-stepper .step-title {
    font-size: .95rem !important;
  }
  .student-stepper .step-items li {
    font-size: .85rem !important;
  }
  .student-stepper .step-row.state-active::after,
  .student-stepper .step-row.state-failed::after {
    font-size: .65rem !important;
    padding: 2px 8px !important;
    top: -8px !important;
  }

  /* Next-action banner — column layout on mobile */
  .next-action-banner > div {
    flex-direction: column;
    align-items: stretch !important;
  }
  .next-action-banner .btn-modern {
    width: 100%;
    justify-content: center;
  }

  /* Hero stats — wrap nicely */
  .hero-stat {
    min-width: 100px;
    padding: 8px 14px;
  }
  .hero-stat .num {
    font-size: 1.4rem;
  }

  /* Cards — reduce padding */
  .card-modern, .info-box {
    padding: 14px;
  }

  /* Buttons — wrap text */
  .btn-modern {
    white-space: normal;
    text-align: center;
  }

  /* Headers — smaller */
  h2 { font-size: 1.4rem; }
  h3 { font-size: 1.15rem; }
  h5 { font-size: 1rem; }

  /* Modal — wider on mobile */
  .modal-dialog.modal-lg {
    margin: 8px;
    max-width: calc(100% - 16px);
  }
}

@media (max-width: 480px) {
  /* Filter pills — wrap */
  .d-flex.flex-wrap.gap-2 .pill {
    font-size: .78rem !important;
    padding: 4px 8px !important;
  }

  /* Notification bell — smaller */
  .notif-bell button {
    padding: 6px;
  }
  .notif-bell button i {
    font-size: 1.1rem !important;
  }

  /* Reduce hero-stat further */
  .hero-stat .num { font-size: 1.2rem; }
  .hero-stat .lbl { font-size: .72rem; }
}
