:root {
  /* ===== Lianudom Digital Group brand — เปลี่ยนสีแบรนด์ได้ที่นี่ที่เดียว ===== */
  --brand: #0c77c2;        /* ฟ้า LDG (จากโลโก้) */
  --brand-dark: #0b2545;   /* น้ำเงินเข้ม */
  --brand-accent: #3969b2; /* น้ำเงินปลายไล่สีของโลโก้ */
  --brand-soft: #e7f1fa;   /* พื้นฟ้าอ่อน */
  --brand-gray: #565b5a;   /* เทา "DIGITAL GROUP" */

  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1c2230;
  --muted: #667085;
  --border: #e3e6eb;
  --primary: var(--brand);
  --primary-hover: #0a63a3;
  --danger: #c4372b;
  --active: #1f9d55;
  --upcoming: #2f6fde;
  --finished: #98a2b3;
  --radius: 10px;
  font-family: "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); line-height: 1.55; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
a { color: var(--primary); }

.container { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
.narrow { max-width: 720px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.hidden { display: none !important; }

/* forms */
label { display: block; font-weight: 500; font-size: .92rem; margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 8px; background: #fff; color: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); border-color: var(--primary); }
textarea { min-height: 96px; resize: vertical; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid .full { grid-column: 1 / -1; }
.req::after { content: " *"; color: var(--danger); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 5px; }
.hp { position: absolute; left: -9999px; }

button, .btn {
  font: inherit; font-weight: 500; cursor: pointer; border: 1px solid var(--border); background: #fff;
  color: var(--text); padding: 8px 14px; border-radius: 8px; text-decoration: none; display: inline-block; white-space: nowrap;
}
button:hover, .btn:hover { background: #f0f2f5; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: .85rem; }
button:disabled { opacity: .6; cursor: progress; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.alert-error { background: #fdecea; color: #8a1f17; }
.alert-success { background: #e7f6ed; color: #14532d; }

/* admin layout */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar .container { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; }
.brand { font-weight: 700; font-size: 1.1rem; margin-right: auto; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: none; background: none; padding: 8px 10px; white-space: nowrap; border-radius: 8px; color: var(--muted); }
.tab.active { background: var(--brand-soft); color: var(--primary); }
.badge-count { background: var(--danger); color: #fff; border-radius: 999px; font-size: .72rem; padding: 1px 7px; margin-left: 4px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.stat b { display: block; font-size: 1.7rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.toolbar > div { min-width: 150px; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 22px 0 10px; }

table { width: 100%; border-collapse: collapse; background: var(--surface); }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; font-size: .92rem; }
th { background: #fafbfc; font-weight: 600; color: var(--muted); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 28px; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.pill.active { background: #e3f5ea; color: var(--active); }
.pill.upcoming { background: #e6eefc; color: var(--upcoming); }
.pill.finished { background: #eef0f3; color: #5c6574; }
select.status-new { color: #b42318; }
select.status-reviewing { color: #b54708; }
select.status-accepted { color: var(--active); }
select.status-rejected { color: var(--muted); }

/* gantt */
.gantt { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px 16px; }
.g-row { display: grid; grid-template-columns: 180px 1fr; align-items: center; gap: 12px; min-height: 30px; }
.g-name { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-track { position: relative; height: 22px; background: repeating-linear-gradient(90deg, transparent 0 calc(100% - 1px), transparent); }
.g-axis { position: relative; height: 22px; border-bottom: 1px solid var(--border); }
.tick { position: absolute; font-size: .75rem; color: var(--muted); padding-left: 4px; border-left: 1px solid var(--border); height: 22px; white-space: nowrap; }
.g-bar { position: absolute; top: 3px; height: 16px; border-radius: 4px; min-width: 3px; }
.g-bar.active { background: var(--active); }
.g-bar.upcoming { background: var(--upcoming); }
.g-bar.finished { background: var(--finished); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: .7; }
.g-body { position: relative; }
.legend { display: flex; gap: 14px; font-size: .8rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }

/* ===== public site ===== */
.site { background: var(--bg); }
.site-header { background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.site-nav { display: flex; align-items: center; gap: 20px; padding-top: 12px; padding-bottom: 12px; }
.logo { display: flex; align-items: center; margin-right: auto; }
.logo img { height: 40px; width: auto; display: block; }
.site-links { display: flex; gap: 18px; }
.site-links a { color: var(--muted); text-decoration: none; font-weight: 500; }
.site-links a:hover { color: var(--brand); }
.btn-lg { padding: 12px 22px; font-size: 1.02rem; border-radius: 10px; }
.btn-light { background: #fff; color: var(--brand-dark); border-color: #fff; }
.btn-light:hover { background: var(--brand-soft); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn-ghost:hover { background: rgba(255, 255, 255, .1); }

.hero {
  color: #fff; padding: 72px 0 80px;
  background:
    radial-gradient(circle at 85% 20%, rgba(62, 136, 202, .55), transparent 45%),
    linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
}
.hero h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); font-weight: 800; margin: 12px 0 16px; letter-spacing: -.01em; }
.hero p { max-width: 640px; font-size: 1.08rem; color: rgba(255, 255, 255, .85); margin: 0; }
.hero .hl { color: #7cc8ff; }
.hero-sm { padding: 36px 0 44px; }
.hero-sm h1 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin: 8px 0 8px; }
.eyebrow { display: inline-block; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; background: rgba(255, 255, 255, .14); padding: 4px 12px; border-radius: 999px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.back { color: rgba(255, 255, 255, .8); text-decoration: none; font-size: .92rem; }
.back:hover { color: #fff; }

.section { padding-top: 56px; padding-bottom: 8px; }
.section-tint { background: var(--brand-soft); padding: 48px 0; margin-top: 48px; }
.section-title { font-size: 1.55rem; font-weight: 700; color: var(--brand-dark); margin-bottom: 20px; }
.features { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.feature { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.feature h3 { font-size: 1.02rem; margin: 10px 0 6px; }
.feature p { margin: 0; color: var(--muted); font-size: .93rem; }
.f-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--brand-soft); }
.positions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.position { background: var(--surface); border-radius: 12px; padding: 18px 20px; border-left: 4px solid var(--brand-accent); display: flex; flex-direction: column; gap: 4px; }
.position span { color: var(--muted); font-size: .9rem; }
.cta-band {
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  color: #fff; border-radius: 18px; padding: 32px 36px; margin-bottom: 56px;
  background: linear-gradient(120deg, var(--brand-accent) 0%, var(--brand) 100%);
}
.cta-band h2 { margin: 0 0 4px; }
.cta-band p { margin: 0; color: rgba(255, 255, 255, .85); }
.site-footer { border-top: 1px solid var(--border); padding: 22px 0; color: var(--muted); font-size: .88rem; background: var(--surface); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.footer-inner img { height: 30px; width: auto; }
.footer-contact { flex: 1; display: flex; flex-wrap: wrap; gap: 4px 6px; color: var(--text); }
.footer-contact a { color: inherit; text-decoration: none; }
.footer-contact .dot { color: var(--muted); margin: 0 4px; }

/* admin content editor */
.content-form { display: grid; gap: 16px; padding-bottom: 80px; }
.edit-list { display: grid; gap: 10px; }
.edit-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: #fafbfc; }
#list-features .edit-row { grid-template-columns: 1fr 2fr auto; }
#list-positions .edit-row { grid-template-columns: 1fr 2fr auto auto; }
.edit-row label { font-size: .8rem; color: var(--muted); font-weight: 500; }
.f-emoji input { text-align: center; font-size: 1.2rem; padding: 6px; }
.edit-check { margin: 0 0 9px; white-space: nowrap; color: var(--text) !important; font-size: .9rem !important; }
.edit-actions { display: flex; gap: 4px; padding-bottom: 3px; }
.save-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: flex-end; gap: 10px;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px;
}
.save-bar #content-status { margin-right: auto; }

.apply-main { margin-top: -64px; position: relative; }
.form-section { font-size: 1rem; color: var(--brand-dark); margin: 26px 0 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.form-section:first-of-type { margin-top: 0; }
.success-card { text-align: center; padding: 40px 24px; }
.success-icon { width: 60px; height: 60px; border-radius: 999px; margin: 0 auto 14px; display: grid; place-items: center; font-size: 1.8rem; color: #fff; background: var(--brand-accent); }

/* admin brand */
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 32px; width: auto; display: block; }
.brand small { color: var(--brand-gray); font-weight: 600; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; border-left: 1px solid var(--border); padding-left: 10px; }
.login .logo img { height: 48px; }
.login .logo { justify-content: center; margin: 0 0 18px; }

@media (max-width: 900px) {
  .features, .positions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .site-links { display: none; }
}
@media (max-width: 560px) {
  .features, .positions { grid-template-columns: 1fr; }
  .logo img { height: 32px; }
  .edit-row, #list-features .edit-row, #list-positions .edit-row { grid-template-columns: 1fr; }
  .hero { padding: 48px 0 56px; }
  .cta-band { padding: 24px; }
}

/* calendar */
:root { --open: #1f9d55; --busy: #d97706; --full: #c4372b; }
.stat .small { display: block; }
.cal-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h2 { margin: 0; min-width: 190px; text-align: center; font-size: 1.3rem; }
.cap-form { display: flex; align-items: center; gap: 8px; }
.cap-form label { margin: 0; font-weight: 400; }
.cap-form input { width: 76px; }
.cal-summary { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .9rem; color: var(--muted); margin-bottom: 12px; }
.cal-summary b { color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-wd { text-align: center; font-size: .8rem; font-weight: 600; color: var(--muted); padding: 4px 0; }
.cal-day {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; white-space: normal;
  min-height: 104px; padding: 7px 8px; border-radius: 8px; border: 1px solid var(--border); border-left: 4px solid var(--open); background: var(--surface);
}
.cal-day:hover { background: #f7f8fa; }
.cal-day.busy { border-left-color: var(--busy); background: #fffaf0; }
.cal-day.full { border-left-color: var(--full); background: #fdf1f0; }
.cal-day.weekend .cal-num { color: var(--muted); }
.cal-day.today .cal-num { background: var(--primary); color: #fff; border-radius: 999px; padding: 0 7px; align-self: flex-start; }
.cal-day.selected { outline: 2px solid var(--primary); outline-offset: 1px; }
.cal-num { font-weight: 700; font-size: .95rem; }
.cal-count { font-size: .76rem; color: var(--muted); }
.cal-day.open .cal-count b { color: var(--open); }
.cal-day.busy .cal-count b { color: var(--busy); }
.cal-day.full .cal-count b { color: var(--full); }
.cal-names { display: flex; flex-wrap: wrap; gap: 3px; }
.cal-name { font-size: .72rem; background: var(--brand-soft); color: var(--primary); border-radius: 4px; padding: 0 5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-name.more { background: #eef0f3; color: var(--muted); }

.cal-grid.public .cal-day { min-height: 54px; cursor: default; }
.cal-grid.public .cal-day:hover { background: var(--surface); }
.cal-grid.public .cal-day.busy:hover { background: #fffaf0; }
.cal-grid.public .cal-day.full:hover { background: #fdf1f0; }
.cal-day.past { border-left-color: var(--border); opacity: .5; }
.cal-nav button:disabled { opacity: .35; cursor: default; }

@media (max-width: 720px) {
  .cal-grid { gap: 3px; }
  .cal-grid.public .cal-day { min-height: 46px; }
  .cal-day { min-height: 64px; padding: 4px; border-left-width: 3px; }
  .cal-names { display: none; }
  .cal-count { font-size: .66rem; }
  .cal-nav h2 { min-width: 0; font-size: 1.05rem; }
}

dialog { border: none; border-radius: 12px; padding: 0; width: min(680px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(16, 24, 40, .45); }
dialog form, dialog .dlg-body { padding: 22px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
dl.info { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; white-space: pre-wrap; word-break: break-word; }

.login { max-width: 380px; margin: 12vh auto; }

@media (max-width: 720px) {
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-row { grid-template-columns: 100px 1fr; }
  .topbar .container { flex-wrap: wrap; }
  dl.info { grid-template-columns: 1fr; }
}
