:root {
    color-scheme: light;
    --font-sans: 'Noto Sans Thai', 'Segoe UI', 'Sarabun', system-ui, sans-serif;
    --fs-sm: .9375rem;
    --fs-md: 1rem;
    --fs-lg: 1.125rem;
    --fs-title: 1.5rem;
    --fs-display: clamp(1.5rem, 2vw, 1.75rem);
    --fs-number: 1.75rem;
    --bg: #f7f8f3;
    --panel: #eef2e9;
    --muted: #697268;
    --ink: #2b382f;
    --border: #dfe5da;
    --accent: #3f6b55;
    --page-gutter: 32px;
    --radius-panel: 16px;
    --radius-control: 10px;
    --control-height: 44px;
    --ease: cubic-bezier(.22,1,.36,1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body { margin: 0; color: var(--ink); background: var(--bg); font-family: var(--font-sans); font-size: var(--fs-md); font-weight: 400; line-height: 1.6; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; line-height: inherit; }
a { color: var(--accent); text-underline-offset: 4px; transition: color .2s; }
a:hover { color: #294c3a; }
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: var(--control-height); padding: 9px 16px; border: 1px solid #3b624e; border-radius: var(--radius-control); color: #fff; background: var(--accent); box-shadow: 0 3px 6px #2c4e3510; font-size: var(--fs-sm); font-weight: 500; text-decoration: none; cursor: pointer; transition: background .2s,transform .2s var(--ease),box-shadow .2s; }
button:hover, .button:hover { color: #fff; background: #335a46; transform: translateY(-1px); box-shadow: 0 4px 10px #2c4e3518; }
button:active, .button:active { transform: translateY(0); }
.secondary { color: #54664e; border-color: #dfe7d8; background: #f4f6ef; box-shadow: none; }
.secondary:hover { color: #36533e; background: #e9efdf; box-shadow: none; }
.icon { display: inline-block; width: 21px; height: 21px; flex: 0 0 auto; vertical-align: middle; }
.icon-button { width: 44px; height: 44px; padding: 0; color: var(--muted); background: transparent; border-color: var(--border); box-shadow: none; }
.icon-button:hover { color: var(--accent); background: #e8eee2; box-shadow: none; }
input, select, textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid #cfd8c9; border-radius: var(--radius-control); color: var(--ink); background: #fff; transition: border-color .2s,box-shadow .2s; }
input::placeholder { color: #737c70; }
input:hover,select:hover { border-color: #95a88d; }
input:focus,select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px #3f6b5510; }
label { display: block; margin: 20px 0 8px; font-size: var(--fs-sm); font-weight: 500; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
h1 { margin: 0 0 8px; font-size: var(--fs-title); font-weight: 600; line-height: 1.6; letter-spacing: -.02em; }
h2 { margin: 0 0 8px; font-size: 1.25rem; font-weight: 500; line-height: 1.6; letter-spacing: -.02em; }
h3 { font-size: var(--fs-lg); font-weight: 500; }
p { margin: 8px 0 18px; }
.muted { color: var(--muted); font-size: var(--fs-sm); }
.eyebrow { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--muted); font-size: var(--fs-sm); }
.status-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #528369; box-shadow: 0 0 0 4px #52836910; }
.status-dot.neutral { background: #92998a; box-shadow: none; }
.skip-link { position: fixed; z-index: 100; top: -100px; left: 20px; padding: 10px 18px; border-radius: 10px; color: #fff; background: var(--ink); }
.skip-link:focus { top: 12px; }
.site-header { position: sticky; top: 0; z-index: 20; background: #fbfcf8f2; border-bottom: 1px solid var(--border); backdrop-filter: blur(14px); }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 26px; max-width: none; min-height: 68px; margin: auto; padding: 8px var(--page-gutter); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.brand:hover { color: var(--ink); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 43px; height: 43px; border: 1px solid #d6e2cc; border-radius: 14px; color: #45654d; background: #e6eddd; }
.brand-mark .icon { width: 24px; height: 24px; }
.brand-text { display: grid; gap: 0; }
.brand-text strong { font-size: var(--fs-lg); font-weight: 600; }
.brand-text>span { color: var(--muted); font-size: var(--fs-sm); }
.nav-dock { display: flex; gap: 7px; align-items: center; padding: 0; }
.nav-dock a { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 16px; border-radius: 10px; color: var(--muted); text-decoration: none; font-size: var(--fs-sm); white-space: nowrap; transition: color .2s,background .2s; }
.nav-dock a:hover { color: var(--accent); background: #edf2e8; }
.nav-dock a[aria-current] { color: #3b5e44; background: #e6eddd; font-weight: 500; }
.nav-dock .icon { width: 18px; height: 18px; }
.account { display: flex; align-items: center; gap: 12px; }
.account form { margin: 0 0 0 4px; }
.account-avatar, .member-avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 auto; border: 1px solid #e2d8c7; border-radius: 50%; color: #766044; background: #f1eadc; font-weight: 500; }
.account-details { display: grid; font-size: var(--fs-sm); }
.account-details strong { max-width: 130px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.account-details>span { color: var(--muted); }
.app-layout { width: 100%; min-width: 0; min-height: calc(100dvh - 148px); margin: 0; }
.content { min-width: 0; padding: 20px var(--page-gutter); }
.panel { margin: 16px 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-panel); background: #fff; box-shadow: 0 4px 14px #2c4e3503; }
.stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px; margin: 16px 0; }
.stat { position: relative; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-panel); background: #fff; }
.stat>span { color: var(--muted); font-size: var(--fs-sm); }
.stat strong { display: block; margin-top: 4px; font-size: var(--fs-number); font-weight: 500; font-variant-numeric: tabular-nums; }
.stat-summary-icon { display: inline-flex; float: right; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 13px; }
.stat>.summary-blue { color: #4b6656; background: #edf2e7; }
.stat>.summary-green { color: #3f7051; background: #eaf3e9; }
.stat>.summary-coral { color: #81633e; background: #f5eddf; }
.badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border: 1px solid #dfe3d9; border-radius: 20px; color: #66705e; background: #f1f4ed; font-size: var(--fs-sm); white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.active { color: #3f6d4b; border-color: #d4e5ce; background: #edf5e8; }
.inactive { color: #9c493f; border-color: #efd7ce; background: #fcf1ec; }
.pending { color: #82642e; border-color: #eadfc8; background: #faf4e8; }
.notice { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 12px; }
.error { color: #9b392e; border-color: #efd0c4; background: #fff1eb; }
.success { color: #326347; border-color: #cfe1c7; background: #edf5e8; }
.account-form { max-width: 720px; }
.account-form>label:first-of-type { margin-top: 0; }
.account-form .muted { margin: 8px 0 20px; }
.form-actions,.security-actions,.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.form-actions { margin-top: 30px; }
.security-actions form { margin: 0; }
.pagination { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 24px; }
.pagination a,.pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 42px; padding: 7px 12px; border: 1px solid transparent; border-radius: 9px; font-size: var(--fs-sm); text-decoration: none; }
.pagination a { color: var(--muted); }
.pagination a:hover { color: var(--ink); background: var(--panel); }
.pagination [aria-current] { color: #3f6147; background: #e6eddd; }
.disabled { color: #71796c; }
.pagination+p { margin: 12px 0 0; }
.table-scroll { overflow-x: auto; }
.empty-state { padding: 42px; color: var(--muted); text-align: center; }
.site-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px var(--page-gutter) 0; padding: 12px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: var(--fs-sm); }
.site-footer>span:first-child { display: flex; align-items: center; gap: 8px; }
.site-footer .icon { width: 17px; height: 17px; }
.app-version { color: var(--muted); font-size: var(--fs-sm); text-align: right; white-space: nowrap; }
@media (max-width: 1000px) { .account-details { display: none; } .header-inner { gap: 16px; }  }
@media (max-width: 700px) { html { scroll-padding-top: 126px; } .header-inner { flex-wrap: wrap; padding: 8px var(--page-gutter); gap: 6px; } .account { gap: 9px; margin-left: auto; } .account-avatar { width: 34px; height: 34px; } .nav-dock { order: 3; width: 100%; justify-content: center; gap: 5px; border-top: 1px solid var(--border); padding-top: 6px; } .nav-dock a { flex: 1; padding: 8px 12px; } .content { padding: 16px var(--page-gutter); } .stats { gap: 10px; } .panel { padding: 16px; } .site-footer { flex-wrap: wrap; } .stat { padding: 14px; } }
@media (max-width: 360px) { .nav-dock a { padding: 8px; gap: 5px; } .nav-dock .icon { width: 16px; height: 16px; } .brand-text>span { display: none; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *,*::before,*::after { animation: none !important; transition: none !important; } }

@media (max-width: 700px) { .nav-dock .icon { display: none; } .nav-dock a { padding: 8px 10px; gap: 0; } }
@media (max-width: 360px) { .nav-dock a { padding: 8px; } }

.page-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.page-heading h1,.device-heading h1 { margin-bottom: 2px; }
.page-heading .muted,.device-heading .muted { margin: 0; }
.page-heading .eyebrow,.device-heading .eyebrow { display: none; }
@media (max-width: 700px) { .brand-text>span { display: none; } }

/* Shared layout and controls for every application section. */
input[type="checkbox"],input[type="radio"] { width: 20px; height: 20px; min-height: 20px; padding: 0; accent-color: var(--accent); }
button:disabled,.button[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }
.danger { color: #934735; border-color: #e6c9bd; background: #fff3ed; box-shadow: none; }
.danger:hover { color: #803822; background: #fbe8dd; }
.page-heading { min-height: 64px; }
.page-heading h1 { overflow-wrap: anywhere; }
.page-heading>.button { flex: 0 0 auto; }
.account-form,.form-panel { width: 100%; max-width: 880px; }
.account-form .form-actions,.form-panel .form-actions { margin-top: 20px; }
@media (max-width: 1099px) { :root { --page-gutter: 24px; } }
@media (max-width: 700px) {
    :root { --page-gutter: 16px; }
    .nav-dock { gap: 2px; }
    .nav-dock a { padding: 8px 6px; }
}
@media (max-width: 360px) { .nav-dock { gap: 0; } .nav-dock a { padding: 8px 4px; } }
@media (min-width: 701px) and (max-width: 1000px) {
    html { scroll-padding-top: 140px; }
    .header-inner { flex-wrap: wrap; gap: 6px 16px; }
    .account { margin-left: auto; }
    .nav-dock { order: 3; width: 100%; justify-content: center; padding-top: 6px; border-top: 1px solid var(--border); }
    .nav-dock a { flex: 1; }
}
