/* =====================================================================
   US Visa Guide — Stylesheet
   โทนสี: กรมท่า + แดงธงชาติสหรัฐฯ, ดีไซน์คลีน อ่านง่าย รองรับมือถือ
   ===================================================================== */

:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #14203a;
    --muted: #64748b;
    --border: #e4e8f0;
    --brand: #143a8a;
    --brand-dark: #0e2b6b;
    --brand-light: #eaf0ff;
    --accent: #c8102e;
    --ok: #0e9f6e;
    --ok-light: #e7f7f0;
    --warn: #b45309;
    --warn-light: #fef6e7;
    --danger: #b91c1c;
    --danger-light: #fdecec;
    --info: #1d4ed8;
    --info-light: #eaf0ff;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(16, 32, 64, .06);
    --shadow-md: 0 6px 24px rgba(16, 32, 64, .08);
    --shadow-lg: 0 18px 50px rgba(16, 32, 64, .12);
    --max: 1180px;
    --font: 'Sarabun', 'Noto Sans Thai', 'Leelawadee UI', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 16.5px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { line-height: 1.4; margin: 0 0 .6em; font-weight: 700; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; margin-top: 1.6em; }
h4 { font-size: 1.05rem; margin-top: 1.3em; }

p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin-bottom: .35em; }

code {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1px 6px;
    font-size: .88em;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }

.muted { color: var(--muted); }
.small { font-size: .9rem; }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.nowrap { white-space: nowrap; }

.bg-soft { background: var(--bg); }

/* ---------------- Layout ---------------- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 20px; }
.page { padding: 34px 0 70px; }
.page-narrow { max-width: 880px; margin: 0 auto; }

.section { margin-bottom: 44px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); }

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

/* ---------------- Header ---------------- */
.app-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.app-header .container { display: flex; align-items: center; gap: 18px; min-height: 66px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--text); text-decoration: none !important; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff; display: grid; place-items: center;
    font-weight: 800; font-size: .95rem; letter-spacing: .5px;
    box-shadow: 0 4px 12px rgba(20, 58, 138, .28);
}
.brand-text small { display: block; font-size: .72rem; color: var(--muted); font-weight: 500; letter-spacing: .2px; }

