:root {
  --stream-ink: #151a2d;
  --stream-muted: #697089;
  --stream-border: #dde1ec;
  --stream-surface: #ffffff;
  --stream-canvas: #f4f6fb;
  --stream-primary: #6338e5;
  --stream-primary-dark: #4d25c7;
  --stream-success: #16845b;
  --stream-warning: #dd7a19;
  --stream-danger: #c83e4d;
}

html { font-size: 15px; min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--stream-ink);
  background: var(--stream-canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: var(--stream-primary); }
a:hover { color: var(--stream-primary-dark); }

:focus-visible {
  outline: 3px solid var(--stream-primary-dark);
  outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--stream-primary-dark) !important;
  outline-offset: 3px !important;
}

.site-header :focus-visible,
.skip-link:focus-visible {
  outline-color: #f1bd2c !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 2000;
  padding: 0.65rem 1rem;
  color: #fff;
  background: var(--stream-ink);
  border-radius: 0.5rem;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.app-container { width: calc(100% - 1.5rem); max-width: none; margin-inline: auto; }

.site-header {
  color: #fff;
  background: var(--stream-ink);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.site-header .navbar { min-height: 3.75rem; padding-block: 0.35rem; }
.site-header .navbar-brand, .site-header .nav-link { color: #fff; }
.site-header .nav-link:hover { color: #dcd1ff; }
.site-header .dropdown-toggle { border: 0; background: transparent; }
.site-header .dropdown-menu { min-width: 12rem; }
.site-header .dropdown-item { color: var(--stream-ink); }
.site-header .dropdown-item:focus, .site-header .dropdown-item:hover { color: var(--stream-primary-dark); background: #f3efff; }
.site-header .account-menu form { margin: 0; }
.site-header .account-menu .dropdown-item { width: 100%; text-align: left; }
.site-header .user-menu-toggle { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.navbar-brand { display: inline-flex; align-items: center; gap: 0.7rem; font-weight: 750; letter-spacing: -0.02em; }

.brand-symbol, .brand-mark {
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, #845ef7, #4d25c7);
  border-radius: 0.7rem;
  box-shadow: 0 0.45rem 1rem rgba(81, 40, 190, 0.28);
  font-weight: 800;
}

.brand-symbol { width: 1.8rem; height: 1.8rem; }
.brand-mark { width: 3.25rem; height: 3.25rem; margin-bottom: 1.25rem; font-size: 1.35rem; }
.navbar-toggler { border-color: rgba(255,255,255,0.3); filter: invert(1); }
.user-badge { display: inline-flex; padding: 0.35rem 0.65rem; color: #e9e4ff; background: rgba(255,255,255,0.08); border-radius: 2rem; }

.page-container { min-height: calc(100vh - 3.75rem); padding-block: 1.25rem 2rem; }
.page-heading { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
h1, h2 { font-weight: 750; letter-spacing: -0.035em; }
h1 { margin-bottom: 0.25rem; font-size: clamp(1.65rem, 2.5vw, 2.35rem); }
h2 { font-size: 1.25rem; }
.eyebrow { margin-bottom: 0.25rem; color: var(--stream-primary); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.text-secondary { color: var(--stream-muted) !important; }

.status-chip { display: inline-flex; align-items: center; gap: 0.45rem; flex: none; padding: 0.4rem 0.65rem; color: #116544; background: #e7f7f0; border: 1px solid #bce7d5; border-radius: 2rem; font-size: 0.8rem; font-weight: 700; }
.status-chip span { width: 0.55rem; height: 0.55rem; background: var(--stream-success); border-radius: 50%; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin-bottom: 0.75rem; }
.metric-card, .content-card, .auth-card { background: var(--stream-surface); border: 1px solid var(--stream-border); border-radius: 0.75rem; box-shadow: 0 0.4rem 1.2rem rgba(30, 37, 65, 0.05); }
.metric-card { display: flex; flex-direction: column; min-height: 7.5rem; padding: 0.9rem 1rem; }
.metric-card > span { color: var(--stream-muted); font-weight: 650; }
.metric-card strong { margin-block: auto; font-size: 1.75rem; }
.metric-card strong small { color: var(--stream-muted); font-size: 1rem; font-weight: 650; }
.metric-card small { color: var(--stream-muted); }
.content-card { padding: 1rem; }
.form-control, .form-select { border-color: #747b90; }
.form-control::placeholder { color: #5f6678; opacity: 1; }
.dashboard-error { margin-bottom: 1rem; }
.operations-dashboard-layout { display: grid; gap: 1rem; }
.operations-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.operations-metric-card { display: flex; flex-direction: column; min-height: 10rem; }
.operations-metric-card p:last-of-type { color: var(--stream-muted); }
.operations-metric-card > a { margin-top: auto; font-weight: 700; text-decoration: none; }
.operations-metric-heading { display: flex; align-items: baseline; gap: 0.75rem; margin-block: 0.15rem 0.55rem; }
.operations-metric-heading strong { font-size: clamp(1.8rem, 3vw, 2.6rem); line-height: 1; }
.operations-metric-heading span { color: var(--stream-muted); font-weight: 700; }
.availability-bar { height: 0.65rem; overflow: hidden; margin-bottom: 0.6rem; background: #e8eaf1; border-radius: 2rem; }
.availability-bar span { display: block; height: 100%; background: var(--stream-success); border-radius: inherit; }
.operations-dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); gap: 1rem; min-height: 0; }
.operations-panel { min-width: 0; }
.operations-panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.75rem; }
.operations-panel-heading h2 { margin: 0; }
.operations-table-scroll { max-height: calc(100vh - 25rem); overflow: auto; }
.operations-table-scroll table { min-width: 46rem; }
.operations-alert-list { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.operations-alert-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.7rem; align-items: start; padding-block: 0.8rem; border-top: 1px solid var(--stream-border); }
.operations-alert-list li:first-child { padding-top: 0; border-top: 0; }
.operations-alert-list a { display: block; color: var(--stream-ink); font-weight: 750; text-decoration: none; }
.operations-alert-list small { display: block; margin-top: 0.2rem; color: var(--stream-muted); }
.finance-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 0.75rem 0 0; }
.finance-grid div { padding: 0.75rem; background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 0.55rem; }
.finance-grid dt { margin-bottom: 0.4rem; color: var(--stream-muted); font-size: 0.8rem; font-weight: 700; text-transform: uppercase; }
.finance-grid dd { margin: 0; font-size: 1.15rem; font-weight: 750; }
.income-trend-card { margin-top: 0.75rem; }
.trend-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.trend-options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.trend-option { padding: 0.45rem 0.75rem; color: var(--stream-muted); border: 1px solid var(--stream-border); border-radius: 2rem; font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.trend-option:hover, .trend-option.active { color: #fff; background: var(--stream-primary); border-color: var(--stream-primary); }
.month-form { display: flex; align-items: center; gap: 0.6rem; margin-block: 1rem; }
.month-form label { color: var(--stream-muted); font-size: 0.85rem; font-weight: 700; }
.month-form .form-control { width: auto; }
.trend-chart-scroll { position: relative; overflow: hidden; border: 1px solid var(--stream-border); border-radius: 0.75rem; background: linear-gradient(to bottom, #fbfaff, #fff); }
.trend-chart { display: block; width: 100%; height: 210px; }

/* Dashboard visual system */
.dashboard-layout { display: grid; width: 100%; min-width: 0; gap: 1rem; }
.dashboard-overview-grid { display: grid; width: 100%; min-width: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.dashboard-summary-card {
  position: relative;
  min-width: 0;
  padding: 1rem;
  overflow: hidden;
  background: var(--stream-surface);
  border: 1px solid var(--stream-border);
  border-radius: 1rem;
  box-shadow: 0 0.75rem 2rem rgba(30, 37, 65, 0.07);
}
.dashboard-summary-card::before { position: absolute; inset: 0 0 auto; height: 0.25rem; content: ""; background: var(--card-accent, var(--stream-primary)); }
.dashboard-summary-card-devices { --card-accent: var(--stream-success); background: linear-gradient(145deg, #fff 64%, #edf9f4); }
.dashboard-summary-card-finance { --card-accent: var(--stream-primary); background: linear-gradient(145deg, #fff 60%, #f2efff); }
.dashboard-summary-card-alerts { --card-accent: var(--stream-warning); background: linear-gradient(145deg, #fff 64%, #fff6e9); }
.dashboard-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; }
.dashboard-card-heading h2 { margin: 0; font-size: 1.35rem; }
.dashboard-card-heading a { padding-block: 0.2rem; font-size: 0.8rem; font-weight: 750; text-decoration: none; }
.dashboard-card-date { padding: 0.3rem 0.55rem; color: var(--stream-muted); background: rgba(255,255,255,0.8); border: 1px solid var(--stream-border); border-radius: 2rem; font-size: 0.75rem; font-weight: 750; }
.dashboard-donut-layout { display: grid; grid-template-columns: minmax(8rem, 1.05fr) minmax(7rem, 0.95fr); align-items: center; gap: clamp(0.6rem, 1.5vw, 1.1rem); min-height: 11rem; padding-top: 0.65rem; }
.dashboard-donut {
  display: grid;
  place-items: center;
  width: min(100%, 10.5rem);
  aspect-ratio: 1;
  margin-inline: auto;
  background: conic-gradient(var(--donut-primary) 0 calc(var(--donut-percent) * 1%), var(--donut-secondary) calc(var(--donut-percent) * 1%) 100%);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(21,26,45,0.05), 0 0.75rem 1.5rem rgba(30,37,65,0.08);
}
.dashboard-donut.is-empty { background: #e8eaf1; }
.dashboard-donut-centre { display: flex; width: 57%; aspect-ratio: 1; align-items: center; justify-content: center; flex-direction: column; color: var(--stream-ink); background: rgba(255,255,255,0.97); border-radius: 50%; box-shadow: 0 0.3rem 1rem rgba(30,37,65,0.08); text-align: center; }
.dashboard-donut-centre strong { font-size: clamp(1.6rem, 3vw, 2.35rem); line-height: 1; }
.dashboard-donut-centre span { margin-top: 0.35rem; color: var(--stream-muted); font-size: 0.72rem; font-weight: 700; }
.dashboard-chart-legend { display: grid; gap: 0.65rem; margin: 0; }
.dashboard-chart-legend div { padding: 0.65rem 0.75rem; background: rgba(255,255,255,0.76); border: 1px solid rgba(221,225,236,0.9); border-radius: 0.7rem; }
.dashboard-chart-legend dt { display: flex; align-items: center; gap: 0.4rem; color: var(--stream-muted); font-size: 0.76rem; font-weight: 750; }
.dashboard-chart-legend dd { display: flex; align-items: baseline; justify-content: space-between; gap: 0.4rem; margin: 0.2rem 0 0; font-size: 1.2rem; font-weight: 800; }
.dashboard-chart-legend dd small { color: var(--stream-muted); font-size: 0.7rem; font-weight: 700; }
.legend-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; }
.legend-dot-success { background: var(--stream-success); }
.legend-dot-warning { background: var(--stream-warning); }
.legend-dot-danger { background: var(--stream-danger); }
.finance-hero { display: flex; min-height: 6.5rem; align-items: center; justify-content: center; flex-direction: column; margin-block: 0.65rem 0.55rem; padding: 0.75rem; color: #fff; background: linear-gradient(145deg, #7565e7, #5434c9); border-radius: 0.9rem; box-shadow: 0 0.75rem 1.5rem rgba(84,52,201,0.18); text-align: center; }
.finance-hero > span { color: #e9e5ff; font-size: 0.76rem; font-weight: 750; letter-spacing: 0.06em; text-transform: uppercase; }
.finance-hero strong { margin-block: 0.2rem; font-size: clamp(1.65rem, 3vw, 2.25rem); letter-spacing: -0.04em; }
.finance-hero small { color: #dcd5ff; }
.dashboard-finance-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; margin: 0; }
.dashboard-finance-grid div { min-width: 0; padding: 0.6rem; background: rgba(255,255,255,0.75); border: 1px solid var(--stream-border); border-radius: 0.65rem; }
.dashboard-finance-grid dt { color: var(--stream-muted); font-size: 0.68rem; font-weight: 750; text-transform: uppercase; }
.dashboard-finance-grid dd { margin: 0.2rem 0 0; overflow: hidden; font-size: clamp(0.85rem, 1.5vw, 1.05rem); font-weight: 800; text-overflow: ellipsis; }
.cash-flow-comparison { margin-top: 0.55rem; }
.cash-flow-labels { display: flex; justify-content: space-between; margin-bottom: 0.3rem; color: var(--stream-muted); font-size: 0.68rem; font-weight: 700; }
.cash-flow-bar { height: 0.5rem; overflow: hidden; background: var(--stream-warning); border-radius: 2rem; }
.cash-flow-bar span { display: block; height: 100%; background: var(--stream-success); border-right: 2px solid #fff; }
.dashboard-income-card { display: flex; width: 100%; min-width: 0; min-height: 0; flex-direction: column; padding: 1rem; border-radius: 1rem; }
.dashboard-chart-toolbar { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 0.55rem; margin-bottom: 0.55rem; }
.dashboard-chart-toolbar .month-form { margin: 0; }
.dashboard-chart-shell { position: relative; width: 100%; min-width: 0; height: clamp(15rem, 29vh, 19rem); overflow: hidden; padding: 0.25rem 0.4rem 0.15rem; background: linear-gradient(180deg, #fbfaff 0%, #fff 100%); border: 1px solid var(--stream-border); border-radius: 0.85rem; }
.dashboard-chart-shell canvas { max-width: 100%; max-height: 100%; }
.status-number { display: inline-flex; min-width: 2rem; justify-content: center; padding: 0.2rem 0.45rem; color: #fff; border-radius: 2rem; font-size: 0.8rem; font-weight: 750; }
.status-number-online { background: var(--stream-success); }
.status-number-offline { background: #b42b3d; }
.group-details-page { display: grid; width: 100%; min-width: 0; height: calc(100dvh - 7rem); min-height: 0; grid-template-rows: auto minmax(0, 1fr); gap: 0.75rem; overflow: hidden; }
.group-details-header { display: grid; gap: 0.75rem; padding: 0.8rem 1rem; }
.group-details-heading { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 0.75rem; }
.group-details-heading h1 { margin: 0; font-size: 1.45rem; overflow-wrap: anywhere; }
.group-details-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; }
.group-summary-strip { display: grid; margin: 0; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.5rem; }
.group-summary-strip > div { min-width: 0; padding: 0.6rem 0.7rem; background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 0.6rem; }
.group-summary-strip dt { margin-bottom: 0.25rem; color: var(--stream-muted); font-size: 0.68rem; font-weight: 750; letter-spacing: 0.035em; text-transform: uppercase; }
.group-summary-strip dd { min-width: 0; margin: 0; font-size: 0.86rem; font-weight: 700; overflow-wrap: anywhere; }
.group-locations-table-card { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; padding: 0; }
.group-locations-toolbar { flex: none; margin: 0; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--stream-border); }
.group-locations-toolbar h2 { margin: 0; font-size: 1rem; }
.group-locations-scroll { min-width: 0; min-height: 0; flex: 1; overflow: auto; }
.group-locations-scroll .data-table th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--stream-border); }
.group-locations-table-card .list-empty-state { flex: 1; }
.compact-empty-state { padding-block: 2rem; }
.location-details-page { display: flex; width: 100%; min-width: 0; height: calc(100dvh - 7rem); min-height: 0; flex-direction: column; gap: 0.75rem; overflow: hidden; }
.location-detail-layout { display: grid; min-width: 0; flex: none; grid-template-columns: minmax(15rem, 1fr) minmax(0, 3fr); gap: 0.75rem; }
.location-summary-panel { display: flex; min-width: 0; flex-direction: column; }
.location-summary-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.65rem; }
.location-summary-heading h1 { margin: 0; font-size: 1.45rem; overflow-wrap: anywhere; }
.location-detail-list { display: grid; gap: 0; margin: 0.8rem 0; }
.location-detail-list div { padding: 0.55rem 0; border-bottom: 1px solid var(--stream-border); }
.location-detail-list dt { margin-bottom: 0.15rem; color: var(--stream-muted); font-size: 0.7rem; font-weight: 750; letter-spacing: 0.04em; text-transform: uppercase; }
.location-detail-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.location-detail-actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: auto; padding-top: 0.2rem; }
.location-income-panel { display: flex; min-width: 0; min-height: 22rem; flex-direction: column; overflow: hidden; }
.location-income-toolbar { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.6rem; }
.location-income-toolbar h2 { margin: 0; }
.location-chart-shell { position: relative; min-width: 0; min-height: 18rem; flex: 1; overflow: hidden; padding: 0.25rem 0.35rem 0.1rem; background: linear-gradient(180deg, #fbfaff 0%, #fff 100%); border: 1px solid var(--stream-border); border-radius: 0.75rem; }
.location-chart-shell canvas { max-width: 100%; max-height: 100%; }
.location-chart-empty { display: grid; min-height: 18rem; flex: 1; place-content: center; }
.location-operations-card { display: flex; min-width: 0; min-height: 0; flex: 1; flex-direction: column; overflow: hidden; }
.location-operations-card > .table-toolbar { flex: none; }
.location-machines-scroll { min-width: 0; min-height: 0; flex: 1; overflow: auto; }
.location-machines-scroll .operation-table th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--stream-border); }
.location-operations-card > .pagination-nav { flex: none; }
.location-operations-card > .empty-state { display: grid; min-height: 0; flex: 1; place-content: center; }
.table-toolbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem; }
.operation-actions-cell { width: 1%; white-space: nowrap; }
.operation-actions-dropdown .dropdown-menu { z-index: 1080; min-width: 10rem; }
.operation-actions-dropdown form { margin: 0; }
.operation-actions-dropdown form .dropdown-item { width: 100%; }
#site-machine-dialog .modal-header .eyebrow { margin-bottom: 0.15rem; }
#site-machine-dialog .modal-title { font-size: 1.25rem; }
#site-machine-dialog .stacked-form label { display: block; margin-bottom: 0.3rem; color: var(--stream-muted); font-size: 0.8rem; font-weight: 700; }
.operation-table { min-width: 70rem; }
.alert-table { min-width: 64rem; }
.alert-table small { color: var(--stream-muted); }
.alert-details-dialog .modal-header { align-items: flex-start; gap: 0.75rem; }
.alert-details-dialog .modal-header > div:first-child { min-width: 0; flex: 1; }
.alert-details-dialog .modal-title { overflow-wrap: anywhere; }
.alert-details-dialog .modal-header .severity-badge { margin-top: 0.15rem; }
.alert-dialog-body { display: grid; gap: 0.75rem; background: #f5f6fa; }
.alert-dialog-card { padding: 0.9rem; background: #fff; border: 1px solid var(--stream-border); border-radius: 0.75rem; }
.alert-dialog-card h3 { margin: 0 0 0.75rem; font-size: 1rem; }
.alert-dialog-context-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.alert-dialog-context-grid > div { min-width: 0; padding: 0.75rem; background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 0.6rem; }
.alert-dialog-primary-link { display: inline-block; margin-bottom: 0.65rem; color: var(--stream-ink); font-size: 1.05rem; font-weight: 800; overflow-wrap: anywhere; }
.alert-dialog-card dl { display: grid; gap: 0; margin: 0; }
.alert-dialog-card dl > div { display: grid; grid-template-columns: minmax(7rem, 0.65fr) minmax(0, 1fr); gap: 0.65rem; padding: 0.45rem 0; border-top: 1px solid var(--stream-border); }
.alert-dialog-card dt { color: var(--stream-muted); font-size: 0.75rem; font-weight: 700; }
.alert-dialog-card dd { min-width: 0; margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.alert-dialog-detail-list { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem !important; }
.alert-dialog-detail-list > div { display: block !important; padding: 0.7rem !important; background: #f8f9fc; border: 1px solid var(--stream-border) !important; border-radius: 0.6rem; }
.alert-dialog-detail-list dt { margin-bottom: 0.25rem; }
.alert-toolbar { align-items: flex-end; }
.report-filter-card { margin-bottom: 0.75rem; }
.report-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.transaction-table { min-width: 68rem; }
.daily-income-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.daily-income-table { min-width: 34rem; }
.machine-income-table { min-width: 62rem; }
.group-income-table { min-width: 28rem; }
.movement-report-table { min-width: 78rem; }
.activity-report-table { min-width: 76rem; }
.activity-report-table small { color: var(--stream-muted); }
.hopper-level-table { min-width: 82rem; }
.offline-device-table { min-width: 78rem; }
.hopper-condition { display: inline-flex; min-width: 6.75rem; justify-content: center; padding: 0.2rem 0.45rem; border: 1px solid; border-radius: 2rem; font-size: 0.75rem; font-weight: 750; }
.condition-healthy { color: #116544; background: #e7f7f0; border-color: #bce7d5; }
.condition-neutral { color: #555d70; background: #f0f2f6; border-color: #d6dae3; }
.condition-moderate { color: #805211; background: #fff7e8; border-color: #edd19d; }
.condition-critical { color: #8f1f30; background: #fff0f2; border-color: #efc3ca; }
.data-table tfoot th, .data-table tfoot td { padding: 0.65rem; background: #f8f9fc; border-top: 2px solid var(--stream-border); font-weight: 750; }
.report-note { margin: 0.75rem 0 0; color: var(--stream-muted); font-size: 0.82rem; }
.income-positive { color: #176b3a; font-weight: 700; }
.income-negative { color: #a51d31; font-weight: 700; }
.filter-form { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: flex-end; gap: 0.45rem; }
.filter-form > div { min-width: 10rem; }
.filter-form > div:first-child { min-width: min(20rem, 100%); }
.filter-form label { display: block; margin-bottom: 0.3rem; color: var(--stream-muted); font-size: 0.8rem; font-weight: 700; }
.stacked-form { display: grid; gap: 1rem; }
.stacked-form .form-grid { display: grid; gap: 0.75rem; }
.stacked-form > .btn { justify-self: start; }
.severity-badge { display: inline-flex; min-width: 4.5rem; justify-content: center; padding: 0.2rem 0.45rem; border: 1px solid; border-radius: 2rem; font-size: 0.75rem; font-weight: 750; }
.severity-high { color: #8f1f30; background: #fff0f2; border-color: #efc3ca; }
.severity-medium { color: #805211; background: #fff7e8; border-color: #edd19d; }
.severity-low { color: #555d70; background: #f0f2f6; border-color: #d6dae3; }
.operation-table small { color: var(--stream-muted); }
.connectivity-status { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.8rem; font-weight: 750; }
.connectivity-status::before { width: 0.55rem; height: 0.55rem; border-radius: 50%; content: ""; }
.connectivity-status.online { color: #116544; }
.connectivity-status.online::before { background: var(--stream-success); }
.connectivity-status.offline { color: #9d2335; }
.connectivity-status.offline::before { background: #b42b3d; }
.connectivity-status.unknown { color: #6b6277; }
.connectivity-status.unknown::before { background: #847b8e; }
.metric-card-link { color: inherit; text-decoration: none; transition: transform 150ms ease, box-shadow 150ms ease; }
.metric-card-link:hover { color: inherit; box-shadow: 0 1rem 2.5rem rgba(30, 37, 65, 0.12); transform: translateY(-2px); }
.result-count { padding: 0.35rem 0.6rem; color: var(--stream-muted); background: #fff; border: 1px solid var(--stream-border); border-radius: 2rem; font-size: 0.8rem; font-weight: 700; }
.page-actions, .table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; }
.page-actions form, .table-actions form { margin: 0; }
.table-actions { white-space: nowrap; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.table-toolbar h2 { margin: 0; }
.search-form { display: flex; gap: 0.5rem; width: min(100%, 38rem); }
.search-form .form-control { min-width: 14rem; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table { font-size: 0.875rem; }
.data-table th { padding: 0.55rem 0.65rem; color: var(--stream-muted); background: #f8f9fc; border-block: 1px solid var(--stream-border); font-size: 0.7rem; letter-spacing: 0.035em; text-transform: uppercase; white-space: nowrap; }
.data-table td { padding: 0.55rem 0.65rem; border-bottom: 1px solid var(--stream-border); vertical-align: middle; }
.data-table tbody tr:hover { background: #faf9ff; }
.location-link { color: var(--stream-ink); font-weight: 700; text-decoration-thickness: 1px; text-underline-offset: 0.2rem; }
.empty-state { padding: 2.5rem 1rem; text-align: center; }
.empty-state h3 { font-size: 1.25rem; }
.empty-state p { margin: 0; color: var(--stream-muted); }
.pagination-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding-top: 0.75rem; color: var(--stream-muted); font-size: 0.85rem; }
.breadcrumb-nav { display: flex; gap: 0.4rem; margin-bottom: 0.75rem; color: var(--stream-muted); font-size: 0.82rem; }

/* Primary list screens */
.list-page-layout { display: grid; width: 100%; min-width: 0; height: calc(100dvh - 7rem); grid-template-rows: auto minmax(0, 1fr); gap: 0.75rem; }
.list-page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; padding: 0.75rem 1rem; }
.list-page-header h1 { flex: none; margin: 0; font-size: 1.45rem; }
.list-page-controls { display: flex; min-width: 0; align-items: center; justify-content: flex-end; flex: 1; gap: 0.55rem; }
.list-page-controls .search-form { width: min(100%, 38rem); }
.list-page-controls .filter-form { flex: 1; }
.list-page-header-alerts .list-page-controls { align-items: center; }
.list-page-header-alerts .list-page-filter { min-width: 0; flex: 1; }
.list-page-filter > div { min-width: 8.5rem; }
.list-page-filter > div:first-child { min-width: min(17rem, 100%); }
.list-page-filter label { margin-bottom: 0.15rem; font-size: 0.68rem; }
.list-page-filter-compact { flex-wrap: nowrap; }
.list-page-filter-compact > div:first-child { flex: 1; }
.list-page-status { width: 100%; margin: 0; padding: 0.5rem 0.75rem; }
.list-table-card { display: flex; width: 100%; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; padding: 0; }
.list-table-scroll { min-width: 0; min-height: 0; flex: 1; overflow: auto; }
.list-table-scroll .data-table { min-width: max-content; }
.list-table-scroll .data-table th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--stream-border); }
.list-pagination { flex: none; padding: 0.65rem 0.8rem; background: #fff; border-top: 1px solid var(--stream-border); }
.list-empty-state { display: grid; min-height: 100%; place-content: center; }

/* Report list screens */
.report-page-layout { display: grid; width: 100%; min-width: 0; height: calc(100dvh - 7rem); grid-template-rows: auto minmax(0, 1fr); gap: 0.75rem; }
.report-page-header { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; padding: 0.75rem 1rem; }
.report-page-header h1 { flex: none; margin: 0; font-size: 1.45rem; }
.report-page-controls { display: flex; min-width: 0; align-items: flex-end; justify-content: flex-end; flex: 1; gap: 0.45rem; }
.report-page-filter { display: flex; min-width: 0; align-items: flex-end; justify-content: flex-end; flex: 1; flex-wrap: wrap; gap: 0.4rem; }
.report-page-filter > div { min-width: 7.75rem; }
.report-page-filter > .report-search-field { min-width: 12rem; flex: 1; }
.report-page-filter label { margin-bottom: 0.15rem; font-size: 0.68rem; }
.report-page-action { flex: none; white-space: nowrap; }
.report-page-validation { width: 100%; flex-basis: 100%; margin: 0; }
.report-page-validation ul { margin: 0; }
.report-table-card { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; padding: 0; }
.report-table-toolbar { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex: none; gap: 0.75rem; padding: 0.65rem 0.8rem; border-bottom: 1px solid var(--stream-border); }
.report-table-toolbar h2 { margin: 0; font-size: 1rem; }
.report-summary { display: flex; min-width: 0; align-items: center; gap: 0.45rem; }
.report-summary-item { display: inline-flex; align-items: baseline; gap: 0.35rem; padding: 0.3rem 0.55rem; color: var(--stream-muted); background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 2rem; font-size: 0.78rem; white-space: nowrap; }
.report-summary-item strong { color: var(--stream-ink); font-size: 0.85rem; }
.report-table-card .list-table-scroll { flex: 1; }
.report-table-card .list-empty-state { flex: 1; }
.daily-income-report-body { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1.6fr) minmax(22rem, 0.8fr); gap: 0.75rem; }
.daily-income-chart-card { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; }
.daily-income-chart-card .trend-chart-scroll { min-height: 0; flex: 1; }
.daily-income-chart-card .trend-chart { width: 100% !important; height: 100% !important; min-height: 15rem; }
.daily-income-report-body .report-note { flex: none; margin: 0; padding: 0.6rem 0.8rem; border-top: 1px solid var(--stream-border); }

.detail-card h2 { margin-bottom: 0.75rem; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.75rem; margin: 0; }
.detail-grid div { padding: 0.75rem; background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 0.55rem; }
.detail-grid dt { margin-bottom: 0.35rem; color: var(--stream-muted); font-size: 0.8rem; text-transform: uppercase; }
.detail-grid dd { margin: 0; font-weight: 650; }
.profile-page-layout { display: grid; width: 100%; min-width: 0; gap: 0.75rem; }
.profile-content-grid { display: grid; min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto; align-items: stretch; gap: 0.75rem; }
.profile-account-card { grid-column: 1; grid-row: 1; }
.profile-notifications-card { grid-column: 2; grid-row: 1 / span 2; }
.profile-mobile-card { grid-column: 1; grid-row: 2; }
.profile-notifications-card .form-check { padding: 0.7rem 0.75rem 0.7rem 2.25rem; background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 0.55rem; }
.programmer-page-layout { display: grid; width: 100%; min-width: 0; height: calc(100dvh - 7rem); grid-template-rows: auto minmax(0, 1fr); gap: 0.75rem; }
.programmer-content-grid { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(22rem, 0.85fr) minmax(26rem, 1.15fr); gap: 0.75rem; }
.programmer-form-card, .programmer-status-card { min-width: 0; min-height: 0; overflow: auto; }
.programmer-form-card > h2 { margin-bottom: 0.85rem; }
.programmer-device-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem; }
.programmer-option { display: flex; min-width: 0; align-items: flex-start; gap: 0.55rem; margin: 0; padding: 0.75rem; background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 0.65rem; }
.programmer-option .form-check-input { flex: none; margin: 0.2rem 0 0; }
.programmer-option span { display: grid; min-width: 0; gap: 0.15rem; }
.programmer-option small { color: var(--stream-muted); font-size: 0.78rem; }
.programmer-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.programmer-instructions { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--stream-border); }
.programmer-instructions h2 { margin-bottom: 0.55rem; }
.programmer-instructions ol { margin: 0; padding-left: 1.25rem; color: var(--stream-muted); }
.programmer-instructions li + li { margin-top: 0.3rem; }
.programmer-status-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.programmer-status-heading { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem; border-bottom: 1px solid var(--stream-border); }
.programmer-status-heading h2 { margin: 0; }
.programmer-status-heading p { margin: 0.25rem 0 0; color: var(--stream-muted); font-size: 0.85rem; }
.programmer-log { min-height: 12rem; flex: 1; overflow: auto; padding: 0.8rem 1rem; color: #e8eaf4; background: #1b2033; font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; font-size: 0.82rem; }
.programmer-log-entry { position: relative; margin: 0; padding: 0.45rem 0 0.45rem 1.1rem; overflow-wrap: anywhere; border-bottom: 1px solid rgba(255,255,255,0.08); }
.programmer-log-entry::before { position: absolute; top: 0.85rem; left: 0; width: 0.45rem; height: 0.45rem; content: ""; background: #93a0c8; border-radius: 50%; }
.programmer-log-entry.is-success::before { background: #3fc78e; }
.programmer-log-entry.is-warning::before { background: #f1a84b; }
.programmer-log-entry.is-error::before { background: #f16c79; }
.assignment-card { margin-top: 0.75rem; }
.machine-details-page { display: grid; width: 100%; min-width: 0; height: calc(100dvh - 7rem); min-height: 0; grid-template-rows: auto minmax(0, 1fr); gap: 0.75rem; overflow: hidden; }
.machine-details-header { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; padding: 0.8rem 1rem; }
.machine-details-header h1 { margin: 0; font-size: 1.45rem; overflow-wrap: anywhere; }
.machine-details-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 0.5rem; }
.machine-details-status { width: 100%; margin: 0; padding: 0.5rem 0.75rem; }
.machine-details-body { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(16rem, 1fr) minmax(0, 2fr); gap: 0.75rem; }
.machine-details-sidebar { display: grid; min-width: 0; min-height: 0; align-content: start; gap: 0.75rem; overflow: auto; }
.machine-detail-card h2 { margin: 0; font-size: 1.05rem; }
.machine-detail-list { display: grid; margin: 0.75rem 0 0; }
.machine-detail-list > div { display: grid; grid-template-columns: minmax(7rem, 0.75fr) minmax(0, 1fr); gap: 0.5rem; padding: 0.5rem 0; border-top: 1px solid var(--stream-border); }
.machine-detail-list dt { color: var(--stream-muted); font-size: 0.75rem; font-weight: 700; }
.machine-detail-list dd { min-width: 0; margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.machine-events-card { display: flex; min-width: 0; min-height: 0; flex-direction: column; overflow: hidden; padding: 0; }
.machine-events-toolbar { display: flex; flex: none; align-items: flex-end; justify-content: space-between; gap: 0.75rem; padding: 0.7rem 0.8rem; border-bottom: 1px solid var(--stream-border); }
.machine-events-toolbar h2 { margin: 0; font-size: 1.05rem; }
.machine-events-date-form { display: flex; align-items: flex-end; gap: 0.45rem; }
.machine-events-date-form label { display: block; margin-bottom: 0.15rem; color: var(--stream-muted); font-size: 0.68rem; font-weight: 700; }
.machine-events-notice { flex: none; margin: 0.65rem 0.8rem 0; padding: 0.5rem 0.65rem; }
.machine-events-scroll { min-width: 0; min-height: 0; flex: 1; overflow: auto; }
.machine-events-table { min-width: 48rem; }
.machine-events-table th { position: sticky; top: 0; z-index: 2; box-shadow: 0 1px 0 var(--stream-border); }
.machine-events-table small { color: var(--stream-muted); }
.machine-event-type { display: inline-flex; padding: 0.22rem 0.45rem; border: 1px solid; border-radius: 2rem; font-size: 0.72rem; font-weight: 750; }
.machine-event-type.general { color: #4432a8; background: #f0edff; border-color: #cec6fa; }
.machine-event-type.transaction { color: #116544; background: #e7f7f0; border-color: #bce7d5; }
.machine-events-card > .list-empty-state { flex: 1; }
.device-detail-page { display: grid; min-width: 0; gap: 0.75rem; }
.device-detail-header { display: flex; min-width: 0; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.75rem; padding: 0.8rem 1rem; }
.device-detail-header h1 { margin: 0; font-size: 1.55rem; }
.device-detail-header p:not(.eyebrow) { margin: 0.15rem 0 0; color: var(--stream-muted); }
.device-detail-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.device-detail-status { width: 100%; margin: 0; padding: 0.5rem 0.75rem; }
.device-detail-grid { display: grid; min-width: 0; grid-template-columns: minmax(16rem, 0.3fr) minmax(0, 1fr); align-items: start; gap: 0.75rem; }
.device-information-card h2, .device-section-heading h2 { margin: 0; font-size: 1.15rem; }
.device-detail-list { display: grid; margin: 0.8rem 0 0; }
.device-detail-list div { display: grid; grid-template-columns: minmax(7rem, 0.8fr) minmax(0, 1fr); gap: 0.6rem; padding: 0.58rem 0; border-top: 1px solid var(--stream-border); }
.device-detail-list dt { color: var(--stream-muted); font-size: 0.78rem; }
.device-detail-list dd { min-width: 0; margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.device-detail-main { display: grid; min-width: 0; gap: 0.75rem; }
.device-section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.device-section-heading > p { max-width: 30rem; margin: 0; color: var(--stream-muted); font-size: 0.84rem; }
.device-configuration-notice { margin-bottom: 0.8rem; padding: 0.65rem 0.75rem; }
.device-configuration-fields { min-width: 0; margin: 0; padding: 0; border: 0; }
.device-pin-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.65rem; }
.device-pin-row { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 0.6rem; margin: 0; padding: 0.75rem; background: #f8f9fc; border: 1px solid var(--stream-border); border-radius: 0.65rem; }
.device-pin-row legend { width: auto; margin: 0; padding: 0 0.25rem; color: var(--stream-primary-dark); font-size: 0.82rem; font-weight: 800; }
.device-pin-row label { display: block; margin-bottom: 0.2rem; color: var(--stream-muted); font-size: 0.75rem; font-weight: 700; }
.device-pin-readonly { background: #f0f1f5; }
.device-pin-readonly h3 { margin: 0; color: var(--stream-primary-dark); font-size: 0.82rem; }
.device-pin-readonly dl { display: grid; gap: 0.6rem; margin: 0; }
.device-pin-readonly dt { margin-bottom: 0.2rem; color: var(--stream-muted); font-size: 0.75rem; font-weight: 700; }
.device-pin-readonly dd { margin: 0; font-weight: 700; }
.device-configuration-actions { display: flex; justify-content: flex-end; margin-top: 0.85rem; }
.record-status { display: inline-flex; flex: none; padding: 0.4rem 0.65rem; border: 1px solid; border-radius: 2rem; font-size: 0.8rem; font-weight: 750; }
.record-status.active { color: #116544; background: #e7f7f0; border-color: #bce7d5; }
.record-status.inactive { color: #9d2335; background: #fff0f2; border-color: #efc3ca; }

.auth-shell { display: grid; place-items: center; min-height: calc(100vh - 14rem); padding-block: 2rem; }
.auth-card { width: min(100%, 32rem); padding: clamp(1.5rem, 5vw, 3rem); }
.notice { display: flex; flex-direction: column; gap: 0.3rem; padding: 1rem; color: #4b3a0e; background: #fff8dc; border: 1px solid #ecd988; border-radius: 0.75rem; }
.notice span { font-size: 0.9rem; }
.auth-form { display: grid; gap: 1rem; }
.auth-form .btn { min-height: 2.75rem; }
.auth-divider { display: flex; align-items: center; gap: 0.75rem; margin-block: 1.5rem; color: var(--stream-muted); font-size: 0.82rem; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; content: ""; background: var(--stream-border); }
.code-input { letter-spacing: 0.18em; text-transform: uppercase; }
.field-validation, .validation-summary { color: #a51d31; font-size: 0.875rem; }
.field-validation:empty, .validation-summary:empty, .validation-summary-valid { display: none; }
.validation-summary ul { margin-bottom: 1rem; padding: 0.75rem 1rem 0.75rem 2rem; background: #fff0f2; border: 1px solid #efc3ca; border-radius: 0.65rem; }
.btn-primary { background: var(--stream-primary); border-color: var(--stream-primary); }
.btn-primary:hover { background: var(--stream-primary-dark); border-color: var(--stream-primary-dark); }

.form-control, .form-select { min-height: 2.25rem; padding: 0.35rem 0.6rem; font-size: 0.875rem; }
.btn { --bs-btn-padding-y: 0.35rem; --bs-btn-padding-x: 0.65rem; --bs-btn-font-size: 0.875rem; }
@media (min-width: 1101px) and (min-height: 700px) {
  .dashboard-layout { height: calc(100dvh - 7rem); grid-template-rows: auto minmax(0, 1fr); }
  .dashboard-chart-shell { height: auto; min-height: 15rem; flex: 1; }
}

@media (max-width: 1100px) {
  .group-summary-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .dashboard-overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-summary-card-finance { grid-column: span 2; }
  .dashboard-summary-card-finance .finance-hero { min-height: 6rem; }
  .daily-income-report-page { height: auto; }
  .daily-income-report-body { grid-template-columns: 1fr; }
  .daily-income-chart-card { min-height: 22rem; }
  .daily-income-report-body .report-table-card { min-height: 24rem; }
}
@media (max-width: 900px) {
  .machine-details-page { height: auto; min-height: calc(100dvh - 6rem); overflow: visible; }
  .machine-details-body { grid-template-columns: 1fr; }
  .machine-details-sidebar { overflow: visible; }
  .machine-events-card { min-height: 30rem; }
  .machine-events-scroll { max-height: 70dvh; }
  .location-details-page { height: auto; min-height: calc(100dvh - 6rem); overflow: visible; }
  .location-operations-card { min-height: 28rem; flex: none; }
  .location-machines-scroll { max-height: 70dvh; }
  .operations-summary-grid { grid-template-columns: 1fr; }
  .operations-dashboard-grid { grid-template-columns: 1fr; }
  .operations-table-scroll { max-height: none; }
  .metric-grid, .finance-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-chart-toolbar { align-items: flex-start; }
  .list-page-header-alerts { align-items: stretch; flex-direction: column; }
  .list-page-header-alerts .list-page-controls { width: 100%; flex-wrap: wrap; }
  .list-page-header-alerts .list-page-filter-compact { flex-wrap: wrap; }
  .report-page-header { align-items: stretch; flex-direction: column; }
  .report-page-header h1 { width: 100%; }
  .report-page-controls { width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .report-page-filter { justify-content: flex-start; flex-wrap: wrap; }
  .profile-content-grid { grid-template-columns: 1fr; grid-template-rows: none; }
  .profile-account-card, .profile-notifications-card, .profile-mobile-card { grid-column: auto; grid-row: auto; }
  .programmer-page-layout { height: auto; }
  .programmer-content-grid { grid-template-columns: 1fr; }
  .programmer-form-card, .programmer-status-card { overflow: visible; }
  .programmer-log { max-height: 24rem; }
  .location-detail-layout { grid-template-columns: 1fr; }
  .location-summary-panel { min-height: 0; }
  .device-detail-grid { grid-template-columns: 1fr; }
  .device-pin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .machine-details-header { align-items: stretch; flex-direction: column; }
  .machine-details-actions { justify-content: flex-start; }
  .machine-events-toolbar, .machine-events-date-form { align-items: stretch; flex-direction: column; }
  .machine-events-date-form .btn { width: 100%; }
  .group-details-page { height: auto; min-height: calc(100dvh - 6rem); overflow: visible; }
  .group-details-heading { align-items: stretch; flex-direction: column; }
  .group-details-actions { justify-content: flex-start; }
  .group-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .group-locations-table-card { min-height: 28rem; }
  .group-locations-scroll { max-height: 70dvh; }
  .app-container { width: calc(100% - 1rem); }
  .page-heading { flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .metric-grid { grid-template-columns: 1fr; }
  .finance-grid { grid-template-columns: 1fr; }
  .status-chip { align-self: flex-start; }
  .table-toolbar, .search-form, .pagination-nav { align-items: stretch; flex-direction: column; }
  .filter-form { align-items: stretch; flex-direction: column; }
  .filter-form > div, .filter-form > div:first-child { width: 100%; min-width: 0; }
  .trend-heading, .month-form { align-items: stretch; flex-direction: column; }
  .month-form .form-control { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .location-income-toolbar { align-items: stretch; flex-direction: column; }
  .location-income-toolbar .trend-options { display: grid; width: 100%; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .location-income-toolbar .trend-option { text-align: center; }
  .location-detail-actions { align-items: stretch; flex-direction: column; }
  .location-chart-shell { min-height: 17rem; }
  .table-toolbar-actions { flex-wrap: wrap; }
  .dashboard-overview-grid { grid-template-columns: 1fr; }
  .dashboard-summary-card-finance { grid-column: auto; }
  .dashboard-donut-layout { grid-template-columns: minmax(8rem, 1fr) minmax(7rem, 0.85fr); }
  .dashboard-chart-toolbar { width: 100%; }
  .dashboard-chart-toolbar .trend-options { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-chart-toolbar .trend-option { text-align: center; }
  .dashboard-chart-toolbar .month-form { width: 100%; align-items: center; flex-direction: row; }
  .dashboard-chart-toolbar .month-form .form-control { width: auto; min-width: 0; flex: 1; }
  .dashboard-chart-toolbar .month-form .btn { flex: none; }
  .dashboard-chart-shell { height: 17rem; }
  .list-page-header { align-items: stretch; flex-direction: column; }
  .list-page-controls { width: 100%; align-items: stretch; flex-direction: column; }
  .list-page-controls .search-form, .list-page-controls .filter-form { width: 100%; }
  .list-page-filter-compact { flex-wrap: wrap; }
  .list-pagination { align-items: center; flex-direction: row; }
  .list-pagination > div { display: flex; gap: 0.4rem; }
  .report-page-layout { height: auto; min-height: calc(100dvh - 6rem); grid-template-rows: auto minmax(24rem, 1fr); }
  .report-page-controls, .report-page-filter { align-items: stretch; flex-direction: column; }
  .report-page-filter > div, .report-page-filter > .report-search-field { width: 100%; min-width: 0; }
  .report-page-action { width: 100%; }
  .report-table-toolbar { align-items: flex-start; flex-direction: column; }
  .report-summary { width: 100%; flex-wrap: wrap; }
  .programmer-device-options { grid-template-columns: 1fr; }
  .programmer-actions { align-items: stretch; flex-direction: column; }
  .alert-dialog-context-grid, .alert-dialog-detail-list { grid-template-columns: 1fr; }
  .device-detail-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .device-detail-actions .record-status { align-self: flex-start; }
  .device-section-heading { flex-direction: column; }
  .device-pin-grid { grid-template-columns: 1fr; }
  .device-configuration-actions .btn { width: 100%; }
}

@media (max-width: 360px) {
  .dashboard-donut-layout { grid-template-columns: 1fr; }
  .dashboard-donut { width: min(100%, 9.5rem); }
  .dashboard-chart-legend { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-chart-legend div { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
