/*!
 * PlanOne Super App UI
 * ต่อจาก Bootstrap 5.3.3 เปลี่ยนสีได้เฉพาะ --sb-primary* และ --sb-grad-from/to (Theme.php)
 */
:root {
    --sb-primary: #F26522;
    --sb-primary-rgb: 242, 101, 34;
    --sb-primary-600: #d9530f;
    --sb-primary-700: #b0430c;
    --sb-primary-50: #fef3ed;
    --sb-primary-100: #fde6da;
    --sb-primary-200: #fbccb5;
    --sb-grad-from: #ff9a4d;
    --sb-grad-to: #ef5b1c;

    --sb-bg: #f4f5f7;
    --sb-card: #ffffff;
    --sb-border: #eceef2;
    --sb-border-soft: #f0f1f4;
    --sb-text: #1f2937;
    --sb-muted: #6b7280;
    --sb-subtle: #9ca3af;
    --sb-head-bg: #fafbfc;

    --sb-radius: 16px;
    --sb-radius-sm: 12px;
    --sb-radius-lg: 20px;
    --sb-radius-hero: 24px;
    --sb-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px rgba(16, 24, 40, .04);
    --sb-shadow-lg: 0 10px 30px rgba(16, 24, 40, .10);

    --sb-rail: 84px;
    --sb-topbar: 62px;
    --sb-bottom-nav: 66px;

    --sb-teal: #0d9488;
    --sb-blue: #2563eb;
    --sb-slate: #475569;
    --sb-success: #16a34a;
    --sb-warning: #d97706;
    --sb-danger: #dc2626;
    --sb-info: #0284c7;
    --sb-purple: #7c3aed;

    --bs-body-font-family: 'Sarabun', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-font-size: 15px;
    --bs-body-color: var(--sb-text);
    --bs-border-color: var(--sb-border);
    --bs-secondary-color: var(--sb-muted);
}

html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--bs-body-font-family);
    font-size: 15px;
    background: var(--sb-bg);
    color: var(--sb-text);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--sb-primary-600); text-decoration: none; }
