/* SNRU-PMS: Thai font (Sarabun, SIL OFL 1.1) served locally, no CDN. */
@font-face {
    font-family: "Sarabun";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../vendor/sarabun-5.3.0/sarabun-thai-400-normal.woff2") format("woff2");
    unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
    font-family: "Sarabun";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../vendor/sarabun-5.3.0/sarabun-latin-400-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Sarabun";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../vendor/sarabun-5.3.0/sarabun-thai-600-normal.woff2") format("woff2");
    unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
    font-family: "Sarabun";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("../vendor/sarabun-5.3.0/sarabun-latin-600-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Sarabun";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../vendor/sarabun-5.3.0/sarabun-thai-700-normal.woff2") format("woff2");
    unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
    font-family: "Sarabun";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../vendor/sarabun-5.3.0/sarabun-latin-700-normal.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Colours, sizes, radius and shadows come from css/tokens.css (UI-2, Q-64); this file only uses them. */

body {
    font-feature-settings: normal;
}

/* Cards (Q-54, Q-64): white surface, rounded corners, soft shadow, light border. */
.card {
    --tblr-card-bg: var(--pms-surface);
    --tblr-card-border-color: var(--pms-border);
    --tblr-card-border-radius: var(--pms-radius-card);
    --tblr-card-inner-border-radius: calc(var(--pms-radius-card) - 1px);
    --tblr-card-box-shadow: var(--pms-shadow-card);
    --tblr-card-cap-bg: var(--pms-surface);
    transition: box-shadow var(--pms-transition);
}
.card-link:hover,
a.card:hover {
    box-shadow: var(--pms-shadow-hover);
}

/* Buttons and fields (Q-64): one radius, short transition, visible keyboard focus. */
.btn {
    --tblr-btn-border-radius: var(--pms-radius-button);
    border-radius: var(--pms-radius-button);
    transition: background-color var(--pms-transition), border-color var(--pms-transition), color var(--pms-transition), box-shadow var(--pms-transition);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
/* Keyboard focus (UI-6): one clear 2px outline for every focusable element (white on the gradients, below).
   An outline is used instead of a box-shadow because outline-style buttons reset box-shadow. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.btn:focus-visible,
.form-check-input:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
.page-link:focus-visible {
    outline: 2px solid var(--pms-blue);
    outline-offset: 2px;
    box-shadow: none;
}
.form-control:focus-visible,
.form-select:focus-visible { outline: 2px solid var(--pms-blue); outline-offset: 0; }
/* field + button groups (login, password): Tabler draws the ring on the whole group; make it as clear as the rest */
.input-group-flat:focus-within { outline: 2px solid var(--pms-blue); outline-offset: 1px; }
.form-control,
.form-select { border-radius: var(--pms-radius-button); }

/* Headings and numbers */
.page-title { font-size: var(--pms-font-size-xl); font-weight: var(--pms-font-weight-bold); color: var(--pms-text); }
.page-pretitle { color: var(--pms-text-muted); }
.text-end, .num { font-variant-numeric: tabular-nums; }

/* Tables (Q-64): light header, hover row, numbers right-aligned by .text-end in the pages. */
.table thead th {
    background: var(--pms-soft-blue);
    color: color-mix(in oklab, var(--pms-text) 80%, var(--pms-blue));
    letter-spacing: .02em;
}
/* DataTables sets every cell to var(--bs-table-bg) (unset in Tabler = transparent) with a stronger selector */
table.table.dataTable > thead > tr > th { background-color: var(--pms-soft-blue); }
.card-table thead th { border-bottom-color: var(--pms-border); }
.table-hover > tbody > tr:hover > *,
.card-table > tbody > tr:hover > * { --tblr-table-bg-state: color-mix(in oklab, var(--pms-blue) 4%, #fff); }
.table tfoot th, .table tfoot td { font-weight: var(--pms-font-weight-bold); background: color-mix(in oklab, var(--pms-soft-blue) 55%, #fff); }

/* Badges: rounded, readable Thai */
.badge { border-radius: var(--pms-radius-sm); font-weight: var(--pms-font-weight-medium); }

/*
 * Colour by data type (Q-54, colours replaced by Q-64): a 4px accent bar on top, the small heading and the
 * title icon take the colour. budget = teal · plan = blue · disbursement = violet · reporting/performance = sky
 * · risk = pink · activity status = indigo · indicators = amber · area/map = deep teal · media = yellow
 * · time/window = soft violet · success / danger / muted = state of a count (reported / missing / not required)
 */
.card[class*="card-type-"] {
    border-top: 4px solid var(--card-accent);
}
.card[class*="card-type-"] > .card-body > .subheader,
.card[class*="card-type-"] > .card-header .card-title {
    /* darker shade of the accent so yellow/cyan headings stay readable on white */
    color: color-mix(in oklab, var(--card-accent) 72%, #000);
}
.card[class*="card-type-"] > .card-header .card-title { font-weight: 600; }
.card-type-budget    { --card-accent: var(--pms-data-budget); }
.card-type-plan      { --card-accent: var(--pms-data-plan); }
.card-type-disburse  { --card-accent: var(--pms-data-disburse); }
.card-type-report    { --card-accent: var(--pms-data-performance); }
.card-type-status    { --card-accent: var(--pms-data-status); }
.card-type-risk      { --card-accent: var(--pms-data-risk); }
.card-type-indicator { --card-accent: var(--pms-data-indicator); }
.card-type-area      { --card-accent: var(--pms-data-area); }
.card-type-media     { --card-accent: var(--pms-data-media); }
.card-type-time      { --card-accent: var(--pms-data-time); }
.card-type-success   { --card-accent: var(--pms-success); }
.card-type-danger    { --card-accent: var(--pms-danger); }
.card-type-muted     { --card-accent: var(--pms-data-muted); }
/* other pages (Q-56) */
.card-type-project   { --card-accent: var(--pms-data-project); }   /* project / activity information, project lists: navy */
.card-type-filter    { --card-accent: var(--pms-data-filter); }    /* filters and search: light grey */
.card-type-access    { --card-accent: var(--pms-data-access); }    /* accounts, roles, access rights, password */
.card-type-feedback  { --card-accent: var(--pms-data-feedback); }  /* feedback, notifications, Google Chat */
.card-type-setting   { --card-accent: var(--pms-data-setting); }   /* master data, system settings */

/* Summary-card icon (Q-57): tinted rounded square in the card colour, before the small heading. */
.stat-head { display: flex; align-items: center; gap: .5rem; }
.stat-icon {
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: .5rem;
    color: color-mix(in oklab, var(--card-accent, var(--tblr-primary)) 80%, #000);
    background: color-mix(in oklab, var(--card-accent, var(--tblr-primary)) 13%, #fff);
}
.stat-icon .icon { width: 1.25rem; height: 1.25rem; stroke-width: 1.75; }

/* Card-header icon (Q-58): smaller tinted square before the title. */
.card-title:has(> .title-icon) { display: inline-flex; align-items: center; gap: .5rem; }
.title-icon {
    flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.75rem; height: 1.75rem; border-radius: .45rem;
    color: color-mix(in oklab, var(--card-accent, var(--tblr-primary)) 80%, #000);
    background: color-mix(in oklab, var(--card-accent, var(--tblr-primary)) 13%, #fff);
}
.title-icon .icon { width: 1.1rem; height: 1.1rem; stroke-width: 1.75; margin: 0; }

/* Dashboard cards by dimension (Q-55, colours from the Q-64 palette): one colour per dimension, header lightly tinted. */
.card-type-dim-budget     { --card-accent: var(--pms-teal); }
.card-type-dim-comdev     { --card-accent: var(--pms-pink); }
.card-type-dim-program    { --card-accent: var(--pms-blue); }
.card-type-dim-subprogram { --card-accent: var(--pms-sky); }
.card-type-dim-main       { --card-accent: var(--pms-data-indicator); }
.card-type-dim-strategic  { --card-accent: var(--pms-violet); }
.card-type-dim-department { --card-accent: var(--pms-teal-deep); }
.card-type-dim-emphasize  { --card-accent: var(--pms-data-status); }
.card[class*="card-type-dim-"] > .card-header {
    background: color-mix(in oklab, var(--card-accent) 7%, #fff);
}
.card[class*="card-type-dim-"] .list-group-item:hover {
    background: color-mix(in oklab, var(--card-accent) 4%, #fff);
}

/* Thai text needs more room than Latin in compact components. */
.btn,
.form-control,
.form-select {
    line-height: 1.5;
}

.navbar-brand-text {
    font-weight: 700;
    letter-spacing: 0;
}

.citizen-mask {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.table-responsive > .table {
    min-width: 720px;
}

/* Keep names readable on small screens: the table scrolls sideways instead of squeezing names. */
.table .col-name {
    min-width: 11rem;
}

/* Wide tables (many status columns) scroll sideways on tablets instead of squeezing text. */
.table-responsive > .table.table-wide {
    min-width: 1000px;
}

.table .col-dept {
    min-width: 9rem;
}

.login-logo {
    font-size: 1.5rem;
    font-weight: 700;
}

/* LINE contact button on the login page: a darker LINE green so white text passes 4.5:1 (UI-6); Tabler has no LINE variant */
.btn-line {
    --tblr-btn-color: #fff;
    --tblr-btn-bg: #05813a;
    --tblr-btn-border-color: #05813a;
    --tblr-btn-hover-color: #fff;
    --tblr-btn-hover-bg: #046b30;
    --tblr-btn-hover-border-color: #046b30;
    --tblr-btn-active-color: #fff;
    --tblr-btn-active-bg: #046b30;
    --tblr-btn-active-border-color: #046b30;
}

/* Multi-line notes entered by users (status notes, Q-11) */
.text-pre-line { white-space: pre-line; }

/* Bulk account creation: long department lists scroll inside the card */
.person-results-wrap { max-height: 60vh; overflow-y: auto; }
.table-responsive.person-results-wrap > .table { min-width: 440px; }
.basket-list { max-height: 45vh; overflow-y: auto; }

/* Searchable multi-select of users (project access) */
.user-picker-options { max-height: 14rem; overflow-y: auto; border: var(--tblr-border-width) solid var(--tblr-border-color); border-top: 0; border-radius: 0 0 var(--tblr-border-radius) var(--tblr-border-radius); }
.user-picker-chips { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: .25rem; }
.user-picker-chips:empty { display: none; }
.user-chip { display: inline-flex; align-items: center; gap: .25rem; font-weight: 400; }
.user-chip .btn-close { width: .5rem; height: .5rem; padding: .25rem; }

/* DataTables pages (.dt-card): wide table scrolls sideways inside its cell on small screens */
.dt-card .dt-layout-table > div { overflow-x: auto; }
.dt-card .dt-search input { min-width: 16rem; }
@media (max-width: 575.98px) { .dt-card .dt-search input { min-width: 0; width: 100%; } }

/* ==================================================================== Layout (UI-3, Q-64)
 * Sidebar: deep brand gradient, menu groups, white active item. Desktop: folds to an icon rail (cookie
 * pms_sidebar, read by the server so there is no flicker) with tooltips. Below 992px: drawer from the side.
 * Top bar: gradient, 64px, sticky, breadcrumb. Footer: layered wave. */
.skip-link {
    position: absolute; inset-inline-start: .5rem; top: -4rem; z-index: 2000;
    padding: .5rem 1rem; border-radius: var(--pms-radius-button);
    background: var(--pms-surface); color: var(--pms-blue); box-shadow: var(--pms-shadow-hover);
}
.skip-link:focus { top: .5rem; }
#main-content:focus { outline: 0; }

.app-sidebar {
    --tblr-navbar-bg: transparent;
    --tblr-navbar-border-color: transparent;
    background: var(--pms-gradient-nav-vertical) !important;
    border: 0 !important;
    min-height: var(--pms-header-height);
}
.navbar-vertical.navbar-expand-lg .navbar-brand { min-height: var(--pms-header-height); }
.app-brand { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.app-brand-mark {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    width: 2.25rem; height: 2.25rem; border-radius: 10px; background: rgba(255, 255, 255, .18);
}
.app-brand-mark .icon { width: 1.35rem; height: 1.35rem; margin: 0; }
.app-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.app-brand-sub { font-size: .72rem; font-weight: 400; opacity: .85; white-space: nowrap; }

#app-sidebar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, .92);
    margin: 1px .75rem; padding: .5rem .75rem; min-height: 2.5rem;
    border-radius: var(--pms-radius-button);
    transition: background-color var(--pms-transition), color var(--pms-transition);
}
#app-sidebar .navbar-nav .nav-link-icon { color: inherit; opacity: 1; }
#app-sidebar .navbar-nav .nav-link-icon .icon { stroke-width: 1.9; }
#app-sidebar .navbar-nav .nav-link:hover { background: rgba(255, 255, 255, .14); color: #fff; }
#app-sidebar .navbar-nav .nav-item.active > .nav-link {
    background: #fff; color: var(--pms-blue); font-weight: var(--pms-font-weight-medium);
    box-shadow: 0 2px 8px rgba(15, 23, 42, .18);
}
#app-sidebar .navbar-nav .nav-item.active::after,
#app-sidebar .navbar-nav .nav-item.active > .nav-link::after { display: none; }
#app-sidebar .nav-link:focus-visible,
#app-sidebar .navbar-toggler:focus-visible,
#app-sidebar .app-brand:focus-visible,
#app-sidebar .btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; border-radius: var(--pms-radius-button); }
#app-sidebar .navbar-nav .nav-item.active > .nav-link:focus-visible { outline-color: #fff; outline-offset: 3px; }
.nav-group-label > span {
    display: block; padding: .9rem 1.5rem .3rem;
    font-size: .72rem; font-weight: var(--pms-font-weight-medium); letter-spacing: .05em;
    color: rgba(255, 255, 255, .78);
}

/* Desktop: folded icon rail with tooltips */
@media (min-width: 992px) {
    body.sidebar-collapsed { --tblr-sidebar-width: 4.75rem; }
    body.sidebar-collapsed .app-brand-text { display: none; }
    body.sidebar-collapsed .navbar-vertical.navbar-expand-lg .navbar-brand { justify-content: center; padding-inline: 0; }
    body.sidebar-collapsed .nav-group-label > span { display: none; }
    body.sidebar-collapsed .nav-group-label { margin: .5rem 1.1rem; border-top: 1px solid rgba(255, 255, 255, .2); }
    body.sidebar-collapsed .nav-group-label:first-child { border-top: 0; }
    body.sidebar-collapsed #app-sidebar .navbar-nav .nav-link { justify-content: center; margin: 2px .65rem; padding-inline: 0; }
    body.sidebar-collapsed #app-sidebar .navbar-nav .nav-link-icon { margin: 0; }
    body.sidebar-collapsed #app-sidebar .navbar-nav .nav-link-title {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;   /* still read by screen readers */
    }
}
.sidebar-tip {
    position: fixed; z-index: var(--pms-z-toast); transform: translateY(-50%); pointer-events: none;
    padding: .3rem .65rem; border-radius: var(--pms-radius-sm);
    background: var(--pms-text); color: #fff; font-size: var(--pms-font-size-sm); white-space: nowrap;
    box-shadow: var(--pms-shadow-hover);
}

/* Small screens: the sidebar is a top bar and the menu a drawer */
@media (max-width: 991.98px) {
    .app-sidebar { background: var(--pms-gradient-nav) !important; z-index: 1045; }
    .app-sidebar-menu {
        position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 1046;
        display: block !important; width: min(18rem, 86vw); height: 100vh !important; overflow-y: auto;
        padding-bottom: 1rem; background: var(--pms-gradient-nav-vertical);
        box-shadow: 8px 0 24px rgba(15, 23, 42, .25);
        transform: translateX(-100%); visibility: hidden;
        transition: transform var(--pms-transition), visibility var(--pms-transition);
    }
    body.sidebar-open { overflow: hidden; }
    body.sidebar-open .app-sidebar-menu { transform: none; visibility: visible; }
    .app-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem .25rem 1.5rem; color: #fff; }
    .app-drawer-head .btn { color: #fff; }
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 1040; background: rgba(15, 23, 42, .45); }
}
.sidebar-backdrop[hidden] { display: none; }

/* Top bar */
.app-topbar {
    --tblr-navbar-bg: transparent;
    --tblr-navbar-border-color: transparent;
    position: sticky; top: 0; z-index: var(--pms-z-header);
    min-height: var(--pms-header-height);
    background: var(--pms-gradient-nav) !important; color: #fff;
    border: 0 !important; box-shadow: 0 2px 10px rgba(30, 41, 59, .12);
}
.app-topbar .nav-link,
.app-topbar .topbar-brand { color: #fff; }
.app-topbar .nav-link:hover { color: #fff; opacity: .9; }
.app-topbar a:focus-visible,
.app-topbar .nav-link:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; border-radius: var(--pms-radius-button); }
.app-topbar-btn { color: #fff; background: rgba(255, 255, 255, .14); border: 0; }
.app-topbar-btn:hover,
.app-topbar-btn:focus-visible { color: #fff; background: rgba(255, 255, 255, .26); }
.app-topbar-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: none; }
.app-topbar .avatar,
.app-sidebar .avatar { background: rgba(255, 255, 255, .22); color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .35); }
.app-user-name { font-weight: var(--pms-font-weight-medium); color: #fff; }
.app-user-role { color: rgba(255, 255, 255, .85); }
.app-breadcrumb { min-width: 0; flex: 1 1 auto; overflow: hidden; }
.app-breadcrumb .breadcrumb { --tblr-breadcrumb-divider: "›"; --tblr-breadcrumb-divider-color: rgba(255, 255, 255, .75); flex-wrap: nowrap; }
.app-breadcrumb .breadcrumb-item { color: rgba(255, 255, 255, .88); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22rem; }
.app-breadcrumb .breadcrumb-item::before { color: rgba(255, 255, 255, .75); }
.app-breadcrumb .breadcrumb-item a { color: #fff; text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .45); text-underline-offset: 3px; }
.app-breadcrumb .breadcrumb-item.active { color: #fff; font-weight: var(--pms-font-weight-medium); }
/* App name in the top bar only while the sidebar is folded (the rail shows the mark only) */
.topbar-brand { display: none; }
@media (min-width: 992px) { body.sidebar-collapsed .topbar-brand { display: inline; } }

/* Footer with a layered wave */
.app-footer { position: relative; padding-top: 3.75rem; overflow: hidden; border-top: 0; }
.app-wave { position: absolute; inset-inline: 0; top: 0; width: 100%; height: 3.5rem; display: block; }

/* Login page */
.login-hero {
    position: relative; overflow: hidden; padding: 1.5rem 1.25rem 2.5rem;
    border-radius: var(--pms-radius-card); background: var(--pms-gradient-nav); color: #fff;
    box-shadow: var(--pms-shadow-card);
}
.login-hero .login-sub { color: rgba(255, 255, 255, .9); }
.login-hero .app-wave { top: auto; bottom: -1px; height: 2rem; }

/* Thai date-time picker (js/thai-datetime.js) */
.thai-dtp-pop { position: absolute; z-index: 1060; top: 100%; inset-inline-start: 0; margin-top: .25rem; width: 19rem; max-width: calc(100vw - 2rem); }
.thai-dtp-grid th { font-weight: 600; color: var(--tblr-secondary); padding: .25rem 0; }
.thai-dtp-grid td { padding: 1px; }
.thai-dtp-grid .btn { padding: .25rem 0; min-height: 2rem; }
.thai-dtp-input { cursor: pointer; }

/* Open reporting window: blinking dot + tag after the quarter (View::liveDot / openQuarterTag) */
.live-dot { position: relative; display: inline-block; width: .55rem; height: .55rem; margin-inline-end: .35rem; border-radius: 50%; background: currentColor; vertical-align: .05em; flex-shrink: 0; }
.live-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: live-pulse 1.4s ease-out infinite; }
@keyframes live-pulse { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.8); opacity: 0; } }
/* Reduced motion (e.g. Windows animation effects off): no growing ring, the dot itself fades slowly (0.5 Hz, no flashing) */
@keyframes live-fade { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live-dot::after { animation: none; display: none; } .live-dot { animation: live-fade 2s ease-in-out infinite; } }
.q-open-tag { display: inline-flex; align-items: center; font-weight: 600; }
.open-window-card { border-inline-start: 4px solid var(--tblr-green); }
.open-window-card .live-dot { color: var(--tblr-green); width: .7rem; height: .7rem; }

/* Feedback threads and notifications (Phase 5) */
.fb-reply { margin-inline-start: 1rem; padding: .4rem .75rem; border-inline-start: 3px solid var(--tblr-border-color); background: var(--tblr-bg-surface-secondary); border-radius: 0 var(--tblr-border-radius) var(--tblr-border-radius) 0; }
.notif-unread { background: var(--tblr-primary-lt, rgba(32, 107, 196, .06)); }
.badge-blink-dot { width: .55rem; height: .55rem; padding: 0; border-radius: 50%; }
.navbar .badge-notification { position: absolute; top: .1rem; inset-inline-end: 0; font-size: .65rem; min-width: 1.1rem; padding: .15rem .3rem; }

/* Progress tracking (progress.php) */
.progress-bar-cell { min-width: 9rem; }

/* Spending plan revision (activity-plan.php) */
.plan-table { min-width: 78rem; }
.plan-table .plan-item { min-width: 13rem; position: sticky; inset-inline-start: 0; background: var(--tblr-bg-surface); z-index: 1; }
.plan-table .plan-input { min-width: 6.25rem; padding-inline: .35rem; }
.plan-table .plan-locked { background: var(--tblr-bg-surface-secondary); color: var(--tblr-secondary); }
.plan-table .plan-fixed { font-size: .8125rem; white-space: nowrap; }
.plan-table .plan-request-row td { border-top: 0; padding-top: 0; }
.plan-row-mismatch [data-sum] { color: var(--tblr-danger); }
.plan-locked-swatch { display: inline-block; width: .9rem; height: .9rem; vertical-align: -.1rem; border-radius: 2px; background: var(--tblr-bg-surface-secondary); border: 1px solid var(--tblr-border-color); }
.plan-save { position: sticky; bottom: 0; z-index: 10; box-shadow: 0 -.25rem .75rem rgba(0, 0, 0, .06); }

/* Indicators page */
.ind-quarters { min-width: 26rem; }
.ind-quarters th, .ind-quarters td { padding: .15rem .5rem; white-space: nowrap; }
.ind-field-head { display: flex; align-items: center; margin-bottom: .25rem; min-height: 1.5rem; }
.ind-help { padding: 0; margin: -.4rem 0 -.4rem .15rem; min-width: 1.9rem; min-height: 1.9rem; vertical-align: middle; color: var(--tblr-primary); }
.ind-help:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: -2px; }
@media (pointer: coarse) { .ind-help { min-width: 2rem; min-height: 2rem; } }
.ind-help-popover { --tblr-popover-max-width: min(26rem, calc(100vw - 1.5rem)); --bs-popover-max-width: min(26rem, calc(100vw - 1.5rem)); font-size: .8125rem; }
.ind-help-popover ul li { margin-bottom: .15rem; }
.ind-save { position: sticky; bottom: 0; z-index: 10; box-shadow: 0 -.25rem .75rem rgba(0, 0, 0, .06); }

/* Operating areas / networks maps (Leaflet) */
.fw-map { height: 18rem; border-radius: var(--tblr-border-radius); z-index: 0; }
.fw-picker { height: 22rem; border-radius: var(--tblr-border-radius); z-index: 0; }
@media (max-width: 575.98px) { .fw-map { height: 14rem; } .fw-picker { height: 16rem; } }

/* Show/hide toggle for login fields ([data-reveal], js/app.js) */
.masked-text { -webkit-text-security: disc; text-security: disc; }
.masked-text::placeholder { -webkit-text-security: none; }
.reveal-toggle { min-width: 2rem; min-height: 2rem; line-height: 1; }
.reveal-toggle:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: 2px; border-radius: 4px; }

/* ==================================================================== Dashboard components (UI-4, Q-64) */
/* Summary cards: large main value, thin bar in the card colour (darkened so it stays visible on white) */
.overview-kpis .kpi-value {
    font-size: var(--pms-font-size-kpi); font-weight: var(--pms-font-weight-bold);
    line-height: var(--pms-line-height-tight); letter-spacing: -.01em; color: var(--pms-text);
}
.overview-kpis .kpi-value-risk { color: color-mix(in oklab, var(--pms-data-risk) 80%, #000); }
.overview-kpis .kpi-value .fs-4 { font-size: var(--pms-font-size-sm) !important; color: var(--pms-text-muted); }
.kpi-bar { height: 6px; margin: .35rem 0 .6rem; border-radius: var(--pms-radius-pill); background: color-mix(in oklab, var(--card-accent, var(--pms-blue)) 14%, #fff); overflow: hidden; }
.kpi-bar > span { display: block; height: 100%; border-radius: inherit; background: color-mix(in oklab, var(--card-accent, var(--pms-blue)) 82%, #000); transition: width var(--pms-transition); }
@media (min-width: 1200px) and (max-width: 1599.98px) { .overview-kpis .kpi-value { font-size: 1.45rem; } }

/* Risk signals are pink everywhere (badges in tables, dimension cards, risk page) */
.badge-risk { background: color-mix(in oklab, var(--pms-data-risk) 14%, #fff); color: color-mix(in oklab, var(--pms-data-risk) 62%, #000); }
.bar-performance { background-color: color-mix(in oklab, var(--pms-data-performance) 75%, #000); }

/* Filter bars and export buttons */
.card-type-filter .form-label { font-weight: var(--pms-font-weight-medium); color: color-mix(in oklab, var(--pms-text) 85%, #fff); }
.btn .icon { stroke-width: 1.9; }

/* DataTables: rounded paging, search and page size matching the fields */
.dt-container .dt-search input,
.dt-container .dt-length select { border-radius: var(--pms-radius-button); }
.dt-container .dt-info { color: var(--pms-text-muted); font-size: var(--pms-font-size-sm); }
.dt-container .pagination { --tblr-pagination-border-radius: var(--pms-radius-button); gap: .2rem; flex-wrap: wrap; }
.dt-container .pagination .page-link { border-radius: var(--pms-radius-button) !important; min-width: 2.25rem; text-align: center; }
.dt-container .pagination .page-item.active .page-link { background: var(--pms-blue); border-color: var(--pms-blue); color: #fff; }
table.dataTable thead > tr > th.dt-orderable-asc:hover,
table.dataTable thead > tr > th.dt-orderable-desc:hover { outline: 0; background: color-mix(in oklab, var(--pms-soft-blue) 88%, var(--pms-blue)); }

/* ==================================================================== All pages (UI-5, Q-64) */
/* Empty state: soft icon + text, same look in tables, lists and cards (pms_empty()) */
.empty-state { display: inline-flex; align-items: center; gap: .6rem; color: var(--pms-text-muted); text-align: start; }
.empty-state-icon {
    flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 50%;
    color: color-mix(in oklab, var(--pms-blue) 70%, #000); background: var(--pms-soft-blue);
}
.empty-state-icon .icon { width: 1.1rem; height: 1.1rem; margin: 0; stroke-width: 1.75; }
td > .empty-state { justify-content: center; }

/* Alerts (flash messages, notices): white card, coloured left edge, rounded */
.alert {
    --tblr-alert-bg: var(--pms-surface);
    border: 1px solid var(--pms-border);
    border-inline-start: 4px solid var(--tblr-alert-color, var(--pms-blue));
    border-radius: var(--pms-radius-button);
    box-shadow: var(--pms-shadow-sm);
    color: var(--pms-text);
}
.alert-success { --tblr-alert-color: var(--pms-success); }
.alert-danger { --tblr-alert-color: var(--pms-danger); }
.alert-warning { --tblr-alert-color: var(--pms-warning); }
.alert-info { --tblr-alert-color: var(--pms-blue); }

/* Header buttons of a page: icon + text, same spacing */
.page-header .btn .icon { margin-inline-end: .35rem; }

/* Executive dashboard / overview (Phase 6) */
.chart-box { width: 100%; height: 300px; }
.chart-box-tall { min-height: 260px; }
.overview-table .overview-name { min-width: 14rem; }
.overview-kpis .h2 { font-variant-numeric: tabular-nums; }
/* Dimension summary cards (Q-49): long lists scroll inside the card on screen, print in full */
.dimension-card-list { max-height: 34rem; overflow-y: auto; font-variant-numeric: tabular-nums; }
.dimension-card .overview-name { min-width: 0; }
.overview-map { height: 32rem; border-radius: var(--tblr-border-radius); z-index: 0; }
/* Map popup (Q-61): same font as the app (Leaflet sets Helvetica Neue, so Thai fell back to another font);
   one size for every line; place (ตำบล อำเภอ จังหวัด) and project name share the same weight. */
.leaflet-container { font-family: var(--tblr-font-sans-serif); }
.leaflet-popup-content,
.leaflet-popup-content .small { font-size: .8125rem; line-height: 1.5; }
.leaflet-popup-content .map-pop-place,
.leaflet-popup-content .overview-map-list a { font-weight: 600; }
/* "สรุปรายอำเภอ" rows filter the map (Q-62) */
#areas-table tbody tr[data-area] { cursor: pointer; }
#areas-table tbody tr[data-area]:focus-visible { outline: 2px solid var(--tblr-primary); outline-offset: -2px; }
#areas-table tbody tr.table-active > td { --tblr-table-bg-state: color-mix(in oklab, var(--pms-data-area) 16%, #fff); font-weight: 600; }
/* popup project list with details (Q-60): scroll inside the popup when a point has many projects */
.overview-map-list { max-height: 16rem; overflow-y: auto; padding-inline-end: .25rem; }
.overview-map-list > li + li { margin-top: .4rem; }
.overview-map-list [data-map-info] { font-size: .8125rem; line-height: 1.5; }
@media (max-width: 575.98px) { .overview-map { height: 22rem; } .chart-box { height: 260px; } }
/* plan / disbursement: quarter rows expand per activity */
.fin-toggle .fin-caret { display: inline-block; transition: transform .15s; }
.fin-toggle:not(.collapsed) .fin-caret { transform: rotate(90deg); }
.fin-activity-row td { background: var(--pms-bg); }

@media print {
    @page { size: A4 landscape; margin: 10mm; }
    body { background: #fff !important; }
    .navbar, aside.navbar, .page-header .btn, .dt-layout-row:not(.dt-layout-table), .d-print-none { display: none !important; }
    .page-wrapper { margin: 0 !important; }
    .card { break-inside: avoid; box-shadow: none !important; }
    .table-responsive { overflow: visible !important; }
    .overview-table { font-size: 9pt; }
    .dimension-card-list { max-height: none; overflow: visible; }
    .card.dimension-card { break-inside: auto; }
    .dimension-card .list-group-item { break-inside: avoid; }
    .report-section, .report-section .card { break-inside: auto; }   /* project report: long cards flow over pages */
    a { color: inherit !important; text-decoration: none !important; }
}

/* Help mark (Q-74): (?) after a heading / column name; the text shows on hover, focus or tap.
   Colours from tokens.css only. */
.help-tip { display: inline-flex; align-items: center; vertical-align: middle; margin-inline-start: .25rem;
    color: var(--pms-text-muted); cursor: help; border-radius: var(--pms-radius-pill); line-height: 1; }
.help-tip .help-tip-icon { width: 1rem; height: 1rem; }
.help-tip:hover, .help-tip:focus-visible { color: var(--pms-blue); }
.help-tip:focus-visible { outline: 2px solid var(--pms-blue); outline-offset: 2px; }
.help-tooltip .tooltip-inner { max-width: 320px; text-align: start; white-space: pre-line; font-weight: 400; }
