:root {
  --bg: #f6f8fc;
  --panel: #ffffff;
  --panel-2: #f2f4f8;
  --ink: #242b4d;
  --muted: #6f7588;
  --line: #dce1ec;
  --accent: #30385d;
  --accent-2: #a8adb6;
  --ok: #1f7a4d;
  --warn: #a96b1d;
  --bad: #b4232f;
  --info: #30385d;
  --shadow: 0 14px 34px rgba(36, 43, 77, 0.08);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

button:hover,
.button:hover {
  border-color: #b4bbcb;
  background: #f8faff;
}

button.primary,
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button.primary:hover,
.button.primary:hover {
  background: #242b4d;
  border-color: #242b4d;
}

button.warning {
  color: var(--warn);
  border-color: #e5c99d;
}

button.danger {
  color: var(--bad);
  border-color: #e7a5a5;
}

button.compact,
.button.compact {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
}

button.ghost {
  border-color: transparent;
  background: transparent;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 7px;
  padding: 9px 10px;
  min-height: 38px;
  outline: none;
}

input[type="checkbox"] {
  width: auto;
  min-height: 0;
  padding: 0;
  accent-color: var(--accent);
}

textarea {
  min-height: 86px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(48, 56, 93, 0.14);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f8f9fc;
}

.login-box {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 9px;
  margin-bottom: 28px;
  text-align: center;
}

.app-brand {
  display: grid;
  align-items: start;
  gap: 7px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.brand-logo {
  display: block;
  width: min(220px, 100%);
  height: auto;
  object-fit: contain;
}

.brand-logo-large {
  width: min(320px, 100%);
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 800;
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  background: #ffffff;
  border-right: 1px solid var(--line);
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.nav {
  display: grid;
  gap: 5px;
  margin-top: 0;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #3d466b;
  text-decoration: none;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 650;
}

.nav a:hover,
.nav a.active {
  background: #eef2fb;
  border-color: #d8deef;
  color: var(--accent);
}

.nav-group {
  display: grid;
  gap: 4px;
}

.subnav {
  display: none;
  gap: 4px;
  padding-left: 14px;
}

.nav-group.open .subnav {
  display: grid;
}

.subnav a {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
  color: var(--muted);
}

.subnav a::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.45;
}

.user-box {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 3px;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 20px 24px 42px;
}

.topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.page-title h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.page-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

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

.grid {
  display: grid;
  gap: 12px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(36, 43, 77, 0.045);
}

.panel.compact {
  box-shadow: none;
}

.collapsible {
  overflow: hidden;
}

.collapsible > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-weight: 800;
}

.collapsible > summary::-webkit-details-marker {
  display: none;
}

.collapsible > summary::after {
  content: "+";
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.collapsible[open] > summary {
  border-bottom: 1px solid var(--line);
}

.collapsible[open] > summary::after {
  content: "-";
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 15px;
}

.panel-body {
  padding: 16px;
}

.kpi {
  padding: 14px 16px;
}

.finance-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.finance-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid #c8cfdd;
  border-radius: 8px;
  padding: 13px 14px;
  min-height: 84px;
}

.finance-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.finance-card strong {
  display: block;
  margin-top: 7px;
  font-size: 21px;
}

.finance-card small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.finance-card.profit {
  border-color: #a7d8b5;
  border-left-color: var(--ok);
  background: #f4fbf5;
}

.finance-card.loss {
  border-color: #efb6b6;
  border-left-color: var(--bad);
  background: #fff5f5;
}

.finance-card.profit strong {
  color: var(--ok);
}

.finance-card.loss strong {
  color: var(--bad);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 12px;
}

.dashboard-grid .wide {
  grid-column: 1 / -1;
}

.chart-bars {
  display: grid;
  gap: 13px;
}

.chart-bars.compact {
  gap: 10px;
}

.chart-row {
  display: grid;
  gap: 6px;
}

.chart-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chart-row-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 750;
}

.chart-row-head strong {
  white-space: nowrap;
  font-size: 13px;
}

.chart-row small {
  color: var(--muted);
  font-size: 11px;
}

.chart-track {
  height: 12px;
  border-radius: 999px;
  background: #e8ecf4;
  overflow: hidden;
}

.chart-track span {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: inherit;
  background: var(--accent);
}

.chart-row.sale .chart-track span {
  background: var(--accent);
}

.chart-row.cost .chart-track span {
  background: #6f7588;
}

.chart-row.material .chart-track span {
  background: #4f6fa6;
}