a:hover { color: var(--sb-primary-700); }
.text-muted, .text-secondary { color: var(--sb-muted) !important; }
.text-primary { color: var(--sb-primary) !important; }
.bg-primary { background-color: var(--sb-primary) !important; }
.border-primary { border-color: var(--sb-primary) !important; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.small-xs { font-size: .78rem; }
.text-xs { font-size: .74rem; }
.tabular { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
::selection { background: var(--sb-primary-100); }

/* ------------------------------------------------------------------ rail */
.sb-rail {
    position: fixed; inset: 0 auto 0 0; width: var(--sb-rail); z-index: 1030;
    background: #fff; border-right: 1px solid var(--sb-border);
    display: flex; flex-direction: column; align-items: center;
    padding: .85rem 0 .9rem;
}
.sb-logo {
    width: 48px; height: 48px; border-radius: 14px; flex: 0 0 auto;
    display: grid; place-items: center; color: #fff; font-size: 1.45rem;
    background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to));
    box-shadow: 0 6px 16px rgba(var(--sb-primary-rgb), .30);
    margin-bottom: 1rem; overflow: hidden;
}
.sb-logo img { width: 100%; height: 100%; object-fit: cover; }
.sb-rail-nav { display: flex; flex-direction: column; gap: .3rem; width: 100%; align-items: center; overflow-y: auto; scrollbar-width: none; flex: 1 1 auto; }
.sb-rail-nav::-webkit-scrollbar { display: none; }
.sb-rail-item {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
    width: 72px; padding: .3rem 0 .35rem; color: var(--sb-muted); border-radius: 14px;
    font-size: 10.5px; font-weight: 500; line-height: 1.15; text-align: center;
    transition: color .15s;
}
.sb-rail-item .ico {
    width: 44px; height: 36px; display: grid; place-items: center; border-radius: 12px;
    font-size: 1.18rem; transition: background .15s, color .15s;
}
.sb-rail-item:hover { color: var(--sb-text); }
.sb-rail-item:hover .ico { background: #f3f4f6; }
.sb-rail-item.active { color: var(--sb-primary-700); font-weight: 600; }
.sb-rail-item.active .ico { background: var(--sb-primary-50); color: var(--sb-primary); }
.sb-rail-item .sb-badge {
    position: absolute; top: 0; right: 9px; min-width: 18px; height: 18px; padding: 0 5px;
    border-radius: 999px; background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
    display: grid; place-items: center; border: 2px solid #fff;
}
.sb-rail-bottom { display: flex; flex-direction: column; align-items: center; gap: .45rem; padding-top: .6rem; border-top: 1px solid var(--sb-border-soft); width: 60px; }
.sb-rail-avatar { border: 2px solid #fff; box-shadow: 0 0 0 2px var(--sb-border); }

/* ---------------------------------------------------------------- layout */
.sb-main { margin-left: var(--sb-rail); min-height: 100vh; display: flex; flex-direction: column; }
.sb-topbar {
    position: sticky; top: 0; z-index: 1020; height: var(--sb-topbar);
    background: rgba(255, 255, 255, .92); backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--sb-border);
    display: flex; align-items: center; gap: 1rem; padding: 0 1.6rem;
}
.sb-org { min-width: 0; display: flex; align-items: center; gap: .65rem; }
.sb-org-logo { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; display: none; }
.sb-org-name { font-weight: 700; font-size: 1rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-org-sub { font-size: .78rem; color: var(--sb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-search-pill {
    margin-left: auto; display: flex; align-items: center; gap: .55rem;
    width: min(340px, 34vw); height: 40px; padding: 0 .55rem 0 .95rem;
    background: #f3f4f6; border: 1px solid transparent; border-radius: 999px; color: var(--sb-muted);
    font-size: .9rem; cursor: pointer; transition: background .15s, border-color .15s;
}
.sb-search-pill:hover { background: #fff; border-color: var(--sb-border); }
.sb-search-pill kbd {
    margin-left: auto; background: #fff; color: var(--sb-muted); border: 1px solid var(--sb-border);
    border-radius: 7px; font-size: .72rem; padding: .1rem .4rem; box-shadow: none; font-family: inherit;
}
.sb-icon-btn {
    position: relative; width: 40px; height: 40px; border-radius: 12px; border: 0;
    display: grid; place-items: center; background: transparent; color: #4b5563; font-size: 1.15rem;
}
.sb-icon-btn:hover { background: #f3f4f6; color: var(--sb-text); }
.sb-icon-btn .dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: #ef4444; border: 2px solid #fff; }
.sb-profile { display: flex; align-items: center; gap: .55rem; padding: .25rem .45rem .25rem .25rem; border-radius: 999px; border: 1px solid transparent; background: transparent; }
.sb-profile:hover { background: #f3f4f6; }
.sb-profile .name { font-weight: 600; font-size: .88rem; line-height: 1.1; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-profile .role { font-size: .72rem; color: var(--sb-muted); max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-content { padding: 1.4rem 1.6rem; width: 100%; flex: 1 0 auto; }
.sb-footer { padding: .9rem 1.6rem 1.2rem; color: var(--sb-subtle); font-size: .78rem; display: flex; flex-wrap: wrap; gap: .35rem 1rem; justify-content: space-between; }

/* ------------------------------------------------------------- page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.page-head .sub { color: var(--sb-muted); margin-top: .2rem; font-size: .92rem; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; font-weight: 700; }

/* ----------------------------------------------------------- section hero */
.section-hero {
    position: relative; overflow: hidden; color: #fff;
    border-radius: var(--sb-radius-hero); padding: 1.7rem 2rem; min-height: 190px;
    background: linear-gradient(120deg, #263451 0%, #493b69 55%, #75446a 100%);
    box-shadow: var(--sb-shadow-lg); margin-bottom: 1.2rem;
}
.section-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, .13) 1.2px, transparent 1.3px);
    background-size: 18px 18px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .15));
    -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .9), rgba(0, 0, 0, .15));
}
.section-hero .hero-body { position: relative; z-index: 1; max-width: min(640px, 62%); }
.section-hero .eyebrow { color: rgba(255, 255, 255, .72); }
.section-hero h1, .section-hero h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin: .35rem 0 .45rem; line-height: 1.25; }
.section-hero p { color: rgba(255, 255, 255, .80); margin-bottom: 1rem; }
.section-hero .hero-art {
    position: absolute; right: 1.2rem; bottom: -6px; height: 112%; max-height: 260px; max-width: 42%;
    object-fit: contain; object-position: right bottom; filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .28)); z-index: 0;
}
.section-hero .btn-light { background: #fff; color: #263451; border: 0; }
.section-hero .btn-ghost { background: rgba(255, 255, 255, .14); color: #fff; border: 1px solid rgba(255, 255, 255, .22); }
.section-hero .btn-ghost:hover { background: rgba(255, 255, 255, .22); color: #fff; }
.hero-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.hero-chip { background: rgba(255, 255, 255, .13); border: 1px solid rgba(255, 255, 255, .18); color: #fff; border-radius: 999px; padding: .28rem .75rem; font-size: .8rem; }

/* ----------------------------------------------------------------- cards */
.card { border: 0; border-radius: var(--sb-radius); box-shadow: var(--sb-shadow); background: var(--sb-card); }
.card-header { background: transparent; border-bottom: 1px solid var(--sb-border-soft); padding: .95rem 1.15rem; }
.card-header:first-child { border-radius: var(--sb-radius) var(--sb-radius) 0 0; }
.card-body { padding: 1.15rem; }
.card-footer { background: transparent; border-top: 1px solid var(--sb-border-soft); padding: .8rem 1.15rem; }
.card-title { font-weight: 700; font-size: 1.02rem; margin: 0; }
.card-sub { color: var(--sb-muted); font-size: .82rem; }
.card-lift { transition: transform .15s, box-shadow .15s; }
.card-lift:hover { transform: translateY(-2px); box-shadow: var(--sb-shadow-lg); }

/* --------------------------------------------------------------- buttons */
.btn { border-radius: 12px; font-weight: 500; padding: .5rem 1rem; }
.btn-sm { border-radius: 10px; padding: .32rem .7rem; font-size: .86rem; }
.btn-lg { border-radius: 14px; padding: .7rem 1.3rem; }
.btn-primary {
    --bs-btn-bg: var(--sb-primary); --bs-btn-border-color: var(--sb-primary);
    --bs-btn-hover-bg: var(--sb-primary-600); --bs-btn-hover-border-color: var(--sb-primary-600);
    --bs-btn-active-bg: var(--sb-primary-700); --bs-btn-active-border-color: var(--sb-primary-700);
    --bs-btn-disabled-bg: var(--sb-primary); --bs-btn-disabled-border-color: var(--sb-primary);
    --bs-btn-focus-shadow-rgb: var(--sb-primary-rgb);
    box-shadow: 0 4px 12px rgba(var(--sb-primary-rgb), .25);
}
.btn-outline-primary {
    --bs-btn-color: var(--sb-primary-600); --bs-btn-border-color: var(--sb-primary-200);
    --bs-btn-hover-bg: var(--sb-primary); --bs-btn-hover-border-color: var(--sb-primary);
    --bs-btn-active-bg: var(--sb-primary-600); --bs-btn-active-border-color: var(--sb-primary-600);
}
.btn-soft { background: var(--sb-primary-50); color: var(--sb-primary-700); border: 1px solid transparent; }
.btn-soft:hover, .btn-soft:focus { background: var(--sb-primary-100); color: var(--sb-primary-700); }
.btn-light { background: #f3f4f6; border-color: #f3f4f6; color: #374151; }
.btn-light:hover { background: #e9eaee; border-color: #e9eaee; }
.btn-white { background: #fff; border: 1px solid var(--sb-border); color: #374151; }
.btn-white:hover { background: #f9fafb; }
.btn-danger-soft { background: #fef2f2; color: #b91c1c; border: 1px solid transparent; }
.btn-danger-soft:hover { background: #fee2e2; color: #991b1b; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-grid; place-items: center; }
.btn-icon.btn-sm { width: 32px; height: 32px; }

/* ----------------------------------------------------------------- forms */
.form-control, .form-select { border-radius: 12px; border-color: #e3e5ea; padding: .55rem .85rem; font-size: .95rem; }
.form-control-sm, .form-select-sm { border-radius: 10px; }
.form-control-lg, .form-select-lg { border-radius: 14px; }
.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--sb-primary-200); box-shadow: 0 0 0 .25rem rgba(var(--sb-primary-rgb), .15);
}
.form-check-input:checked { background-color: var(--sb-primary); border-color: var(--sb-primary); }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23aaa'/%3e%3c/svg%3e"); }
.form-label { font-weight: 600; font-size: .88rem; margin-bottom: .35rem; color: #374151; }
.form-text { font-size: .8rem; color: var(--sb-muted); }
.input-group-text { border-radius: 12px; background: #f9fafb; border-color: #e3e5ea; color: var(--sb-muted); }
.input-group > .form-control:not(:first-child), .input-group > .form-select:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group > .input-group-text:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-icon { position: relative; }
.input-icon > .bi { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--sb-subtle); pointer-events: none; }
.input-icon > .form-control { padding-left: 2.3rem; }
.req::after { content: " *"; color: #dc2626; }
.invalid-feedback { font-size: .8rem; }

/* --------------------------------------------------------------- tables */
.table { --bs-table-hover-bg: var(--sb-primary-50); margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .85rem; border-bottom-color: var(--sb-border-soft); }
.table thead th {
    font-size: .82rem; font-weight: 600; color: var(--sb-muted); background: var(--sb-head-bg);
    border-bottom: 1px solid var(--sb-border); white-space: nowrap;
}
.table-hover > tbody > tr:hover > * { background: var(--sb-primary-50); --bs-table-accent-bg: var(--sb-primary-50); }
.table td { vertical-align: middle; }
.table tr.text-muted > td { color: var(--sb-subtle); }
.table-card { border-radius: var(--sb-radius); overflow: hidden; }
.table-responsive { border-radius: inherit; }

/* ---------------------------------------------------- badges, pills, alerts */
.badge { font-weight: 600; border-radius: 999px; padding: .36em .7em; }
.badge-soft { background: var(--sb-primary-50); color: var(--sb-primary-700); }
.badge-soft-success { background: #dcfce7; color: #166534; }
.badge-soft-warning { background: #fef3c7; color: #92400e; }
.badge-soft-danger { background: #fee2e2; color: #991b1b; }
.badge-soft-info { background: #e0f2fe; color: #075985; }
.badge-soft-secondary { background: #f1f5f9; color: #475569; }
.badge-soft-purple { background: #ede9fe; color: #5b21b6; }
.badge-soft-primary { background: var(--sb-primary-50); color: var(--sb-primary-700); }
.badge-soft-slate { background: #f1f5f9; color: #475569; }
.badge-soft-blue { background: #dbeafe; color: #1e40af; }
.badge-soft-teal { background: #ccfbf1; color: #115e59; }
.badge-soft-amber { background: #fef3c7; color: #92400e; }
.nav-pills .nav-link { border-radius: 999px; color: #4b5563; font-weight: 500; padding: .42rem .95rem; }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--sb-primary); color: #fff; }
.nav-pills .nav-link:not(.active):hover { background: #f3f4f6; }
.pagination { --bs-pagination-border-radius: 10px; gap: .25rem; margin: 0; }
.pagination .page-link { border-radius: 10px !important; border: 0; color: #4b5563; min-width: 36px; text-align: center; }
.pagination .page-item.active .page-link { background: var(--sb-primary); color: #fff; }
.pagination .page-item.disabled .page-link { background: transparent; }
.alert { border: 0; border-radius: 14px; display: flex; gap: .7rem; align-items: flex-start; padding: .85rem 1rem; }
.alert > .bi { font-size: 1.15rem; line-height: 1.35; flex: 0 0 auto; }
.alert-primary { background: var(--sb-primary-50); color: var(--sb-primary-700); }
.alert-success { background: #ecfdf3; color: #166534; }
.alert-warning { background: #fffbeb; color: #92400e; }
.alert-danger { background: #fef2f2; color: #991b1b; }
.alert-info { background: #eff6ff; color: #1e40af; }
.alert-secondary { background: #f3f4f6; color: #374151; }

/* -------------------------------------------------- modal / dropdown / toast */
.modal-content { border: 0; border-radius: var(--sb-radius-lg); box-shadow: var(--sb-shadow-lg); }
.modal-header { border-bottom: 1px solid var(--sb-border-soft); padding: 1rem 1.25rem; }
.modal-title { font-weight: 700; font-size: 1.08rem; }
.modal-body { padding: 1.2rem 1.25rem; }
.modal-footer { border-top: 1px solid var(--sb-border-soft); padding: .8rem 1.25rem; }
.modal-backdrop.show { opacity: .42; }
.dropdown-menu { border: 0; border-radius: 14px; box-shadow: var(--sb-shadow-lg); padding: .4rem; font-size: .92rem; }
.dropdown-item { border-radius: 10px; padding: .45rem .75rem; display: flex; align-items: center; gap: .55rem; }
.dropdown-item:active, .dropdown-item.active { background: var(--sb-primary); color: #fff; }
.dropdown-item .bi { color: var(--sb-muted); }
.dropdown-item:active .bi { color: #fff; }
.toast-stack { position: fixed; top: calc(var(--sb-topbar) + .75rem); right: 1.2rem; z-index: 1090; display: flex; flex-direction: column; gap: .5rem; width: min(380px, calc(100vw - 2rem)); }
.toast-item {
    display: flex; gap: .65rem; align-items: flex-start; background: #fff; border-radius: 14px; box-shadow: var(--sb-shadow-lg);
    padding: .8rem .9rem; border-left: 4px solid var(--sb-primary); animation: toastIn .25s ease-out;
}
.toast-item.success { border-left-color: var(--sb-success); }
.toast-item.danger { border-left-color: var(--sb-danger); }
.toast-item.warning { border-left-color: var(--sb-warning); }
.toast-item.info { border-left-color: var(--sb-info); }
.toast-item .bi { font-size: 1.15rem; }
.toast-item.success .bi { color: var(--sb-success); }
.toast-item.danger .bi { color: var(--sb-danger); }
.toast-item.warning .bi { color: var(--sb-warning); }
.toast-item.info .bi { color: var(--sb-info); }
.toast-item .btn-close { margin-left: auto; font-size: .7rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------- app tiles */
.app-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 1.1rem .6rem; }
.app-tile { display: flex; flex-direction: column; align-items: center; gap: .5rem; color: var(--sb-text); text-align: center; position: relative; font-size: .86rem; font-weight: 500; line-height: 1.25; }
.app-tile:hover { color: var(--sb-text); }
.app-ico {
    position: relative; width: 56px; height: 56px; border-radius: 17px; display: grid; place-items: center;
    color: #fff; font-size: 1.5rem; transition: transform .15s, box-shadow .15s;
    background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to));
    box-shadow: 0 6px 14px rgba(var(--sb-primary-rgb), .25);
}
.app-tile:hover .app-ico { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(var(--sb-primary-rgb), .30); }
.app-ico.teal { background: linear-gradient(135deg, #2dd4bf, #0d9488); box-shadow: 0 6px 14px rgba(13, 148, 136, .25); }
.app-ico.blue { background: linear-gradient(135deg, #60a5fa, #2563eb); box-shadow: 0 6px 14px rgba(37, 99, 235, .25); }
.app-ico.slate { background: linear-gradient(135deg, #94a3b8, #475569); box-shadow: 0 6px 14px rgba(71, 85, 105, .22); }
.app-ico.danger { background: linear-gradient(135deg, #fb7185, #e11d48); box-shadow: 0 6px 14px rgba(225, 29, 72, .25); }
.app-ico.amber { background: linear-gradient(135deg, #fbbf24, #d97706); box-shadow: 0 6px 14px rgba(217, 119, 6, .25); }
.app-ico .sb-badge {
    position: absolute; top: -5px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
    background: #ef4444; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; border: 2px solid #fff;
}

/* ------------------------------------------------------------------ stats */
.stat { display: flex; align-items: center; gap: .85rem; }
.stat-ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 1.25rem; flex: 0 0 auto; background: var(--sb-primary-50); color: var(--sb-primary); }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; }
.stat-label { color: var(--sb-muted); font-size: .84rem; }
.tint-primary { background: var(--sb-primary-50); color: var(--sb-primary); }
.tint-success { background: #dcfce7; color: #16a34a; }
.tint-warning { background: #fef3c7; color: #d97706; }
.tint-danger { background: #fee2e2; color: #dc2626; }
.tint-info { background: #e0f2fe; color: #0284c7; }
.tint-purple { background: #ede9fe; color: #7c3aed; }
.tint-blue { background: #dbeafe; color: #2563eb; }
.tint-teal { background: #ccfbf1; color: #0d9488; }
.tint-slate { background: #f1f5f9; color: #475569; }

/* ------------------------------------------------------------------ ring */
.ring {
    --p: 0; --size: 92px; --thick: 10px;
    width: var(--size); height: var(--size); border-radius: 50%; flex: 0 0 auto;
    background: conic-gradient(var(--sb-primary) calc(var(--p) * 1%), #edf0f4 0);
    display: grid; place-items: center; position: relative;
}
.ring::before { content: ""; position: absolute; inset: var(--thick); border-radius: 50%; background: #fff; }
.ring > span { position: relative; font-weight: 700; font-size: 1.15rem; }
.ring.on-dark::before { background: #2f3858; }

/* ----------------------------------------------------------------- empty */
.empty-state { text-align: center; padding: 2.2rem 1rem; color: var(--sb-muted); }
.empty-ico { width: 64px; height: 64px; border-radius: 20px; background: var(--sb-primary-50); color: var(--sb-primary); display: inline-grid; place-items: center; font-size: 1.7rem; margin-bottom: .75rem; }
.empty-state h6 { color: var(--sb-text); font-weight: 700; margin-bottom: .25rem; }

/* --------------------------------------------------------------- avatars */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; flex: 0 0 auto; background: var(--sb-primary-100); color: var(--sb-primary-700); font-weight: 700; font-size: .85rem; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 26px; height: 26px; font-size: .7rem; }
.avatar-sm { width: 32px; height: 32px; font-size: .78rem; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar-xl { width: 76px; height: 76px; font-size: 1.5rem; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid #fff; margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* -------------------------------------------------------- list rows / misc */
.list-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--sb-border-soft); }
.list-row:last-child { border-bottom: 0; }
.list-row .meta { color: var(--sb-muted); font-size: .8rem; }
.date-chip { width: 48px; flex: 0 0 auto; border-radius: 12px; text-align: center; background: var(--sb-primary-50); color: var(--sb-primary-700); padding: .25rem 0; line-height: 1.1; }
.date-chip .d { font-weight: 700; font-size: 1.1rem; display: block; }
.date-chip .m { font-size: .72rem; }
.quick-action { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 14px; color: var(--sb-text); background: #f9fafb; border: 1px solid var(--sb-border-soft); }
.quick-action:hover { background: var(--sb-primary-50); border-color: var(--sb-primary-100); color: var(--sb-text); }
.quick-action .ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: #fff; color: var(--sb-primary); box-shadow: var(--sb-shadow); }
.time-pill { display: inline-flex; align-items: center; gap: .3rem; background: #f3f4f6; color: #4b5563; border-radius: 999px; padding: .15rem .6rem; font-size: .78rem; }
.check-row { display: flex; align-items: center; gap: .75rem; padding: .62rem .2rem; border-bottom: 1px dashed var(--sb-border); color: var(--sb-text); }
.check-row:last-child { border-bottom: 0; }
.check-row:hover { color: var(--sb-text); background: #fafbfc; }
.check-row .state { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .9rem; flex: 0 0 auto; border: 2px solid #d1d5db; color: transparent; }
.check-row.done .state { background: var(--sb-success); border-color: var(--sb-success); color: #fff; }
.check-row.done .label { color: var(--sb-muted); text-decoration: line-through; text-decoration-color: #cbd5e1; }
.kv { display: grid; grid-template-columns: minmax(120px, 34%) 1fr; gap: .45rem 1rem; font-size: .92rem; }
.kv dt { color: var(--sb-muted); font-weight: 500; }
.kv dd { margin: 0; }
.code-box { position: relative; background: #0f172a; color: #e2e8f0; border-radius: 12px; padding: .8rem 3rem .8rem .9rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; word-break: break-all; }
.code-box .btn { position: absolute; top: .45rem; right: .45rem; }
.color-swatch { width: 100%; aspect-ratio: 1.6; border-radius: 14px; border: 3px solid transparent; cursor: pointer; display: grid; place-items: end start; padding: .45rem .55rem; color: #fff; font-size: .78rem; font-weight: 600; box-shadow: var(--sb-shadow); }
.color-swatch.active { border-color: #111827; }
.perm-group { border: 1px solid var(--sb-border); border-radius: 14px; padding: .75rem .9rem; }
.perm-group h6 { font-size: .86rem; font-weight: 700; margin-bottom: .45rem; }

/* ---------------------------------------------------------- search modal */
.search-modal .modal-dialog { max-width: 620px; margin-top: 8vh; }
.search-modal .search-input { border: 0; font-size: 1.05rem; padding: 1rem 1rem 1rem 2.9rem; border-radius: 20px 20px 0 0; border-bottom: 1px solid var(--sb-border-soft); }
.search-modal .search-input:focus { box-shadow: none; }
.search-modal .search-icon { position: absolute; left: 1.15rem; top: 1.05rem; color: var(--sb-subtle); font-size: 1.05rem; }
.search-results { max-height: 52vh; overflow-y: auto; padding: .45rem; }
.search-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: 12px; color: var(--sb-text); }
.search-item:hover, .search-item.active { background: var(--sb-primary-50); color: var(--sb-text); }
.search-item .ico { width: 36px; height: 36px; border-radius: 11px; background: #f3f4f6; display: grid; place-items: center; color: var(--sb-muted); flex: 0 0 auto; }
.search-item.active .ico { background: var(--sb-primary); color: #fff; }
.search-item .type { margin-left: auto; font-size: .72rem; color: var(--sb-subtle); white-space: nowrap; }

/* ------------------------------------------------------ searchable select */
.sselect { position: relative; }
.sselect-input { cursor: pointer; padding-right: 2.2rem; background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right .8rem center; background-size: 14px 10px; }
.sselect-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1060; background: #fff; border-radius: 14px; box-shadow: var(--sb-shadow-lg); max-height: 260px; overflow-y: auto; padding: .35rem; display: none; }
.sselect.open .sselect-menu { display: block; }
.sselect-option { padding: .45rem .65rem; border-radius: 10px; cursor: pointer; font-size: .92rem; }
.sselect-option .hint { color: var(--sb-muted); font-size: .78rem; }
.sselect-option:hover, .sselect-option.active { background: var(--sb-primary-50); }
.sselect-option.selected { font-weight: 600; color: var(--sb-primary-700); }
.sselect-empty { padding: .6rem .7rem; color: var(--sb-muted); font-size: .88rem; }

/* ------------------------------------------------------------- dashboard */
.dash-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 320px; gap: 1.2rem; align-items: start; }
.dash-side { position: sticky; top: calc(var(--sb-topbar) + 1.2rem); display: flex; flex-direction: column; gap: 1.2rem; }
.dash-feed { display: flex; flex-direction: column; gap: 1.2rem; min-width: 0; }
@media (min-width: 1600px) { .dash-grid { grid-template-columns: 19% minmax(0, 1fr) 22%; } }
@media (max-width: 1399.98px) { .dash-grid { grid-template-columns: 260px minmax(0, 1fr) 290px; } }
@media (max-width: 1199.98px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr) 300px; }
    .dash-grid > .dash-left { display: none; }
}
@media (max-width: 991.98px) {
    .dash-grid { grid-template-columns: minmax(0, 1fr); }
    .dash-side { position: static; }
}
.profile-card { text-align: center; padding: 1.3rem 1.1rem 1.1rem; }
.profile-card .avatar { margin: 0 auto .6rem; }
.profile-card .name { font-weight: 700; font-size: 1.05rem; }
.profile-card .pos { color: var(--sb-muted); font-size: .84rem; }

/* -------------------------------------------------------------- settings */
.settings-hero {
    position: relative; overflow: hidden; color: #fff; border-radius: 24px; padding: 2rem 2.5rem;
    background: linear-gradient(115deg, #243954 0%, #39445f 50%, #6b4960 100%);
    display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.6rem;
    box-shadow: var(--sb-shadow-lg); min-height: 220px;
}
.settings-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, .10) 1.2px, transparent 1.3px); background-size: 18px 18px;
    mask-image: linear-gradient(90deg, rgba(0, 0, 0, .8), transparent 75%);
    -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, .8), transparent 75%);
}
.settings-hero .hero-text { position: relative; z-index: 1; }
.settings-hero .eyebrow { color: rgba(255, 255, 255, .7); }
.settings-hero h1 { font-size: 2rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; margin: .5rem 0 .6rem; }
.settings-hero p { color: rgba(255, 255, 255, .78); margin: 0; max-width: 520px; }
.settings-hero img { position: relative; z-index: 1; width: 280px; height: 220px; object-fit: contain; filter: drop-shadow(0 18px 26px rgba(0, 0, 0, .3)); flex: 0 0 auto; margin: -1rem -.5rem -1.5rem 0; }
.settings-pick-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .9rem; flex-wrap: wrap; }
.settings-pick-head h2 { font-size: 1.15rem; font-weight: 700; margin: 0; }
.settings-search { position: relative; width: min(320px, 100%); }
.settings-search .bi { position: absolute; left: .85rem; top: 50%; transform: translateY(-50%); color: var(--sb-subtle); }
.settings-search input { background: #fff; border-radius: 12px; padding-left: 2.3rem; border: 1px solid var(--sb-border); box-shadow: var(--sb-shadow); }
.settings-groups { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.6rem; }
@media (max-width: 1199.98px) { .settings-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.settings-group {
    display: flex; flex-direction: column; gap: .5rem; padding: 1.1rem 1.15rem 1rem; border-radius: 18px; background: #fff;
    border: 2px solid transparent; box-shadow: var(--sb-shadow); color: var(--sb-text); transition: border-color .15s, background .15s, transform .15s;
}
.settings-group:hover, .settings-group.active { border-color: var(--sb-primary); background: var(--sb-primary-50); color: var(--sb-text); }
.settings-group .gico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; background: var(--sb-primary-100); color: var(--sb-primary); font-size: 1.2rem; }
.settings-group .gname { font-weight: 700; font-size: 1rem; }
.settings-group .gdesc { font-size: .82rem; color: var(--sb-muted); line-height: 1.45; flex: 1 1 auto; }
.settings-group .gcount { display: flex; align-items: center; justify-content: space-between; font-size: .8rem; color: var(--sb-muted); font-weight: 600; padding-top: .35rem; }
.settings-group.active .gcount, .settings-group:hover .gcount { color: var(--sb-primary-700); }
.settings-results { margin-bottom: 1.6rem; }
.settings-results .btn-soft { margin: 0 .4rem .45rem 0; }
.settings-workspace { background: #fff; border-radius: 20px; box-shadow: var(--sb-shadow); padding: 1.3rem 1.4rem 1.5rem; }
.settings-workspace .ws-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-bottom: 1rem; margin-bottom: 1.2rem; border-bottom: 1px solid var(--sb-border-soft); }
.settings-workspace .ws-title { font-size: 1.25rem; font-weight: 700; margin: .15rem 0 0; }
.settings-subnav { display: flex; flex-wrap: wrap; gap: .4rem; }
.settings-subnav a { display: inline-flex; align-items: center; gap: .4rem; padding: .42rem .9rem; border-radius: 999px; background: #f3f4f6; color: #4b5563; font-weight: 500; font-size: .9rem; }
.settings-subnav a:hover { background: var(--sb-primary-50); color: var(--sb-primary-700); }
.settings-subnav a.active { background: var(--sb-primary); color: #fff; box-shadow: 0 4px 12px rgba(var(--sb-primary-rgb), .25); }
.section-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.section-desc { color: var(--sb-muted); font-size: .86rem; }
.art-slot .art-preview { height: 210px; border-radius: 14px; background: #edf0f5; display: grid; place-items: center; overflow: hidden; }
.art-slot .art-preview img { width: 100%; height: 210px; object-fit: contain; }
.logo-preview { width: 96px; height: 96px; border-radius: 18px; background: #edf0f5; display: grid; place-items: center; overflow: hidden; color: var(--sb-subtle); font-size: 2rem; }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.sig-preview { height: 70px; max-width: 220px; object-fit: contain; }

/* ------------------------------------------------------- menu index page */
.menu-group-title { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--sb-muted); font-weight: 700; margin: 0 0 .85rem; }

/* -------------------------------------------------------------- auth page */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: #fff; }
.auth-art {
    position: relative; overflow: hidden; color: #fff; padding: 2.6rem 3rem; display: flex; flex-direction: column; justify-content: space-between;
    background: linear-gradient(135deg, #263451 0%, #493b69 55%, #75446a 100%);
}
.auth-art::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255, 255, 255, .12) 1.2px, transparent 1.3px); background-size: 18px 18px; }
.auth-art > * { position: relative; }
.auth-art img.art { width: min(520px, 92%); max-height: 46vh; object-fit: contain; align-self: center; filter: drop-shadow(0 24px 30px rgba(0, 0, 0, .3)); }
.auth-art h2 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
.auth-form { display: flex; flex-direction: column; justify-content: center; padding: 2.5rem clamp(1.5rem, 5vw, 4.5rem); position: relative; z-index: 2; }
.auth-form .card { box-shadow: none; }
@media (max-width: 991.98px) {
    .auth-wrap { grid-template-columns: 1fr; background: var(--sb-bg); }
    .auth-art { padding: 1.6rem 1.4rem 4.6rem; border-radius: 0 0 26px 26px; min-height: auto; }
    .auth-art img.art { max-height: 150px; width: auto; margin: .5rem auto 0; }
    .auth-art h2 { font-size: 1.35rem; }
    .auth-art .art-foot { display: none; }
    .auth-form { padding: 0 1rem 2rem; margin-top: -3.4rem; }
    .auth-form > .auth-card { background: #fff; border-radius: 22px; box-shadow: var(--sb-shadow-lg); padding: 1.4rem 1.2rem; }
}

/* --------------------------------------------------------- bottom nav */
.sb-bottom-nav { display: none; }
.m-only { display: none !important; }

/* ===================================================== mobile (<992px) */
@media (max-width: 991.98px) {
    .sb-rail { display: none; }
    .sb-main { margin-left: 0; }
    .sb-topbar { padding: 0 1rem; gap: .5rem; padding-top: env(safe-area-inset-top); height: calc(var(--sb-topbar) + env(safe-area-inset-top)); }
    .sb-org-logo { display: block; }
    .sb-search-pill { width: 40px; height: 40px; padding: 0; justify-content: center; background: transparent; }
    .sb-search-pill .label, .sb-search-pill kbd { display: none; }
    .sb-profile .who { display: none; }
    .sb-content { padding: 1rem 1rem calc(var(--sb-bottom-nav) + 1.6rem + env(safe-area-inset-bottom)); }
    .sb-footer { padding-bottom: calc(var(--sb-bottom-nav) + 1.2rem + env(safe-area-inset-bottom)); justify-content: center; text-align: center; }
    .m-only { display: block !important; }
    .d-only { display: none !important; }

    .sb-bottom-nav {
        display: grid; grid-template-columns: repeat(5, 1fr); align-items: end;
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1035;
        height: calc(var(--sb-bottom-nav) + env(safe-area-inset-bottom)); padding: 0 .4rem env(safe-area-inset-bottom);
        background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid var(--sb-border); box-shadow: 0 -4px 18px rgba(16, 24, 40, .06);
    }
    .sb-bottom-nav a {
        height: var(--sb-bottom-nav); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
        color: var(--sb-muted); font-size: .7rem; font-weight: 500; position: relative;
    }
    .sb-bottom-nav a .bi { font-size: 1.28rem; line-height: 1; }
    .sb-bottom-nav a.active { color: var(--sb-primary); font-weight: 700; }
    .sb-bottom-nav a.center .bubble {
        width: 54px; height: 54px; border-radius: 18px; display: grid; place-items: center; color: #fff; font-size: 1.4rem;
        background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to));
        box-shadow: 0 8px 18px rgba(var(--sb-primary-rgb), .38); margin-top: -26px; margin-bottom: 3px; border: 4px solid #fff;
    }
    .sb-bottom-nav a.center { color: var(--sb-text); }

    .toast-stack { top: calc(.6rem + env(safe-area-inset-top)); left: 50%; right: auto; transform: translateX(-50%); }

    .page-head h1 { font-size: 1.3rem; }
    .section-hero { padding: 1.3rem 1.25rem 1.4rem; min-height: 0; border-radius: 22px; }
    .section-hero .hero-body { max-width: 100%; }
    .section-hero h1, .section-hero h2 { font-size: 1.32rem; }
    .section-hero .hero-art { position: relative; display: block; right: auto; bottom: auto; height: 120px; max-width: 100%; margin: .6rem auto -1.6rem; }
    .settings-hero { padding: 1.3rem; border-radius: 22px; min-height: 0; gap: .5rem; }
    .settings-hero h1 { font-size: 1.4rem; }
    .settings-hero p { font-size: .88rem; }
    .settings-hero img { width: 110px; height: 110px; margin: 0; }
    .settings-search { width: 100%; }
    .settings-groups { gap: .7rem; }
    .settings-group { padding: .9rem; border-radius: 16px; }
    .settings-group .gdesc { display: none; }
    .settings-workspace { padding: 1rem; border-radius: 18px; }
    .settings-subnav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem .2rem; }
    .settings-subnav::-webkit-scrollbar { display: none; }
    .settings-subnav a { white-space: nowrap; }
    .kv { grid-template-columns: 1fr; gap: .1rem; }
    .kv dd { margin-bottom: .45rem; }
    .table-mobile-cards thead { display: none; }
    .table-mobile-cards tr { display: block; padding: .55rem .2rem; border-bottom: 1px solid var(--sb-border-soft); }
    .table-mobile-cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0 !important; padding: .22rem .6rem !important; text-align: right; }
    .table-mobile-cards td::before { content: attr(data-label); color: var(--sb-muted); font-size: .8rem; text-align: left; flex: 0 0 auto; }
    .table-mobile-cards td.cell-main { display: block; text-align: left; }
    .table-mobile-cards td.cell-main::before { display: none; }
}

/* ---------------------------------------------------- mobile app header */
.m-hero {
    background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to)); color: #fff;
    border-radius: 0 0 26px 26px; padding: 1.2rem 1.1rem 5rem; margin: -1rem -1rem 0;
}
.m-hero .eyebrow { color: rgba(255, 255, 255, .78); }
.m-float { margin-top: -4.2rem; position: relative; z-index: 2; }
.hscroll { display: flex; gap: .8rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: .3rem; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: 0 0 auto; }

/* --------------------------------------------------------------- print */
@media print {
    .sb-rail, .sb-topbar, .sb-bottom-nav, .sb-footer, .toast-stack, .no-print { display: none !important; }
    .sb-main { margin-left: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ------------------------------------------------------- แผนที่ (Leaflet) */
.mini-map, .big-map { position: relative; z-index: 0; isolation: isolate; background: #e8eef0; }
.mini-map { height: 240px; border-radius: 16px; overflow: hidden; }
.map-card { overflow: hidden; }
.big-map { height: calc(100vh - 290px); min-height: 420px; }
.map-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .75rem .9rem; border-bottom: 1px solid var(--sb-border-soft); }
.map-toolbar .form-select { width: auto; min-width: 150px; }
.map-layers { display: flex; flex-wrap: wrap; gap: .35rem .9rem; font-size: .84rem; }
.map-layers label { display: inline-flex; align-items: center; gap: .3rem; cursor: pointer; white-space: nowrap; }
.map-layers .form-check-input { margin: 0; }
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.dot-water { background: #2563eb; } .dot-waste { background: #16a34a; } .dot-none { background: #94a3b8; } .dot-debt { background: #fff; border-color: #dc2626; box-shadow: none; }
.map-village span { display: inline-block; white-space: nowrap; background: rgba(255,255,255,.92); border-radius: 999px; padding: .15rem .55rem; font-size: .75rem; font-weight: 600; color: #334155; box-shadow: 0 2px 8px rgba(15,23,42,.15); transform: translate(-50%, -50%); }
.map-complaint span { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; border-radius: 999px; padding: .2rem .4rem; font-size: .8rem; color: #fff; background: #f59e0b; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(15,23,42,.25); transform: translate(-50%, -50%); }
.map-complaint.over span { background: #dc2626; } .map-complaint.done span { background: #64748b; }
.map-complaint b { font-size: .7rem; background: rgba(0,0,0,.25); border-radius: 999px; padding: 0 .3rem; }
.map-pop { font-family: inherit; min-width: 180px; line-height: 1.45; }
.map-off { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; color: var(--sb-muted); text-align: center; padding: 1rem; }
.map-off i { font-size: 2rem; }
.leaflet-container { font-family: inherit; }
@media (max-width: 767.98px) {
    .big-map { height: calc(100vh - 330px); min-height: 360px; }
    .map-toolbar .form-select { flex: 1 1 100%; }
}

/* ========================================================== หน้าประชาชน */
.cz-body { background: var(--sb-bg, #f4f5f7); padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
.cz-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .6rem 1rem; color: #fff;
    background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to)); }
.cz-brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; min-width: 0; }
.cz-brand img, .cz-logo { width: 38px; height: 38px; border-radius: 12px; object-fit: contain; background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 1.2rem; flex: 0 0 auto; }
.cz-user { display: flex; align-items: center; gap: .4rem; font-size: .85rem; }
.cz-user img { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.6); }
.cz-main { max-width: 680px; margin: 0 auto; padding: 1rem; }
.cz-hero { position: relative; overflow: hidden; border-radius: 24px; padding: 1.3rem 1.2rem; color: #fff; margin-bottom: 1rem; min-height: 150px;
    background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to)); box-shadow: var(--sb-shadow-lg); }
.cz-hero h1 { font-size: 1.35rem; font-weight: 700; margin: 0 0 .3rem; max-width: 62%; }
.cz-hero p { margin: 0; opacity: .88; font-size: .9rem; max-width: 62%; }
.cz-hero img { position: absolute; right: -10px; bottom: -14px; height: 150px; }
.cz-section { font-weight: 700; font-size: 1rem; margin: 1.2rem 0 .6rem; display: flex; align-items: center; gap: .4rem; }
.cz-tile { display: flex; align-items: center; gap: .8rem; padding: .85rem; border-radius: 18px; background: #fff; border: 1px solid var(--sb-border-soft);
    color: inherit; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.cz-tile:hover { transform: translateY(-1px); box-shadow: var(--sb-shadow); color: inherit; }
.cz-tile .t { font-weight: 600; line-height: 1.3; }
.cz-tile .d { font-size: .8rem; color: var(--sb-muted); line-height: 1.35; }
.cz-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr); background: #fff;
    border-top: 1px solid var(--sb-border-soft); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -6px 20px rgba(15,23,42,.06); }
.cz-nav a { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .5rem 0 .45rem; font-size: .72rem; color: var(--sb-muted); text-decoration: none; }
.cz-nav a i { font-size: 1.25rem; }
.cz-nav a.active { color: var(--sb-primary); font-weight: 600; }
.cz-foot { text-align: center; font-size: .75rem; color: var(--sb-muted); margin: 2rem 0 1rem; }
.cz-foot a { color: inherit; }
.timeline { position: relative; padding-left: 1.6rem; }
.timeline::before { content: ''; position: absolute; left: .55rem; top: .3rem; bottom: .3rem; width: 2px; background: var(--sb-border-soft); }
.tl-item { position: relative; padding-bottom: 1rem; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -1.6rem; top: .1rem; width: 1.15rem; height: 1.15rem; border-radius: 50%; display: grid; place-items: center; font-size: .65rem; color: #fff; background: var(--sb-primary); box-shadow: 0 0 0 3px #fff; }
.tl-item .when { font-size: .75rem; color: var(--sb-muted); }
.doc-input { border: 1px dashed var(--sb-border, #d1d5db); border-radius: 14px; padding: .65rem .8rem; }
.req-no { font-size: 1.9rem; font-weight: 800; letter-spacing: .02em; color: var(--sb-primary); }
@media (min-width: 992px) { .cz-body { padding-bottom: 0; } .cz-nav { position: sticky; top: 58px; max-width: 680px; margin: 0 auto; border-radius: 0 0 18px 18px; border: 1px solid var(--sb-border-soft); border-top: 0; } }
@media (max-width: 420px) { .cz-hero h1, .cz-hero p { max-width: 100%; } .cz-hero img { position: static; display: block; height: 110px; margin: .5rem auto -1rem; } }
.tl-dot.tone-info { background: #0ea5e9; } .tl-dot.tone-primary { background: var(--sb-primary); } .tl-dot.tone-warning { background: #f59e0b; }
.tl-dot.tone-purple { background: #7c3aed; } .tl-dot.tone-success { background: #16a34a; } .tl-dot.tone-danger { background: #dc2626; }
.tl-dot.tone-secondary, .tl-dot.tone-slate { background: #94a3b8; }

/* ขั้นตอนงานประปา */
.wsteps { display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none; }
.wsteps::-webkit-scrollbar { display: none; }
.wstep { flex: 1 0 74px; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .45rem .3rem; border-radius: 12px; background: var(--sb-head-bg); border: 1px solid var(--sb-border); color: var(--sb-muted); font-size: .76rem; text-align: center; line-height: 1.2; }
.wstep i { font-size: 1.05rem; }
.wstep.done { color: var(--sb-success); background: rgba(22, 163, 74, .08); }
.wstep.now { color: #fff; border-color: transparent; background: var(--sb-primary); box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }

/* กราฟแท่งในรายงาน */
.mini-bars { display: flex; align-items: flex-end; gap: 6px; height: 190px; padding: 18px 0 0; overflow-x: auto; }
.mini-bars .mb-col { flex: 1 0 34px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 34px; }
.mini-bars .mb-bar { width: 70%; max-width: 38px; background: linear-gradient(180deg, var(--sb-primary, #F26522), color-mix(in srgb, var(--sb-primary, #F26522) 60%, #fff)); border-radius: 6px 6px 2px 2px; }
.mini-bars .mb-val { font-size: .68rem; color: var(--sb-muted); margin-bottom: 2px; white-space: nowrap; }
.mini-bars .mb-lbl { font-size: .7rem; color: var(--sb-muted); margin-top: 4px; white-space: nowrap; }
.kpi-big { font-size: 1.6rem; font-weight: 700; line-height: 1.15; }

/* ตัวสร้างแบบคำร้อง */
.builder-row { display: flex; gap: .5rem; align-items: center; padding: .6rem; border: 1px solid var(--bs-border-color); border-radius: .75rem; background: var(--bs-body-bg); }
.builder-row .flex-grow-1 { align-self: stretch; }
.builder-handle { cursor: grab; color: #94a3b8; font-size: 1.1rem; padding: 0 .1rem; align-self: flex-start; margin-top: .2rem; }
.builder-row[draggable="true"] { box-shadow: 0 6px 18px rgba(15,23,42,.12); }

/* ---------------------------------------------------------------- จองคิว */
.q-steps { list-style: none; display: flex; gap: .35rem; padding: 0; margin: 0 0 .75rem; counter-reset: s; }
.q-steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem; font-size: .78rem; color: var(--sb-muted); position: relative; }
.q-steps li span { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--sb-border); font-weight: 700; }
.q-steps li.done span { background: var(--sb-primary-100); border-color: var(--sb-primary-200); color: var(--sb-primary-700); }
.q-steps li.now { color: var(--sb-text); font-weight: 600; }
.q-steps li.now span { background: var(--sb-primary); border-color: var(--sb-primary); color: #fff; }
.q-days { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .25rem; scroll-snap-type: x proximity; }
.q-day { flex: 0 0 76px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; padding: .55rem .25rem; border-radius: 14px; background: #fff;
    border: 1px solid var(--sb-border); color: inherit; text-decoration: none; line-height: 1.2; }
.q-day .w { font-size: .75rem; color: var(--sb-muted); } .q-day .n { font-size: 1.35rem; font-weight: 700; } .q-day .m { font-size: .7rem; color: var(--sb-muted); }
.q-day .f { font-size: .7rem; margin-top: .2rem; color: var(--sb-primary-600); font-weight: 600; text-align: center; }
.q-day.active { border-color: var(--sb-primary); background: var(--sb-primary-50); box-shadow: 0 0 0 2px rgba(var(--sb-primary-rgb), .25); }
.q-day.off { opacity: .45; pointer-events: none; } .q-day.off .f { color: var(--sb-muted); }
.q-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.q-slot { display: flex; flex-direction: column; align-items: center; padding: .6rem .25rem; border-radius: 12px; background: #fff; border: 1px solid var(--sb-primary-200);
    color: var(--sb-primary-700); text-decoration: none; min-height: 56px; justify-content: center; }
.q-slot b { font-size: 1.05rem; } .q-slot span { font-size: .72rem; }
.q-slot:hover { background: var(--sb-primary-50); color: var(--sb-primary-700); }
.q-slot.off { border-color: var(--sb-border); color: var(--sb-subtle); background: var(--sb-head-bg); }
.q-big { font-size: 4rem; font-weight: 800; line-height: 1.05; letter-spacing: .02em; color: var(--sb-primary-700); }
.q-now { font-size: 3.5rem; font-weight: 800; line-height: 1; color: var(--sb-primary-700); }
.q-wait-list { display: flex; flex-wrap: wrap; gap: .4rem; }
.q-wait-list .chip { padding: .3rem .6rem; border-radius: 10px; background: var(--sb-head-bg); border: 1px solid var(--sb-border); font-weight: 600; font-size: .9rem; }
.q-wait-list .chip.bk { border-color: var(--sb-primary-200); background: var(--sb-primary-50); }

/* ช่องเซ็นชื่อ (บัญชีของฉัน) */
.sig-pad { border: 1px dashed var(--sb-border); border-radius: var(--sb-radius-sm); background: #fff; overflow: hidden; }
.sig-pad canvas { display: block; width: 100%; height: auto; aspect-ratio: 14 / 5; touch-action: none; cursor: crosshair; }
.sig-current { background: #f7f8fa; border-radius: var(--sb-radius-sm); padding: .5rem; text-align: center; }
.sig-current img { max-width: 100%; max-height: 90px; }

/* ตัวเลขแจ้งเตือนบนกระดิ่ง */
.sb-icon-btn .bell-count { position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #ef4444; color: #fff; font-size: .68rem; font-weight: 700; line-height: 18px; text-align: center; border: 2px solid #fff; box-sizing: content-box; }

.tint-secondary { background: #f1f5f9; color: #64748b; }
/* แถบความก้าวหน้า KPI */
.kpi-bar { height: 8px; border-radius: 999px; background: #eef0f3; overflow: hidden; }
.kpi-bar > span { display: block; height: 100%; border-radius: inherit; }
.kpi-bar .success { background: #16a34a; } .kpi-bar .info { background: #0284c7; } .kpi-bar .warning { background: #d97706; } .kpi-bar .danger { background: #dc2626; } .kpi-bar .secondary { background: #94a3b8; }
.plan-block { white-space: pre-line; }

/* ---------------------------------------------------------------- ขั้นตอนคำขอใช้งบ */
.stepper { display: flex; list-style: none; margin: 0; padding: 0; gap: .25rem; overflow-x: auto; }
.stepper li { flex: 1 1 0; min-width: 92px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; color: var(--sb-muted); font-size: .85rem; }
.stepper li::before { content: ""; position: absolute; top: 15px; left: calc(-50% + 18px); right: calc(50% + 18px); height: 2px; background: var(--sb-border); }
.stepper li:first-child::before { display: none; }
.stepper .dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--sb-bg); border: 2px solid var(--sb-border); font-weight: 600; z-index: 1; margin-bottom: .3rem; }
.stepper li.done { color: var(--sb-text); }
.stepper li.done .dot { background: var(--sb-teal); border-color: var(--sb-teal); color: #fff; }
.stepper li.done::before, .stepper li.current::before { background: var(--sb-teal); }
.stepper li.current { color: var(--sb-primary-700); font-weight: 600; }
.stepper li.current .dot { border-color: var(--sb-primary); background: var(--sb-primary-50); color: var(--sb-primary-700); }
.budget-hint { background: var(--sb-primary-50); border-radius: var(--sb-radius-sm); padding: .55rem .8rem; line-height: 1.9; }
.work-tabs .nav-link { display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap; }
@media (max-width: 767.98px) {
    .work-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .stepper { overflow: visible; }
    .stepper li { min-width: 0; font-size: .74rem; }
    .stepper .dot { width: 28px; height: 28px; }
    .stepper li::before { top: 13px; }
}
.kpi-bar .primary { background: var(--sb-primary); }
.type-pick { border: 1px solid var(--sb-border); background: var(--sb-card); color: var(--sb-text); padding: .6rem .8rem; white-space: nowrap; font-weight: 500; }
.type-pick:hover { border-color: var(--sb-primary-200); background: var(--sb-primary-50); }
.btn-check:checked + .type-pick { border-color: var(--sb-primary); background: var(--sb-primary-50); color: var(--sb-primary-700); box-shadow: 0 0 0 .15rem rgba(var(--sb-primary-rgb), .15); }
.btn-check:disabled + .type-pick { opacity: .45; }
.form-section-title { font-weight: 600; color: var(--sb-primary-700); border-bottom: 1px solid var(--sb-border); padding-bottom: .35rem; margin-top: .4rem; }
.eval-table td, .eval-table th { vertical-align: middle; }
.chart-box { position: relative; height: 280px; }
.report-link { transition: border-color .15s, box-shadow .15s; }
.report-link:hover { border-color: var(--sb-primary-200); box-shadow: var(--sb-shadow-lg); }
.table-total td, .table-total th { font-weight: 700; background: var(--sb-head-bg); }
.public-wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
.public-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; background: linear-gradient(135deg, var(--sb-grad-from), var(--sb-grad-to)); color: #fff; border-radius: var(--sb-radius-lg); padding: 1.25rem 1.4rem; margin: 8px 0 16px; }
.public-head .form-select { min-width: 190px; }
.manual-toc { position: sticky; top: calc(var(--sb-topbar) + 12px); }
.manual-steps { padding-left: 1.2rem; } .manual-steps li { margin-bottom: .45rem; line-height: 1.6; }
.manual-section { scroll-margin-top: calc(var(--sb-topbar) + 12px); }
@media print { .manual-toc, [data-manual-search] { display: none !important; } .manual-section { break-inside: avoid; } }
@media (max-width: 575.98px) {
    .card .fs-5.tabular, .card .fs-4.tabular { font-size: 1.02rem !important; white-space: nowrap; }
    .card .stat-ico + .min-w-0 .fs-5 { font-size: 1rem !important; }
}
.items-col { min-width: 170px; }
