:root {
  color-scheme: light;
  --page: #f8fafc;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --panel-hover: rgba(248, 250, 252, 0.5);
  --text: #1e293b;
  --heading: #0f172a;
  --muted: #64748b;
  --muted-light: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #f1f5f9;
  --blue: #2563eb;
  --blue-hover: #1d4ed8;
  --blue-soft: #dbeafe;
  --blue-row: rgba(239, 246, 255, 0.55);
  --green: #16a34a;
  --green-soft: #dcfce7;
  --red: #dc2626;
  --red-soft: #fee2e2;
  --amber: #d97706;
  --purple: #7c3aed;
  --purple-soft: #f3e8ff;
  --dark-panel: #0f172a;
  --dark-line: #334155;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.22);
  --radius: 12px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1120;
  --panel: #111827;
  --panel-soft: #172033;
  --panel-hover: rgba(30, 41, 59, 0.45);
  --text: #dbe4ef;
  --heading: #f8fafc;
  --muted: #94a3b8;
  --muted-light: #64748b;
  --line: #263244;
  --line-soft: #1e293b;
  --blue-soft: rgba(37, 99, 235, 0.18);
  --blue-row: rgba(37, 99, 235, 0.1);
  --green-soft: rgba(22, 163, 74, 0.18);
  --red-soft: rgba(220, 38, 38, 0.16);
  --purple-soft: rgba(124, 58, 237, 0.16);
  --dark-panel: #020617;
  --dark-line: #1e293b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--page);
  color: var(--text);
}

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

button,
select {
  cursor: pointer;
}

svg {
  display: block;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: visible;
}

.topbar {
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

.brand-icon svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand h1 {
  margin: 0;
  color: var(--heading);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title-alfa {
  color: #dc2626;
}

.brand-title-account {
  color: var(--heading);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.button {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.button.primary {
  background: var(--blue);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--blue-hover);
}

.button.secondary {
  border-color: var(--line);
  background: var(--panel);
  color: var(--muted);
}

.button.secondary:hover {
  background: var(--panel-soft);
}

.button.danger {
  border-color: var(--red);
  background: var(--red);
  color: #ffffff;
}

.button.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

.theme-toggle,
.icon-button,
.table-icon,
.file-actions button,
.file-actions a {
  display: inline-grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: inherit;
}

.theme-toggle {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel);
}

.main-layout {
  flex: 1 0 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 24px 24px;
  overflow: visible;
}

.top-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.top-panel-head {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--panel-soft);
}

.top-tabs,
.gantt-scale {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.top-tab,
.gantt-scale button {
  min-height: 26px;
  border: 0;
  border-radius: 5px;
  padding: 4px 10px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
}

.top-tab.active,
.gantt-scale button.active {
  background: var(--blue);
  color: #ffffff;
}

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

.notification-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.notification-chip.blue {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--blue-soft);
  color: var(--blue);
}

.notification-chip.green {
  border-color: rgba(22, 163, 74, 0.24);
  background: rgba(22, 163, 74, 0.10);
  color: var(--green);
}

.notification-chip.red {
  border-color: rgba(220, 38, 38, 0.24);
  background: rgba(220, 38, 38, 0.10);
  color: var(--red);
}

.top-tab-panel[hidden],
.gantt-scale[hidden],
.filters-strip[hidden],
.contracts-panel[hidden] {
  display: none;
}

.economy-strip {
  min-height: 38px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.top-panel .economy-strip {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 8px 16px 10px;
}

.economy-item {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.economy-item strong {
  color: var(--heading);
  font-size: 13px;
  font-weight: 800;
}

.economy-item .negative {
  color: var(--red);
}

.economy-item .positive {
  color: var(--green);
}

.economy-item.profit {
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.gantt-panel {
  padding: 12px 16px 16px;
}

.gantt-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.gantt-filters label {
  display: grid;
  gap: 4px;
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.gantt-filters input,
.gantt-filters select {
  min-height: 30px;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}

#paymentGanttChart {
  min-width: 0;
}

.gantt-mode .top-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 112px);
}

.gantt-mode .gantt-panel {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: clamp(560px, calc(100vh - 150px), 860px);
}

.gantt-mode #paymentGanttChart {
  flex: 1 1 auto;
  display: flex;
  min-height: 0;
}

.gantt-mode #paymentGanttChart > .gantt-empty {
  flex: 1 1 auto;
  min-height: clamp(560px, calc(100vh - 190px), 820px);
}

