/* Cost Planning & Budgeting Module CSS — Powered by theme/tokens.css */

.cost-main {
  padding: 24px;
  max-width: min(1600px, 100%);
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
}

.cost-main .btn:not(.btn-primary):not([style*="background"]):not(.text-error):not(.more-btn) {
  background: rgb(var(--surface));
  color: rgb(var(--text));
  border: 1px solid rgb(var(--border));
}

.cost-main .btn:not(.btn-primary):not([style*="background"]):not(.text-error):not(.more-btn):hover {
  background: rgb(var(--hover));
  border-color: rgb(var(--border));
}

.cost-main .btn .ui-icon {
  fill: none;
  stroke: currentColor;
}

.cost-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  color: rgb(var(--muted));
  font-size: var(--font-helper);
  margin-bottom: 16px;
}

.cost-breadcrumb a {
  color: rgb(var(--primary));
  text-decoration: none;
}

.cost-breadcrumb a:hover {
  text-decoration: underline;
}

.cost-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.cost-header h1 {
  margin: 0;
}

.cost-header .subtitle {
  color: rgb(var(--muted));
  margin-top: 4px;
  font-size: var(--font-body);
}

.cost-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* KPI */
.cost-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.cost-kpi-card {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cost-kpi-card:hover {
  border-color: rgb(var(--primary) / 0.4);
}

.cost-kpi-card .kpi-label {
  color: rgb(var(--muted));
  font-size: var(--font-helper);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cost-kpi-card .kpi-value {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 8px 0 4px;
  color: rgb(var(--text));
  line-height: 1.2;
}

.cost-kpi-card .kpi-sub {
  color: rgb(var(--muted));
  font-size: var(--font-helper);
}

/* Panels & toolbar */
.cost-panel {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 20px;
}

.cost-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.cost-panel-head h2 {
  margin: 0;
  font-size: var(--font-heading);
}

.cost-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.cost-toolbar .search {
  min-width: 220px;
  max-width: 380px;
  flex: 1;
}

/* Badges */
.cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: var(--font-helper);
  font-weight: 600;
  white-space: nowrap;
}

.cost-badge.active { background: rgb(var(--success) / 0.14); color: rgb(var(--success)); }
.cost-badge.approved { background: rgb(var(--success) / 0.14); color: rgb(var(--success)); }
.cost-badge.draft { background: rgb(var(--muted) / 0.15); color: rgb(var(--muted)); }
.cost-badge.pending { background: rgb(var(--warning) / 0.14); color: rgb(var(--warning)); }
.cost-badge.open { background: rgb(var(--primary) / 0.12); color: rgb(var(--primary)); }
.cost-badge.partial { background: rgb(var(--warning) / 0.18); color: rgb(var(--warning)); }
.cost-badge.closed { background: rgb(var(--muted) / 0.2); color: rgb(var(--muted)); }
.cost-badge.revised { background: rgb(var(--primary) / 0.1); color: rgb(var(--primary)); }
.cost-badge.overbudget { background: rgb(var(--error) / 0.14); color: rgb(var(--error)); }

/* Progress */
.cost-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.cost-progress-bar {
  flex: 1;
  height: 6px;
  background: rgb(var(--border));
  border-radius: 3px;
  overflow: hidden;
}

.cost-progress-fill {
  height: 100%;
  background: rgb(var(--primary));
  border-radius: 3px;
  transition: width 0.3s ease;
}

.cost-progress-fill.high {
  background: rgb(var(--warning));
}

.cost-progress-fill.over {
  background: rgb(var(--error));
}

.cost-progress-label {
  font-size: var(--font-helper);
  color: rgb(var(--muted));
  white-space: nowrap;
  min-width: 36px;
  text-align: right;
}

/* Utilization bar */
.cost-util {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cost-util-track {
  height: 8px;
  background: rgb(var(--border));
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.cost-util-fill {
  height: 100%;
  border-radius: 4px;
  background: rgb(var(--success));
  transition: width 0.3s ease;
}

.cost-util-fill.near {
  background: rgb(var(--warning));
}

.cost-util-fill.over {
  background: rgb(var(--error));
}

.cost-util-meta {
  display: flex;
  justify-content: space-between;
  font-size: var(--font-helper);
  color: rgb(var(--muted));
}

/* Variance indicators */
.cost-variance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--font-helper);
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
}

.cost-variance.within {
  background: rgb(var(--success) / 0.12);
  color: rgb(var(--success));
}

.cost-variance.near {
  background: rgb(var(--warning) / 0.14);
  color: rgb(var(--warning));
}

.cost-variance.over {
  background: rgb(var(--error) / 0.14);
  color: rgb(var(--error));
}

/* Charts */
.cost-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.cost-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cost-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 72px;
  gap: 10px;
  align-items: center;
}