.chart-row.labor .chart-track span {
  background: #8a97ad;
}

.chart-row.misc .chart-track span {
  background: #a96b1d;
}

.chart-row.profit .chart-track span,
.stacked-bar .profit,
.chart-legend i.profit {
  background: var(--ok);
}

.chart-row.loss .chart-track span,
.stacked-bar .loss,
.chart-legend i.loss {
  background: var(--bad);
}

.chart-row.profit .chart-row-head strong {
  color: var(--ok);
}

.chart-row.loss .chart-row-head strong {
  color: var(--bad);
}

.stacked-chart {
  display: grid;
  gap: 14px;
}

.stacked-bar {
  display: flex;
  height: 28px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ecf4;
}

.stacked-bar span {
  min-width: 8px;
}

.stacked-bar .material,
.chart-legend i.material {
  background: #4f6fa6;
}

.stacked-bar .labor,
.chart-legend i.labor {
  background: #8a97ad;
}

.stacked-bar .misc,
.chart-legend i.misc {
  background: #a96b1d;
}

.chart-legend {
  display: grid;
  gap: 9px;
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.chart-legend strong {
  margin-left: auto;
  color: var(--ink);
}

.chart-legend small {
  width: 54px;
  text-align: right;
}

.inline-select {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.inline-select select {
  min-width: 260px;
}

.work-chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, 0.75fr);
  gap: 18px;
  align-items: start;
}

.work-chart-summary {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f8faff;
}

.work-chart-summary h3 {
  margin: 0;
  font-size: 17px;
}

.work-chart-summary p {
  margin: -5px 0 0;
  color: var(--muted);
}

.kpi span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.kpi strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
  letter-spacing: 0;
}

.kpi small {
  color: var(--muted);
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.sheet-table-wrap {
  max-height: min(64vh, 720px);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overscroll-behavior: contain;
}

tr.selected-row td {
  background: #eef2fb;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px 9px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--panel-2);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.spreadsheet-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--panel-2);
  box-shadow: 0 1px 0 var(--line), 0 6px 14px rgba(36, 43, 77, 0.06);
}

.number-cell {
  text-align: right;
  white-space: nowrap;
}

.spreadsheet-table th,
.spreadsheet-table td {
  white-space: nowrap;
}

.spreadsheet-table {
  min-width: 1280px;
  border-collapse: separate;
  border-spacing: 0;
}

.spreadsheet-table th:first-child,
.spreadsheet-table td:first-child {
  position: sticky;
  left: 0;
}

.spreadsheet-table th:first-child {
  z-index: 8;
}

.spreadsheet-table td:first-child {
  z-index: 2;
  background: var(--panel);
  box-shadow: 1px 0 0 var(--line);
}

.spreadsheet-table th.sheet-colored,
.spreadsheet-table td.sheet-colored {
  background: var(--sheet-col-bg);
}

.spreadsheet-table th.filter-active {
  outline: 2px solid rgba(48, 56, 93, 0.28);
  outline-offset: -2px;
}

.sheet-header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sheet-header-main small {
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.sheet-filter {
  margin-top: 6px;
  text-transform: none;
  font-size: 11px;
  font-weight: 700;
  position: relative;
  width: max-content;
}

.sheet-filter summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid #cbd3e3;
  border-radius: 6px;
  background: #ffffff;
  color: var(--accent);
}

.sheet-filter summary::-webkit-details-marker {
  display: none;
}

.sheet-filter[open] summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(48, 56, 93, 0.12);
}

.sheet-filter-menu {
  display: grid;
  gap: 8px;
  min-width: 210px;
  width: max-content;
  max-width: min(320px, 70vw);
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 10px 24px rgba(36, 43, 77, 0.12);
  text-align: left;
}

.sheet-filter-menu label {
  font-size: 11px;
  color: var(--muted);
}