.main-nav { display: flex; gap: 2px; margin-left: 8px; flex: 1; flex-wrap: wrap; }
.main-nav a {
    padding: 8px 12px; border-radius: 9px; color: #334155;
    font-size: .94rem; font-weight: 500; text-decoration: none !important;
    transition: background .15s, color .15s;
}
.main-nav a:hover { background: var(--surface-2); color: var(--brand); }
.main-nav a.is-active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.nav-toggle {
    display: none; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; width: 42px; height: 42px; cursor: pointer; font-size: 1.2rem;
}

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
    font-family: inherit; font-size: .95rem; font-weight: 600;
    cursor: pointer; text-decoration: none !important; transition: all .15s;
    line-height: 1.4; white-space: nowrap;
}
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(20, 58, 138, .22); }
.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #a70d26; }
.btn-outline { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--brand); }
.btn-ghost:hover { background: var(--brand-light); }
.btn-success { background: var(--ok); color: #fff; }
.btn-lg { padding: 13px 26px; font-size: 1.02rem; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

.btn-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---------------- Cards ---------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-head { padding: 18px 22px; border-bottom: 1px solid var(--border); background: var(--surface); }
.card-head h2, .card-head h3 { margin: 0; font-size: 1.12rem; }
.card-head p { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }
.card-body { padding: 22px; }
.card-body > :last-child { margin-bottom: 0; }
.card-hover { transition: transform .18s, box-shadow .18s, border-color .18s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #cfd9ea; }
.card-link { display: block; color: inherit; text-decoration: none !important; }

/* ---------------- Hero ---------------- */
.hero {
    background:
        radial-gradient(1100px 420px at 88% -10%, rgba(200, 16, 46, .16), transparent 60%),
        linear-gradient(135deg, #0e2b6b 0%, #143a8a 52%, #1d4ed8 100%);
    color: #fff;
    padding: 58px 0 64px;
    position: relative;
    overflow: hidden;
}
.hero::after {
    content: ''; position: absolute; inset: auto -60px -120px auto; width: 380px; height: 380px;
    background: radial-gradient(circle, rgba(255,255,255,.12), transparent 65%); border-radius: 50%;
}
.hero-inner { max-width: 780px; position: relative; z-index: 1; }
.hero h1 { font-size: 2.45rem; margin-bottom: .4em; color: #fff; }
.hero p.lead { font-size: 1.1rem; color: rgba(255, 255, 255, .9); margin-bottom: 1.6em; }
.hero .badge { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.3); }
.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; margin-top: 30px; }
.hero-stat strong { display: block; font-size: 1.55rem; }
.hero-stat span { color: rgba(255,255,255,.78); font-size: .88rem; }

/* ---------------- Badges / pills ---------------- */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 999px;
    font-size: .8rem; font-weight: 600; line-height: 1.7;
    background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.badge-blue { background: var(--info-light); color: var(--brand); border-color: #cfdcff; }
.badge-green { background: var(--ok-light); color: #067a53; border-color: #c4ecd9; }
.badge-warn { background: var(--warn-light); color: var(--warn); border-color: #f5e0b8; }
.badge-danger { background: var(--danger-light); color: var(--danger); border-color: #f6cfcf; }
.badge-purple { background: #f3eeff; color: #6d28d9; border-color: #e0d4ff; }
.badge-orange { background: #fff3e6; color: #c2410c; border-color: #ffd9b3; }
.badge-slate { background: #eef1f6; color: #475569; border-color: #dbe1ea; }
.badge-rose { background: #ffeef2; color: #be123c; border-color: #ffd3dd; }
.badge-cyan { background: #e6f8fb; color: #0e7490; border-color: #bfeaf3; }
.badge-indigo { background: #eef0ff; color: #4338ca; border-color: #d6dbff; }
.badge-pink { background: #ffeef7; color: #be185d; border-color: #ffd3e8; }

/* ---------------- Callouts ---------------- */
.callout {
    border-radius: var(--radius-sm);
    padding: 15px 18px;
    margin: 20px 0;
    border-left: 4px solid var(--info);
    background: var(--info-light);
    font-size: .97rem;
}
.callout > :last-child { margin-bottom: 0; }
.callout strong:first-child { display: inline; }
.callout-tip { border-left-color: var(--ok); background: var(--ok-light); }
.callout-warn { border-left-color: var(--warn); background: var(--warn-light); }
.callout-danger { border-left-color: var(--danger); background: var(--danger-light); }
.callout-info { border-left-color: var(--info); background: var(--info-light); }
.callout ul, .callout ol { margin-bottom: .4em; }

/* ---------------- Tables ---------------- */
.table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: .95rem; }
.table th, .table td { padding: 11px 13px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { background: var(--surface-2); font-weight: 600; color: #334155; font-size: .88rem; white-space: nowrap; }
.table tbody tr:hover { background: #fbfcfe; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------------- Lists ---------------- */
.checklist { list-style: none; padding-left: 0; }
.checklist li { position: relative; padding-left: 30px; margin-bottom: .5em; }
.checklist li::before {
    content: '✓'; position: absolute; left: 0; top: 2px;
    width: 19px; height: 19px; border-radius: 50%;
    background: var(--ok-light); color: var(--ok);
    font-size: .72rem; font-weight: 700; display: grid; place-items: center;
}
.steps-list { counter-reset: sl; list-style: none; padding-left: 0; }
.steps-list > li { counter-increment: sl; position: relative; padding-left: 42px; margin-bottom: 1em; }
.steps-list > li::before {
    content: counter(sl); position: absolute; left: 0; top: 3px;
    width: 27px; height: 27px; border-radius: 9px;
    background: var(--brand-light); color: var(--brand);
    font-weight: 700; font-size: .85rem; display: grid; place-items: center;
}

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; color: #334155; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--border);
    border-radius: 10px; font-family: inherit; font-size: .97rem;
    background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}
.form-textarea { min-height: 110px; resize: vertical; }
.form-hint { font-size: .84rem; color: var(--muted); margin-top: 5px; }
.form-error { color: var(--danger); font-size: .86rem; margin-top: 5px; }

/* ---------------- Flash messages ---------------- */
.flash {
    border-radius: var(--radius-sm); padding: 13px 18px; margin-bottom: 18px;
    font-size: .95rem; border: 1px solid transparent; display: flex; gap: 10px; align-items: flex-start;
}
.flash-success { background: var(--ok-light); border-color: #c4ecd9; color: #067a53; }
.flash-error { background: var(--danger-light); border-color: #f6cfcf; color: var(--danger); }
.flash-info { background: var(--info-light); border-color: #cfdcff; color: var(--brand); }

/* ---------------- Progress ---------------- */
.progress { height: 9px; background: #e6ebf5; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--brand), #2f6bff); border-radius: 999px; transition: width .4s ease; }
.progress-label { display: flex; justify-content: space-between; font-size: .84rem; color: var(--muted); margin-bottom: 6px; }

.progress-ring { position: relative; width: 96px; height: 96px; flex: 0 0 auto; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring .value {
    position: absolute; inset: 0; display: grid; place-items: center;
    font-weight: 700; font-size: 1.15rem; color: var(--brand);
}

/* ---------------- Guide layout ---------------- */
.guide-layout { display: grid; grid-template-columns: 296px minmax(0, 1fr); gap: 28px; align-items: start; }
.sidebar { position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto; padding-right: 4px; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: #d7dee9; border-radius: 3px; }

.sidebar-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-sm); }
.sidebar-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.sidebar-group { margin-bottom: 14px; }
.sidebar-group > .group-title {
    font-size: .8rem; font-weight: 700; color: var(--brand);
    padding: 6px 4px; margin-bottom: 2px; border-bottom: 1px dashed var(--border);
}
.sidebar-link {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 8px 10px; border-radius: 9px; font-size: .89rem;
    color: #334155; text-decoration: none !important; line-height: 1.5;
    transition: background .13s;
}
.sidebar-link:hover { background: var(--surface-2); }
.sidebar-link.is-active { background: var(--brand-light); color: var(--brand); font-weight: 600; }
.sidebar-link .num {
    flex: 0 0 22px; width: 22px; height: 22px; border-radius: 7px;
    background: #eef1f6; color: #475569; font-size: .74rem; font-weight: 700;
    display: grid; place-items: center; margin-top: 2px;
}
.sidebar-link.is-active .num { background: var(--brand); color: #fff; }
.sidebar-link.is-done .num { background: var(--ok-light); color: var(--ok); }
.sidebar-link.is-done .num::after { content: '✓'; }
.sidebar-link.is-done .num span { display: none; }

.step-header { margin-bottom: 26px; }
.step-header .step-kicker { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.step-header h1 { margin-bottom: .35em; }
.step-header .lead { font-size: 1.05rem; color: var(--muted); margin: 0; }

.content-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 34px; box-shadow: var(--shadow-sm); }
.content-card > h3:first-child { margin-top: 0; }

.step-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 26px; }
.step-nav a {
    flex: 1; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 13px 16px; text-decoration: none !important;
    transition: border-color .15s, transform .15s;
}
.step-nav a:hover { border-color: var(--brand); transform: translateY(-2px); }
.step-nav a.next { text-align: right; }
.step-nav .nav-label { font-size: .78rem; color: var(--muted); display: block; }
.step-nav .nav-title { font-weight: 600; color: var(--text); font-size: .95rem; }
.step-nav a:hover .nav-title { color: var(--brand); }

.mobile-steps { display: none; margin-bottom: 18px; }

/* ---------------- Task checklist ---------------- */
.task-list { list-style: none; padding: 0; margin: 0; }
.task-item {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    margin-bottom: 9px; background: var(--surface); transition: background .15s, border-color .15s;
}
.task-item:hover { border-color: #cfd9ea; background: #fcfdff; }
.task-item.is-done { background: var(--ok-light); border-color: #c4ecd9; }
.task-item.is-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-check { flex: 0 0 auto; margin-top: 4px; }
.task-check input { width: 19px; height: 19px; accent-color: var(--ok); cursor: pointer; }
.task-title { font-weight: 600; font-size: .97rem; }
.task-desc { font-size: .87rem; color: var(--muted); margin-top: 2px; }
.task-cat { font-size: .74rem; color: var(--muted); }

.task-group-title { font-weight: 700; font-size: .98rem; margin: 22px 0 10px; display: flex; align-items: center; gap: 9px; }
.task-group-title .count { font-size: .78rem; color: var(--muted); font-weight: 500; }

/* ---------------- Steps overview ---------------- */
.phase-block { margin-bottom: 30px; }
.phase-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 1.08rem; font-weight: 700; margin-bottom: 14px; color: var(--brand);
}
.phase-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.step-card {
    display: flex; gap: 16px; padding: 18px 20px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none !important; color: inherit; transition: all .16s; margin-bottom: 12px;
}
.step-card:hover { border-color: #c3d0e8; box-shadow: var(--shadow-md); transform: translateX(3px); }
.step-card .step-num {
    flex: 0 0 40px; width: 40px; height: 40px; border-radius: 12px;
    background: var(--brand-light); color: var(--brand); font-weight: 700;
    display: grid; place-items: center; font-size: .95rem;
}
.step-card.is-done .step-num { background: var(--ok-light); color: var(--ok); }
.step-card h3 { margin: 0 0 4px; font-size: 1.03rem; }
.step-card p { margin: 0; color: var(--muted); font-size: .91rem; }
.step-card .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 9px; }

/* ---------------- Accordion (FAQ) ---------------- */
.accordion { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.accordion-item + .accordion-item { border-top: 1px solid var(--border); }
.accordion-trigger {
    width: 100%; text-align: left; background: none; border: none; cursor: pointer;
    padding: 16px 20px; font-family: inherit; font-size: .98rem; font-weight: 600;
    color: var(--text); display: flex; justify-content: space-between; gap: 14px; align-items: flex-start;
}
.accordion-trigger:hover { background: var(--surface-2); }
.accordion-trigger .chev { flex: 0 0 auto; color: var(--muted); transition: transform .2s; }
.accordion-item.is-open .accordion-trigger .chev { transform: rotate(180deg); }
.accordion-panel { display: none; padding: 0 20px 18px; color: #334155; font-size: .95rem; }
.accordion-item.is-open .accordion-panel { display: block; }
.accordion-panel > :last-child { margin-bottom: 0; }

/* ---------------- Stats / dashboard ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.stat .label { font-size: .84rem; color: var(--muted); }
.stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1.3; }
.stat .sub { font-size: .82rem; color: var(--muted); }

.dash-hero {
    background: linear-gradient(135deg, #143a8a, #1d4ed8);
    color: #fff; border-radius: var(--radius); padding: 26px 28px; margin-bottom: 24px;
    display: flex; gap: 26px; align-items: center; flex-wrap: wrap; justify-content: space-between;
}
.dash-hero h1 { color: #fff; margin: 0 0 6px; font-size: 1.6rem; }
.dash-hero p { margin: 0; color: rgba(255,255,255,.85); }
.dash-hero .progress { background: rgba(255,255,255,.22); }
.dash-hero .progress-bar { background: #fff; }
.dash-hero .progress-label { color: rgba(255,255,255,.85); }

/* ---------------- Visa cards ---------------- */
.visa-card { display: flex; flex-direction: column; height: 100%; }
.visa-card .visa-icon {
    width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
    font-size: 1.3rem; background: var(--brand-light); color: var(--brand); margin-bottom: 14px;
}
.visa-card h3 { margin: 0 0 4px; font-size: 1.08rem; }
.visa-card .visa-en { font-size: .84rem; color: var(--muted); margin-bottom: 10px; }
.visa-card .visa-tagline { color: #334155; font-size: .93rem; flex: 1; }
.visa-card .visa-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0; }
.visa-card .visa-foot { border-top: 1px solid var(--border); padding-top: 13px; margin-top: auto; display: flex; gap: 10px; align-items: center; justify-content: space-between; }

.price-tag { font-weight: 700; color: var(--brand); }

/* ---------------- Misc ---------------- */
.empty-state { text-align: center; padding: 54px 22px; color: var(--muted); }
.empty-state .icon { font-size: 2.4rem; margin-bottom: 12px; }

.breadcrumb { display: flex; gap: 8px; font-size: .86rem; color: var(--muted); margin-bottom: 16px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb span.sep { opacity: .6; }

.note-box { background: var(--surface-2); border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 14px; margin-top: 22px; }
.note-box textarea { width: 100%; border: none; background: transparent; font-family: inherit; font-size: .93rem; resize: vertical; min-height: 70px; outline: none; }
.note-status { font-size: .8rem; color: var(--ok); }

.search-bar { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.search-bar .form-input { flex: 1; min-width: 220px; }

.alpha-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 22px; }
.alpha-nav a {
    width: 32px; height: 32px; display: grid; place-items: center;
    border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
    font-size: .85rem; font-weight: 600; color: var(--muted); text-decoration: none !important;
}
.alpha-nav a:hover { border-color: var(--brand); color: var(--brand); }

.term { padding: 16px 0; border-bottom: 1px solid var(--border); }
.term h3 { margin: 0 0 4px; font-size: 1rem; }
.term .term-th { color: var(--brand); font-size: .9rem; margin-bottom: 6px; }
.term p { margin: 0; font-size: .93rem; color: #334155; }

.resource-item { display: flex; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.resource-item .r-icon { flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; background: var(--brand-light); color: var(--brand); display: grid; place-items: center; }
.resource-item h3 { margin: 0 0 3px; font-size: .98rem; }
.resource-item p { margin: 0; font-size: .89rem; color: var(--muted); }
.resource-item .url { font-size: .8rem; color: var(--brand); word-break: break-all; }

/* ---------------- Footer ---------------- */
.app-footer { background: #0e1a33; color: #a9b6cc; padding: 40px 0 26px; margin-top: 40px; font-size: .9rem; }
.app-footer h4 { color: #fff; font-size: .95rem; margin-bottom: 12px; }
.app-footer a { color: #c7d3e6; text-decoration: none; }
.app-footer a:hover { color: #fff; text-decoration: underline; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 26px; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.12); margin-top: 26px; padding-top: 18px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: .84rem; }

/* ---------------- Admin ---------------- */
.admin-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 24px; align-items: start; }
.admin-nav { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; position: sticky; top: 84px; }
.admin-nav a { display: block; padding: 9px 12px; border-radius: 9px; color: #334155; font-size: .92rem; text-decoration: none !important; }
.admin-nav a:hover { background: var(--surface-2); }
.admin-nav a.is-active { background: var(--brand-light); color: var(--brand); font-weight: 600; }

/* ---------------- Print ---------------- */
.print-body { background: #fff; color: #000; font-size: 12pt; }
.print-body .print-head { border-bottom: 2px solid #000; padding-bottom: 10px; margin-bottom: 18px; }
.print-body h1 { font-size: 18pt; }
.print-body h2 { font-size: 13pt; margin-top: 18px; border-bottom: 1px solid #ccc; padding-bottom: 4px; }
.print-body ul { list-style: none; padding-left: 0; }
.print-body li { margin-bottom: 6px; padding-left: 22px; position: relative; }
.print-body li::before { content: '☐'; position: absolute; left: 0; }
.print-actions { display: flex; gap: 10px; margin-bottom: 20px; }
/* ---------------- การพิมพ์ ---------------- */
@media print {
    @page { margin: 15mm; }
    body.print-body { padding: 0 !important; background: #fff; }
    .print-actions { display: none !important; }
    .print-head { border-bottom: 2px solid #000; padding-bottom: 8px; margin-bottom: 14px; }
    /* อย่าให้หัวข้อแยกจากเนื้อหาที่ตามมา และอย่าให้รายการถูกตัดกลางหน้า */
    h1, h2, .print-head { page-break-after: avoid; break-after: avoid; }
    li, tr { page-break-inside: avoid; break-inside: avoid; }
    .table { page-break-inside: avoid; break-inside: avoid; }
    a { text-decoration: none; color: #000; }
}

/* ---------------- Responsive ---------------- */
@media (max-width: 1080px) {
    .guide-layout { grid-template-columns: 250px minmax(0, 1fr); gap: 20px; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .main-nav {
        display: none; position: absolute; top: 66px; left: 0; right: 0;
        background: var(--surface); border-bottom: 1px solid var(--border);
        flex-direction: column; padding: 12px 16px; box-shadow: var(--shadow-md); gap: 2px;
    }
    .main-nav.is-open { display: flex; }
    .main-nav a { padding: 11px 12px; }
    .nav-toggle { display: grid; place-items: center; }
    .header-actions .btn { padding: 8px 12px; font-size: .86rem; }
    .brand-text small { display: none; }

    .guide-layout { grid-template-columns: 1fr; }
    .sidebar { display: none; }
    .mobile-steps { display: block; }
    .content-card { padding: 22px 18px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .hero { padding: 40px 0 44px; }
    .hero h1 { font-size: 1.75rem; }
    .admin-layout { grid-template-columns: 1fr; }
    .admin-nav { position: static; display: flex; gap: 6px; overflow-x: auto; }
    .admin-nav a { white-space: nowrap; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .step-nav { flex-direction: column; }
    .dash-hero { padding: 20px; }
    .table { font-size: .88rem; }
    .table th, .table td { padding: 9px 10px; }
}

@media (max-width: 520px) {
    body { font-size: 16px; }
    .stat-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; }
    .content-card { padding: 18px 15px; }
    .hero h1 { font-size: 1.5rem; }
    .btn { padding: 9px 15px; font-size: .9rem; }
    .step-card { flex-direction: column; gap: 10px; }
}