.cost-bar-label {
  font-size: var(--font-helper);
  color: rgb(var(--muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cost-bar-track {
  height: 10px;
  background: rgb(var(--canvas));
  border: 1px solid rgb(var(--border));
  border-radius: 4px;
  overflow: hidden;
}

.cost-bar {
  height: 100%;
  background: rgb(var(--primary));
  border-radius: 3px;
  min-width: 2px;
  transition: width 0.3s ease;
}

.cost-bar.labour { background: rgb(var(--primary) / 0.75); }
.cost-bar.equipment { background: rgb(var(--muted)); }
.cost-bar.actual { background: rgb(var(--success)); }
.cost-bar.committed { background: rgb(var(--warning)); }

.cost-bar-value {
  font-size: var(--font-helper);
  color: rgb(var(--text));
  text-align: right;
  font-weight: 600;
}

/* Tabs */
.cost-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid rgb(var(--border));
  margin-bottom: 20px;
  overflow-x: auto;
}

.cost-tab-btn {
  padding: 10px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: rgb(var(--muted));
  font-size: var(--font-body);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cost-tab-btn:hover {
  color: rgb(var(--text));
}

.cost-tab-btn.active {
  color: rgb(var(--primary));
  border-bottom-color: rgb(var(--primary));
  font-weight: 600;
}

/* Category tree */
.cost-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cost-tree-item {
  border-bottom: 1px solid rgb(var(--border));
}

.cost-tree-item:last-child {
  border-bottom: 0;
}

.cost-tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  cursor: pointer;
  border-radius: 4px;
}

.cost-tree-row:hover {
  background: rgb(var(--hover));
}

.cost-tree-row .code {
  font-size: var(--font-helper);
  color: rgb(var(--muted));
  min-width: 88px;
}

.cost-tree-row .name {
  flex: 1;
  font-weight: 500;
  color: rgb(var(--text));
}

.cost-tree-row .amount {
  font-weight: 600;
  font-size: var(--font-body);
}

.cost-tree-children {
  list-style: none;
  margin: 0;
  padding: 0 0 0 24px;
  background: rgb(var(--canvas));
}

.cost-tree-children .cost-tree-row {
  padding: 8px;
  font-size: var(--font-helper);
}

/* Dialog & forms */
.cost-dialog {
  max-width: 860px;
  width: calc(100% - 32px);
  padding: 0;
  border-radius: 8px;
  border: 1px solid rgb(var(--border));
  background: rgb(var(--surface));
}

.cost-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgb(var(--border));
}

.cost-dialog-body {
  padding: 20px;
  max-height: calc(85vh - 120px);
  overflow-y: auto;
}

.cost-dialog-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid rgb(var(--border));
  background: rgb(var(--canvas));
}

.form-duo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.form-trio {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.form-duo .full,
.form-trio .full,
.form-full {
  grid-column: 1 / -1;
}

.cost-page-form {
  min-width: 0;
  max-width: 100%;
}

.cost-page-form .form-trio {
  align-items: start;
}

.cost-page-form .cost-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
}

.cost-page-form .cost-field > .helper {
  min-height: 1.2em;
  line-height: 1.3;
}