.sheet-filter-menu input,
.sheet-filter-menu select {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.sheet-filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sheet-filter-actions button {
  min-height: 29px;
  padding: 4px 7px;
  font-size: 11px;
}

.sheet-panel-body {
  padding-top: 0;
}

.sheet-toolbar {
  display: grid;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}

.sheet-toolbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sheet-column-color {
  display: grid;
  gap: 7px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.sheet-column-color input[type="color"] {
  width: 44px;
  height: 32px;
  min-height: 32px;
  padding: 2px;
}

.sheet-input {
  width: 100%;
  min-width: 92px;
  min-height: 30px;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
}

.sheet-input.wide {
  min-width: 250px;
}

.sheet-input.number {
  text-align: right;
}

.sheet-input.over-supplied,
.quantity-over {
  color: var(--bad);
  font-weight: 800;
}

.sheet-input:hover {
  background: #f8faff;
  border-color: #d8deef;
}

.sheet-input:focus {
  background: #ffffff;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(48, 56, 93, 0.12);
}

.sheet-input.dirty {
  border-color: #d49b38;
  background: #fff7e6;
}

.sheet-input:invalid {
  border-color: var(--bad);
  background: #fff5f5;
}

.sheet-input:disabled {
  color: #8d94a6;
  background: #eef1f6;
  border-color: #dfe4ee;
  cursor: not-allowed;
}

.spreadsheet-table tr.saving td {
  opacity: 0.62;
}

.sheet-add-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px dashed #bfc7d8;
  background: #f8faff;
  border-radius: 8px;
  padding: 10px 12px;
}

.sheet-add-bar strong {
  color: var(--accent);
}

.sheet-add-bar.bottom {
  margin-top: 0;
}

.inline-editor {
  margin-top: 12px;
  border-color: #cfd6e6;
}

.receipt-cell {
  min-width: 360px;
  max-width: 460px;
}

.receipt-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  max-width: 100%;
}

.receipt-compact {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 28px;
  color: var(--muted);
}

.receipt-icon {
  flex: 0 0 auto;
  min-width: 32px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  color: #5c6478;
  background: #eef1f6;
}

.receipt-text {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.receipt-text strong {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  line-height: 1.2;
}

.receipt-text small {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.2;
}

.receipt-compact.sent .receipt-icon {
  color: var(--ok);
  background: #eaf7ee;
}

.receipt-compact.failed .receipt-icon {
  color: var(--bad);
  background: #feecec;
}

.receipt-compact.pending .receipt-icon,
.receipt-compact.attached .receipt-icon {
  color: var(--warn);
  background: #fff3df;
}

.receipt-actions {
  flex: 0 0 auto;
  gap: 6px;
  flex-wrap: nowrap;
}

.receipt-actions button {
  min-height: 28px;
  padding: 4px 8px;
}

.expense-receipt-field {
  align-self: end;
}

.expense-receipt-field input {
  padding: 7px 8px;
}

.is-hidden {
  display: none !important;
}

.expense-filter-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.expense-filter-bar input {
  width: 145px;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.expense-filter-bar small {
  color: var(--muted);
}

.receipt-summary {
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faff;
}

.receipt-summary strong {
  color: var(--accent);
}

.receipt-summary small,
.settings-note {
  line-height: 1.4;
}

.spreadsheet-table td:first-child,
.spreadsheet-table th:first-child {
  white-space: normal;
  min-width: 260px;
}

.section-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

tr:hover td {
  background: #f8faff;
}

.spreadsheet-table tr:hover td.sheet-colored,
.spreadsheet-table tr:hover th.sheet-colored {
  background: var(--sheet-col-bg);
}

.spreadsheet-table tr:hover td:first-child:not(.sheet-colored) {
  background: #f8faff;
}

.muted {
  color: var(--muted);
}

.nowrap {
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 750;
  background: #eef1f6;
  color: #4c546c;
}

.badge.ok {
  color: var(--ok);
  background: #eaf7ee;
}

.badge.warn {
  color: var(--warn);
  background: #fff3df;
}

.badge.bad {
  color: var(--bad);
  background: #feecec;
}

.badge.info {
  color: var(--info);
  background: #eaf1ff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.form-grid .span-3 {
  grid-column: span 3;
}

.form-grid .span-4 {
  grid-column: span 4;
}

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

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #f8faff;
}

.panel-body .bulk-toolbar,
.table-wrap + .bulk-toolbar {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
}

.select-control {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
}

.select-cell {
  width: 38px;
  min-width: 38px;
  text-align: center;
}

.compact-kpis {
  padding-top: 0;
}

.labor-actions-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 8px;
}

.labor-actions-title h2 {
  margin: 0;
  font-size: 15px;
}

.labor-action-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.labor-action {
  box-shadow: none;
}

.labor-action > summary {
  min-height: 48px;
  padding: 10px 14px;
  padding-right: 42px;
  position: relative;
}

.labor-action > summary::after {
  position: absolute;
  right: 14px;
  top: 13px;
}

.labor-action > summary span {
  font-weight: 850;
}