.gantt-empty {
  min-height: 96px;
  display: grid;
  place-items: center;
  color: var(--muted-light);
  font-size: 12px;
}

.gantt-scroll {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.gantt-mode .gantt-scroll {
  flex: 1 1 auto;
  min-height: clamp(560px, calc(100vh - 190px), 820px);
  max-height: none;
}

.gantt-grid {
  min-width: max-content;
  display: grid;
  grid-template-columns: 190px repeat(var(--gantt-columns), minmax(var(--gantt-cell), var(--gantt-cell)));
}

.gantt-corner,
.gantt-period,
.gantt-name,
.gantt-slot,
.gantt-total-label,
.gantt-total {
  min-height: 42px;
  border-right: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.gantt-corner,
.gantt-period {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.gantt-period.is-overloaded,
.gantt-slot.is-overloaded {
  background: rgba(220, 38, 38, 0.08);
}

.gantt-corner,
.gantt-name,
.gantt-total-label {
  position: sticky;
  left: 0;
}

.gantt-corner {
  z-index: 8;
}

.gantt-name {
  z-index: 4;
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 7px 10px;
  background: var(--panel);
}

.gantt-name strong {
  overflow: hidden;
  color: var(--heading);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt-name span {
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 700;
}

.gantt-slot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px;
  background: var(--panel);
}

.gantt-payment {
  min-width: 0;
  display: inline-grid;
  gap: 1px;
  border: 0;
  border-radius: 6px;
  padding: 4px 6px;
  background: var(--blue-soft);
  color: var(--blue);
  line-height: 1.1;
  cursor: pointer;
  text-align: left;
}

.gantt-payment:hover {
  background: rgba(37, 99, 235, 0.18);
}

.gantt-payment strong {
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.gantt-payment small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.gantt-total-label,
.gantt-total {
  position: sticky;
  bottom: 0;
  z-index: 5;
  min-height: 40px;
  background: var(--panel-soft);
}

.gantt-total-label {
  z-index: 7;
  display: grid;
  align-items: center;
  padding: 8px 10px;
  color: var(--heading);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.gantt-total {
  display: grid;
  place-items: center;
  padding: 6px;
}

.gantt-total.has-total strong {
  border-radius: 6px;
  padding: 4px 6px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.filters-strip {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 140px 160px 120px 120px auto;
  gap: 8px;
  align-items: end;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.filter-field {
  display: grid;
  gap: 3px;
}

.filter-field span {
  color: var(--muted-light);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.filter-field input,
.filter-field select {
  width: 100%;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
  padding: 5px 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}

.filter-field input:focus,
.filter-field select:focus {
  border-color: var(--blue);
}

.filter-reset {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
}

.filter-reset:hover {
  color: var(--blue);
  border-color: #cbd5e1;
}

.contracts-panel,
.payroll-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
}

.contracts-panel {
  flex: 0 0 auto;
}

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

.panel-header.compact {
  min-height: 45px;
  padding: 12px 16px;
}

.panel-header h2 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-transform: uppercase;
}

.link-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
}

.link-action:hover {
  color: var(--blue-hover);
}

.small-plus {
  font-size: 16px;
  line-height: 1;
}

.table-scroll,
.payroll-scroll {
  flex: 0 0 auto;
  min-height: 0;
  overflow: visible;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.contracts-table {
  min-width: 1120px;
  table-layout: fixed;
}

.payroll-table {
  min-width: 760px;
  table-layout: fixed;
}

thead {
  position: sticky;
  top: 0;
  z-index: 12;
  background: var(--panel-soft);
}

th {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

.contracts-table th:nth-child(1),
.contracts-table td:nth-child(1) {
  width: 104px;
  padding-left: 8px;
  padding-right: 8px;
}

.contracts-table th:nth-child(2),
.contracts-table td:nth-child(2) {
  width: 10%;
}

.contracts-table th:nth-child(3),
.contracts-table td:nth-child(3) {
  width: 124px;
  padding-left: 4px;
  padding-right: 4px;
}

.contracts-table th:nth-child(4),
.contracts-table td:nth-child(4) {
  width: 9%;
}

.contracts-table th:nth-child(5),
.contracts-table td:nth-child(5) {
  width: 16%;
}

.contracts-table th:nth-child(6),
.contracts-table td:nth-child(6) {
  width: 28%;
}

.contracts-table th:nth-child(7),
.contracts-table td:nth-child(7) {
  width: 9%;
}

.contracts-table th:nth-child(8),
.contracts-table td:nth-child(8) {
  width: 7%;
}

.contracts-table th:nth-child(9),
.contracts-table td:nth-child(9) {
  width: 4%;
}

.payroll-table th:nth-child(1),
.payroll-table td:nth-child(1) {
  width: 32%;
}

.payroll-table th:nth-child(2),
.payroll-table td:nth-child(2) {
  width: 22%;
}

.payroll-table th:nth-child(3),
.payroll-table td:nth-child(3) {
  width: 14%;
}

.payroll-table th:nth-child(4),
.payroll-table td:nth-child(4) {
  width: 28%;
}

.payroll-table th:nth-child(5),
.payroll-table td:nth-child(5) {
  width: 4%;
}

.payroll-table th {
  padding: 8px;
  color: var(--muted-light);
  font-size: 10px;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font-size: 12px;
  vertical-align: middle;
}

.payroll-table td {
  padding: 8px;
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: var(--panel-hover);
}

.contract-row.top-row {
  position: sticky;
  z-index: 8;
  background: var(--blue-row);
  box-shadow: inset 0 -1px 0 var(--line-soft);
}

.contract-row.top-row:hover {
  background: var(--blue-row);
}

.contract-row.payroll-row {
  background: color-mix(in srgb, var(--green-soft) 18%, var(--panel));
}

.contract-row.payroll-row:hover {
  background: color-mix(in srgb, var(--green-soft) 26%, var(--panel));
}

.contract-row.locked-row {
  box-shadow: inset 3px 0 0 #f59e0b;
}

.center-col {
  width: 40px;
  text-align: center;
}

.money-col {
  text-align: right;
}

.muted-head,
.muted-cell {
  color: var(--muted-light);
}

.table-icon {
  width: 24px;
  height: 24px;
  margin: 0 auto;
  color: var(--muted-light);
  border-radius: 6px;
  transition: color 0.14s ease, background 0.14s ease;
}

.table-icon:hover {
  background: var(--panel-soft);
}

.table-icon.danger:hover {
  color: var(--red);
}

.select-shell,
.status-shell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.select-shell select,
.status-shell select {
  width: 100%;
  appearance: none;
  outline: none;
  border: 0;
  background: transparent;
}

.select-shell select {
  text-align: center;
  text-align-last: center;
}

.select-shell svg,
.status-shell svg {
  position: absolute;
  right: 0;
  pointer-events: none;
  color: var(--muted-light);
}

.select-shell.top-type select {
  width: auto;
  min-width: 86px;
  padding: 2px 12px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #1d4ed8;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

[data-theme="dark"] .select-shell.top-type select {
  color: #93c5fd;
}

.select-shell.sub-type select {
  width: auto;
  min-width: 88px;
  padding: 2px 16px 2px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

[data-theme="dark"] .select-shell.sub-type select {
  border-color: rgba(148, 163, 184, 0.35);
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
}

.select-shell.payroll-type select {
  width: auto;
  min-width: 56px;
  padding: 2px 16px 2px 8px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
  text-transform: uppercase;
}

.contractor-link,
.payroll-name {
  max-width: 190px;
  display: block;
  overflow: hidden;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.contractor-cell {
  position: relative;
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  max-width: 210px;
}

.row-lock-pill {
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}

.contractor-card {
  position: absolute;
  left: -8px;
  top: calc(100% + 8px);
  z-index: 40;
  width: 310px;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

[data-theme="dark"] .contractor-card {
  border-color: rgba(37, 99, 235, 0.42);
  background: #132444;
  color: #bfdbfe;
}

.contractor-card::before {
  content: "";
  position: absolute;
  left: 18px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-left: 1px solid #bfdbfe;
  border-top: 1px solid #bfdbfe;
  background: inherit;
  transform: rotate(45deg);
}

.contractor-card strong {
  color: #1e3a8a;
  font-size: 13px;
}

[data-theme="dark"] .contractor-card strong {
  color: #dbeafe;
}

.contractor-card span,
.contractor-card p {
  margin: 0;
  color: currentColor;
  font-size: 12px;
  line-height: 1.35;
}

.contractor-card p {
  color: #2563eb;
}

[data-theme="dark"] .contractor-card p {
  color: #93c5fd;
}

.contractor-cell:hover .contractor-link,
.contractor-cell:hover .payroll-name {
  color: var(--blue);
  text-decoration: underline;
}

.contractor-cell:hover .contractor-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.contractor-link.top {
  color: var(--blue);
}

.contractor-link.payroll {
  color: var(--green);
}

.contractor-link:hover,
.payroll-name:hover {
  text-decoration: underline;
}

.contractor-link:empty::before,
.payroll-name:empty::before {
  content: "Выбрать...";
  color: var(--muted-light);
  font-style: italic;
}

.cell-input,
.money-input {
  width: 100%;
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  transition: border-color 0.14s ease, background 0.14s ease;
}

.cell-input {
  padding: 4px 8px;
}

.money-input {
  padding: 4px 8px;
  text-align: right;
}

.contracts-table td:nth-child(3) .money-input {
  width: 118px;
  padding-left: 4px;
  padding-right: 4px;
}

.contract-date-row {
  display: grid;
  grid-template-columns: minmax(112px, 1fr) auto 104px;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
}

.contract-date-row > span {
  color: var(--muted-light);
}

.contract-number-input {
  min-width: 0;
}

.contract-date-input {
  width: 104px;
  min-width: 0;
  padding-left: 4px;
  padding-right: 0;
  font-size: 12px;
}

.contract-date-input::-webkit-datetime-edit {
  padding: 0;
}

.contract-date-input::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.cell-input:hover,
.money-input:hover {
  border-color: #cbd5e1;
}

.money-input[readonly],
.money-input.readonly {
  border-color: transparent;
  background: var(--panel-soft);
  color: var(--heading);
  cursor: default;
}

.cell-input:focus,
.money-input:focus {
  border-color: var(--blue);
  background: var(--panel);
}

.money-input[readonly]:hover,
.money-input[readonly]:focus,
.money-input.readonly:hover,
.money-input.readonly:focus {
  border-color: transparent;
  background: var(--panel-soft);
}

.font-strong {
  color: var(--heading);
  font-weight: 700;
}

.vat-cell {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 0;
}

.vat-cell strong {
  color: var(--heading);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.vat-cell span {
  color: var(--muted-light);
  font-size: 10px;
  line-height: 1.15;
  white-space: nowrap;
}

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

.months-input {
  width: 64px;
  display: inline-block;
  text-align: right;
}

.month-label {
  margin-left: 3px;
  color: var(--muted);
  white-space: nowrap;
}

.payments-cell {
  display: grid;
  gap: 6px;
  min-width: 280px;
}

.payment-summary {
  width: max-content;
  min-width: 236px;
  max-width: 100%;
  min-height: 28px;
  display: inline-grid;
  grid-template-columns: minmax(90px, auto) auto auto;
  align-items: center;
  gap: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-align: left;
}

[data-theme="dark"] .payment-summary {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(148, 163, 184, 0.12);
}

.payment-summary:hover {
  border-color: #94a3b8;
  background: var(--panel-soft);
}

.payment-summary strong {
  color: var(--heading);
  font-size: 12px;
  white-space: nowrap;
}

.payment-summary em {
  color: var(--blue);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.payment-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 5px 0;
}

.payment-quick-actions button,
.payment-tools-tabs button {
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 8px;
  background: var(--panel);
  color: var(--blue);
  font-size: 10px;
  font-weight: 800;
}

.payment-tools-tabs button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.payment-row {
  display: grid;
  grid-template-columns: 118px auto 104px 20px;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
}

.payment-row.due-7,
.gantt-payment.due-7 {
  box-shadow: inset 0 0 0 1px rgba(220, 38, 38, 0.36);
  background: rgba(220, 38, 38, 0.10);
}

.payment-row.due-14,
.gantt-payment.due-14 {
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.36);
  background: rgba(245, 158, 11, 0.12);
}

.payment-row.due-30,
.gantt-payment.due-30 {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.26);
}

.payment-row.payment-focus {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.payment-row > span {
  color: var(--muted-light);
}

.payment-amount {
  width: 118px;
  min-width: 0;
  padding-left: 4px;
  padding-right: 4px;
}

.payment-date {
  width: 104px;
  min-width: 0;
  padding-left: 4px;
  padding-right: 0;
  font-size: 12px;
}

.payment-date::-webkit-datetime-edit {
  padding: 0;
}

.payment-date::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  margin: 0;
  padding: 0;
}

.payment-add,
.payment-remove {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
}

.payment-add {
  justify-self: start;
  padding: 0;
}

.payment-add:hover {
  color: var(--blue-hover);
  text-decoration: underline;
}

.payment-remove {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted-light);
  font-size: 16px;
  line-height: 1;
}

.payment-remove:hover {
  background: var(--red-soft);
  color: var(--red);
}

.payment-empty {
  color: var(--muted-light);
  font-size: 11px;
  font-style: italic;
}

.status-shell {
  max-width: 146px;
}

.status-shell span {
  position: absolute;
  left: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  pointer-events: none;
}

.status-shell select {
  padding: 6px 14px 6px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.status-shell.signed span {
  background: #22c55e;
}

.status-shell.signed select {
  color: var(--green);
}

.status-shell.review span {
  background: #f59e0b;
}

.status-shell.review select {
  color: var(--amber);
}

.doc-buttons {
  position: relative;
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 98px;
}

.doc-square {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.doc-square.has-files.contract {
  border-color: transparent;
  background: var(--blue-soft);
  color: var(--blue);
}

.doc-square.has-files.letters {
  border-color: transparent;
  background: var(--red-soft);
  color: var(--red);
}

.doc-square.has-files.acts {
  border-color: transparent;
  background: var(--green-soft);
  color: var(--green);
}

.doc-square.has-files.other {
  border-color: transparent;
  background: var(--purple-soft);
  color: var(--purple);
}

.documents-card {
  position: absolute;
  right: -8px;
  top: calc(100% + 8px);
  z-index: 42;
  width: 330px;
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  box-shadow: 0 16px 32px rgba(15, 23, 42, 0.16);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

[data-theme="dark"] .documents-card {
  border-color: rgba(37, 99, 235, 0.42);
  background: #132444;
  color: #bfdbfe;
}

.documents-card::before {
  content: "";
  position: absolute;
  right: 18px;
  top: -6px;
  width: 10px;
  height: 10px;
  border-left: 1px solid #bfdbfe;
  border-top: 1px solid #bfdbfe;
  background: inherit;
  transform: rotate(45deg);
}

.doc-buttons:hover .documents-card {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.documents-card > strong {
  color: #1e3a8a;
  font-size: 13px;
}

[data-theme="dark"] .documents-card > strong {
  color: #dbeafe;
}

.documents-card-group {
  display: grid;
  gap: 6px;
}

.documents-card-group > span,
.documents-empty {
  color: currentColor;
  font-size: 12px;
  font-weight: 700;
}

.documents-card-file {
  min-width: 0;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.documents-card-file em {
  display: inline-grid;
  place-items: center;
  min-height: 22px;
  border-radius: 5px;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
}

.documents-card-file em.pdf {
  background: var(--red-soft);
  color: var(--red);
}

.documents-card-file em.word {
  background: var(--blue-soft);
  color: var(--blue);
}

.documents-card-file em.excel {
  background: var(--green-soft);
  color: var(--green);
}

.documents-card-file em.other {
  background: var(--panel-soft);
  color: var(--muted);
}

.documents-card-file p {
  margin: 0;
  overflow: hidden;
  color: #1e3a8a;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

[data-theme="dark"] .documents-card-file p {
  color: #dbeafe;
}

.bottom-grid {
  height: auto;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  gap: 24px;
}

.bottom-grid.economy-only {
  display: flex;
  justify-content: flex-end;
}

.bottom-grid.economy-only .economy-panel {
  width: min(620px, 100%);
  min-height: 220px;
}

.payroll-summary {
  background: rgba(248, 250, 252, 0.5);
  font-weight: 700;
}

.accent-total {
  color: var(--blue);
}

.economy-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid #1e293b;
  border-radius: var(--radius);
  background: var(--dark-panel);
  color: #ffffff;
  box-shadow: var(--shadow-lg);
}

.economy-panel h3 {
  margin: 0 0 16px;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.summary-lines {
  display: grid;
  gap: 12px;
}

.summary-lines div,
.profit-block {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.summary-lines span,
.profit-block span {
  color: #94a3b8;
  font-size: 14px;
}

.summary-lines strong {
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.summary-lines .negative {
  color: #f87171;
}

.profit-block {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--dark-line);
  align-items: flex-end;
}

.profit-block > div {
  display: grid;
  gap: 4px;
}

.profit-block span {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.profit-block strong {
  color: #ffffff;
  font-size: 24px;
  line-height: 1.1;
}

.profit-block strong.positive {
  color: #4ade80;
}

.profit-block strong.negative {
  color: #f87171;
}

.margin-block {
  text-align: right;
}

.margin-block strong {
  font-size: 18px;
}

.statusbar {
  height: 32px;
  flex: 0 0 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  border-top: 1px solid var(--line);
  background: #f1f5f9;
  color: var(--muted);
  font-size: 10px;
}

[data-theme="dark"] .statusbar {
  background: #0f172a;
}

.statusbar span:last-child {
  margin-left: auto;
}

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

.modal {
  width: min(100vw - 32px, 720px);
  padding: 0;
  border: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.modal-card {
  display: flex;
  max-height: 90vh;
  overflow: hidden;
  flex-direction: column;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 20px 42px rgba(0, 0, 0, 0.22);
}

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

.modal-head h3 {
  margin: 0;
  color: var(--heading);
  font-size: 18px;
  font-weight: 700;
}

.icon-button {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  background: var(--panel-soft);
}

.contractor-modal {
  max-width: 448px;
}

.contractor-preview {
  margin: 16px 16px 0;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
}

[data-theme="dark"] .contractor-preview {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.13);
  color: #93c5fd;
}

.contractor-preview h4 {
  margin: 0 0 4px;
  color: #1e3a8a;
  font-size: 14px;
}

[data-theme="dark"] .contractor-preview h4 {
  color: #bfdbfe;
}

.contractor-preview p {
  margin: 3px 0;
}

.contractor-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  overflow: auto;
}

.contractor-form-grid label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

.contractor-form-grid label:nth-child(1),
.contractor-form-grid label:nth-child(2) {
  grid-column: 1 / -1;
}

.contractor-form-grid input,
.contractor-form-grid select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 12px;
  outline: none;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
}

.contractor-form-grid input:focus,
.contractor-form-grid select:focus {
  border-color: var(--blue);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px 16px;
}

.file-modal {
  width: min(100vw - 32px, 900px);
}

.confirm-modal {
  width: min(420px, calc(100vw - 32px));
}

.confirm-card {
  gap: 0;
}

.confirm-body {
  padding: 16px;
}

.confirm-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.payment-tools-modal {
  max-width: 760px;
}

.payment-tools-card {
  max-height: min(90vh, 760px);
}

.payment-tools-tabs {
  display: flex;
  gap: 6px;
  padding: 12px 16px 0;
}

.payment-generator-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  overflow: auto;
}

.payment-generator-form label,
.payment-bulk-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.payment-generator-form input,
.payment-bulk-form textarea {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
}

.payment-generator-form .check-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.payment-bulk-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.payment-bulk-form[hidden],
.payment-generator-form[hidden] {
  display: none;
}

.payment-bulk-form textarea {
  min-height: 240px;
  resize: vertical;
}

.form-hint {
  margin: 0;
  color: var(--muted-light);
  font-size: 12px;
}

.file-card {
  height: min(90vh, 680px);
}

.file-layout {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 2fr;
  overflow: hidden;
}

.file-list-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.hidden-input {
  display: none;
}

.upload-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 600;
}

.upload-button:hover {
  background: #dbeafe;
}

[data-theme="dark"] .upload-button {
  border-color: rgba(37, 99, 235, 0.35);
  background: rgba(37, 99, 235, 0.13);
  color: #93c5fd;
}

.file-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
}

.file-empty {
  margin-top: 40px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.file-item {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.file-item:hover {
  background: var(--panel-soft);
}

.file-item.active {
  border-color: var(--blue);
  background: #eff6ff;
}

[data-theme="dark"] .file-item.active {
  background: rgba(37, 99, 235, 0.13);
}

.file-main {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.file-type {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
}

.file-type.pdf {
  background: var(--red-soft);
  color: var(--red);
}

.file-type.word {
  background: var(--blue-soft);
  color: var(--blue);
}

.file-type.excel {
  background: var(--green-soft);
  color: var(--green);
}

.file-type.other {
  background: var(--panel-soft);
  color: var(--muted);
}

.file-meta {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.file-meta strong {
  overflow: hidden;
  color: var(--heading);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta span {
  color: var(--muted);
  font-size: 12px;
}

.file-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.file-actions button,
.file-actions a {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
}

.file-actions button:hover,
.file-actions a:hover {
  background: var(--panel-soft);
  color: var(--blue);
}

.file-actions button:last-child:hover {
  color: var(--red);
}

.file-preview {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: #f8fafc;
}

[data-theme="dark"] .file-preview {
  background: #0f172a;
}

.preview-empty {
  flex: 1;
  min-height: 340px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  color: var(--muted-light);
  text-align: center;
}

.preview-empty svg {
  opacity: 0.24;
}

.preview-empty strong {
  max-width: 420px;
  color: var(--text);
  overflow-wrap: anywhere;
}

.preview-empty p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.iframe-shell {
  position: relative;
  flex: 1;
  min-height: 440px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  box-shadow: inset 0 1px 5px rgba(15, 23, 42, 0.05);
}

.iframe-shell iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--page);
}

.auth-card {
  width: min(380px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

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

.auth-brand h1 {
  margin: 0;
  color: var(--heading);
  font-size: 22px;
  line-height: 1.1;
}

.auth-card label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-card input {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  outline: none;
  background: var(--panel);
  color: var(--text);
  font-size: 14px;
  text-transform: none;
}

.auth-card input:focus {
  border-color: var(--blue);
}

.auth-error {
  margin: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
}

.user-badge {
  min-height: 32px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
}

.user-badge strong {
  color: var(--heading);
  font-size: 12px;
  line-height: 1.1;
}

.user-badge span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: default;
  opacity: 0.72;
}

.contractor-link:disabled {
  cursor: default;
}

.locked-docs {
  min-width: 98px;
  justify-content: center;
  color: var(--muted-light);
}

.presentation-panel {
  padding: 14px 16px 16px;
}

.presentation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 12px;
}

.presentation-card {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--panel);
}

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

.presentation-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.presentation-metrics div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px;
  border-radius: 7px;
  background: var(--panel-soft);
}

.presentation-metrics small,
.key-row-item small,
.calendar-payment span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.presentation-metrics strong {
  overflow: hidden;
  color: var(--heading);
  font-size: 15px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presentation-metrics .positive {
  color: var(--green);
}

.presentation-metrics .negative,
.risk-item.red strong {
  color: var(--red);
}

.risk-list,
.presentation-calendar,
.key-row-list {
  display: grid;
  gap: 7px;
}

.risk-item,
.key-row-item,
.calendar-payment {
  min-width: 0;
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  background: var(--panel-soft);
}

.risk-item strong,
.key-row-item strong,
.calendar-payment strong {
  overflow: hidden;
  color: var(--heading);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.risk-item.blue {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--blue-soft);
}

.risk-item.green {
  border-color: rgba(22, 163, 74, 0.24);
  background: var(--green-soft);
}

.risk-item.amber {
  border-color: rgba(217, 119, 6, 0.24);
  background: rgba(217, 119, 6, 0.09);
}

.calendar-payment {
  grid-template-columns: 82px minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--line);
  text-align: left;
}

.calendar-payment em,
.key-row-item em {
  color: var(--heading);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.key-row-item {
  grid-template-columns: minmax(0, 1fr) 72px auto;
  align-items: center;
}

.presentation-empty {
  color: var(--muted-light);
  font-size: 12px;
}

.admin-users-panel {
  padding: 14px 16px 16px;
}

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

.admin-panel-head div {
  display: grid;
  gap: 2px;
}

.admin-panel-head strong {
  color: var(--heading);
  font-size: 14px;
}

.admin-panel-head span {
  color: var(--muted);
  font-size: 11px;
}

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-users-table {
  min-width: 760px;
}

.admin-users-table th,
.admin-users-table td {
  padding: 10px 12px;
  text-align: center;
}

.admin-users-table td:first-child {
  display: grid;
  gap: 2px;
  text-align: left;
}

.admin-users-table td:first-child strong {
  color: var(--heading);
  font-size: 13px;
}

.admin-users-table td:first-child span {
  color: var(--muted);
  font-size: 11px;
}

.admin-users-table select {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  background: var(--panel);
  color: var(--text);
}

.permission-mark {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  min-height: 22px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
}

.permission-mark.yes {
  background: var(--green-soft);
  color: var(--green);
}

.permission-mark.no {
  background: var(--red-soft);
  color: var(--red);
}

@media (max-width: 1100px) {
  .app-shell {
    overflow: visible;
  }

  .main-layout {
    overflow: visible;
  }

  .bottom-grid {
    height: auto;
    grid-template-columns: 1fr;
  }

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

  .payroll-panel,
  .economy-panel {
    min-height: 220px;
  }

  .presentation-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .topbar {
    height: auto;
    flex: 0 0 auto;
    align-items: flex-start;
    flex-direction: column;
    padding: 12px;
  }

  .topbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .main-layout {
    padding: 12px;
    gap: 12px;
  }

  .filters-strip {
    grid-template-columns: 1fr;
  }

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

  .statusbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 12px;
  }

  .statusbar span:last-child {
    margin-left: 0;
  }

  .contractor-form-grid,
  .file-layout {
    grid-template-columns: 1fr;
  }

  .file-list-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}