.cost-page-form .cost-field .input,
.cost-page-form .cost-field admin-select,
.cost-page-form .cost-field admin-date-picker,
.cost-page-form .cost-field admin-select > button.input,
.cost-page-form .cost-field admin-date-picker > button.input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.cost-page-form .cost-field admin-select > button.input,
.cost-page-form .cost-field admin-date-picker > button.input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cost-page-form .cost-field admin-select > button.input > span,
.cost-page-form .cost-field .date-trigger-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cost-form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.cost-form-grid .full {
  grid-column: 1 / -1;
}

.cost-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgb(var(--border));
  font-size: var(--font-body);
}

.cost-meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cost-meta-item span {
  color: rgb(var(--muted));
  font-size: var(--font-helper);
}

.cost-meta-item strong {
  color: rgb(var(--text));
  font-weight: 600;
}

.cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-table);
}

.cost-table th,
.cost-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgb(var(--border));
  text-align: left;
}

.cost-table th {
  background: rgb(var(--hover));
  color: rgb(var(--muted));
  font-weight: 600;
}

.cost-table tbody tr:hover {
  background: rgb(var(--hover) / 0.5);
}

.cost-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cost-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
}

.cost-rev-table {
  min-width: 36rem;
}

.cost-rev-table .input {
  width: 100%;
  min-width: 6.5rem;
  box-sizing: border-box;
  text-align: right;
}

.cost-chart-card {
  min-height: 0;
}

.cost-filters .cost-form-grid,
.cost-filters .form-trio {
  margin-bottom: 12px;
}

.cost-empty {
  color: rgb(var(--muted));
}

.cost-flow .cost-flow-step {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  background: rgb(var(--canvas));
  min-width: 110px;
}

.cost-flow .cost-flow-step span {
  font-size: var(--font-helper);
  color: rgb(var(--muted));
}

.cost-flow .cost-flow-step strong {
  font-size: var(--font-body);
  color: rgb(var(--text));
}

.cost-flow .cost-flow-arrow {
  color: rgb(var(--muted));
  font-size: 1.1rem;
}

.cost-badge.underreview,
.cost-badge.cost-status-underreview {
  background: rgb(var(--warning) / 0.14);
  color: rgb(var(--warning));
}

.cost-bar.planned {
  background: rgb(var(--primary) / 0.55);
}

.cost-bar.budget {
  background: rgb(var(--primary));
}

.cost-toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 80;
  padding: 12px 16px;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-left: 4px solid rgb(var(--primary));
  border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.08);
  max-width: min(360px, calc(100vw - 32px));
}

.cost-modal::backdrop {
  background: rgb(0 0 0 / 0.35);
}

.cost-row-menu {
  background: rgb(var(--surface));
}

.cost-row-menu a,
.cost-row-menu button {
  color: rgb(var(--text));
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
}

/* —— PSM-aligned table chrome (shared class names) —— */
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.page-heading p {
  color: rgb(var(--muted));
  margin-top: 4px;
}

.page-heading > .btn,
.page-heading > div.flex,
.page-heading > .heading-actions {
  flex-shrink: 0;
  white-space: nowrap;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.bulk-menu-wrap {
  position: relative;
}

.bulk-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 200px;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 6px 20px rgb(var(--overlay) / 0.12);
}

.bulk-popover .option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: var(--font-body);
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.bulk-popover .option:hover,
.bulk-popover .option:focus {
  background: rgb(var(--hover));
}

.bulk-sep {
  height: 1px;
  margin: 4px 6px;
  background: rgb(var(--border));
}

.table-panel {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  margin-bottom: 16px;
}

.toolbar-wrap {
  position: relative;
  overflow: visible;
  z-index: 6;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  flex-wrap: wrap;
}

.search-box {
  min-width: 220px;
  max-width: 320px;
  flex: 1;
}

.quick-filter {
  min-width: 150px;
  width: 160px;
}

.sort-control {
  min-width: 180px;
}

.toolbar-end {
  margin-left: auto;
}

.toolbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-text {
  border: 0;
  background: transparent;
  color: rgb(var(--primary));
  padding: 6px 4px;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-text:hover {
  text-decoration: underline;
}

.clear-all-filters {
  color: rgb(var(--muted));
  white-space: nowrap;
}

.clear-all-filters:hover {
  color: rgb(var(--text));
}

.adv-filter-anchor {
  position: relative;
}

.adv-filter-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: auto;
  z-index: 40;
  width: min(560px, calc(100vw - 16px));
  max-width: min(560px, calc(100vw - 16px));
  box-sizing: border-box;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 10px 28px rgb(var(--overlay) / 0.14);
}

.adv-filter-rows {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: visible;
}

.adv-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) 36px;
  gap: 8px;
  align-items: center;
}

.adv-filter-field,
.adv-filter-op,
.adv-filter-value-wrap {
  min-width: 0;
}

.adv-filter-value-wrap .field {
  margin: 0;
}

.adv-filter-value-wrap .input {
  width: 100%;
  min-height: 40px;
}

.adv-filter-remove {
  color: rgb(var(--muted));
  justify-self: center;
}

.adv-filter-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgb(var(--border));
  flex-wrap: wrap;
}

.adv-filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

.table-wrap {
  position: relative;
  z-index: 1;
  overflow-x: auto;
  padding: 0 16px;
}

.data-table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

.data-table th {
  font-size: var(--font-helper);
  height: 40px;
  text-align: left;
  white-space: nowrap;
  padding: 0 10px;
  border-bottom: 1px solid rgb(var(--border));
  background: rgb(var(--hover));
  color: rgb(var(--muted));
  font-weight: 600;
}

.data-table td {
  height: 66px;
  padding: 8px 10px;
  border-bottom: 1px solid rgb(var(--border));
  vertical-align: middle;
  white-space: nowrap;
}

.data-table td.num,
.data-table th.num {
  text-align: right;
}

.data-table tbody tr:hover {
  background: rgb(var(--hover) / 0.5);
}

.data-table tbody tr.row-click {
  cursor: pointer;
}

.data-table tbody tr.row-click:focus-visible {
  outline: 2px solid rgb(var(--primary));
  outline-offset: -2px;
}

.data-table .col-check {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 44px;
  min-width: 44px;
  max-width: 44px;
  text-align: center;
  vertical-align: middle;
  background: rgb(var(--surface));
}

.data-table thead .col-check {
  z-index: 3;
  background: rgb(var(--hover));
}

.data-table .col-check .check {
  margin: 0 auto;
  display: inline-block;
  vertical-align: middle;
}

.data-table .col-action {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 52px;
  min-width: 52px;
  max-width: 52px;
  text-align: center;
  vertical-align: middle;
  background: rgb(var(--surface));
}

.data-table thead .col-action {
  z-index: 3;
  background: rgb(var(--hover));
  text-align: center;
}

.data-table tbody tr:hover .col-check,
.data-table tbody tr:hover .col-action {
  background: rgb(var(--hover) / 0.55);
}

.primary-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.primary-cell a,
.primary-cell strong {
  font-weight: 600;
}

.primary-cell a:hover {
  color: rgb(var(--primary));
}

.cell-sub {
  display: block;
  color: rgb(var(--muted));
  font-size: var(--font-helper);
  margin-top: 2px;
}

.more-cell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.more-btn {
  border: 0;
  background: transparent;
  padding: 6px;
  border-radius: 8px;
  cursor: pointer;
  color: rgb(var(--muted));
  min-height: 32px;
  min-width: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.more-btn .ui-icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
}

.more-btn:hover,
.more-btn:focus-visible {
  background: rgb(var(--hover));
  color: rgb(var(--text));
}

.more-btn[aria-expanded="true"] {
  background: rgb(var(--hover));
  color: rgb(var(--text));
}

.more-popover,
.bulk-popover {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 15;
  min-width: 160px;
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 6px 20px rgb(var(--overlay) / 0.12);
}

.more-popover.menu-fixed,
.bulk-popover.menu-fixed {
  position: fixed !important;
  right: auto !important;
  z-index: 100 !important;
}

.more-popover .option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border-radius: 4px;
  font-size: var(--font-body);
  border: 0;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.more-popover .option:hover,