.labor-action > summary small {
  color: var(--muted);
  font-weight: 650;
  margin-left: auto;
  padding-right: 8px;
}

.labor-form-grid {
  gap: 10px;
}

.pending-labor-card {
  margin-top: 12px;
  border-color: #d8d1a8;
  background: #fffdf5;
}

.pending-labor-card .panel-header {
  background: #fff8dc;
}

.pending-labor-card .panel-header h2 {
  color: var(--warn);
}

.form-hint {
  border: 1px solid #cdd6e8;
  background: #f3f6fd;
  color: var(--ink);
  border-radius: 7px;
  padding: 9px 10px;
  font-size: 12px;
  font-weight: 700;
}

.labor-form-grid select[multiple] {
  min-height: 96px;
}

.labor-list-panel {
  margin-top: 12px;
  overflow: hidden;
}

.labor-panel-body {
  display: grid;
  gap: 10px;
}

.labor-filter-strip,
.list-toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.labor-check-toggle {
  min-height: 38px;
  padding: 0 2px;
}

.list-toolbar button {
  align-self: end;
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fbfcff;
}

.occurrence-checkbox {
  align-self: end;
  min-height: 38px;
}

.weekly-check-table {
  min-width: 760px;
}

.weekly-check-table th,
.weekly-check-table td {
  vertical-align: middle;
}

.weekly-day {
  min-width: 70px;
  text-align: center;
}

.weekly-day strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 24px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 850;
  margin: 0 auto;
}

.weekly-status-button {
  border-color: #efb6b6;
  background: #feecec;
  color: var(--bad);
  min-height: 24px;
  width: 44px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 850;
}

.weekly-status-button:hover {
  border-color: var(--bad);
  background: #fff5f5;
}

.weekly-day small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  white-space: nowrap;
  font-size: 10px;
}

.weekly-day.ok strong {
  color: var(--ok);
  background: #eaf7ee;
}

.weekly-day.occurrence strong {
  color: var(--info);
  background: #eaf1ff;
}

.weekly-day.partial strong {
  color: var(--warn);
  background: #fff3df;
}

.weekly-day.missing strong {
  color: var(--bad);
  background: #feecec;
}

.select-cell input {
  vertical-align: middle;
}

.import-box-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faff;
}

.import-box-heading strong,
.import-box-heading span {
  display: block;
}

.import-box-heading span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tabs a {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: white;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 13px;
}

.tabs a.active {
  background: #eef2fb;
  border-color: #d8deef;
  color: var(--accent);
}

.bars {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.bar {
  height: 12px;
  border-radius: 999px;
  background: #e3e7f0;
  overflow: hidden;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.split {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 12px;
}

.empty {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #242b4d;
  color: white;
  border-radius: 8px;
  padding: 10px 13px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
  max-width: min(420px, calc(100vw - 36px));
  z-index: 10;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.integration-alert-panel {
  position: fixed;
  right: 18px;
  top: 18px;
  width: min(420px, calc(100vw - 36px));
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #efb6b6;
  border-left: 4px solid var(--bad);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 12;
}

.integration-alert-panel > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.integration-alert-panel > div > button {
  width: 30px;
  min-height: 30px;
  padding: 0;
}

.integration-alert-panel ul {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.integration-alert-panel li {
  display: grid;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.integration-alert-panel li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.integration-alert-panel small {
  color: var(--bad);
  font-weight: 750;
}

.loader {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.mobile-menu {
  display: none;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .grid.four,
  .grid.three,
  .grid.two,
  .dashboard-grid,
  .work-chart-layout,
  .finance-strip,
  .form-grid,
  .split {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 14px;
  }

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

  .grid.four,
  .grid.three,
  .grid.two,
  .dashboard-grid,
  .work-chart-layout,
  .finance-strip,
  .form-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid .span-2,
  .form-grid .span-3,
  .form-grid .span-4 {
    grid-column: auto;
  }

  .sheet-toolbar .actions {
    width: 100%;
  }

  .labor-actions-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .labor-action > summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .labor-action > summary small {
    margin-left: 0;
    padding-right: 0;
  }

  .list-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .list-pagination .actions {
    width: 100%;
  }

  .list-pagination button {
    flex: 1;
  }

  .sheet-table-wrap {
    max-height: 58vh;
  }

  .bar-row {
    grid-template-columns: 1fr;
  }

  .inline-select {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .inline-select select {
    min-width: 0;
    width: 100%;
  }

  button,
  .button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .nav {
    grid-template-columns: 1fr;
  }
}
