/* Solar ภาคประชาชน — ระบบหน้าจอ (ไม่ต้อง build) */
@font-face { font-family: 'Sarabun'; src: url('../fonts/Sarabun-Regular.ttf') format('truetype'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Sarabun'; src: url('../fonts/Sarabun-Bold.ttf') format('truetype'); font-weight: 600 700; font-display: swap; }

:root {
    --bg: #f4f6f5; --card: #ffffff; --fg: #15201b; --muted: #66736d; --line: #e3e8e5; --line2: #eef2f0;
    --primary: #166a48; --primary-600: #12583c; --primary-50: #e8f3ee; --primary-100: #d2e9de;
    --yellow: #f2b544; --yellow-50: #fef6e4; --danger: #c93a3a; --danger-50: #fdeeee;
    --info: #2563eb; --radius: 12px; --radius-sm: 8px; --shadow: 0 1px 2px rgba(16, 24, 20, .05), 0 1px 3px rgba(16, 24, 20, .06);
    --shadow-lg: 0 10px 30px rgba(16, 24, 20, .14); --side: 256px; --top: 56px; --fs: 15px;
    --input-bg: #fff; --hover: #f1f5f3; --sidebar: #0f2a1f; --sidebar-fg: #cfe0d7; --sidebar-active: #1d4d38;
    color-scheme: light;
}
:root.dark {
    --bg: #0c1210; --card: #121a17; --fg: #e6eeea; --muted: #94a39c; --line: #22302a; --line2: #1a2622;
    --primary: #2fa572; --primary-600: #28925f; --primary-50: #13261e; --primary-100: #18352a;
    --yellow-50: #2a2210; --danger-50: #2a1414; --input-bg: #0f1714; --hover: #18221e; --sidebar: #08110d; --sidebar-active: #173b2b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4); color-scheme: dark;
}
:root.text-lg { --fs: 17px; } :root.text-xl { --fs: 19px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Sarabun', 'Leelawadee UI', 'Noto Sans Thai', system-ui, sans-serif; background: var(--bg); color: var(--fg); line-height: 1.5; }
a { color: var(--primary); text-decoration: none; } a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; } h1 { font-size: 1.45rem; font-weight: 700; } h2 { font-size: 1.02rem; font-weight: 700; } h3 { font-size: .95rem; font-weight: 700; }
p { margin: .25rem 0; } small, .sm { font-size: .82rem; } .xs { font-size: .74rem; }
.muted { color: var(--muted); } .ok { color: #13844f; } .warn { color: #b7791f; } .bad { color: var(--danger); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .85em; } .nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.pre { white-space: pre-line; } .break { word-break: break-word; } .b { font-weight: 700; } .hide { display: none !important; }
.ic { width: 1.1em; height: 1.1em; flex-shrink: 0; vertical-align: -.18em; } .ic.lg { width: 1.4em; height: 1.4em; } .ic.xl { width: 2em; height: 2em; }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
hr { border: 0; border-top: 1px solid var(--line); margin: 1rem 0; }

/* ===== layout ===== */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--sidebar); color: var(--sidebar-fg); display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.sidebar .brand { display: flex; align-items: center; gap: .6rem; padding: 0 1rem; height: var(--top); color: #fff; font-weight: 700; border-bottom: 1px solid rgba(255, 255, 255, .06); }
.sidebar .brand .logo { width: 32px; height: 32px; border-radius: 9px; background: var(--yellow); color: #13261e; display: grid; place-items: center; }
.sidebar .brand small { display: block; font-weight: 400; color: #9fbfb0; font-size: .72rem; line-height: 1.1; }
.sidebar nav { flex: 1; overflow-y: auto; padding: .5rem .55rem 1rem; }
.sidebar .grp { margin-top: .9rem; } .sidebar .grp > div { font-size: .7rem; letter-spacing: .04em; color: #7fa392; padding: 0 .6rem .3rem; text-transform: uppercase; }
.sidebar a.it { display: flex; align-items: center; gap: .65rem; padding: .48rem .65rem; border-radius: 8px; color: var(--sidebar-fg); font-size: .92rem; }
.sidebar a.it:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.sidebar a.it.on { background: var(--sidebar-active); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--yellow); }
.sidebar a.it .cnt { margin-left: auto; background: var(--yellow); color: #13261e; border-radius: 99px; font-size: .7rem; padding: 0 .45rem; font-weight: 700; }
.sidebar .me { border-top: 1px solid rgba(255, 255, 255, .06); padding: .7rem .9rem; display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.sidebar .me .av { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700; }
.sidebar .me .nm { flex: 1; min-width: 0; } .sidebar .me .nm b { display: block; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .me a { color: #9fbfb0; } .sidebar .me a:hover { color: #fff; }
.main { margin-left: var(--side); min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top); display: flex; align-items: center; gap: .75rem; padding: 0 1.25rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .crumb { flex: 1; min-width: 0; font-size: .9rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .iconbtn { position: relative; }
.topbar .dot { position: absolute; top: 2px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .66rem; display: grid; place-items: center; font-weight: 700; }
.content { padding: 1.25rem; max-width: 1400px; margin: 0 auto; }
.menu-btn { display: none; }
.scrim { display: none; }
#progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--yellow); z-index: 200; transition: width .3s, opacity .4s; }
@media (max-width: 1023px) {
    .sidebar { transform: translateX(-100%); } .app.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
    .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
    .main { margin-left: 0; } .menu-btn { display: inline-flex; } .content { padding: 1rem .8rem 5rem; }
}

/* ===== page header ===== */
.ph { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.ph .t { min-width: 0; } .ph .t .row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ph .back { display: inline-flex; align-items: center; gap: .2rem; font-size: .85rem; color: var(--muted); margin-bottom: .2rem; }
.ph .acts { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* ===== card / panel ===== */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card > .hd { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.card > .hd .sub { font-size: .78rem; color: var(--muted); font-weight: 400; }
.card > .bd { padding: 1rem; } .card > .bd.flush { padding: 0; }
.stack { display: flex; flex-direction: column; gap: 1rem; } .stack.sm { gap: .5rem; } .stack.xs { gap: .3rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; } .row.between { justify-content: space-between; } .row.nowrap { flex-wrap: nowrap; } .row.top { align-items: flex-start; } .grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 1rem; } .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); } .g4.keep, .g2.keep { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* stat tiles */
.stat { padding: .85rem 1rem; } .stat .l { font-size: .8rem; color: var(--muted); } .stat .v { font-size: 1.55rem; font-weight: 700; line-height: 1.2; margin-top: .15rem; } .stat .h { font-size: .75rem; color: var(--muted); }
a.card.stat:hover { border-color: var(--primary); text-decoration: none; }
.stat.warn .v { color: #b7791f; } .stat.bad .v { color: var(--danger); } .stat.ok .v { color: var(--primary); }

/* ===== buttons ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .9rem; border-radius: var(--radius-sm); border: 1px solid var(--primary); background: var(--primary); color: #fff; font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; white-space: nowrap; line-height: 1.25; text-decoration: none !important; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--primary-600); } .btn:disabled, .btn.busy { opacity: .55; pointer-events: none; }
.btn.out { background: var(--card); color: var(--fg); border-color: var(--line); } .btn.out:hover { background: var(--hover); }
.btn.ghost { background: transparent; color: var(--fg); border-color: transparent; } .btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); } .btn.danger.out { background: var(--card); color: var(--danger); border-color: #efc4c4; } .btn.danger.out:hover { background: var(--danger-50); }
.btn.yellow { background: var(--yellow); border-color: var(--yellow); color: #13261e; }
.btn.sm { padding: .32rem .6rem; font-size: .82rem; } .btn.lg { padding: .75rem 1.1rem; font-size: 1rem; } .btn.block { width: 100%; }
.btn.icon { padding: .45rem; } .iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; border: 0; background: transparent; color: var(--fg); cursor: pointer; }
.iconbtn:hover { background: var(--hover); }
.linkbtn { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; } .linkbtn:hover { text-decoration: underline; } .linkbtn.muted { color: var(--muted); }

/* ===== forms ===== */
.f { display: flex; flex-direction: column; gap: .3rem; font-size: .88rem; min-width: 0; } .f > span.lb { font-weight: 600; } .f .req { color: var(--danger); }
.in, .f input:not([type=checkbox]):not([type=radio]):not([type=file]), .f select, .f textarea, select.in, textarea.in {
    width: 100%; font: inherit; font-size: .92rem; color: var(--fg); background: var(--input-bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .5rem .65rem; outline: none; transition: border-color .15s, box-shadow .15s; }
.in:focus, .f input:focus, .f select:focus, .f textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-100); }
.f input:disabled, .f select:disabled { opacity: .6; } textarea { resize: vertical; min-height: 4.5rem; }
.f .hint { font-size: .76rem; color: var(--muted); } .err { color: var(--danger); font-size: .78rem; margin: 0; } .has-err input, .has-err select, .has-err textarea { border-color: var(--danger) !important; }
.chk { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .9rem; } .chk input { width: 1.05rem; height: 1.05rem; accent-color: var(--primary); }
.form-grid { display: grid; gap: .85rem 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-grid .full { grid-column: 1 / -1; }
@media (max-width: 700px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.search { position: relative; } .search .ic { position: absolute; left: .65rem; top: 50%; transform: translateY(-50%); color: var(--muted); } .search input { padding-left: 2rem !important; }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; } .filters .in { width: auto; min-width: 10rem; }

/* ===== tables ===== */
.tbl-wrap { overflow-x: auto; } table.tbl { width: 100%; border-collapse: collapse; font-size: .88rem; }
.tbl th { text-align: left; font-weight: 600; font-size: .76rem; color: var(--muted); background: var(--line2); padding: .55rem .8rem; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: .6rem .8rem; border-bottom: 1px solid var(--line2); vertical-align: top; } .tbl tr:last-child td { border-bottom: 0; }
.tbl tr.link { cursor: pointer; } .tbl tr.link:hover td { background: var(--hover); } .tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tfoot td { font-weight: 700; background: var(--line2); } .tbl .empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.tbl.compact td, .tbl.compact th { padding: .4rem .6rem; }
@media (max-width: 700px) { .tbl.cards thead { display: none; } .tbl.cards tr { display: block; padding: .6rem .8rem; border-bottom: 1px solid var(--line); } .tbl.cards td { display: flex; gap: .5rem; padding: .15rem 0; border: 0; } .tbl.cards td::before { content: attr(data-l); color: var(--muted); font-size: .76rem; min-width: 6.5rem; } .tbl.cards td.num { justify-content: flex-start; } }
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem; padding: .7rem 1rem; font-size: .84rem; border-top: 1px solid var(--line); }
.pager .pg { display: flex; gap: .25rem; flex-wrap: wrap; } .pager .pg a, .pager .pg span { min-width: 2rem; padding: .2rem .5rem; text-align: center; border: 1px solid var(--line); border-radius: 7px; color: var(--fg); }
.pager .pg a:hover { background: var(--hover); text-decoration: none; } .pager .pg .on { background: var(--primary); border-color: var(--primary); color: #fff; } .pager .pg .off { opacity: .4; }

/* ===== badges / tones ===== */
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .1rem .55rem; border-radius: 99px; font-size: .74rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1.5; }
.badge.md { font-size: .85rem; padding: .2rem .75rem; }
.t-gray { background: #f1f3f2; color: #4a5550; border-color: #e2e6e4; } .t-blue { background: #eaf1fe; color: #1d4ed8; border-color: #cfdffb; } .t-indigo { background: #eef0fe; color: #4338ca; border-color: #d9dcfb; }
.t-purple { background: #f4edfe; color: #7e22ce; border-color: #e6d6fb; } .t-yellow { background: #fef6e4; color: #92600a; border-color: #f8e2b1; } .t-orange { background: #fff1e6; color: #c2410c; border-color: #fdd7bd; }
.t-red { background: #fdeeee; color: #b42318; border-color: #f7cfcf; } .t-teal { background: #e6f7f5; color: #0f766e; border-color: #c4ebe6; } .t-green { background: #e8f6ee; color: #11704a; border-color: #c8e8d6; }
:root.dark .badge { filter: saturate(.9); } :root.dark .t-gray { background: #1d2723; color: #b3c0ba; border-color: #2b3833; }
:root.dark [class*=" t-"]:not(.t-gray), :root.dark [class^="t-"]:not(.t-gray) { background: color-mix(in srgb, currentColor 14%, transparent); border-color: color-mix(in srgb, currentColor 28%, transparent); }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .3rem .7rem; border-radius: 99px; background: var(--line2); color: var(--muted); font-size: .84rem; border: 0; cursor: pointer; font: inherit; font-size: .84rem; white-space: nowrap; }
.chip:hover { background: var(--hover); color: var(--fg); text-decoration: none; } .chip.on { background: var(--primary); color: #fff; } .chip .n { background: var(--card); color: var(--fg); border-radius: 99px; padding: 0 .4rem; font-size: .72rem; } .chip.on .n { background: rgba(255, 255, 255, .22); color: #fff; }
.chips { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .2rem; margin-bottom: .8rem; }
.alert { padding: .7rem .9rem; border-radius: var(--radius-sm); font-size: .88rem; border: 1px solid; display: flex; gap: .5rem; align-items: flex-start; }
.alert.warn { background: var(--yellow-50); border-color: #f3dca6; color: #7a5208; } .alert.bad { background: var(--danger-50); border-color: #f2c9c9; color: #9b1c1c; } .alert.info { background: #eef4ff; border-color: #d3e0fb; color: #1e3a8a; } .alert.ok { background: var(--primary-50); border-color: var(--primary-100); color: var(--primary); }
:root.dark .alert { background: color-mix(in srgb, currentColor 10%, transparent); }

/* ===== info list / kv ===== */
dl.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem 1.25rem; margin: 0; } dl.kv.one { grid-template-columns: minmax(0, 1fr); }
dl.kv dt { font-size: .74rem; color: var(--muted); } dl.kv dd { margin: .1rem 0 0; font-size: .9rem; word-break: break-word; }
@media (max-width: 600px) { dl.kv { grid-template-columns: minmax(0, 1fr); } }

/* ===== stepper / timeline ===== */
.stepper { display: flex; overflow-x: auto; gap: 0; padding: .2rem 0 .3rem; font-size: .84rem; }
.stepper .s { flex: 1; display: flex; align-items: center; gap: .45rem; min-width: max-content; } .stepper .s:not(:last-child)::after { content: ''; flex: 1; height: 2px; min-width: 1rem; margin: 0 .5rem; background: var(--line); }
.stepper .s.done:not(:last-child)::after { background: var(--primary); }
.stepper .n { width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line); font-weight: 700; color: var(--muted); font-size: .78rem; flex-shrink: 0; }
.stepper .done .n { background: var(--primary); border-color: var(--primary); color: #fff; } .stepper .cur .n { background: var(--yellow); border-color: var(--yellow); color: #13261e; } .stepper .cur { font-weight: 700; } .stepper .s:not(.cur) .lb { color: var(--muted); }
.stepper .stop .n { background: var(--danger); border-color: var(--danger); color: #fff; } .stepper .stop { font-weight: 700; }
.callout { border-radius: 12px; padding: .75rem 1rem; margin-bottom: 1rem; display: flex; gap: .6rem; align-items: flex-start; flex-wrap: wrap; background: var(--line2); }
.callout.ok { background: color-mix(in srgb, var(--primary) 12%, transparent); } .callout.warn { background: var(--yellow-50); } .callout.bad { background: var(--danger-50); } .callout .grow { flex: 1; min-width: 12rem; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: .9rem; }
.timeline li { position: relative; } .timeline li::before { content: ''; position: absolute; left: calc(-1.1rem - 6px); top: .45rem; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); border: 2px solid var(--card); }
.timeline .note { background: var(--line2); border-radius: 8px; padding: .35rem .6rem; font-size: .86rem; margin-top: .25rem; white-space: pre-line; }

/* ===== attachments ===== */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.thumbs a { position: relative; display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; aspect-ratio: 1; background: var(--line2); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; } .thumbs .file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; height: 100%; padding: .4rem; text-align: center; font-size: .7rem; color: var(--muted); word-break: break-all; }
.thumbs .cap { position: absolute; inset: auto 0 0 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: .66rem; padding: .1rem .3rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumbs .del { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .55); color: #fff; cursor: pointer; display: grid; place-items: center; }
.upload { position: relative; overflow: hidden; } .upload input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.empty { border: 1px dashed var(--line); border-radius: var(--radius-sm); padding: 1.6rem 1rem; text-align: center; color: var(--muted); font-size: .88rem; }

/* ===== tabs ===== */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; overflow-x: auto; }
.tabs button, .tabs a { padding: .55rem .85rem; border: 0; background: none; font: inherit; font-size: .9rem; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; } .tabs a:hover { text-decoration: none; color: var(--fg); }

/* ===== dialog / toast ===== */
.dlg-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(10, 20, 15, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 1rem 1rem; overflow-y: auto; animation: fade .15s; }
.dlg { width: 100%; max-width: 480px; background: var(--card); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pop .18s; } .dlg.wide { max-width: 760px; } .dlg.xwide { max-width: 1000px; }
.dlg .hd { padding: 1rem 1.2rem .4rem; } .dlg .hd p { color: var(--muted); font-size: .86rem; } .dlg .bd { padding: .6rem 1.2rem 1rem; } .dlg .ft { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.2rem 1.1rem; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }
@media (max-width: 600px) { .dlg-wrap { padding: 0; align-items: flex-end; } .dlg { border-radius: 16px 16px 0 0; max-height: 92vh; overflow-y: auto; } }
#toasts { position: fixed; z-index: 150; left: 50%; bottom: 1.5rem; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; width: min(440px, calc(100% - 1.5rem)); }
.toast { display: flex; gap: .55rem; align-items: flex-start; padding: .75rem .9rem; border-radius: 10px; color: #fff; background: var(--primary); box-shadow: var(--shadow-lg); font-size: .9rem; animation: pop .2s; } .toast.error { background: var(--danger); } .toast button { margin-left: auto; background: none; border: 0; color: #fff; cursor: pointer; padding: 0; }
.m-layout #toasts { bottom: 5.5rem; }

/* ===== list items ===== */
.list { display: flex; flex-direction: column; } .list > * { padding: .7rem 1rem; border-bottom: 1px solid var(--line2); display: flex; gap: .7rem; align-items: center; color: var(--fg); }
.list > *:last-child { border-bottom: 0; } .list > a:hover { background: var(--hover); text-decoration: none; }
.list .unread { background: var(--primary-50); }

/* ===== auth / public ===== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth .art { background: radial-gradient(circle at 20% 20%, #1f7a55, #0f2a1f 70%); color: #e8f3ee; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .art::after { content: ''; position: absolute; width: 420px; height: 420px; right: -120px; bottom: -120px; border-radius: 50%; background: radial-gradient(circle, rgba(242, 181, 68, .55), transparent 65%); }
.auth .art h1 { font-size: 2.1rem; color: #fff; } .auth .art p { color: #b9d6c8; max-width: 26rem; }
.auth .pane { display: flex; align-items: center; justify-content: center; padding: 2rem 1.2rem; } .auth .box { width: 100%; max-width: 380px; }
@media (max-width: 900px) { .auth { grid-template-columns: 1fr; } .auth .art { display: none; } }
.public { max-width: 720px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.public .top { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; font-weight: 700; } .public .top .logo { width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; }

/* ===== mobile (หน้างาน) ===== */
.m-layout { max-width: 640px; margin: 0 auto; min-height: 100vh; padding-bottom: 5rem; }
.m-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem; padding: .55rem .8rem; background: var(--primary); color: #fff; }
.m-top a, .m-top button { color: #fff; } .m-top .t { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-top .iconbtn:hover { background: rgba(255, 255, 255, .12); }
.m-body { padding: .8rem; display: flex; flex-direction: column; gap: .8rem; }
.m-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: flex; justify-content: center; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.m-nav > div { display: flex; width: 100%; max-width: 640px; } .m-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem 0 .45rem; font-size: .72rem; color: var(--muted); }
.m-nav a.on { color: var(--primary); font-weight: 700; } .m-nav a:hover { text-decoration: none; }
.m-banner { background: var(--yellow-50); color: #7a5208; font-size: .82rem; padding: .45rem .8rem; display: flex; gap: .5rem; align-items: center; }
.m-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .9rem; } .m-card.link { display: block; color: var(--fg); } .m-card.link:hover { border-color: var(--primary); text-decoration: none; }
.m-layout .btn { padding: .75rem 1rem; font-size: 1rem; } .m-layout .f input, .m-layout .f select, .m-layout .f textarea { font-size: 1rem; padding: .7rem .75rem; }
.sig-pad { position: relative; border: 2px dashed var(--line); border-radius: 12px; background: #fff; } .sig-pad canvas { width: 100%; height: 180px; touch-action: none; display: block; }
.sig-pad .ph { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa5a0; pointer-events: none; margin: 0; }

/* ===== portal (ลูกค้า) ===== */
.portal { max-width: 760px; margin: 0 auto; padding: 0 0 3rem; } .portal .p-top { display: flex; align-items: center; gap: .6rem; padding: .9rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.portal .p-top .logo { width: 34px; height: 34px; border-radius: 10px; background: var(--primary); color: #fff; display: grid; place-items: center; } .portal .p-body { padding: 1rem; display: flex; flex-direction: column; gap: 1rem; }

/* survey / checklist */
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .4rem; } .check-list li { display: flex; gap: .5rem; align-items: flex-start; font-size: .9rem; }
.steps-nav { display: flex; gap: .3rem; overflow-x: auto; } .steps-nav button { flex: 1; min-width: max-content; padding: .45rem .6rem; border-radius: 9px; border: 1px solid var(--line); background: var(--card); font: inherit; font-size: .8rem; cursor: pointer; color: var(--muted); }
.steps-nav button.on { background: var(--primary); border-color: var(--primary); color: #fff; } .steps-nav button.done { border-color: var(--primary); color: var(--primary); }
.bar { height: 8px; border-radius: 99px; background: var(--line2); overflow: hidden; } .bar > i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .3rem; }
.code { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; background: var(--line2); padding: .6rem .8rem; border-radius: 8px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.richtext { font-size: .92rem; } .richtext h1 { font-size: 1.15rem; text-align: center; } .richtext table { border-collapse: collapse; } .richtext td, .richtext th { border: 1px solid var(--line); padding: .25rem .45rem; }
.scroll-box { max-height: 60vh; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }

@media print { .sidebar, .topbar, .m-nav, .m-top, .ph .acts, #toasts, .no-print { display: none !important; } .main { margin: 0; } .content { padding: 0; } .card { box-shadow: none; } body { background: #fff; } }

/* ---------- รูปถ่ายงานสำรวจ: หน้าตั้งค่า + รายการรูปในฟอร์มมือถือ ---------- */
.photo-item { align-items: flex-start !important; }
.photo-item.dim { opacity: .45; }
.ph-thumb { position: relative; flex: none; width: 120px; }
.ph-thumb.busy { opacity: .5; pointer-events: none; }
.ph-img { display: block; width: 120px; aspect-ratio: 4 / 3; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line2); cursor: zoom-in; }
.ph-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph-up, .ph-reset { position: absolute; bottom: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(17, 24, 39, .72); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ph-up { right: 4px; } .ph-reset { right: 36px; }
.ph-up input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ph-up svg, .ph-reset svg { width: 15px; height: 15px; }
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shot { border: 1px solid var(--line); border-radius: 12px; padding: .65rem; display: flex; flex-direction: column; gap: .5rem; background: var(--card); }
.shot.done { border-color: var(--primary-100, #bbdfcd); background: var(--primary-50); }
.shot.miss { border-color: #f3c9c9; }
.shot-h { display: flex; gap: .6rem; align-items: flex-start; }
.shot-h .ph-img { width: 96px; }
.shot-n { font-size: .78rem; font-weight: 700; white-space: nowrap; }
.shot .thumbs { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }

/* ผลสำรวจบน desktop: รูปจัดตามรายการ */
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: .5rem; }
.pcell { position: relative; display: block; aspect-ratio: 4 / 3; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line2); color: var(--fg); }
.pcell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pcell.miss { border: 2px dashed #e5a3a3; background: var(--danger-50, #fdecec); }
.pempty { position: absolute; inset: 0 0 1.4rem 0; display: grid; place-items: center; text-align: center; font-size: .72rem; color: var(--muted); padding: .3rem; word-break: break-word; }
.pcell.miss .pempty { color: var(--danger, #b42318); font-weight: 700; }
.pcap { position: absolute; inset: auto 0 0 0; background: rgba(0, 0, 0, .6); color: #fff; font-size: .68rem; padding: .15rem .35rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcell:hover { text-decoration: none; }
