:root {
    --st-900: #032f2a; --st-800: #064e3b; --st-700: #075b4e; --st-600: #0b8d72; --st-500: #12a586;
    --st-100: #d9f5ec; --st-50: #f0fbf7;
    --st-ink: #0f2a26; --st-muted: #5b6f6b; --st-line: #dfe9e6; --st-bg: #f4f8f7;
    --st-urgent: #c2410c; --st-urgent-bg: #fff4ed; --st-danger: #b91c1c;
    --st-radius: 16px; --st-shadow: 0 10px 28px rgba(4, 62, 53, .08);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Kanit', system-ui, sans-serif; color: var(--st-ink); background: var(--st-bg); font-size: 15px; line-height: 1.6; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--st-600); }
.st-shell { width: min(100% - 32px, 1080px); margin-inline: auto; }
.st-narrow { width: min(100% - 32px, 780px); }
.st-main { flex: 1; padding-bottom: 40px; }
.st-muted { color: var(--st-muted); font-size: 13px; }

/* Top bar */
.st-topbar { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--st-line); backdrop-filter: blur(8px); }
.st-topbar-inner { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.st-brand { display: flex; align-items: center; gap: 10px; color: var(--st-800); text-decoration: none; }
.st-brand strong { display: block; font-size: 16px; line-height: 1.2; }
.st-brand small { display: block; color: var(--st-muted); font-size: 11px; }
.st-brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #9af5d8; background: linear-gradient(135deg, var(--st-700), var(--st-600)); flex: none; }
.st-brand-mark.is-lg { width: 60px; height: 60px; border-radius: 18px; font-size: 26px; margin: 0 auto 12px; }
.st-nav { display: flex; align-items: center; gap: 6px; }
.st-nav a { min-height: 40px; display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 11px; color: var(--st-800); text-decoration: none; font-size: 14px; font-weight: 500; }
.st-nav a:hover { background: var(--st-50); }
.st-nav a.st-nav-primary { color: #fff; background: var(--st-700); }
.st-nav a.st-nav-primary:hover { background: var(--st-800); }
.st-nav a.st-nav-logout { color: var(--st-muted); }

/* Hero */
.st-hero { margin: 24px 0 18px; padding: 28px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-radius: 22px; color: #fff; background: radial-gradient(circle at 92% 5%, rgba(66,226,181,.25), transparent 30%), linear-gradient(135deg, var(--st-900), var(--st-700) 55%, var(--st-600)); box-shadow: 0 18px 40px rgba(4,62,53,.16); }
.st-hero h1 { margin: 4px 0 2px; font-size: clamp(22px, 3vw, 30px); line-height: 1.25; }
.st-hero p { margin: 0; color: rgba(234,255,249,.8); font-size: 14px; }
.st-kicker { display: inline-flex; align-items: center; gap: 7px; color: #82f3cf; font-size: 12px; font-weight: 600; letter-spacing: .5px; }

/* Buttons */
.st-btn { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border: 1px solid transparent; border-radius: 12px; font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; cursor: pointer; white-space: nowrap; }
.st-btn.is-primary { color: #fff; background: var(--st-700); }
.st-btn.is-primary:hover { background: var(--st-800); }
.st-btn.is-light { color: var(--st-800); background: #fff; }
.st-btn.is-ghost { color: var(--st-800); background: #fff; border-color: var(--st-line); }
.st-btn.is-ghost:hover { background: var(--st-50); }
.st-btn.is-danger { color: var(--st-danger); background: #fff; border-color: #f5c2c2; }
.st-btn.is-danger:hover { background: #fef2f2; }
.st-btn.is-block { width: 100%; }

/* Alerts */
.st-alert { margin: 0 0 16px; padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; font-size: 14px; }
.st-alert i { margin-top: 4px; }
.st-alert.is-error { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; }
.st-alert.is-success { color: #065f46; background: #ecfdf5; border: 1px solid #a7f3d0; }
.st-alert.is-info { color: #0c4a6e; background: #f0f9ff; border: 1px solid #bae6fd; }

/* Toolbar */
.st-toolbar { margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.st-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 13px; background: #fff; border: 1px solid var(--st-line); }
.st-tabs a { padding: 6px 14px; border-radius: 9px; color: var(--st-muted); text-decoration: none; font-size: 14px; }
.st-tabs a.is-active { color: #fff; background: var(--st-700); }
.st-search { position: relative; flex: 1; max-width: 340px; min-width: 200px; }
.st-search i { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--st-muted); font-size: 13px; }
.st-search input { width: 100%; min-height: 42px; padding: 8px 12px 8px 36px; border: 1px solid var(--st-line); border-radius: 12px; font: inherit; font-size: 14px; background: #fff; }

/* Cards */
.st-list { display: grid; gap: 12px; }
.st-card { display: block; padding: 18px 20px; border: 1px solid var(--st-line); border-radius: var(--st-radius); background: #fff; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.st-card:hover { transform: translateY(-2px); box-shadow: var(--st-shadow); border-color: #c4ddd6; }
.st-card.is-pinned { border-left: 4px solid var(--st-600); }
.st-card.is-urgent { border-left: 4px solid var(--st-urgent); }
.st-card h2 { margin: 4px 0 4px; font-size: 17px; line-height: 1.4; color: var(--st-800); }
.st-card p { margin: 0 0 10px; color: var(--st-muted); font-size: 14px; overflow-wrap: anywhere; }
.st-card-badges { display: flex; flex-wrap: wrap; gap: 6px; }
.st-card-badges:empty { display: none; }
.st-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; color: var(--st-muted); background: #f1f5f4; }
.st-badge.is-pin { color: var(--st-700); background: var(--st-100); }
.st-badge.is-urgent { color: var(--st-urgent); background: var(--st-urgent-bg); }
.st-card-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--st-muted); font-size: 12.5px; }
.st-card-meta i { margin-right: 3px; opacity: .8; }
.st-empty { padding: 50px 20px; text-align: center; color: var(--st-muted); border: 1px dashed var(--st-line); border-radius: var(--st-radius); background: #fff; }
.st-empty i { font-size: 38px; opacity: .5; }
.st-pager { margin-top: 20px; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.st-pager a { min-width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--st-line); background: #fff; color: var(--st-800); text-decoration: none; }
.st-pager a.is-active { color: #fff; background: var(--st-700); border-color: var(--st-700); }

/* Article */
.st-back { margin: 22px 0 14px; display: inline-flex; align-items: center; gap: 7px; color: var(--st-muted); text-decoration: none; font-size: 14px; }
.st-back:hover { color: var(--st-700); }
.st-article, .st-panel { padding: 28px; border-radius: 20px; background: #fff; border: 1px solid var(--st-line); box-shadow: var(--st-shadow); margin-bottom: 16px; }
.st-article.is-urgent { border-top: 4px solid var(--st-urgent); }
.st-article h1 { margin: 8px 0 8px; font-size: clamp(21px, 3vw, 27px); line-height: 1.35; color: var(--st-800); overflow-wrap: anywhere; }
.st-body { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--st-line); font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.st-attachment { margin-top: 22px; padding: 14px; border-radius: 14px; background: var(--st-50); border: 1px solid var(--st-100); }
.st-attachment img { display: block; max-width: 100%; max-height: 520px; margin: 0 auto 12px; border-radius: 10px; }
.st-attachment-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; overflow-wrap: anywhere; }
.st-attachment-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.st-owner-actions { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--st-line); display: flex; gap: 8px; }
.st-owner-actions form { margin: 0; }

/* Forms */
.st-panel-title { margin: 0 0 6px; font-size: 21px; color: var(--st-800); }
.st-field { display: block; margin: 0 0 16px; padding: 0; border: 0; min-width: 0; }
.st-field > span { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--st-800); }
.st-field input[type=text], .st-field input[type=password], .st-field textarea, .st-field input[type=file] { width: 100%; padding: 10px 13px; border: 1px solid #cfdcd8; border-radius: 12px; font: inherit; font-size: 15px; background: #fff; color: var(--st-ink); }
.st-field textarea { resize: vertical; min-height: 200px; line-height: 1.7; }
.st-field input:focus, .st-field textarea:focus, .st-search input:focus { outline: 3px solid rgba(18,165,134,.2); border-color: var(--st-500); }
.st-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.st-choice { display: flex; gap: 8px; flex-wrap: wrap; }
.st-choice label, .st-check { display: inline-flex; align-items: center; gap: 8px; padding: 8px 13px; border: 1px solid var(--st-line); border-radius: 11px; cursor: pointer; font-size: 14px; background: #fff; }
.st-choice label.is-urgent { color: var(--st-urgent); }
.st-choice input, .st-check input { width: 17px; height: 17px; accent-color: var(--st-600); margin: 0; }
.st-current-file { margin: -6px 0 16px; padding: 10px 12px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-radius: 12px; background: var(--st-50); font-size: 14px; overflow-wrap: anywhere; }
.st-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.st-profile { margin: 14px 0; display: grid; gap: 0; }
.st-profile div { display: grid; grid-template-columns: 140px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--st-line); font-size: 14px; }
.st-profile dt { color: var(--st-muted); }
.st-profile dd { margin: 0; font-weight: 500; }

/* Login */
.st-guest { background: radial-gradient(circle at 15% 15%, #d2f5ec 0, transparent 30%), linear-gradient(135deg, #f5fafa, #e6f4f0); }
.st-login-wrap { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 30px 16px; }
.st-login-card { width: min(100%, 420px); padding: 34px 30px; border-radius: 24px; background: #fff; box-shadow: 0 24px 60px rgba(4,62,53,.13); }
.st-login-head { text-align: center; margin-bottom: 20px; }
.st-login-head h1 { margin: 0; font-size: 24px; color: var(--st-800); }
.st-login-head p { margin: 4px 0 0; color: var(--st-muted); font-size: 14px; }
.st-login-help { margin: 16px 0 6px; text-align: center; color: var(--st-muted); font-size: 13px; }
.st-login-back { display: block; text-align: center; color: var(--st-muted); font-size: 13px; text-decoration: none; }

.st-footer { padding: 18px 0; color: var(--st-muted); font-size: 12.5px; text-align: center; border-top: 1px solid var(--st-line); background: #fff; }

@media (max-width: 720px) {
    .st-hide-sm, .st-nav a span { display: none; }
    .st-nav a { padding: 8px 11px; }
    .st-nav a.st-nav-primary span { display: inline; }
    .st-hero { padding: 22px 20px; flex-direction: column; align-items: flex-start; }
    .st-article, .st-panel { padding: 20px 18px; }
    .st-field-row { grid-template-columns: 1fr; gap: 0; }
    .st-search { max-width: none; }
    .st-profile div { grid-template-columns: 110px 1fr; }
}
@media (max-width: 400px) {
    .st-brand small { display: none; }
    .st-nav a.st-nav-primary span { display: none; }
}
@media (prefers-reduced-motion: reduce) { .st-card { transition: none; } }

/* ===== เมนูหลัก 3 หมวด + หน้าตั้งค่า ===== */
.st-nav a.is-active { background: var(--st-50); }
.st-nav a.st-nav-primary.is-active { background: var(--st-900); }
.st-menu { border-top: 1px solid var(--st-line); background: #fff; }
.st-menu-inner { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.st-menu-inner::-webkit-scrollbar { display: none; }
.st-menu a { flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 11px 14px; border-bottom: 3px solid transparent; color: var(--st-muted); text-decoration: none; font-size: 14.5px; font-weight: 500; white-space: nowrap; }
.st-menu a:hover { color: var(--st-700); }
.st-menu a.is-active { color: var(--st-700); border-bottom-color: var(--st-600); }
.st-badge.is-cat { color: #1e40af; background: #eff6ff; }
.st-kicker.is-dark { color: var(--st-600); }

.st-urgent-strip { margin-bottom: 16px; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; border-radius: 14px; background: var(--st-urgent-bg); border: 1px solid #fed7aa; }
.st-urgent-strip strong { color: var(--st-urgent); font-size: 14px; }
.st-urgent-strip a { color: #7c2d12; font-size: 14px; text-decoration: none; }
.st-urgent-strip a:hover { text-decoration: underline; }
.st-home-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.st-home-col { padding: 18px 18px 8px; border: 1px solid var(--st-line); border-radius: var(--st-radius); background: #fff; }
.st-home-col header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.st-home-col h2 { margin: 0; display: flex; align-items: center; gap: 9px; font-size: 16.5px; color: var(--st-800); }
.st-home-col header a { flex: none; color: var(--st-600); font-size: 13px; text-decoration: none; }
.st-cat-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; color: var(--st-700); background: var(--st-100); font-size: 14px; }
.st-home-col ul { list-style: none; margin: 0; padding: 0; }
.st-home-col li + li { border-top: 1px solid #edf3f1; }
.st-home-col li a { display: block; padding: 10px 0; color: inherit; text-decoration: none; }
.st-home-col li a:hover .st-home-title { color: var(--st-600); }
.st-home-title { display: block; font-size: 14.5px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.st-home-title .fa-thumbtack { color: var(--st-600); font-size: 12px; }
.st-home-title .st-badge { padding: 0 7px; font-size: 11px; }
.st-home-col small { display: block; margin-top: 2px; color: var(--st-muted); font-size: 12px; }
.st-home-empty { margin: 8px 0 14px; color: var(--st-muted); font-size: 14px; }

.st-settings-head { margin: 24px 0 18px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; }
.st-settings-head h1 { margin: 2px 0; font-size: clamp(21px, 3vw, 26px); color: var(--st-800); }
.st-settings-head p { margin: 0; }
.st-count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: rgba(0,0,0,.08); font-size: 12px; text-align: center; }
.st-tabs a.is-active .st-count { background: rgba(255,255,255,.25); }
.st-table-wrap { overflow-x: auto; border: 1px solid var(--st-line); border-radius: var(--st-radius); background: #fff; }
.st-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.st-table th { padding: 11px 14px; text-align: left; font-weight: 500; color: var(--st-muted); background: #f8fbfa; border-bottom: 1px solid var(--st-line); white-space: nowrap; }
.st-table td { padding: 12px 14px; border-bottom: 1px solid #edf3f1; vertical-align: top; }
.st-table tr:last-child td { border-bottom: 0; }
.st-table-title { color: var(--st-800); font-weight: 500; text-decoration: none; overflow-wrap: anywhere; }
.st-table-title:hover { color: var(--st-600); }
.st-table-empty { padding: 40px 14px !important; text-align: center; color: var(--st-muted); }
.st-nowrap { white-space: nowrap; }
.st-row-actions { display: flex; gap: 6px; }
.st-row-actions form { margin: 0; }
.st-icon-btn { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--st-line); border-radius: 10px; background: #fff; color: var(--st-700); cursor: pointer; text-decoration: none; font-size: 13px; }
.st-icon-btn:hover { background: var(--st-50); }
.st-icon-btn.is-on { color: #fff; background: var(--st-600); border-color: var(--st-600); }
.st-icon-btn.is-danger { color: var(--st-danger); border-color: #f5c2c2; }
.st-icon-btn.is-danger:hover { background: #fef2f2; }

@media (max-width: 960px) {
    .st-home-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .st-col-hide { display: none; }
    .st-menu a { padding: 10px 11px; font-size: 14px; }
    .st-settings-head .st-btn { width: 100%; }
}
.st-toolbar .st-search { margin-left: auto; }
@media (max-width: 720px) { .st-toolbar .st-search { margin-left: 0; flex-basis: 100%; } }

/* ===== ความรู้: แท็บประเภท วิดีโอ / One Page / เอกสาร-บทความ ===== */
.st-ktabs a { display: inline-flex; align-items: center; gap: 6px; }
.st-media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.st-media-card { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--st-line); border-radius: var(--st-radius); background: #fff; color: inherit; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease; }
.st-media-card:hover { transform: translateY(-2px); box-shadow: var(--st-shadow); }
.st-media-thumb { position: relative; display: block; aspect-ratio: 16 / 9; background: linear-gradient(135deg, var(--st-700), var(--st-600)); overflow: hidden; }
.st-media-grid.is-onepage .st-media-thumb { aspect-ratio: 3 / 4; background: linear-gradient(135deg, #e6f4f0, #cfeee3); }
.st-media-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.st-media-grid.is-onepage .st-media-thumb img { object-position: top; }
.st-media-icon { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: rgba(3, 47, 42, .72); font-size: 20px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.st-media-grid.is-onepage .st-media-thumb img ~ .st-media-icon { display: none; }
.st-media-grid.is-onepage .st-media-icon { color: var(--st-700); background: #fff; }
.st-media-pin { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--st-600); font-size: 12px; }
.st-media-body { padding: 12px 14px 14px; }
.st-media-body strong { display: block; color: var(--st-800); font-size: 15px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.st-media-body small { display: block; margin-top: 4px; color: var(--st-muted); font-size: 12.5px; }
.st-video { margin-top: 18px; display: grid; gap: 10px; justify-items: start; }
.st-video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 14px; background: #000; }
.st-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.st-article.is-onepage .st-attachment img { max-height: none; width: 100%; object-fit: contain; }
.st-knowledge-box { margin: -4px 0 16px; padding: 14px 16px 2px; border-radius: 14px; background: var(--st-50); border: 1px solid var(--st-100); }
.st-knowledge-box .st-muted { margin: 0 0 12px; }
.st-field input[type=url] { width: 100%; padding: 10px 13px; border: 1px solid #cfdcd8; border-radius: 12px; font: inherit; font-size: 15px; background: #fff; }
@media (max-width: 720px) {
    .st-media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .st-media-body { padding: 10px; }
    .st-media-body strong { font-size: 14px; }
    .st-ktabs { width: 100%; overflow-x: auto; }
    .st-ktabs a { flex: none; }
}
