/* Dorle palette, with consistent application layout and controls. */
:root {
  --ink: #1f1f1f;
  --muted: #6b4e36;
  --green: #5e6a49;
  --mint: #e8decc;
  --line: rgba(107, 78, 54, .2);
  --bg: #f6f2eb;
  --paper: #fbf8f2;
  --cream: #f6f2eb;
  --sand: #e8decc;
  --beige: #cdbfa8;
  --cedar: #6b4e36;
  --moss: #5e6a49;
  --tea: #a9b78a;
  --vermilion: #d24a2f;
  --danger: #8c3427;
  --radius: 8px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
html[lang=th] body { font-family: -apple-system, BlinkMacSystemFont, "Leelawadee UI", Tahoma, sans-serif; }
a { color: var(--green); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--vermilion); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 650; letter-spacing: -.6px; line-height: 1.35; }
h2 { font-size: 17px; font-weight: 600; line-height: 1.5; }
h3 { font-size: 16px; font-weight: 600; }
p { margin-top: 6px; color: var(--muted); }
html[lang=th] h1, html[lang=th] h2, html[lang=th] h3, html[lang=th] .eyebrow { letter-spacing: 0; line-height: 1.6; }
small { font-size: 12px; }
.topbar { min-height: 76px; padding: 14px 32px; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.brand, .sidebar-brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 650; }
.brand-logo { width: 78px; height: 28px; object-fit: contain; flex-shrink: 0; }
.brand small, .sidebar-brand small { display: block; font-size: 10px; color: var(--muted); font-weight: 400; letter-spacing: .2px; }
.top-end { display: flex; align-items: center; gap: 16px; }
.top-end form { margin: 0; }
.workspace { font-size: 12px; color: var(--muted); }
.header-context { display: none; font-weight: 600; }
.language-switch { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; }
.language-switch button { border: 0; background: transparent; color: var(--muted); border-radius: 4px; padding: 4px 9px; min-height: 30px; font-size: 12px; }
.language-switch button.selected { background: var(--sand); color: var(--cedar); font-weight: 600; }
main { width: 100%; max-width: 1320px; margin: 0 auto; padding: 30px 32px 0; min-width: 0; }
.admin-shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.admin-shell .topbar { grid-column: 2; grid-row: 1; }
.admin-shell .topbar .brand, .admin-shell .workspace { display: none; }
.admin-shell .header-context { display: block; }
.admin-shell main { grid-column: 2; grid-row: 2; }
.admin-nav { position: sticky; top: 0; height: 100svh; align-self: start; grid-column: 1; grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 4px; padding: 20px 14px; border-right: 1px solid var(--line); background: var(--paper); min-width: 0; }
.admin-nav .sidebar-brand { display: flex; flex-direction: column; align-items: flex-start; padding: 4px 12px 24px; gap: 12px; margin-bottom: 10px; }
.sidebar-brand img { width: 84px; height: 28px; object-fit: contain; }
.nav-label { padding: 12px 12px 6px; font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .8px; }
.admin-nav>a:not(.sidebar-brand) { padding: 10px 12px; border-radius: 6px; font-size: 13px; text-decoration: none; color: var(--muted); line-height: 1.6; }
.admin-nav>a:not(.sidebar-brand):hover { background: var(--bg); color: var(--ink); }
.admin-nav>a.selected { background: var(--sand); color: var(--ink); font-weight: 600; }
.nav-account { margin-top: auto; padding: 24px 12px 6px; font-size: 11px; color: var(--muted); min-width: 0; }
.nav-account span { display: block; overflow-wrap: anywhere; }
.eyebrow { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: .5px; margin-bottom: 6px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 24px; }
.page-heading>div { min-width: 0; }
.page-heading p { font-size: 13px; max-width: 760px; }
.page-heading>.button, .year-chip { flex-shrink: 0; }
.year-chip { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; font-size: 16px; font-weight: 600; }
.year-chip span { font-size: 11px; font-weight: 400; color: var(--muted); border-left: 1px solid var(--line); padding-left: 10px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 20px; min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-heading p { font-size: 13px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1px solid var(--green); border-radius: 6px; background: var(--green); color: var(--paper); font-size: 13px; font-weight: 500; text-decoration: none; line-height: 1.5; }
.button:hover { background: var(--cedar); border-color: var(--cedar); }
.button.secondary { background: var(--paper); color: var(--ink); border-color: var(--beige); }
.button.secondary:hover { background: var(--bg); border-color: var(--cedar); }
.button.danger { background: var(--paper); color: var(--danger); border-color: var(--vermilion); }
.button.danger:hover { background: var(--bg); }
.button:disabled { opacity: .5; }
.wide { width: 100%; }
.text-button { background: transparent; border: 0; padding: 6px 0; color: var(--green); font-size: 13px; line-height: 1.5; }
.danger { color: var(--danger); }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; min-width: 0; }
input, select, textarea { width: 100%; min-width: 0; min-height: 40px; padding: 8px 11px; border: 1px solid var(--beige); border-radius: 5px; background: var(--paper); color: var(--ink); font-size: 14px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:focus, select:focus, textarea:focus { border-color: var(--green); }
textarea { min-height: 160px; resize: vertical; }
input[type=file] { padding: 8px; font-size: 13px; }
.check { flex-direction: row; align-items: center; gap: 9px; font-weight: 400; }
.check input { width: 16px; height: 16px; min-height: 16px; flex-shrink: 0; accent-color: var(--green); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 22px; }
.form-grid>p { margin: 0; }
.form-grid code { overflow-wrap: anywhere; font-size: 12px; }
.full { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.form-grid>.full:last-child:has(.button) { display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.report-filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; }
.filter-actions .button { white-space: nowrap; }
.footnote { font-size: 12px; color: var(--muted); }
.table-hint { margin: 0 0 10px; }
.table-scroll { overflow-x: auto; width: 100%; border: 1px solid var(--line); border-radius: 6px; }
.employee-table { width: 100%; min-width: 850px; border-collapse: collapse; text-align: left; font-size: 13px; }
.employee-table th, .employee-table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.employee-table thead th { background: var(--bg); font-size: 12px; color: var(--muted); font-weight: 500; }
.employee-table tbody th { font-weight: 500; min-width: 130px; }
.employee-table tbody tr:last-child>* { border-bottom: 0; }
.employee-table tbody tr:hover { background: rgba(232, 222, 204, .18); }
.employee-table td { overflow-wrap: anywhere; }
.account-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 230px; }
.account-actions form { margin: 0; }
.account-actions .button { padding: 4px 0; min-height: 28px; border: 0; background: transparent; font-size: 12px; color: var(--green); text-align: left; }
.account-actions .button:hover { text-decoration: underline; background: transparent; }
.account-delete { font-size: 12px; color: var(--danger); }
.account-delete summary { cursor: pointer; }
.account-delete[open] { flex-basis: 100%; }
.account-delete form { margin-top: 10px; border: 1px solid var(--line); border-left: 3px solid var(--vermilion); border-radius: 5px; padding: 14px; max-width: 320px; background: var(--bg); }
.account-delete p, .account-delete label { font-size: 12px; }
.account-delete label { margin: 12px 0; }
.account-delete .button { padding: 7px 10px; border: 1px solid var(--vermilion); background: var(--paper); color: var(--danger); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 4px; padding: 3px 8px; background: var(--mint); color: var(--green); font-size: 11px; font-weight: 500; white-space: nowrap; }
.pill.muted { background: var(--bg); color: var(--muted); }
.report-table { min-width: 1000px; }
.report-table td, .report-table th { min-width: 95px; }
.report-table small { display: block; color: var(--muted); font-size: 11px; }
.report-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.settings-group>summary, .management-section>summary, .password-panel>summary { display: flex; justify-content: space-between; align-items: center; cursor: pointer; gap: 16px; font-size: 15px; font-weight: 600; list-style: none; }
.settings-group>summary::-webkit-details-marker, .management-section>summary::-webkit-details-marker, .password-panel>summary::-webkit-details-marker { display: none; }
.settings-group>summary::after, .management-section>summary::after, .password-panel>summary::after { content: ""; width: 7px; height: 7px; flex-shrink: 0; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(-45deg); }
.settings-group[open]>summary::after, .management-section[open]>summary::after, .password-panel[open]>summary::after { transform: rotate(45deg); }
.settings-group[open]>summary, .management-section[open]>summary, .password-panel[open]>summary { padding-bottom: 18px; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.settings-group>section>.section-heading { margin-bottom: 0; }
.settings-group .form-grid { max-width: 960px; }
.mapping-description { font-size: 13px; margin: 0 0 16px; }
.employee { border-top: 1px solid var(--line); padding: 14px 0; }
.employee:last-child { padding-bottom: 0; }
.employee summary { display: flex; justify-content: space-between; align-items: center; gap: 14px; cursor: pointer; }
.employee summary>span:first-child { flex: 1; min-width: 0; }
.employee summary strong { font-size: 13px; font-weight: 500; }
.employee summary small { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.employee .form-grid { margin-top: 20px; padding: 18px; border-radius: 6px; background: var(--bg); }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.stat.featured { border-top: 3px solid var(--moss); padding-top: 18px; }
.stat-label { font-size: 12px; color: var(--muted); }
.stat strong { display: block; font-size: 30px; line-height: 1.3; font-weight: 600; margin-top: 12px; font-variant-numeric: tabular-nums; }
.stat strong small { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.stat p { font-size: 12px; }
.infraction-totals { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; margin: 0; }
.infraction-totals>div { padding: 8px 16px; border-right: 1px solid var(--line); min-width: 0; }
.infraction-totals>div:first-child { padding-left: 0; }
.infraction-totals>div:last-child { border-right: 0; }
.infraction-totals dt { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.infraction-totals dd { margin: 8px 0 0; font-size: 24px; font-weight: 600; line-height: 1.3; }
.month-picker { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.month-button { padding: 8px 2px; border: 1px solid var(--line); border-radius: 5px; background: var(--paper); color: var(--ink); }
.month-button span { display: block; font-size: 12px; font-weight: 500; }
.month-button small { font-size: 9px; color: var(--muted); }
.month-button.active { border-color: var(--green); background: var(--green); color: var(--paper); }
.month-button.active small { color: var(--paper); }
.month-button:disabled { background: var(--bg); color: var(--muted); opacity: .6; }
.record-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 20px 0 16px; }
.record-heading h3 span { font-weight: 400; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.metric { background: var(--paper); padding: 16px; min-width: 0; }
.metric span { display: block; margin-bottom: 8px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.metric strong { font-size: 19px; font-weight: 500; }
.lower-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tally { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; margin: 0; }
.tally>div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding: 10px 0; font-size: 12px; }
.tally dt { color: var(--muted); }
.tally dd { margin: 0; font-weight: 500; white-space: nowrap; }
.definitions>div { display: flex; justify-content: space-between; gap: 20px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.definitions strong { font-weight: 500; white-space: pre-wrap; }
.help-note { padding: 14px; margin-top: 18px; background: var(--bg); border-radius: 5px; font-size: 12px; }
.help-note strong { font-weight: 500; }
.help-note p { font-size: 12px; }
.alert { border: 1px solid var(--beige); border-left: 3px solid var(--cedar); border-radius: 6px; padding: 12px 16px; background: var(--paper); margin-bottom: 20px; font-size: 13px; }
.alert.error { border-left-color: var(--vermilion); color: var(--danger); }
.alert.success { border-left-color: var(--green); color: var(--green); }
.demo-banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--sand); border-radius: 6px; padding: 12px 16px; font-size: 12px; margin-bottom: 24px; }
.demo-banner a { flex-shrink: 0; }
.preview-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.preview-tabs a { text-decoration: none; }
.preview-tabs a[aria-current=page] { background: var(--green); color: var(--paper); }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 13px; }
.auth-shell main { max-width: 540px; padding: 0 24px; }
.auth-shell .workspace, .auth-shell .header-context { display: none; }
.login-layout { display: flex; align-items: center; justify-content: center; min-height: calc(100svh - 180px); padding: 40px 0; }
.login-card { width: 100%; max-width: 420px; padding: 30px; margin: 0; box-shadow: 0 6px 24px rgba(107,78,54,.04); }
.login-card h1 { font-size: 24px; }
.preview-heading { font-size: 20px; }
.page-heading h2.dashboard-title { font-size: 24px; }
.login-card>p { font-size: 13px; margin: 8px 0 24px; }
.login-card label { margin-bottom: 18px; }
.login-card .footnote { margin: 18px 0 0; font-size: 12px; }
.google-g { font-size: 18px; font-weight: 600; color: #4285f4; }
.center { text-align: center; }
.preview-link { display: block; text-align: center; margin-top: 20px; font-size: 12px; }
footer { display: flex; justify-content: space-between; gap: 16px; margin-top: 24px; border-top: 1px solid var(--line); padding: 18px 0 24px; color: var(--muted); font-size: 11px; }
.auth-shell footer { justify-content: center; border-top: 0; margin-top: 0; padding-top: 0; font-size: 10px; }
@media (max-width: 1150px) {
  .admin-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .infraction-totals { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 0; }
  .infraction-totals>div:nth-child(3n) { border-right: 0; }
  .infraction-totals>div:nth-child(3n+1) { padding-left: 0; }
  .month-picker { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 850px) {
  .admin-shell { display: block; }
  .admin-shell .topbar .brand { display: flex; }
  .admin-shell .header-context { display: none; }
  .topbar { padding: 14px 20px; min-height: 68px; flex-wrap: wrap; gap: 12px; }
  .admin-nav { position: static; height: auto; display: flex; flex-direction: row; gap: 4px; overflow-x: auto; padding: 8px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-nav .sidebar-brand, .nav-label, .nav-account { display: none; }
  .admin-nav>a:not(.sidebar-brand) { flex-shrink: 0; padding: 9px 12px; font-size: 12px; }
  main { padding: 24px 20px 0; }
  .top-end { margin-left: auto; gap: 12px; }
  .workspace { display: none; }
  .lower-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
}
@media (max-width: 600px) {
  body { font-size: 13px; }
  h1 { font-size: 24px; }
  h2 { font-size: 16px; }
  .topbar { padding: 12px 16px; }
  .brand { gap: 8px; font-size: 15px; }
  .brand-logo { width: 62px; height: 24px; }
  .brand small { font-size: 9px; }
  .top-end { gap: 10px; }
  .top-end .text-button { font-size: 12px; }
  .language-switch button { min-height: 28px; padding: 3px 8px; }
  main { padding: 22px 16px 0; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; gap: 14px; margin-bottom: 20px; }
  .page-heading p { font-size: 12px; }
  .year-chip { font-size: 14px; }
  .year-chip span { font-size: 10px; }
  .panel { padding: 18px; margin-bottom: 16px; }
  .section-heading { align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
  .section-heading p { font-size: 12px; }
  .form-grid, .report-filters { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .full { grid-column: 1; }
  .filter-actions .button { width: 100%; }
  .employee .form-grid { padding: 14px; }
  .account-actions .button, .account-delete summary { min-height: 40px; display: inline-flex; align-items: center; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
  .stat.featured { grid-column: 1 / -1; }
  .stat { padding: 16px; }
  .stat strong { font-size: 27px; }
  .stat p { font-size: 11px; }
  .infraction-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 0; }
  .infraction-totals>div { padding: 4px 12px; }
  .infraction-totals>div:nth-child(3n) { border-right: 1px solid var(--line); }
  .infraction-totals>div:nth-child(2n) { border-right: 0; }
  .infraction-totals>div:nth-child(3n+1) { padding-left: 12px; }
  .infraction-totals>div:nth-child(2n+1) { padding-left: 0; }
  .infraction-totals dd { font-size: 23px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric { padding: 14px; }
  .tally { column-gap: 16px; }
  .demo-banner { align-items: flex-start; flex-direction: column; gap: 8px; }
  .login-card { padding: 24px; }
  .auth-shell main { padding: 0 18px; }
  footer { flex-wrap: wrap; font-size: 10px; }
}
.year-selector{display:flex;align-items:flex-end;gap:10px;flex-shrink:0}.year-selector label{min-width:150px}.report-filters.has-year-filter{grid-template-columns:minmax(130px,.65fr) minmax(0,1fr) minmax(0,1fr) auto}.test-data-banner{border-left-color:var(--vermilion);font-weight:500}.test-data-actions .check{margin:16px 0}@media(max-width:600px){.year-selector{width:100%}.year-selector label{flex:1}.report-filters.has-year-filter{grid-template-columns:minmax(0,1fr)}}
