/* Additions on top of site.css (the design system copied from HavirTax). */

/* Darker button colors so white text stays readable. */
[data-ht-theme="emerald"] { --ht-primary-hover: #0a7f57; }
[data-ht-theme="wheat"] {
    --ht-primary: #b7791f; --ht-primary-rgb: 183, 121, 31; --ht-primary-hover: #8a5a12;
    --ht-primary-light: #e0b25c; --ht-primary-deep: #744a0c;
    --ht-accent: #c2703d; --ht-accent-rgb: 194, 112, 61;
    --ht-sidebar: #2a2010; --ht-sidebar-2: #392c17; --ht-sidebar-text: #cdbd9f;
}
[data-bs-theme="dark"][data-ht-theme="wheat"] { --ht-sidebar: #151007; --ht-sidebar-2: #241b0d; }
.btn-primary {
    --bs-btn-bg: var(--ht-primary-hover); --bs-btn-border-color: var(--ht-primary-hover);
    --bs-btn-hover-bg: var(--ht-primary-deep); --bs-btn-hover-border-color: var(--ht-primary-deep);
    --bs-btn-active-bg: var(--ht-primary-deep); --bs-btn-disabled-bg: var(--ht-primary-hover); --bs-btn-disabled-border-color: var(--ht-primary-hover);
}
.welcome-card { background: linear-gradient(120deg, var(--ht-primary-deep) 0%, var(--ht-primary-hover) 50%, var(--ht-accent) 130%); }

/* Shape options use the same attributes as site.css; compact also tightens the page. */
[data-ht-density="compact"] .app-content { padding-block: 18px 24px; }

.nav-sub a[aria-disabled="true"] { opacity: .6; cursor: default; }

/* Theme management page */
.theme-card { text-align: right; background: var(--ht-surface); color: var(--ht-text); cursor: pointer; }
.theme-card[aria-pressed="true"] { border-color: var(--ht-primary); box-shadow: 0 0 0 1px var(--ht-primary); }
.theme-card .name { display: flex; align-items: center; justify-content: space-between; font-weight: 500; padding-top: 10px; }
.theme-card .ti-circle-check { color: var(--ht-primary); visibility: hidden; font-size: 18px; }
.theme-card[aria-pressed="true"] .ti-circle-check { visibility: visible; }
.theme-color { display: flex; align-items: center; gap: 12px; }
.theme-color input { width: 56px; height: 42px; padding: 3px; border: 1px solid var(--ht-border); border-radius: 12px; background: var(--ht-surface); cursor: pointer; }
.look-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 20px; }
.look-options .seg { display: inline-flex; flex-wrap: wrap; }

/* Dashboard */
.dash-filter .select2-container--default .select2-selection--multiple,
.dash-filter .select2-container--default .select2-selection--single { min-height: 42px; }
.welcome-card label { font-size: .84rem; margin-bottom: 6px; display: block; opacity: .95; }
.dash-filter { flex: 1 1 420px; max-width: 620px; color: var(--ht-text); }
.dash-filter label { color: #fff; }
.progress-track { display: block; height: 8px; border-radius: 99px; background: var(--ht-surface-2); overflow: hidden; min-width: 90px; }
.progress-fill { display: block; height: 100%; border-radius: 99px; background: var(--ht-primary-hover); }
.bar-chart .bar { background: var(--ht-primary-hover); }

/* Client toasts */
.toast-x.hide { opacity: 0; transition: opacity .25s; }

/* Reports */
:root {
    --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100;
    --series-5: #e87ba4; --series-6: #008300; --series-7: #6250d6; --series-8: #e34948;
}
[data-bs-theme="dark"] {
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500;
    --series-5: #d55181; --series-6: #008300; --series-7: #9085e9; --series-8: #e66767;
}
.report-filter { padding: 18px 20px; display: flex; flex-wrap: wrap; gap: 14px 16px; align-items: flex-end; margin-bottom: 20px; }
.report-field { flex: 1 1 200px; min-width: 0; }
.report-field label { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .82rem; color: var(--ht-muted); margin-bottom: 6px; min-height: 22px; }
.report-field .select2-container { width: 100% !important; }
.report-filter-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.report-filter-actions .btn { min-height: 42px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.link-all { border: 0; background: none; padding: 0; font-size: .76rem; color: var(--ht-primary); cursor: pointer; }
.link-all:hover { text-decoration: underline; }
.report-status { margin-bottom: 20px; align-items: center; }
.report-status .spinner-border { flex-shrink: 0; color: var(--ht-primary); }
.report-results > * + * { margin-top: 20px; }
.report-results[hidden] { display: none; }

/* The one loud element of a report: how far the plan has come. */
.report-hero { border-radius: var(--ht-radius-lg); padding: 24px 28px; color: #fff; background: linear-gradient(120deg, var(--ht-primary-deep) 0%, var(--ht-primary-hover) 55%, var(--ht-accent) 130%); display: grid; grid-template-columns: minmax(170px, auto) minmax(0, 1fr); gap: 20px 36px; align-items: center; }
.report-hero-figure { font-size: 3rem; font-weight: 800; line-height: 1.05; }
.report-hero-label { font-size: .85rem; opacity: .9; margin-top: 4px; }
.report-hero-track { height: 12px; border-radius: 99px; background: rgba(255, 255, 255, .22); overflow: hidden; }
.report-hero-fill { display: block; height: 100%; border-radius: 99px; background: #fff; transition: width .5s ease; }
.report-hero-facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin-top: 14px; }
.report-hero-facts div { font-size: .8rem; opacity: .95; }
.report-hero-facts b { display: block; font-size: 1.1rem; font-weight: 700; }
.report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.report-toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.report-search { position: relative; flex: 0 1 240px; }
.report-search .ti { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ht-subtle); }
.report-search input { padding-inline-start: 36px; }

.report-table th.num, .report-table td.num { text-align: center; white-space: nowrap; }
.report-table td { white-space: nowrap; }
.report-table tfoot td { font-weight: 700; background: var(--ht-surface-2); border-top: 2px solid var(--ht-border); }
.report-table th.report-group { text-align: center; border-inline: 1px solid var(--ht-border); }
.report-table .sticky-col { position: sticky; inset-inline-start: 0; background: var(--ht-surface); z-index: 1; }
.report-table tfoot .sticky-col { background: var(--ht-surface-2); }
.report-sort { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: inherit; font: inherit; cursor: pointer; white-space: nowrap; }
.report-sort .ti { font-size: 14px; opacity: .45; }
th[aria-sort] .report-sort { color: var(--ht-primary); }
th[aria-sort] .report-sort .ti { opacity: 1; }
.report-more { text-align: center; padding: 12px; border-top: 1px solid var(--ht-border); }
.report-progress { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.report-progress .progress-track { flex: 1; }
.report-progress-value { font-size: .76rem; color: var(--ht-muted); min-width: 38px; }
.report-group-row td { background: var(--ht-surface-2); font-weight: 700; }
.report-group-row .ti { color: var(--ht-primary); margin-inline-end: 6px; }

.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-row { display: grid; grid-template-columns: minmax(80px, 150px) minmax(60px, 1fr) minmax(80px, auto); gap: 10px; align-items: center; font-size: .86rem; }
.rank-row.ranked { grid-template-columns: auto minmax(80px, 150px) minmax(60px, 1fr) minmax(80px, auto); }
.rank-no { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: .76rem; background: var(--ht-surface-2); color: var(--ht-muted); }
.rank-no.top { background: rgba(var(--ht-primary-rgb), .14); color: var(--ht-primary); font-weight: 700; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { display: block; height: 10px; border-radius: 99px; background: var(--ht-surface-2); overflow: hidden; }
.rank-fill { display: block; height: 100%; border-radius: 99px; background: var(--ht-primary-hover); }
.rank-value { font-weight: 500; white-space: nowrap; }
.rank-value small { display: block; font-weight: 400; color: var(--ht-subtle); font-size: .72rem; }

.chart-keys { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .78rem; color: var(--ht-muted); }
.chart-key { display: inline-flex; align-items: center; gap: 6px; }
.chart-key i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.line-chart svg { display: block; max-width: 100%; }
.chart-grid { stroke: var(--ht-border); stroke-width: 1; }
.chart-axis { fill: var(--ht-subtle); font-size: 11px; font-family: inherit; }
.chart-cross { stroke: var(--ht-subtle); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip { position: fixed; z-index: 2000; pointer-events: none; background: var(--ht-sidebar); color: #fff; border-radius: 10px; padding: 8px 12px; font-size: .78rem; box-shadow: var(--ht-shadow-lg); max-width: 300px; }
.chart-tip-title { font-weight: 500; margin-bottom: 4px; }
.chart-tip-row { display: flex; align-items: center; gap: 6px; }
.chart-tip-row i { width: 9px; height: 9px; border-radius: 2px; flex-shrink: 0; }
.chart-tip-row b { margin-inline-start: auto; padding-inline-start: 14px; font-weight: 500; white-space: nowrap; }
.stack-bar { display: flex; gap: 2px; height: 14px; border-radius: 6px; overflow: hidden; background: var(--ht-surface-2); }
.stack-seg { display: block; min-width: 2px; }
.stack-seg:focus-visible { outline: 2px solid var(--ht-text); outline-offset: -2px; }

/* Factory cards of the city share report and city rows of the supply report */
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.supply-row { border-top: 1px solid var(--ht-border); }
.supply-row:first-child { border-top: 0; }
.supply-row summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(100px, 170px) minmax(60px, 1fr) minmax(110px, auto) 20px; gap: 14px; align-items: center; padding: 12px 20px; font-size: .88rem; }
.supply-row summary::-webkit-details-marker { display: none; }
.supply-row summary:hover { background: var(--ht-surface-2); }
.supply-row summary .ti { color: var(--ht-subtle); transition: transform .15s; }
.supply-row[open] summary .ti { transform: rotate(180deg); }
.supply-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supply-total small { display: block; color: var(--ht-subtle); font-size: .72rem; }
.supply-detail { padding: 0 20px 14px; }
.heat-cell { text-align: center; white-space: nowrap; }
.report-note { font-size: .8rem; color: var(--ht-muted); line-height: 1.9; }
.report-note summary { cursor: pointer; color: var(--ht-primary); }

/* Admin access */
.access-layout { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 20px; align-items: start; }
.access-people { position: sticky; top: calc(var(--ht-topbar-height) + 16px); }
.access-people-list { max-height: 62vh; overflow-y: auto; padding: 8px; display: grid; gap: 4px; }
.access-person { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ht-text); text-align: start; cursor: pointer; }
.access-person:hover { background: var(--ht-surface-2); }
.access-person[aria-pressed="true"] { background: rgba(var(--ht-primary-rgb), .1); }
.access-avatar { width: 36px; height: 36px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: rgba(var(--ht-primary-rgb), .12); color: var(--ht-primary); }
.access-person-text { min-width: 0; flex: 1; }
.access-person-text b { display: block; font-weight: 500; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.access-person-text small { color: var(--ht-subtle); font-size: .74rem; }
.access-empty { text-align: center; padding: 64px 20px; color: var(--ht-muted); }
.access-empty .ti { font-size: 42px; color: var(--ht-subtle); display: block; margin-bottom: 10px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.pick { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--ht-border); border-radius: 10px; cursor: pointer; font-size: .85rem; margin: 0; background: var(--ht-surface); }
.pick:hover { border-color: rgba(var(--ht-primary-rgb), .5); }
.pick:has(input:checked) { border-color: var(--ht-primary); background: rgba(var(--ht-primary-rgb), .07); }
.pick input { margin: 0; flex-shrink: 0; }
.pick small { display: block; font-size: .72rem; color: var(--ht-subtle); }
.perm-group { border-top: 1px solid var(--ht-border); padding: 16px 20px; }
.perm-group:first-child { border-top: 0; }
.perm-group-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.perm-group-head h3 { font-size: .92rem; font-weight: 700; margin: 0; }
.perm-count { color: var(--ht-subtle); font-weight: 400; font-size: .76rem; margin-inline-start: 6px; }
.access-save { position: sticky; bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; flex-wrap: wrap; z-index: 5; }

/* Token and contact pages */
.token-output { direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; font-family: Consolas, "Courier New", monospace; font-size: .82rem; line-height: 1.8; background: var(--ht-sidebar); color: #e7eaf3; border-radius: 12px; padding: 16px; margin: 0; max-height: 50vh; overflow: auto; }
.contact-office { display: flex; gap: 16px; padding: 22px; height: 100%; }
.contact-office h2 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.contact-office p { color: var(--ht-muted); font-size: .88rem; line-height: 2; margin: 0; }
.contact-phone { font-size: 1.5rem; font-weight: 800; color: inherit; direction: ltr; display: inline-block; }

@media (max-width: 991.98px) {
    .access-layout { grid-template-columns: minmax(0, 1fr); }
    .access-people { position: static; }
    .access-people-list { max-height: 260px; }
}
@media (max-width: 575.98px) {
    .report-hero { grid-template-columns: minmax(0, 1fr); padding: 20px; }
    .report-hero-figure { font-size: 2.4rem; }
    .report-filter-actions, .report-filter-actions .btn { width: 100%; justify-content: center; }
    .rank-row, .rank-row.ranked { grid-template-columns: minmax(0, 1fr) auto; }
    .rank-no { display: none; }
    .rank-track { grid-column: 1 / -1; grid-row: 2; }
    .supply-row summary { grid-template-columns: minmax(0, 1fr) auto 20px; }
    .supply-row summary .stack-bar { grid-column: 1 / -1; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) { .report-hero-fill { transition: none; } }
.report-status[hidden], [data-editor][hidden], [data-restricted][hidden], .access-empty[hidden], .share-grid[hidden], .access-person[hidden] { display: none !important; }
.report-hero a { color: inherit; }

/* Multi-select lists match the single-select look */
.select2-container--default .select2-selection--multiple { min-height: 46px; padding: 4px 8px; border: 1px solid var(--ht-border); border-radius: 12px; background: var(--ht-surface); color: var(--ht-text); cursor: pointer; }
.select2-container--default.select2-container--focus .select2-selection--multiple,
.select2-container--default.select2-container--open .select2-selection--multiple { border-color: rgba(var(--ht-primary-rgb), .6); box-shadow: 0 0 0 3px rgba(var(--ht-primary-rgb), .12); }
.select2-container--default.select2-container--disabled .select2-selection--multiple { background: var(--ht-surface-2); opacity: .75; cursor: not-allowed; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.select2-container--default .select2-selection--multiple .select2-selection__choice { display: inline-flex; align-items: center; gap: 4px; margin: 2px 0; padding: 3px 10px; border: 0; border-radius: 8px; background: rgba(var(--ht-primary-rgb), .1); color: var(--ht-primary); font-size: .8rem; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__display { padding: 0; cursor: default; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { position: static; order: 2; padding: 0; border: 0; background: none; color: inherit; font-size: 15px; line-height: 1; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover { background: none; color: var(--ht-danger); }
.select2-container--default .select2-search--inline .select2-search__field { margin: 4px 4px 0; font-family: inherit; color: var(--ht-text); }
.report-stats .stat-card > div:last-child { min-width: 0; }
.report-stats .stat-card .value { font-size: 1.4rem; overflow-wrap: anywhere; }
.report-table th:not(.num):not(.report-group), .report-table td:not(.num):not(.heat-cell) { text-align: start; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove { border: 0 !important; }
.access-people-list { overflow-x: hidden; grid-template-columns: minmax(0, 1fr); }
.access-person .badge-soft { flex-shrink: 0; }
.access-save, .form-switch .form-check-label { margin-inline-start: 0; }
.form-switch .form-check-label { padding-inline-start: 6px; }
.report-table .table, .report-table.table-responsive .table { --bs-table-bg: var(--ht-surface); }

/* Server-side lists (orders, services, transfers) */
.sgrid-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--ht-border); }
.sgrid-toolbar .report-search { flex: 0 1 260px; }
.sgrid-col { width: auto; min-width: 150px; }
.sgrid-toggle[aria-pressed="true"] { background: rgba(var(--ht-primary-rgb), .1); color: var(--ht-primary); }
.sgrid-toolbar .btn { display: inline-flex; align-items: center; gap: 6px; }
.sgrid-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sgrid-tools { display: flex; gap: 8px; margin-inline-start: auto; }
.sgrid-scroll { position: relative; }
.sgrid.is-loading .sgrid-scroll { opacity: .55; pointer-events: none; transition: opacity .15s; }
.sgrid .table { --bs-table-bg: var(--ht-surface); }
.sgrid td, .sgrid th { white-space: nowrap; text-align: start; }
.sgrid td.num, .sgrid th.num { text-align: center; }
.sgrid .sgrid-no { color: var(--ht-subtle); width: 1%; text-align: center; }
.sgrid-filters th { background: var(--ht-surface) !important; padding: 8px 10px !important; }
.sgrid-filters input { min-width: 110px; }
.sgrid-wrap { display: inline-block; white-space: normal; min-width: 220px; max-width: 360px; line-height: 1.7; }
.sgrid-actions { display: flex; gap: 6px; }
.sgrid-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--ht-border); font-size: .82rem; color: var(--ht-muted); }
.sgrid-pager { display: flex; align-items: center; gap: 8px; }
.sgrid-size { width: auto; }
@media (max-width: 575.98px) { .sgrid-tools { margin-inline-start: 0; } .sgrid-toolbar .report-search { flex: 1 1 100%; } }