.more-popover .option:focus {
  background: rgb(var(--hover));
}

.more-popover .option.text-error,
.bulk-popover .option.text-error,
.bulk-popover [data-action="bulk-remove"],
.bulk-popover [data-action="bulk-remove-all"] {
  color: rgb(var(--error));
}

.bulk-popover .option:disabled,
.bulk-popover .option[disabled],
.bulk-popover .option.text-error:disabled,
.bulk-popover [data-action="bulk-remove"]:disabled {
  color: rgb(var(--muted));
  opacity: .5;
  cursor: not-allowed;
  background: transparent;
}

.bulk-popover .option:disabled:hover,
.bulk-popover .option[disabled]:hover {
  background: transparent;
  color: rgb(var(--muted));
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: rgb(var(--muted));
  font-size: var(--font-helper);
}

.page-size {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-size admin-select {
  width: 72px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
}

.page-number {
  background: rgb(var(--primary) / 0.08);
  color: rgb(var(--primary));
  padding: 5px 10px;
  border-radius: 5px;
}

.demo-note {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgb(var(--muted));
  font-size: var(--font-helper);
  margin-top: 16px;
}

.empty-cell {
  text-align: center;
  padding: 40px !important;
  white-space: normal !important;
}

.empty-cell strong {
  display: block;
  margin-bottom: 6px;
}

/* Responsive — desktop-first, breakpoint 768px */
@media (max-width: 1024px) {
  .cost-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .cost-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .cost-main {
    padding: 16px;
  }

  .cost-header {
    flex-direction: column;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .cost-kpi-grid {
    grid-template-columns: 1fr;
  }

  .form-duo,
  .form-trio,
  .cost-form-grid {
    grid-template-columns: 1fr;
  }

  body[data-page="create"] .cost-main,
  body[data-page="cost-item"] .cost-main,
  body[data-page="cost-category"] .cost-main,
  body[data-page="category"] .cost-main,
  body[data-page="cost-revision"] .cost-main {
    padding: 12px;
  }

  .cost-panel,
  .table-panel,
  .cost-header,
  .page-heading {
    min-width: 0;
    max-width: 100%;
  }

  .cost-page-form .cost-panel {
    padding: 12px;
  }

  .cost-page-form .cost-actions .btn {
    flex: 1 1 calc(50% - 8px);
    justify-content: center;
  }

  .cost-bar-row {
    grid-template-columns: 80px 1fr 56px;
    gap: 6px;
  }

  .cost-meta-row {
    flex-direction: column;
    gap: 10px;
  }

  .toolbar-end {
    margin-left: 0;
  }

  .toolbar-tools {
    width: 100%;
  }

  .search-box {
    max-width: none;
    flex-basis: 100%;
  }

  .quick-filter {
    flex: 1;
    width: auto;
  }

  .adv-filter-panel {
    left: 0;
    right: auto;
    width: min(560px, calc(100vw - 16px));
    max-width: min(560px, calc(100vw - 16px));
  }

  .adv-filter-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .adv-filter-remove {
    justify-self: end;
  }

  .adv-filter-foot {
    align-items: stretch;
  }

  .adv-filter-actions {
    margin-left: 0;
    width: 100%;
  }

  .adv-filter-actions .btn {
    flex: 1;
  }

  .table-footer {
    flex-wrap: wrap;
  }
}

/* Fields show only the inner blue border when focused (no outer focus ring). */
#content input:not(.check):not([type=checkbox]):not([type=radio]):focus-visible,
#content textarea:focus-visible,
#content .input:focus-visible,
#content admin-select button.input:focus-visible,
#content admin-select .popover input:focus-visible,
#content admin-date-picker .date-trigger:focus-visible {
  outline: none;
  box-shadow: none;
  border-color: rgb(var(--focus));
}

.data-table tbody tr:has(.more-cell[data-view]) { cursor: pointer; }
#revision-decision .cost-dialog-head { gap: 12px; }
#revision-decision .cost-field { display: block; margin-top: 12px; }
#revision-decision .form-error:empty { display: none; }
