@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* amoCRM SLA dashboard */
.sla-workspace {
  display: grid;
  gap: 22px;
  background: #f6f8fb;
}

.sla-workspace-header {
  align-items: flex-end;
  margin-bottom: 0;
}

.sla-header-copy {
  max-width: 680px;
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.sla-status-banner {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
}

.sla-status-banner.warning {
  border-color: #f0d5a6;
  background: var(--amber-soft);
}

.sla-status-banner.success {
  border-color: #bfe8d0;
  background: var(--green-soft);
}

.sla-status-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  border-radius: 50%;
  background: var(--amber-accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.sla-status-banner.success .sla-status-icon { background: var(--green); }

.sla-indicator-tabs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.sla-indicator-tabs button,
.sla-indicator-placeholder {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  min-height: 76px;
  align-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 14px;
  text-align: left;
  box-shadow: none;
}

.sla-indicator-tabs button > span,
.sla-indicator-placeholder > span {
  display: grid;
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  place-items: center;
  align-self: center;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.sla-indicator-tabs strong { align-self: end; font-size: 13px; }
.sla-indicator-tabs small { align-self: start; margin-top: 3px; color: var(--muted); font-size: 10px; }
.sla-indicator-tabs button.active { border-color: var(--blue); background: var(--blue-soft); }
.sla-indicator-tabs button.active > span { background: var(--blue); color: #fff; }
.sla-indicator-placeholder { border-style: dashed; color: var(--muted); }

.sla-workspace .sla-indicator-tabs button:hover:not(.active) {
  border-color: #cad5df;
  background: #f1f5f8;
  color: var(--ink);
}

.sla-workspace .sla-indicator-tabs button.active:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--ink);
}

.sla-period-bar {
  display: grid;
  grid-template-columns: minmax(190px, 240px) minmax(210px, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
}

.sla-city-scope {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.sla-city-scope > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.sla-city-scope > small {
  color: var(--muted);
  font-size: 9px;
}

.sla-city-scope select,
.sla-city-scope .ui-select-trigger {
  min-height: 38px;
  border: 1px solid #b9c9d8;
  border-radius: 9px;
  background: var(--blue-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.sla-period-copy { display: grid; gap: 2px; }
.sla-period-copy > span { color: var(--muted); font-size: 10px; font-weight: 600; text-transform: uppercase; }
.sla-period-copy strong { font-size: 14px; }
.sla-period-copy small { color: var(--muted); font-size: 10px; }

.sla-period-presets {
  display: flex;
  gap: 5px;
  border-radius: 11px;
  background: var(--surface-soft);
  padding: 4px;
}

.sla-period-presets button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 11px;
  box-shadow: none;
}

.sla-period-presets button.active {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 2px 7px rgba(42, 49, 55, .08);
}

.sla-workspace .sla-period-presets button:hover:not(.active) {
  background: #e8eef3;
  color: var(--ink);
}

.sla-workspace .sla-period-presets button.active:hover {
  background: #fff;
  color: var(--blue);
}

.sla-period-dates { display: flex; align-items: center; gap: 7px; }
.sla-period-dates label { display: grid; grid-template-columns: auto 132px; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.sla-period-dates input {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 6px 8px;
  font: inherit;
  font-size: 11px;
}

.sla-status-banner div {
  display: grid;
  gap: 3px;
}

.sla-status-banner strong { font-size: 14px; }
.sla-status-banner span:not(.sla-status-icon) { color: #65717d; font-size: 12px; line-height: 1.45; }

.sla-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.sla-metric {
  display: grid;
  min-height: 112px;
  align-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

.sla-metric > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.sla-metric strong {
  margin-top: 10px;
  color: var(--ink);
  font-size: 23px;
  line-height: 1;
}

.sla-metric small { margin-top: 8px; color: var(--muted-light); font-size: 10px; }
.sla-metric.success strong { color: var(--green); }
.sla-metric.danger strong { color: var(--red); }

.sla-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.sla-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.sla-card:hover {
  border-color: #cdd7e0;
  box-shadow: 0 10px 28px rgba(36, 54, 68, .055);
}

.sla-settings-card { border-color: #d9e6f2; background: #fbfdff; }
.sla-settings-card > .sla-card-heading { background: #f1f7fc; }
.sla-manager-card { border-color: #dce8e4; background: #fbfdfc; }
.sla-manager-card > .sla-card-heading { background: #f1f7f5; }
.sla-journal-card { border-color: #e4e0ec; background: #fdfcff; }
.sla-journal-card > .sla-card-heading { background: #f6f3fa; }

.sla-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  padding: 16px 18px;
}

.sla-card-heading > div:first-child { min-width: 0; }
.sla-card-heading small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; line-height: 1.4; }

.sla-card-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.sla-collapse-toggle {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  min-height: 36px;
  place-items: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, .82);
  color: var(--ink);
  padding: 0;
  box-shadow: 0 2px 7px rgba(43, 57, 68, .06);
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.sla-workspace .sla-collapse-toggle:hover {
  border-color: #b9c8d5;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 5px 14px rgba(43, 57, 68, .11);
  transform: translateY(-1px) scale(1.04);
}

.sla-workspace .sla-collapse-toggle:active { transform: scale(.96); }

.sla-collapse-icon,
.sla-collapse-icon::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  content: "";
  transform: translate(-50%, -50%);
  transition: transform 220ms cubic-bezier(.22, 1, .36, 1), opacity 180ms ease;
}

.sla-collapse-icon::before { transform: translate(-50%, -50%) rotate(90deg) scaleX(0); }
.sla-collapse-toggle[aria-expanded="false"] .sla-collapse-icon::before { transform: translate(-50%, -50%) rotate(90deg) scaleX(1); }
#slaSettingsForm[hidden],
#slaManagerTable[hidden],
#slaDealJournal[hidden] { display: none !important; }

.sla-card h3 { margin: 2px 0 0; font-size: 17px; }

.sla-chip {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.sla-chip.warning { background: var(--amber-soft); color: var(--amber); }
.sla-chip.success { background: var(--green-soft); color: var(--green); }
.sla-chip.danger { background: var(--red-soft); color: var(--red); }

.sla-settings-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
  padding: 18px;
}

.sla-settings-form label,
.sla-field-group {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.sla-settings-form .wide { grid-column: 1 / -1; }
.sla-settings-form [hidden],
.sla-card[hidden],
.sla-stage-norm-settings[hidden] { display: none !important; }

.sla-stage-norm-settings {
  display: grid;
  gap: 11px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.sla-stage-norm-settings > header {
  display: grid;
  gap: 3px;
}

.sla-stage-norm-settings > header > span { color: var(--ink); font-size: 12px; font-weight: 700; }
.sla-stage-norm-settings > header > small { color: var(--muted); font-size: 10px; font-weight: 400; }

.sla-stage-norm-rows {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sla-stage-norm-row {
  grid-template-columns: minmax(0, 1fr) 124px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 8px 9px 8px 11px;
}

.sla-stage-norm-row > span { display: grid; min-width: 0; gap: 2px; }
.sla-stage-norm-row strong { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sla-stage-norm-row small { color: var(--muted); font-size: 9px; font-weight: 400; }
.sla-stage-norm-row input { min-height: 34px !important; text-align: right; }
.sla-stage-norm-row input:disabled { background: #edf0f3; color: var(--muted); }

.sla-settings-form input[type="text"],
.sla-settings-form input[type="time"],
.sla-settings-form input[type="number"],
.sla-search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  font: inherit;
  font-size: 13px;
}

.sla-settings-form input[readonly] { background: var(--surface-soft); color: #596772; }
.sla-field-hint { color: var(--muted); font-size: 10px; font-weight: 400; }

.sla-toggle-row {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  border-radius: 11px;
  background: var(--blue-soft);
  padding: 12px;
}

.sla-toggle-row input { margin: 2px 0 0; }
.sla-toggle-row span { display: grid; gap: 3px; }
.sla-toggle-row strong { color: var(--ink); font-size: 12px; }
.sla-toggle-row small { color: var(--muted); font-size: 10px; font-weight: 400; }

.sla-inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sla-inline-fields label { grid-template-columns: auto 1fr; align-items: center; }
.sla-field-label { color: var(--muted); font-size: 11px; font-weight: 600; }

.sla-days {
  display: flex;
  gap: 7px;
  margin: 0;
  border: 0;
  padding: 0;
}

.sla-days legend { margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 600; }
.sla-days label { position: relative; display: block; }
.sla-days input { position: absolute; opacity: 0; }
.sla-days span {
  display: grid;
  width: 37px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}
.sla-days input:checked + span { border-color: var(--blue); background: var(--blue-soft); color: var(--blue); }

.sla-form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

#slaSettingsState { color: var(--muted); font-size: 11px; }
#slaSettingsState[data-mode="ok"] { color: var(--green); }
#slaSettingsState[data-mode="bad"] { color: var(--red); }

.sla-logic-card {
  padding-bottom: 18px;
  border-color: #cfe0ee;
  background: linear-gradient(135deg, #edf6fd 0%, #f3f8fc 56%, #f8fbfd 100%);
}

.sla-logic-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px 8px;
}

.sla-logic-heading h3 { margin: 2px 0 0; font-size: 17px; }
.sla-logic-heading > small { max-width: 430px; color: var(--muted); font-size: 10px; line-height: 1.45; text-align: right; }

.sla-timeline {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 10px 20px 16px;
  padding: 0;
  list-style: none;
}

.sla-timeline::before {
  position: absolute;
  top: 19px;
  right: 11%;
  left: 11%;
  height: 2px;
  background: #c6dbea;
  content: "";
}

.sla-timeline li {
  position: relative;
  display: grid;
  grid-template-rows: 38px auto;
  justify-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid rgba(203, 220, 233, .86);
  border-radius: 13px;
  background: rgba(255, 255, 255, .72);
  padding: 14px 14px 16px;
  text-align: center;
  transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.sla-timeline li:hover {
  border-color: #b9d1e4;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 20px rgba(45, 79, 105, .08);
  transform: translateY(-2px);
}

.sla-timeline li > span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  z-index: 1;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 0 6px #eef6fc;
}

.sla-timeline li div { display: grid; gap: 5px; align-content: start; }
.sla-timeline strong { font-size: 12px; line-height: 1.35; }
.sla-timeline small { color: var(--muted); font-size: 10px; line-height: 1.45; }

.sla-note { margin: 0 20px; border-radius: 11px; padding: 12px 14px; }
.sla-note.warning { background: var(--amber-soft); color: var(--amber); }
.sla-note strong { font-size: 11px; }
.sla-note p { margin: 4px 0 0; color: #785a2f; font-size: 10px; line-height: 1.45; }

.sla-manager-card,
.sla-journal-card,
.sla-stage-card { min-width: 0; }
.sla-journal-heading { align-items: flex-end; }
.sla-search { width: min(360px, 42vw); }
.sla-search input { min-height: 38px; }
#slaJournalHint { max-width: 520px; }

.sla-journal-limit-note {
  border-bottom: 1px solid var(--line-soft);
  background: #f8fafc;
  color: var(--muted);
  padding: 9px 12px;
  font-size: 10px;
}

.sla-table-wrap { overflow: auto; }
.sla-table { width: 100%; min-width: 1040px; border-collapse: collapse; }
.sla-stage-table { min-width: 780px; }
.sla-table th {
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  color: var(--muted);
  padding: 9px 12px;
  text-align: left;
  text-transform: uppercase;
  font-size: 8px;
  letter-spacing: .04em;
}
.sla-table td {
  border-bottom: 1px solid var(--line-soft);
  padding: 11px 12px;
  vertical-align: middle;
  font-size: 11px;
}
.sla-table tr:last-child td { border-bottom: 0; }
.sla-table tbody tr { transition: background-color 140ms ease; }
.sla-table tbody tr:hover { background: #f3f6f9; color: var(--ink); }
.sla-table td > strong,
.sla-table td > small,
.sla-deal-link strong,
.sla-deal-link small { display: block; }
.sla-table td > small,
.sla-deal-link small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.sla-deal-link { color: var(--blue); text-decoration: none; }
.sla-deal-link:hover strong { text-decoration: underline; }
.sla-danger-text { color: var(--red); }
.sla-stuck-card { min-width: 0; border-color: color-mix(in srgb, var(--red) 24%, var(--line)); }
.sla-stage-journal-table { min-width: 1380px; }

.sla-empty {
  display: grid;
  min-height: 130px;
  place-content: center;
  gap: 5px;
  padding: 24px;
  text-align: center;
}
.sla-empty strong { font-size: 13px; }
.sla-empty span { color: var(--muted); font-size: 11px; }
.sla-legacy-details { border-top: 1px solid var(--line); margin-top: 14px; }
.sla-legacy-details > summary { cursor: pointer; padding: 14px 16px; color: var(--muted); font-size: 12px; font-weight: 700; }
.sla-legacy-details[open] > summary { color: var(--text); }

.sla-analytics-filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto;
  gap: 9px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.sla-analytics-filters[hidden],
.sla-analytics-insights[hidden],
#slaControlLayout[hidden] { display: none !important; }

.sla-analytics-filters label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.sla-analytics-filters select,
.sla-analytics-filters .ui-select-trigger {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-size: 11px;
}

.sla-analytics-filters > button { min-height: 38px; white-space: nowrap; }
.sla-analytics-insights { display: grid; gap: 14px; }
.sla-analytics-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sla-analytics-pair.is-single { grid-template-columns: minmax(0, 1fr); }
.sla-analytics-card { min-width: 0; }
.sla-analytics-card > :not(header) { padding: 16px 18px; }

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

.sla-funnel-step {
  position: relative;
  display: grid;
  min-height: 96px;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: linear-gradient(145deg, var(--blue-soft), #fff);
  padding: 12px;
}

.sla-funnel-step span { color: var(--muted); font-size: 10px; }
.sla-funnel-step strong { color: var(--ink); font-size: 24px; }
.sla-funnel-step small { color: var(--blue); font-size: 9px; }

.sla-coverage-list { display: grid; gap: 10px; }
.sla-coverage-list > div {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}
.sla-coverage-list span { color: var(--ink); font-size: 11px; }
.sla-coverage-list strong { color: var(--blue); font-size: 12px; }
.sla-coverage-list small { color: var(--muted); font-size: 9px; }
.sla-coverage-list i {
  display: block;
  height: 4px;
  grid-column: 1 / -1;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}
.sla-coverage-list i::after { display: block; width: var(--coverage); height: 100%; border-radius: inherit; background: var(--blue); content: ""; }

#slaAnalyticsBreakdowns { display: grid; gap: 18px; padding: 0; }
.sla-analytics-breakdown + .sla-analytics-breakdown { border-top: 1px solid var(--line-soft); }
.sla-analytics-breakdown h4 { margin: 0; padding: 13px 18px; font-size: 13px; }
.sla-analytics-breakdown .sla-table-wrap { padding: 0; }
.sla-analytics-breakdown .sla-table { min-width: 900px; }
.sla-loss-summary { display: grid; gap: 10px; }
.sla-loss-summary > strong { font-size: 18px; }
.sla-loss-summary > span { display: flex; gap: 7px; flex-wrap: wrap; }
.sla-loss-summary em { border-radius: 999px; background: var(--red-soft); color: var(--red); padding: 5px 8px; font-size: 10px; font-style: normal; }
.sla-loss-summary small { color: var(--muted); font-size: 10px; }
.sla-analytics-journal { min-width: 1780px; }

.sla-schedule-section {
  display: grid;
  gap: 14px;
}

.sla-schedule-section[hidden] { display: none !important; }

.sla-schedule-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.sla-schedule-summary-card {
  display: grid;
  min-height: 98px;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
}

.sla-schedule-summary-card > span,
.sla-schedule-summary-card > small {
  color: var(--muted);
  font-size: 10px;
}

.sla-schedule-summary-card > strong {
  font-size: 20px;
  line-height: 1.15;
}

.sla-schedule-summary-card.success { border-color: #bfe8d0; background: #f5fcf8; }
.sla-schedule-summary-card.warning { border-color: #f0d5a6; background: #fffaf1; }
.sla-schedule-card { border-color: #d5e2ec; background: #fbfdff; }
.sla-schedule-card > .sla-card-heading { background: #f0f6fb; }

.sla-schedule-heading-actions { flex-wrap: wrap; }

.sla-schedule-enabled {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  border: 1px solid #cbd9e5;
  border-radius: 10px;
  background: #fff;
  padding: 7px 10px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
}

.sla-schedule-enabled input { width: 16px; height: 16px; accent-color: var(--blue); }

.sla-schedule-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 16px;
}

.sla-schedule-week-nav { display: flex; gap: 6px; }
.sla-schedule-week-nav button { min-height: 34px; padding: 7px 10px; }
.sla-schedule-toolbar > strong { text-align: center; font-size: 13px; }
.sla-schedule-toolbar > span { color: var(--muted); font-size: 10px; text-align: right; }

.sla-schedule-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(150px, 1fr));
  gap: 1px;
  overflow-x: auto;
  background: var(--line-soft);
}

.sla-schedule-day {
  display: grid;
  min-height: 250px;
  align-content: start;
  gap: 10px;
  background: #fff;
  padding: 12px;
}

.sla-schedule-day.today { background: #f7fbff; box-shadow: inset 0 3px 0 var(--blue); }
.sla-schedule-day.no-coverage { background: #fffaf4; }

.sla-schedule-day-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.sla-schedule-day-heading div { display: grid; gap: 3px; }
.sla-schedule-day-heading span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.sla-schedule-day-heading strong { font-size: 14px; }
.sla-schedule-day-heading button {
  display: grid;
  width: 28px;
  height: 28px;
  min-height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  padding: 0;
  font-size: 18px;
  line-height: 1;
  box-shadow: none;
}

.sla-workspace .sla-schedule-day-heading button:hover {
  border-color: #a9c5dc;
  background: var(--blue-soft);
  color: var(--blue);
}

.sla-schedule-shifts { display: grid; gap: 8px; }

.sla-schedule-shift {
  display: grid;
  gap: 5px;
  border: 1px solid #dce5ec;
  border-radius: 10px;
  background: #f8fafc;
  padding: 9px;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.sla-schedule-shift.active { border-color: #9ed8b8; background: var(--green-soft); }
.sla-schedule-shift:hover { border-color: #b7c9d8; background: #f1f6fa; color: var(--ink); transform: translateY(-1px); }
.sla-schedule-shift.active:hover { border-color: #8acba8; background: #e9f8f0; }
.sla-schedule-shift strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.sla-schedule-shift span { color: var(--blue); font-size: 12px; font-weight: 800; }
.sla-schedule-shift small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }

.sla-schedule-empty {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px dashed #e4cfae;
  border-radius: 10px;
  color: #9a6a1d;
  padding: 12px;
  text-align: center;
  font-size: 10px;
}

.sla-schedule-coverage {
  margin-top: auto;
  border-radius: 8px;
  background: #eef3f7;
  color: var(--muted);
  padding: 6px 8px;
  font-size: 9px;
  text-align: center;
}

.sla-schedule-day.no-coverage .sla-schedule-coverage { background: #fff0d8; color: #956414; }

.sla-schedule-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line-soft);
  padding: 11px 16px;
  color: var(--muted);
  font-size: 10px;
}

.editor-dialog.sla-schedule-dialog { width: min(680px, calc(100vw - 32px)); }
.sla-schedule-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sla-schedule-form-grid input { width: 100%; }

@media (max-width: 1100px) {
  .sla-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sla-layout { grid-template-columns: 1fr; }
  .sla-period-bar { grid-template-columns: 1fr; }
  .sla-indicator-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sla-analytics-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .sla-analytics-pair { grid-template-columns: 1fr; }
  .sla-funnel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sla-timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sla-timeline::before { display: none; }
  .sla-schedule-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .sla-workspace-header,
  .sla-card-heading,
  .sla-form-actions { align-items: stretch; flex-direction: column; }
  .sla-card-heading-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .sla-card-heading-actions .sla-collapse-toggle { align-self: flex-end; }
  .sla-metric-grid { grid-template-columns: 1fr 1fr; }
  .sla-settings-form { grid-template-columns: 1fr; }
  .sla-settings-form .wide { grid-column: 1; }
  .sla-stage-norm-rows { grid-template-columns: 1fr; }
  .sla-search { width: 100%; }
  .sla-period-presets { overflow-x: auto; }
  .sla-period-dates { align-items: stretch; flex-direction: column; }
  .sla-period-dates label { grid-template-columns: 24px 1fr; }
  .sla-indicator-tabs { grid-template-columns: 1fr; }
  .sla-analytics-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sla-analytics-filters > button { grid-column: 1 / -1; }
  .sla-funnel { grid-template-columns: 1fr 1fr; }
  .sla-logic-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .sla-logic-heading > small { text-align: left; }
  .sla-timeline { grid-template-columns: 1fr; }
  .sla-timeline li { grid-template-columns: 38px minmax(0, 1fr); grid-template-rows: auto; justify-items: start; text-align: left; }
  .sla-schedule-summary { grid-template-columns: 1fr; }
  .sla-schedule-toolbar { grid-template-columns: 1fr; }
  .sla-schedule-toolbar > strong,
  .sla-schedule-toolbar > span { text-align: left; }
  .sla-schedule-footer { flex-direction: column; }
  .sla-schedule-form-grid { grid-template-columns: 1fr; }
  .sla-schedule-form-grid .wide { grid-column: 1; }
}

/* Compact source hierarchy table */
.registry-layout {
  grid-template-columns: minmax(0, 1fr);
}

.validation-panel {
  display: none;
}

.source-table-header,
.source-table-row.source-heading,
.source-table-row.branch-heading,
.source-table-row.level-three-row {
  display: grid;
  min-width: 1040px;
  grid-template-columns: minmax(300px, 1.4fr) 170px minmax(240px, 1fr) 150px 110px 126px 32px;
  gap: 0;
  align-items: center;
}

.source-table-header {
  min-height: 32px;
  border-bottom: 1px solid var(--line);
  background: #fafbfc;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  padding: 0;
  text-transform: uppercase;
}

.source-table-row.source-heading,
.source-table-row.branch-heading,
.source-table-row.level-three-row {
  min-height: 54px;
  background: var(--surface);
  padding: 0;
}

.source-table-row.source-heading {
  min-height: 64px;
}

.source-block.expanded .source-table-row.source-heading,
.branch-group.expanded .source-table-row.branch-heading {
  background: #fafbfc;
}

.source-table-row.branch-heading {
  padding-left: 0;
}

.source-table-row.level-three-row {
  border-top: 1px solid var(--line-soft);
  background: #fcfcfd;
  padding-left: 0;
}

.source-table-header > span,
.source-table-row.source-heading > *,
.source-table-row.branch-heading > *,
.source-table-row.level-three-row > * {
  min-width: 0;
  align-self: stretch;
  border-left: 1px solid var(--line-soft);
  padding: 7px 10px;
}

.source-table-header > span {
  display: flex;
  align-items: center;
  padding-top: 0;
  padding-bottom: 0;
  text-align: left;
}

.source-table-header > span:first-child,
.source-table-row.source-heading > *:first-child,
.source-table-row.branch-heading > *:first-child,
.source-table-row.level-three-row > *:first-child {
  border-left: 0;
}

.source-table-row.source-heading > *:first-child {
  padding-left: 12px;
}

.source-table-row.branch-heading > *:first-child {
  padding-left: 50px;
}

.source-table-row.level-three-row > *:first-child {
  padding-left: 78px;
}

.source-table-identity {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
}

.source-table-identity label {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 1px;
}

.source-table-identity label > span:first-child {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  text-transform: uppercase;
}

.source-identity {
  gap: 10px;
}

.source-identity label {
  height: 42px;
  grid-template-rows: 10px 30px;
  gap: 2px;
  align-content: center;
}

.source-identity label > span:first-child {
  line-height: 10px;
}

.source-identity .source-table-input {
  min-height: 30px;
  padding: 2px 0;
  font-size: 13px;
  line-height: 24px;
}

.table-toggle {
  display: grid;
  width: 24px;
  min-width: 24px;
  height: 28px;
  min-height: 28px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-weight: 400;
  padding: 0;
}

.table-toggle:hover {
  border: 0;
  background: var(--surface-strong);
  color: var(--blue);
}

.table-elbow {
  width: 12px;
  height: 24px;
  flex: 0 0 12px;
  border-bottom: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.source-table-input {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 11px;
  padding: 5px 7px;
  text-overflow: ellipsis;
}

.source-table-identity .source-table-input {
  font-size: 12px;
  font-weight: 500;
}

.source-table-input:hover {
  border-color: var(--line);
  background: var(--surface);
}

.source-table-input:focus {
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 0 0 2px rgba(42, 88, 220, 0.1);
  outline: 0;
}

.source-table-input::placeholder {
  color: var(--muted-light);
  font-weight: 400;
}

.source-table-input.marker-input {
  font-family: var(--font-mono);
  font-size: 10px;
}

.table-marker-field {
  display: grid;
  min-width: 0;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 4px 7px 3px;
}

.table-marker-field > span,
.table-final-link > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.table-marker-field .marker-input {
  min-height: 22px;
  border: 0;
  background: transparent;
  padding: 1px 0 0;
}

.table-marker-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(42, 88, 220, 0.1);
}

.table-marker-field .marker-input:focus {
  border: 0;
  box-shadow: none;
}

.table-scope-note {
  color: var(--muted-light);
  font-size: 9px;
  text-align: left;
}

.table-final-link {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 32px;
  gap: 1px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 4px 7px;
  text-align: left;
}

.table-final-link code {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-final-link:hover {
  border-color: var(--blue);
  background: var(--surface);
}

.table-channel-link-empty {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--blue);
  justify-content: flex-start;
  padding: 8px 12px;
  text-align: left;
}

.table-channel-link-empty:hover,
.table-channel-link-empty:focus-visible {
  background: var(--blue-soft);
  outline: 0;
}

.source-table-input.link-input,
.source-table-input.phone-input {
  border-color: var(--line-soft);
  background: var(--surface-soft);
  font-size: 10px;
}

.source-table-actions {
  display: flex;
  min-width: 0;
  gap: 4px;
  align-items: center;
  justify-content: flex-start;
}

.source-table-row > .source-expense-switch {
  justify-self: stretch;
  grid-column: auto;
  grid-row: auto;
  margin-left: 0;
}

.table-expense-empty,
.table-empty {
  color: var(--muted-light);
  font-size: 10px;
  text-align: left;
}

.table-inline-empty {
  min-width: 900px;
  color: var(--muted-light);
  font-size: 10px;
  padding: 10px 78px;
}

.source-register {
  overflow-x: auto;
}

.source-group,
.source-block {
  min-width: 900px;
}

.source-paths-inner,
.branch-children-inner {
  width: 100%;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-Thin.woff2") format("woff2");
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-ThinItalic.woff2") format("woff2");
  font-weight: 100;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-ExtraLight.woff2") format("woff2");
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-ExtraLightItalic.woff2") format("woff2");
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-LightItalic.woff2") format("woff2");
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-MediumItalic.woff2") format("woff2");
  font-weight: 500;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-SemiBoldItalic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-BoldItalic.woff2") format("woff2");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-ExtraBoldItalic.woff2") format("woff2");
  font-weight: 800;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "TT Interfaces";
  src: url("./fonts/tt-interfaces/TTInterfaces-BlackItalic.woff2") format("woff2");
  font-weight: 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --ink: #2a3137;
  --muted: #768694;
  --muted-light: #98a3b6;
  --page: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f4f6fb;
  --surface-strong: #eef1f7;
  --surface-hover: #e2e7ef;
  --line: #dce3eb;
  --line-soft: #e7ecf2;
  --line-strong: #c7d1dc;
  --blue: #0070ff;
  --blue-soft: #edf5ff;
  --coral: #0070ff;
  --coral-dark: #2b7fff;
  --green: #10b55f;
  --green-accent: #10b55f;
  --green-soft: #f1fbf5;
  --amber: #96600d;
  --amber-accent: #f3a53c;
  --amber-soft: #fff6e8;
  --red: #ff4d3a;
  --red-accent: #ff4d3a;
  --red-soft: #ffedeb;
  --deep: #2a3137;
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 14px;
  --radius-lg: 24px;
  --dropdown-compact-radius: 12px;
  --dropdown-trigger-radius: 14px;
  --dropdown-menu-radius: 20px;
  --dropdown-option-radius: 14px;
  --shadow-dialog: 0 10px 30px rgba(42, 49, 55, 0.14);
  --font: "TT Interfaces", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  font-family: var(--font);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
}

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

button {
  min-height: 40px;
  border: 1px solid var(--coral);
  border-radius: var(--radius);
  background: var(--coral);
  color: #fff;
  cursor: pointer;
  font-weight: 500;
  padding: 0 18px;
  white-space: nowrap;
}

button:hover {
  border-color: var(--coral-dark);
  background: var(--coral-dark);
}

button:active {
  border-color: #0058cc;
  background: #0058cc;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 4px solid rgba(0, 112, 255, 0.18);
  outline-offset: 1px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 9px 11px;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--muted-light);
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.secondary-button:hover {
  border-color: var(--line);
  background: var(--surface-strong);
}

.secondary-button:active {
  border-color: var(--line);
  background: var(--surface-hover);
  color: var(--ink);
}

.text-button {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 13px;
  padding: 3px 6px;
}

.text-button:hover {
  border: 0;
  background: var(--blue-soft);
  color: var(--blue);
}

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

.danger-button:hover {
  border-color: var(--red-soft);
  background: var(--red-soft);
  color: var(--red);
}

.icon-button {
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  padding: 0;
}

.icon-button:hover {
  border-color: var(--line-soft);
  background: var(--surface-strong);
  color: var(--ink);
}

.app-shell,
.admin-panel {
  min-height: 100vh;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-window {
  width: min(440px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
  padding: 26px;
}

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

.login-brand h1 {
  margin: 0;
  font-size: 22px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label,
.form-grid label {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.login-form label > span,
.form-grid label > span {
  font-size: 12px;
  font-weight: 600;
}

.error-text {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 12px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) auto minmax(240px, 1fr);
  gap: 24px;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  padding: 0 28px;
}

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

.brand-block img {
  flex: 0 0 auto;
}

.brand-block h1 {
  overflow: hidden;
  margin: 0;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-block .eyebrow {
  margin-bottom: 0;
  font-size: 9px;
}

.module-switcher,
.filter-switcher,
.city-tabs,
.dialog-tabs {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 3px;
}

.module-switcher button,
.filter-switcher button,
.city-tabs button,
.dialog-tabs button {
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 0 13px;
}

.module-switcher button:hover,
.filter-switcher button:hover,
.city-tabs button:hover,
.dialog-tabs button:hover {
  border: 0;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
}

.module-switcher button.active,
.filter-switcher button.active,
.city-tabs button.active,
.dialog-tabs button.active {
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(23, 32, 51, 0.1);
  color: var(--blue);
  font-weight: 700;
}

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

.topbar-actions button {
  min-height: 32px;
}

.save-state {
  min-width: 76px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.save-state[data-mode="ok"] {
  color: var(--green);
}

.save-state[data-mode="bad"] {
  color: var(--red);
}

@media (max-width: 1320px) {
  .topbar-actions .save-state {
    display: none;
  }
}

.main-view {
  display: none;
}

.main-view.active {
  display: block;
}

.workspace {
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 26px 28px 50px;
}

.workspace-header {
  display: flex;
  min-height: 52px;
  gap: 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.workspace-header h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.city-tabs button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.city-tabs button span {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 10px;
}

.city-tabs button.active span {
  background: var(--blue-soft);
  color: var(--blue);
}

.registry-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto minmax(410px, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.search-field input {
  min-height: 38px;
  background: var(--surface);
}

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

.summary-strip {
  display: flex;
  min-height: 44px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 14px;
  overflow-x: auto;
}

.summary-strip span {
  flex: 0 0 auto;
  min-width: 130px;
  border-left: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 10.5px;
  padding: 0 14px;
}

.summary-strip span:first-child {
  border-left: 0;
}

.summary-strip b {
  margin-right: 4px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.summary-strip .summary-danger b {
  color: var(--red);
}

.summary-strip .summary-warning b {
  color: var(--amber);
}

.summary-strip .summary-success b {
  color: var(--green);
}

.summary-strip .summary-phone {
  margin-left: auto;
}

.registry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  align-items: start;
}

.source-register,
.validation-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.source-list {
  min-height: 140px;
}

.source-group + .source-group {
  border-top: 8px solid var(--page);
}

.source-group-heading {
  display: flex;
  min-height: 38px;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px 14px;
}

.source-group-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.source-group-heading small {
  margin-left: auto;
  color: var(--muted);
  font-size: 9.5px;
}

.source-group-empty {
  min-height: 54px;
  color: var(--muted);
  font-size: 10.5px;
  padding: 18px 14px;
}

.source-block {
  --tone: var(--blue);
  border-bottom: 1px solid var(--line);
}

.source-block:last-child {
  border-bottom: 0;
}

.source-block.tone-1 {
  --tone: #2453d4;
}

.source-block.tone-2 {
  --tone: #2fc98f;
}

.source-block.tone-3 {
  --tone: #2453d4;
}

.source-block.tone-4 {
  --tone: #f3a53c;
}

.source-block.tone-5 {
  --tone: #6b778c;
}

.source-block.tone-6 {
  --tone: #f05b67;
}

.source-block.brand-yandex-maps {
  --tone: #172033;
}

.source-block.brand-2gis {
  --tone: #2fc98f;
}

.source-block.brand-vk {
  --tone: #2453d4;
}

.source-block.brand-avito {
  --tone: #f05b67;
}

.source-block.brand-google {
  --tone: #2453d4;
}

.source-block.brand-yandex-direct {
  --tone: #2453d4;
}

.source-heading {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 180px) auto auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  background: var(--surface);
  padding: 8px 12px;
}

.source-block.expanded .source-heading {
  background: var(--surface-soft);
}

.source-toggle {
  display: flex;
  min-width: 0;
  min-height: 48px;
  gap: 9px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.source-toggle:hover {
  border: 0;
  background: transparent;
  color: var(--ink);
}

.source-toggle::before {
  width: 12px;
  height: 16px;
  flex: 0 0 12px;
  margin: 0 2px;
  color: var(--ink);
  content: "+";
  font-size: 15px;
  font-weight: 400;
  line-height: 16px;
  text-align: center;
}

.source-block.expanded .source-toggle::before {
  content: "-";
}

.source-logo {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  overflow: hidden;
  background: transparent;
}

.source-logo img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.source-logo.logo-avito,
.source-logo.logo-2gis {
  justify-content: start;
}

.source-logo.logo-avito img {
  width: 40px;
  max-width: 40px;
  height: 40px;
}

.source-logo.logo-2gis img {
  width: 40px;
  max-width: 40px;
  height: 40px;
}

.source-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.source-copy strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.source-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 400;
  text-overflow: ellipsis;
}

.hierarchy-label {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
  text-transform: uppercase;
}

.level-marker {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 38px;
  align-content: center;
  gap: 2px;
  overflow: hidden;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 5px 8px;
  text-align: left;
}

.level-marker-tools,
.final-marker-tools {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 5px;
  align-items: center;
}

.pencil-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--blue);
  font-size: 16px;
}

.pencil-button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.pencil-button::before {
  width: 15px;
  height: 15px;
  background: currentColor;
  content: "";
  -webkit-mask: url("./icons/edit-settings.svg") center / contain no-repeat;
  mask: url("./icons/edit-settings.svg") center / contain no-repeat;
}

.level-marker:hover {
  border-color: var(--tone, var(--blue));
  background: var(--surface-soft);
  color: var(--ink);
}

.level-marker span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.level-marker code {
  display: block;
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.level-marker.missing {
  border-style: dashed;
  color: var(--muted-light);
}

.source-meta,
.source-heading-actions,
.path-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.source-meta > span {
  color: var(--muted);
  font-size: 11px;
}

.source-meta .source-state {
  min-width: 30px;
  border-radius: 14px;
  cursor: help;
  font-size: 10px;
  font-weight: 600;
  padding: 4px 7px;
  text-align: center;
}

.source-expense-switch {
  display: inline-grid;
  width: 126px;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  padding: 2px;
}

.source-expense-switch button {
  min-height: 24px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  padding: 0 6px;
  transition: none;
}

.source-expense-switch button:hover {
  border: 0;
  background: var(--surface);
  color: var(--ink);
}

.source-expense-switch button.active {
  background: var(--blue);
  box-shadow: 0 1px 2px rgba(23, 32, 51, 0.12);
  color: #fff;
}

.source-heading-actions {
  gap: 3px;
}

.source-heading-actions .text-button,
.branch-heading > .connection-action,
.level-three-heading > .connection-action {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.source-heading-actions .text-button:hover,
.branch-heading > .connection-action:hover,
.level-three-heading > .connection-action:hover {
  color: var(--blue);
}

.source-state.danger {
  background: var(--red-soft);
  color: var(--red);
}

.source-state.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.source-state.success {
  background: var(--green-soft);
  color: var(--green);
}

.source-paths {
  display: grid;
  overflow: hidden;
  grid-template-rows: 0fr;
  border-top: 1px solid transparent;
  background: var(--surface-soft);
  transition:
    grid-template-rows 280ms cubic-bezier(0.2, 0.75, 0.25, 1),
    border-color 180ms ease;
}

.source-paths-inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition:
    opacity 180ms ease,
    transform 260ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.source-block.expanded .source-paths {
  grid-template-rows: 1fr;
  border-top-color: var(--line);
}

.source-block.expanded .source-paths-inner {
  opacity: 1;
  transform: translateY(0);
}

.branch-group + .branch-group {
  border-top: 1px solid var(--line-soft);
}

.branch-heading {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto minmax(130px, 180px) auto 30px;
  min-height: 60px;
  gap: 12px;
  align-items: center;
  background: var(--surface);
  padding: 6px 12px 6px 28px;
}

.branch-group.expanded .branch-heading {
  background: #fafbfc;
}

.branch-toggle {
  display: grid;
  min-width: 0;
  min-height: 46px;
  grid-template-columns: 16px 14px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
}

.branch-toggle:hover {
  border: 0;
  background: transparent;
  color: var(--ink);
}

.branch-toggle::before {
  width: 12px;
  height: 16px;
  justify-self: center;
  color: var(--ink);
  content: "+";
  font-size: 15px;
  font-weight: 400;
  line-height: 16px;
  text-align: center;
}

.branch-group.expanded .branch-toggle::before {
  content: "-";
}

.tree-elbow {
  width: 12px;
  height: 28px;
  border-bottom: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
}

.branch-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.branch-copy strong {
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 500;
}

.branch-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.branch-state {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 13px;
  background: var(--surface-strong);
  font-size: 10px;
  font-weight: 600;
}

.branch-state.danger {
  background: var(--red-soft);
  color: var(--red);
}

.branch-state.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.branch-state.success {
  background: var(--green-soft);
  color: var(--green);
}

.branch-children {
  display: grid;
  overflow: hidden;
  grid-template-rows: 0fr;
  border-top: 1px solid transparent;
  background: var(--surface);
  transition:
    grid-template-rows 260ms cubic-bezier(0.2, 0.75, 0.25, 1),
    border-color 180ms ease;
}

.branch-children-inner {
  min-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-5px);
  transition:
    opacity 170ms ease,
    transform 240ms cubic-bezier(0.2, 0.75, 0.25, 1);
}

.branch-group.expanded .branch-children {
  grid-template-rows: 1fr;
  border-top-color: var(--line-soft);
}

.branch-group.expanded .branch-children-inner {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .source-toggle::before,
  .branch-toggle::before,
  .source-expense-switch::before,
  .source-expense-switch::after,
  .source-paths,
  .source-paths-inner,
  .branch-children,
  .branch-children-inner {
    transition: none;
    animation: none;
  }
}

.level-three-node + .level-three-node,
.terminal-row + .level-three-node,
.terminal-row + .terminal-row {
  border-top: 1px solid var(--line-soft);
}

.level-three-heading {
  display: grid;
  grid-template-columns: 14px auto minmax(160px, 1fr) minmax(130px, 180px);
  min-height: 52px;
  gap: 9px;
  align-items: center;
  background: #fafbfc;
  padding: 6px 12px 6px 64px;
}

.level-three-heading strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.terminal-row {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(170px, 220px) 228px 96px;
  min-height: 82px;
  align-items: center;
  background: var(--surface);
}

.terminal-row.has-error {
  box-shadow: inset 3px 0 0 var(--red);
}

.terminal-row.has-warning {
  box-shadow: inset 3px 0 0 #e4a135;
}

.terminal-row.is-ready {
  box-shadow: inset 3px 0 0 var(--green);
}

.terminal-marker {
  display: grid;
  position: relative;
  min-width: 0;
  gap: 4px;
  padding: 9px 12px 9px 72px;
}

.terminal-marker::before {
  position: absolute;
  top: 0;
  bottom: 50%;
  left: 50px;
  width: 12px;
  border-bottom: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  content: "";
}

.terminal-row.nested .terminal-marker {
  padding-left: 88px;
}

.terminal-row.nested .terminal-marker::before {
  left: 66px;
}

.terminal-marker > span:first-child {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.final-marker {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  overflow: hidden;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  padding: 4px 6px;
  text-align: left;
}

.final-marker:hover {
  border-color: var(--tone, var(--blue));
  background: var(--surface-soft);
  color: var(--ink);
}

.final-marker code {
  display: block;
  overflow: hidden;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.final-marker.missing {
  color: var(--red);
}

.terminal-phone {
  display: flex;
  width: max-content;
  max-width: 100%;
  min-height: 26px;
  gap: 7px;
  align-items: center;
  overflow: hidden;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted);
  padding: 3px 7px;
  text-align: left;
}

.terminal-phone span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.terminal-phone strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-phone.ready {
  border-color: #add3ee;
  background: #eef7fd;
}

.terminal-phone.configured {
  border-color: #ead3a5;
  background: var(--amber-soft);
}

.terminal-phone.missing {
  border-style: dashed;
}

.terminal-bindings {
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 8px 0;
}

.terminal-bindings .terminal-phone {
  width: 100%;
}

.terminal-link {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 30px;
  align-content: center;
  gap: 2px;
  overflow: hidden;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 4px 7px;
  text-align: left;
}

.terminal-link span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.terminal-link strong {
  overflow: hidden;
  font-size: 10px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-link.ready {
  border-color: #b7d8c8;
  background: var(--green-soft);
}

.terminal-link.missing {
  border-color: #efb9c1;
  border-style: dashed;
  background: var(--red-soft);
  color: var(--red);
}

.path-messengers {
  display: grid;
  grid-template-columns: repeat(3, 36px) 30px;
  gap: 5px;
  align-items: center;
}

.messenger-link-chip {
  position: relative;
  display: grid;
  width: 36px;
  height: 32px;
  grid-template-columns: 1fr;
  place-items: center;
  border-color: var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--muted-light);
  padding: 0;
}

.messenger-brand-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.messenger-brand-icon img {
  display: block;
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.messenger-link-chip .messenger-state {
  position: absolute;
  right: -3px;
  bottom: -3px;
  display: grid;
  width: 14px;
  height: 14px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.messenger-link-chip.ready .messenger-state {
  background: var(--green);
  color: #fff;
}

.messenger-link-chip.ready.whatsapp {
  border-color: #a9ddc8;
  background: #edf9f4;
  color: #147453;
}

.messenger-link-chip.ready.telegram {
  border-color: #add3ee;
  background: #eef7fd;
  color: #1671a8;
}

.messenger-link-chip.ready.max {
  border-color: #c8cbd2;
  background: #f2f3f5;
  color: #222a38;
}

.messenger-link-chip.missing:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.path-checks {
  display: grid;
  grid-template-columns: repeat(4, 56px);
  gap: 5px;
  justify-content: start;
}

.check-pill {
  display: grid;
  grid-template-columns: 1fr auto;
  min-width: 0;
  height: 26px;
  gap: 3px;
  align-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 9px;
  padding: 0 6px;
}

.check-pill b {
  font-size: 8px;
}

.check-pill.success {
  background: var(--green-soft);
  color: var(--green);
}

.check-pill.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.check-pill.danger {
  background: var(--red-soft);
  color: var(--red);
}

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

.path-actions {
  justify-content: flex-end;
  padding-right: 8px;
}

.issue-count {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
}

.issue-count.danger {
  background: var(--red-soft);
  color: var(--red);
}

.issue-count.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.issue-count.success {
  background: var(--green-soft);
  color: var(--green);
}

.inline-empty,
.empty-state {
  color: var(--muted);
  font-size: 12px;
  padding: 20px;
}

.empty-state {
  display: grid;
  min-height: 150px;
  place-content: center;
  text-align: center;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 14px;
}

.validation-panel {
  position: sticky;
  top: 78px;
  transition: box-shadow 160ms ease;
}

.validation-panel.attention {
  box-shadow: 0 0 0 3px rgba(36, 83, 212, 0.18);
}

.validation-heading {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.validation-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.validation-heading .eyebrow {
  color: var(--muted);
  font-size: 8px;
  font-weight: 500;
}

.validation-score {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 17px;
  font-size: 12px;
  font-weight: 600;
}

.validation-score.danger {
  background: var(--red-soft);
  color: var(--red);
}

.validation-score.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.validation-score.success {
  background: var(--green-soft);
  color: var(--green);
}

.validation-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.validation-totals span {
  min-height: 38px;
  color: var(--muted);
  font-size: 10px;
  padding: 11px 13px;
}

.validation-totals span + span {
  border-left: 1px solid var(--line);
}

.danger-text {
  color: var(--red);
}

.warning-text {
  color: var(--amber);
}

.success-text {
  color: var(--green);
}

.issue-list {
  display: grid;
}

.issue-row {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  min-height: 50px;
  gap: 9px;
  align-items: start;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
}

.issue-row:hover {
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-soft);
  color: var(--ink);
}

.issue-dot {
  width: 7px;
  height: 7px;
  margin-top: 4px;
  border-radius: 50%;
  background: var(--amber);
}

.issue-row.error .issue-dot {
  background: var(--red);
}

.issue-row span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.issue-row strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.issue-row small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  white-space: normal;
}

.validation-more {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  padding: 10px 12px;
}

.validation-empty {
  display: grid;
  min-height: 130px;
  gap: 4px;
  place-content: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.validation-empty strong {
  color: var(--green);
  font-size: 13px;
}

.process-workspace {
  max-width: 1180px;
}

.expense-workspace {
  max-width: 1320px;
}

.expense-toolbar {
  display: flex;
  min-height: 48px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.expense-mode-switcher button {
  min-width: 138px;
}

.expense-panel {
  display: none;
  border: 1px solid var(--line);
  background: var(--surface);
}

.expense-panel.active {
  display: block;
}

.expense-section-heading {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 0 14px;
}

.expense-section-heading h3 {
  margin: 0;
  font-size: 13px;
}

.expense-section-heading small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.expense-section-heading button {
  flex: 0 0 auto;
}

.expense-table {
  display: grid;
}

.expense-row {
  display: grid;
  min-height: 64px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 14px;
}

.expense-row:last-child {
  border-bottom: 0;
}

.expense-table-header {
  min-height: 34px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.api-expense-row {
  grid-template-columns: minmax(220px, 1fr) 160px 34px;
}

.api-campaign-panel {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.api-campaign-heading {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 14px;
}

.api-campaign-heading h4 {
  margin: 0;
  font-size: 12px;
}

.api-campaign-heading small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.api-balance {
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 9px;
  padding: 6px 8px;
  white-space: nowrap;
}

.api-campaign-list {
  display: grid;
}

.api-campaign-row {
  display: grid;
  min-height: 48px;
  grid-template-columns: minmax(220px, 1fr) 130px 140px 150px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 14px;
}

.api-campaign-row:last-child {
  border-bottom: 0;
}

.api-campaign-row.api-campaign-table-header {
  min-height: 30px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.api-campaign-name,
.api-campaign-cell {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.api-campaign-name strong,
.api-campaign-cell strong {
  overflow: hidden;
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.api-campaign-name small,
.api-campaign-cell small {
  color: var(--muted);
  font-size: 9px;
}

.api-campaign-empty {
  min-height: 92px;
}

.api-creative-empty {
  display: grid;
  gap: 3px;
  border-top: 1px solid var(--line-soft);
  padding: 12px 14px;
  color: var(--muted);
  font-size: 9px;
}

.api-creative-empty strong {
  color: var(--ink);
  font-size: 10px;
}

.api-creative-directory {
  border-top: 1px solid var(--line);
}

.api-creative-directory > summary {
  display: flex;
  min-height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  list-style: none;
}

.api-creative-directory > summary::-webkit-details-marker {
  display: none;
}

.api-creative-directory > summary::after {
  content: "Показать";
  margin-left: auto;
  color: var(--primary);
  font-size: 9px;
  font-weight: 600;
}

.api-creative-directory[open] > summary::after {
  content: "Скрыть";
}

.api-creative-directory > summary strong {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.api-creative-row {
  display: grid;
  min-height: 44px;
  grid-template-columns: minmax(180px, 1fr) minmax(190px, 1fr) minmax(150px, .8fr) 110px;
  gap: 12px;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  padding: 7px 14px;
}

.api-creative-table-header {
  min-height: 28px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.api-attribution-panel {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.api-attribution-heading {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 14px;
}

.api-attribution-heading h4 {
  margin: 0;
  font-size: 12px;
}

.api-attribution-heading small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.api-attribution-heading button {
  flex: 0 0 auto;
}

.attribution-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(100px, 1fr));
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-soft);
}

.attribution-summary > span {
  display: grid;
  min-width: 0;
  gap: 2px;
  border-right: 1px solid var(--line-soft);
  padding: 10px 14px;
}

.attribution-summary > span:last-child {
  border-right: 0;
}

.attribution-summary b {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attribution-summary .summary-success b {
  color: var(--green);
}

.attribution-summary .summary-warning b {
  color: var(--amber);
}

.attribution-summary small {
  color: var(--muted);
  font-size: 9px;
}

.attribution-breakdown {
  display: grid;
  overflow-x: auto;
}

.attribution-breakdown-row {
  display: grid;
  min-width: 720px;
  min-height: 48px;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 0.8fr) 80px 80px 140px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 14px;
}

.attribution-breakdown-row:last-child {
  border-bottom: 0;
}

.attribution-breakdown-header {
  min-height: 30px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.attribution-breakdown-header > :nth-child(n + 3),
.attribution-number,
.attribution-revenue {
  justify-self: end;
}

.attribution-number,
.attribution-revenue {
  font-size: 10.5px;
  white-space: nowrap;
}

.attribution-empty {
  min-height: 92px;
}

@media (max-width: 850px) {
  .expense-section-heading {
    align-items: flex-start;
    flex-direction: column;
    padding-block: 10px;
  }

  .api-campaign-row {
    grid-template-columns: minmax(170px, 1fr) 110px 120px;
  }

  .api-campaign-row > :nth-child(4) {
    display: none;
  }

  .api-creative-row {
    grid-template-columns: minmax(170px, 1fr) minmax(180px, 1fr) 100px;
  }

  .api-creative-row > :nth-child(3) {
    display: none;
  }

  .api-attribution-heading {
    align-items: stretch;
    flex-direction: column;
    padding-block: 12px;
  }

  .api-attribution-heading button {
    width: 100%;
  }

  .attribution-summary {
    grid-template-columns: repeat(3, minmax(100px, 1fr));
  }

  .attribution-summary > span:nth-child(3) {
    border-right: 0;
  }
}

@media (max-width: 560px) {
  .attribution-summary {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }

  .attribution-summary > span:nth-child(3) {
    border-right: 1px solid var(--line-soft);
  }

  .attribution-summary > span:nth-child(even) {
    border-right: 0;
  }
}

.manual-expense-row {
  grid-template-columns: minmax(170px, 1.2fr) minmax(210px, 1fr) 120px minmax(160px, 0.8fr) 130px 34px;
}

.expense-channel {
  display: flex;
  min-width: 0;
  gap: 9px;
  align-items: center;
}

.expense-channel-mark {
  width: 5px;
  height: 28px;
  flex: 0 0 5px;
  border-radius: var(--radius-xs);
  background: var(--blue);
}

.expense-channel-icon,
.technical-brand-icon {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  overflow: hidden;
  background: transparent;
}

.expense-channel-icon img,
.technical-brand-icon img {
  display: block;
  width: 25px;
  height: 25px;
  object-fit: contain;
}

.expense-channel strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-status,
.expense-frequency {
  width: max-content;
  min-width: 104px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 8px;
  text-align: center;
}

.expense-status.success {
  background: var(--green-soft);
  color: var(--green);
}

.expense-status.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.expense-status.danger {
  background: var(--red-soft);
  color: var(--red);
}

.expense-period {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: center;
  color: var(--muted);
}

.expense-period strong {
  color: var(--ink);
  font-size: 10.5px;
  white-space: nowrap;
}

.expense-date,
.expense-amount {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.expense-date span,
.expense-amount small {
  color: var(--muted);
  font-size: 9px;
}

.expense-date strong,
.expense-amount strong {
  font-size: 11px;
  white-space: nowrap;
}

.expense-amount small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-actions {
  display: flex;
  justify-content: flex-end;
}

.technical-workspace {
  max-width: 1460px;
}

.technical-toolbar {
  display: flex;
  min-height: 48px;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.technical-register {
  border: 1px solid var(--line);
  background: var(--surface);
}

.technical-section-heading {
  display: flex;
  min-height: 48px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 0 14px;
}

.technical-section-heading h3 {
  margin: 0;
  font-size: 13px;
}

.technical-table {
  display: grid;
}

.technical-row {
  display: grid;
  min-height: 68px;
  grid-template-columns: minmax(180px, 0.9fr) minmax(250px, 1.15fr) minmax(220px, 1fr) 112px 94px;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 14px;
}

.technical-row:last-child {
  border-bottom: 0;
}

.technical-table-header {
  min-height: 34px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.technical-title {
  display: grid;
  min-width: 0;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 2px 9px;
  align-items: center;
}

.technical-mark {
  width: 5px;
  height: 30px;
  grid-row: 1 / span 2;
  justify-self: center;
  border-radius: var(--radius-xs);
  background: var(--blue);
}

.technical-row.custom .technical-mark {
  background: var(--amber);
}

.technical-brand-icon {
  grid-row: 1 / span 2;
}

.technical-title strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-title small {
  color: var(--muted);
  font-size: 9px;
}

.technical-location {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.technical-location > span {
  display: none;
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.technical-location strong {
  overflow-wrap: anywhere;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.35;
}

.technical-value {
  min-width: 0;
}

.technical-value-copy {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  padding: 5px 8px;
  text-align: left;
}

.technical-value-copy:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--ink);
}

.technical-value-copy code {
  display: block;
  min-width: 0;
  overflow: hidden;
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.technical-value-copy span {
  color: var(--blue);
  font-size: 9px;
  font-weight: 600;
}

.technical-empty,
.technical-code-state {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.35;
}

.technical-empty {
  color: var(--red);
}

.technical-status {
  min-width: 98px;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 8px;
  text-align: center;
}

.technical-status.success {
  background: var(--green-soft);
  color: var(--green);
}

.technical-status.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.technical-status.danger {
  background: var(--red-soft);
  color: var(--red);
}

.technical-actions {
  display: flex;
  justify-content: flex-end;
}

.technical-actions .text-button {
  white-space: nowrap;
}

.process-list {
  border: 1px solid var(--line);
  background: var(--surface);
}

.process-row {
  display: grid;
  grid-template-columns: 32px 36px minmax(0, 1fr) 104px 76px;
  min-height: 62px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 12px;
}

.process-row:last-child {
  border-bottom: 0;
}

.task-check {
  display: inline-grid;
  width: 24px;
  height: 24px;
  place-items: center;
}

.task-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.task-check span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.task-check input:checked + span {
  border-color: var(--green);
  background: var(--green);
}

.task-check input:checked + span::after {
  color: #fff;
  content: "✓";
  font-size: 12px;
}

.task-number {
  color: var(--muted-light);
  font-size: 10px;
}

.task-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.task-copy strong {
  font-size: 12.5px;
  line-height: 1.35;
}

.task-copy small {
  color: var(--muted);
  font-size: 10.5px;
}

.task-status {
  min-width: 88px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 8px;
  text-align: center;
}

.task-status.success {
  background: var(--green-soft);
  color: var(--green);
}

.task-status.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.task-status.neutral {
  background: var(--surface-strong);
  color: var(--muted);
}

.task-status.muted {
  background: var(--surface-soft);
  color: var(--muted-light);
}

.editor-dialog {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-dialog);
  color: var(--ink);
  padding: 0;
}

.editor-dialog.small-dialog {
  width: min(620px, calc(100vw - 32px));
}

.editor-dialog.internal-password-dialog {
  width: min(420px, calc(100vw - 32px));
}

.internal-password-body {
  display: grid;
  gap: 8px;
}

.internal-password-body label {
  display: grid;
  gap: 7px;
}

.internal-password-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 11px;
}

.editor-dialog::backdrop {
  background: rgba(23, 32, 51, 0.46);
}

.editor-dialog form {
  display: grid;
  max-height: calc(100vh - 34px);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.small-dialog form {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.dialog-heading {
  display: flex;
  min-height: 66px;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 12px 18px;
}

.dialog-heading h2 {
  max-width: 720px;
  overflow: hidden;
  margin: 0;
  font-size: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-tabs {
  margin: 10px 18px 0;
  overflow-x: auto;
}

.dialog-tabs button {
  flex: 1 0 auto;
}

.dialog-body {
  overflow-y: auto;
  padding: 18px;
}

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

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

.form-grid label small {
  color: var(--muted);
  font-size: 10px;
}

.form-section-heading {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.form-section-heading strong {
  font-size: 12px;
}

.messenger-link-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 11px 12px;
}

.messenger-link-heading > div {
  display: grid;
  gap: 3px;
}

.messenger-link-heading strong {
  font-size: 12px;
}

.messenger-link-heading span {
  color: var(--muted);
  font-size: 10.5px;
}

.messenger-editor-list {
  display: grid;
  border: 1px solid var(--line);
}

.messenger-editor-group {
  display: grid;
}

.messenger-editor-group[hidden] {
  display: none;
}

.messenger-editor-group + .messenger-editor-group {
  border-top: 1px solid var(--line);
}

.messenger-editor-group h4 {
  display: flex;
  min-height: 36px;
  gap: 7px;
  align-items: center;
  margin: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
}

.messenger-editor-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 76px;
  gap: 10px;
  align-items: end;
  border-bottom: 1px solid var(--line-soft);
  padding: 10px;
}

.messenger-editor-row:last-child {
  border-bottom: 0;
}

.messenger-editor-row label {
  min-width: 0;
}

.messenger-badge {
  display: inline-grid;
  width: 38px;
  height: 32px;
  place-items: center;
  align-self: end;
  border-radius: var(--radius-sm);
  font-size: 9px;
  font-weight: 700;
}

.messenger-badge.whatsapp {
  background: #edf9f4;
  color: #147453;
}

.messenger-badge.telegram {
  background: #eef7fd;
  color: #1671a8;
}

.messenger-badge.max {
  background: #f2f3f5;
  color: #222a38;
}

.path-panel {
  display: none;
}

.path-panel.active {
  display: block;
}

.marker-preview {
  display: grid;
  min-width: 0;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px 12px;
}

.marker-preview span {
  color: var(--muted);
  font-size: 10px;
}

.marker-preview code {
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 11px;
}

.issue-preview {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.issue-preview strong {
  font-size: 12px;
}

.issue-preview span {
  border-left: 3px solid var(--amber);
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
  padding: 7px 9px;
}

.issue-preview span.error {
  border-left-color: var(--red);
  background: var(--red-soft);
  color: var(--red);
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 9px;
  align-items: center;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 11px 18px;
}

.city-management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.city-management-actions .text-button {
  min-height: 30px;
  padding: 2px 0;
  font-size: 13px;
  font-weight: 500;
}

.city-management-actions .danger-text {
  color: var(--red);
}

.city-management-actions .danger-text:hover {
  color: var(--red);
}

.code-dialog {
  width: min(980px, calc(100vw - 32px));
}

.city-sites-control {
  display: flex;
  min-height: 58px;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.city-sites-control > div {
  display: grid;
  gap: 3px;
}

.city-sites-control span {
  color: var(--muted);
  font-size: 10px;
}

.technical-settings {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.technical-settings summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}

.technical-settings-grid {
  display: grid;
  gap: 11px;
  padding-top: 12px;
}

.technical-settings-grid label {
  display: grid;
  gap: 6px;
}

.site-manager-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 38px auto;
  gap: 9px;
  align-items: end;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 12px 18px;
}

.site-manager-toolbar label {
  display: grid;
  gap: 5px;
}

.site-manager-toolbar label span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.site-code-details {
  display: flex;
  min-height: 40px;
  gap: 16px;
  align-items: center;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  padding: 8px 18px;
  white-space: nowrap;
}

.site-code-details b {
  color: var(--ink);
}

.site-code-meta {
  display: flex;
  min-height: 42px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 8px 18px;
}

.site-code-meta span {
  font-size: 11px;
  font-weight: 600;
}

.site-code-meta span.success {
  color: var(--green);
}

.site-code-meta span.warning {
  color: var(--amber);
}

.site-code-meta code {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--blue);
  font-size: 10px;
  padding: 4px 7px;
}

.site-code-body {
  display: grid;
  min-height: 420px;
}

#siteCodePreview {
  width: 100%;
  min-height: 420px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 0;
  background: #151a24;
  color: #e8ecf3;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  padding: 14px;
}

.unassigned-section {
  border-top: 1px solid var(--line);
  padding-top: 5px;
}

.unassigned-list {
  display: grid;
}

.unassigned-row {
  display: grid !important;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 9px !important;
  align-items: start;
  border-bottom: 1px solid var(--line-soft);
  padding: 9px 0;
}

.unassigned-row input {
  width: 18px;
  min-height: 18px;
  margin: 1px 0 0;
}

.unassigned-row > span {
  display: grid;
  gap: 3px;
}

.unassigned-row strong {
  font-size: 11px;
}

.unassigned-row small {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(360px, calc(100vw - 32px));
  border-radius: var(--radius);
  background: var(--deep);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  padding: 11px 14px;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

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

@media (max-width: 1280px) {
  .registry-toolbar {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 1060px) {
  .topbar {
    grid-template-columns: minmax(180px, 1fr) auto auto;
    gap: 12px;
    padding: 0 18px;
  }

  .topbar-actions .save-state,
  .topbar-actions .text-button {
    display: none;
  }

  .workspace {
    padding-right: 18px;
    padding-left: 18px;
  }

  .registry-layout {
    grid-template-columns: 1fr;
  }

  .validation-panel {
    position: static;
  }

}

@media (max-width: 820px) {
  .topbar {
    grid-template-columns: minmax(150px, 1fr) auto;
    min-height: 58px;
  }

  .module-switcher {
    order: 3;
    grid-column: 1 / -1;
    margin-bottom: 8px;
  }

  .topbar-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .workspace-header {
    align-items: flex-start;
  }

  .registry-toolbar {
    grid-template-columns: 1fr;
  }

  .filter-switcher,
  .toolbar-actions {
    grid-column: 1;
  }

  .toolbar-actions {
    flex-wrap: wrap;
  }

  .source-heading {
    grid-template-columns: minmax(0, 1fr) minmax(130px, 170px);
    gap: 8px;
  }

  .source-meta {
    grid-column: 1;
    grid-row: 2;
    justify-content: flex-start;
    padding-left: 32px;
  }

  .source-heading-actions {
    grid-column: 1 / -1;
    grid-row: 3;
    justify-content: flex-end;
    border-top: 1px solid var(--line-soft);
    padding-top: 6px;
  }

  .branch-heading {
    grid-template-columns: minmax(0, 1fr) auto minmax(130px, 170px) auto 30px;
    padding-left: 16px;
  }

  .level-three-heading {
    grid-template-columns: 14px auto minmax(120px, 1fr) minmax(120px, 160px);
    padding-left: 44px;
  }

  .terminal-row {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 3px 8px;
    padding: 8px 8px 8px 0;
  }

  .terminal-marker {
    grid-column: 1;
    padding-left: 62px;
  }

  .terminal-marker::before {
    left: 40px;
  }

  .terminal-row.nested .terminal-marker {
    padding-left: 78px;
  }

  .terminal-row.nested .terminal-marker::before {
    left: 56px;
  }

  .terminal-bindings {
    grid-column: 1;
    margin-left: 62px;
  }

  .path-checks {
    grid-column: 1;
    margin-left: 62px;
  }

  .path-actions {
    grid-column: 2;
    grid-row: 1 / span 3;
    flex-direction: column;
    justify-content: center;
  }

  .expense-toolbar {
    align-items: stretch;
  }

  .expense-table-header {
    display: none;
  }

  .api-expense-row {
    grid-template-columns: minmax(0, 1fr) auto 30px;
  }

  .manual-expense-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 12px;
  }

  .manual-expense-row .expense-channel {
    grid-column: 1;
    grid-row: 1;
  }

  .manual-expense-row .expense-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .manual-expense-row .expense-period {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--line-soft);
    padding-top: 8px;
  }

  .manual-expense-row .expense-date {
    grid-column: 1;
    grid-row: 3;
  }

  .manual-expense-row .expense-frequency {
    grid-column: 2;
    grid-row: 3;
  }

  .manual-expense-row .expense-amount {
    grid-column: 1 / -1;
    grid-row: 4;
    border-top: 1px solid var(--line-soft);
    padding-top: 8px;
  }

  .technical-table-header {
    display: none;
  }

  .technical-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 12px;
  }

  .technical-title {
    grid-column: 1;
    grid-row: 1;
  }

  .technical-status {
    grid-column: 2;
    grid-row: 1;
  }

  .technical-location {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--line-soft);
    padding-top: 8px;
  }

  .technical-location > span {
    display: block;
  }

  .technical-value {
    grid-column: 1;
    grid-row: 3;
  }

  .technical-actions {
    grid-column: 2;
    grid-row: 3;
  }

  .process-row {
    grid-template-columns: 28px 28px minmax(0, 1fr) 76px;
  }

  .process-row .task-status {
    display: none;
  }

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

  .form-grid .wide {
    grid-column: 1;
  }
}

@media (max-width: 560px) {
  .legacy-audit-columns {
    display: none;
  }

  .legacy-audit-row {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 9px 10px;
  }

  .legacy-audit-row select {
    width: calc(100% - 28px);
    margin-left: 28px;
  }

  body {
    font-size: 13px;
  }

  .brand-block h1 {
    max-width: 150px;
  }

  .topbar-actions .secondary-button {
    display: none;
  }

  .workspace {
    padding: 18px 12px 36px;
  }

  .workspace-header {
    display: grid;
    gap: 12px;
  }

  .workspace-header h2 {
    font-size: 21px;
  }

  .city-tabs {
    width: 100%;
    overflow-x: auto;
  }

  .city-tabs button {
    flex: 1 0 auto;
  }

  .filter-switcher {
    overflow-x: auto;
  }

  .filter-switcher button {
    flex: 1 0 auto;
  }

  .toolbar-actions button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    white-space: normal;
  }

  .summary-strip span {
    min-width: 126px;
  }

  .expense-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .expense-mode-switcher {
    width: 100%;
  }

  .expense-mode-switcher button {
    min-width: 0;
    flex: 1;
    padding: 0 8px;
  }

  .expense-toolbar > button {
    width: 100%;
  }

  .technical-toolbar > button {
    flex: 1;
    min-width: 0;
  }

  .api-expense-row {
    grid-template-columns: minmax(0, 1fr) 30px;
    gap: 7px;
  }

  .api-expense-row .expense-status {
    grid-column: 1;
    grid-row: 2;
    margin-left: 14px;
  }

  .api-expense-row .expense-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .source-heading {
    padding: 8px;
  }

  .source-heading > .level-marker-tools {
    grid-column: 1 / -1;
    grid-row: 2;
    width: calc(100% - 32px);
    margin-left: 32px;
  }

  .source-meta,
  .source-heading-actions {
    grid-row: 3;
  }

  .source-heading-actions {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .source-meta .source-state {
    min-width: 30px;
    font-size: 10px;
  }

  .source-heading-actions .text-button {
    flex: 1;
  }

  .branch-heading {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 6px 8px;
    padding: 7px 8px 7px 12px;
  }

  .branch-heading > .level-marker-tools {
    grid-column: 1 / -1;
    grid-row: 3;
    width: calc(100% - 38px);
    margin-left: 38px;
  }

  .branch-toggle {
    grid-column: 1;
    grid-row: 1;
  }

  .branch-state {
    grid-column: 2;
    grid-row: 1;
  }

  .branch-heading > .branch-expense-switch {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
    margin-left: 38px;
  }

  .branch-heading > .connection-action {
    grid-column: 1 / -1;
    grid-row: 4;
    justify-self: end;
  }

  .level-three-heading {
    grid-template-columns: 14px minmax(0, 1fr);
    gap: 4px 8px;
    padding: 8px 10px 8px 36px;
  }

  .level-three-heading .tree-elbow {
    grid-row: 1 / span 4;
  }

  .level-three-heading .hierarchy-label,
  .level-three-heading strong,
  .level-three-heading .level-marker-tools {
    grid-column: 2;
  }

  .level-three-heading .connection-action {
    grid-column: 2;
    justify-self: start;
  }

  .terminal-marker {
    padding-left: 52px;
  }

  .terminal-marker::before {
    left: 30px;
  }

  .terminal-row.nested .terminal-marker {
    padding-left: 62px;
  }

  .terminal-row.nested .terminal-marker::before {
    left: 40px;
  }

  .path-checks {
    grid-template-columns: repeat(2, 56px);
    margin-left: 52px;
  }

  .terminal-bindings {
    margin-left: 52px;
  }

  .messenger-link-heading,
  .messenger-editor-row {
    align-items: stretch;
  }

  .messenger-link-heading {
    flex-direction: column;
  }

  .messenger-link-heading button {
    width: 100%;
  }

  .messenger-editor-row {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .messenger-editor-row > .text-button {
    grid-column: 2;
    justify-self: start;
  }

  .city-sites-control {
    align-items: stretch;
    flex-direction: column;
  }

  .city-sites-control button {
    width: 100%;
  }

  .site-manager-toolbar {
    grid-template-columns: minmax(0, 1fr) 38px;
    padding: 10px 12px;
  }

  .site-manager-toolbar #addSiteButton {
    grid-column: 1 / -1;
    width: 100%;
  }

  .site-code-details {
    gap: 12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .site-code-body,
  #siteCodePreview {
    min-height: 360px;
  }

  .process-row {
    grid-template-columns: 26px 26px minmax(0, 1fr);
  }

  .process-row > .text-button {
    grid-column: 3;
    justify-self: start;
  }

  .editor-dialog,
  .editor-dialog.small-dialog {
    width: calc(100vw - 16px);
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

  .editor-dialog form {
    max-height: calc(100vh - 18px);
  }

  .dialog-heading {
    padding: 10px 13px;
  }

  .dialog-tabs {
    margin: 8px 12px 0;
  }

  .dialog-body {
    padding: 14px 12px;
  }

  .dialog-actions {
    grid-template-columns: 1fr 1fr;
    padding: 10px 12px;
  }

  .dialog-actions > span {
    display: none;
  }

  .city-management-actions {
    grid-column: 1 / -1;
  }

  .dialog-actions .danger-button {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .toast {
    right: 12px;
    bottom: 12px;
  }
}

/* Inline validation results shown by the registry filters. */
.source-block.has-validation-errors > .source-heading {
  background: rgba(225, 56, 78, 0.045) !important;
  box-shadow: inset 3px 0 0 var(--red);
}

.source-block.has-validation-warnings > .source-heading {
  background: rgba(214, 148, 0, 0.055) !important;
  box-shadow: inset 3px 0 0 var(--amber);
}

.source-table-row.hierarchy-row.has-validation-error {
  background: rgba(225, 56, 78, 0.05) !important;
  box-shadow: inset 3px 0 0 var(--red);
}

.source-table-row.hierarchy-row.has-validation-warning {
  background: rgba(214, 148, 0, 0.06) !important;
  box-shadow: inset 3px 0 0 var(--amber);
}

.source-inline-issues,
.city-inline-issues {
  min-width: 1170px;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  transition: box-shadow 180ms ease;
}

.city-inline-issues {
  border-bottom: 8px solid var(--page);
}

.source-inline-issues.attention,
.city-inline-issues.attention,
#sourceList .empty-state.attention {
  box-shadow: inset 0 0 0 2px rgba(20, 111, 238, 0.3);
}

.inline-validation-heading {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line-soft);
  background: var(--surface-soft);
  padding: 8px 16px;
}

.inline-validation-heading > span {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: baseline;
}

.inline-validation-heading small {
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
}

.inline-validation-heading strong {
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

.has-validation-errors .inline-validation-heading strong {
  color: var(--red);
}

.inline-validation-toggle,
.inline-validation-toggle:hover,
.inline-validation-toggle:focus-visible {
  min-height: 30px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 500;
  padding: 0 8px;
  outline: 0;
}

.inline-validation-toggle:hover,
.inline-validation-toggle:focus-visible {
  background: var(--blue-soft);
}

.inline-validation-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-validation-item,
.inline-validation-item:hover,
.inline-validation-item:focus-visible {
  display: grid;
  min-width: 0;
  min-height: 58px;
  grid-template-columns: 8px minmax(0, 1fr) 16px;
  gap: 10px;
  align-items: center;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  color: var(--ink);
  padding: 9px 14px 10px 16px;
  text-align: left;
  white-space: normal;
}

.inline-validation-item:nth-child(even) {
  border-right: 0;
}

.inline-validation-item:last-child:nth-child(odd),
.city-inline-issues .inline-validation-item {
  grid-column: 1 / -1;
  border-right: 0;
}

.inline-validation-item.error:hover,
.inline-validation-item.error:focus-visible {
  background: rgba(225, 56, 78, 0.05);
}

.inline-validation-item.warning:hover,
.inline-validation-item.warning:focus-visible {
  background: rgba(214, 148, 0, 0.06);
}

.inline-validation-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.inline-validation-item.error .inline-validation-dot {
  background: var(--red);
}

.inline-validation-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.inline-validation-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-validation-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.inline-validation-arrow {
  color: var(--muted-light);
  font-size: 18px;
  line-height: 1;
  transition: color 140ms ease, transform 140ms ease;
}

.inline-validation-item:hover .inline-validation-arrow,
.inline-validation-item:focus-visible .inline-validation-arrow {
  color: var(--blue);
  transform: translateX(2px);
}

/* Keep the registry as one compact table at every viewport. */
.registry-layout {
  grid-template-columns: minmax(0, 1fr);
}

.validation-panel {
  display: none;
}

.source-table-row > .branch-expense-switch {
  grid-column: auto;
  grid-row: auto;
  justify-self: end;
  margin-left: 0;
}

/* Registry cells use one shared grid instead of separate floating fields. */
.source-table-row.source-heading > .table-marker-field,
.source-table-row.branch-heading > .table-marker-field,
.source-table-row.level-three-row > .table-marker-field,
.source-table-row.hierarchy-row > .table-marker-field,
.source-table-row.source-heading > .table-final-link,
.source-table-row.branch-heading > .table-final-link,
.source-table-row.level-three-row > .table-final-link,
.source-table-row.hierarchy-row > .table-final-link,
.source-table-row.source-heading > .phone-input,
.source-table-row.branch-heading > .phone-input,
.source-table-row.level-three-row > .phone-input,
.source-table-row.hierarchy-row > .phone-input {
  align-self: stretch;
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 7px 10px;
}

.source-table-row > .table-marker-field:focus-within,
.source-table-row > .table-marker-field .marker-input:focus,
.source-table-row > .table-marker-field .marker-input:focus-visible {
  box-shadow: none;
  outline: 0;
}

.source-table-row > .table-scope-note,
.source-table-row > .table-empty,
.source-table-row > .table-expense-empty {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.source-table-row > .table-final-link:hover {
  border-left-color: var(--line-soft);
  background: var(--surface-soft);
}

.source-table-row > .table-final-link:focus-visible {
  outline: 0;
  background: var(--surface-soft);
}

.table-calltracking {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 2px;
  border: 0;
  border-left: 1px solid var(--line-soft);
  border-radius: 0;
  background: transparent;
  padding: 7px 10px;
  text-align: left;
}

.table-calltracking:hover,
.table-calltracking:focus-visible {
  background: var(--surface-soft);
}

.table-calltracking span {
  color: var(--muted);
  font-size: 8px;
  text-transform: uppercase;
}

.table-calltracking strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-calltracking.missing strong {
  color: var(--muted);
}

.level-actions {
  display: flex;
  min-width: max-content;
  flex: 0 0 auto;
  gap: 10px;
  align-items: center;
  margin-left: auto;
  padding-left: 20px;
}

.text-button.level-action,
.text-button.level-action:hover,
.text-button.level-action:focus,
.text-button.level-action:focus-visible,
.text-button.level-action:active {
  min-height: 28px;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  padding: 3px 2px;
  outline: 0;
  white-space: nowrap;
}

.text-button.level-action-add,
.text-button.level-action-add:focus,
.text-button.level-action-add:active {
  color: var(--green);
}

.text-button.level-action-add:hover,
.text-button.level-action-add:focus-visible {
  color: #0b6b4d;
}

.text-button.level-action-remove,
.text-button.level-action-remove:focus,
.text-button.level-action-remove:active {
  color: var(--red);
}

.text-button.level-action-remove:hover,
.text-button.level-action-remove:focus-visible {
  color: #991f32;
}

.add-symbol,
.terminal-phone .add-symbol,
.terminal-link .add-symbol,
.final-marker .add-symbol {
  color: var(--green);
  font: inherit;
  text-transform: none;
}

#pathForm.branch-edit-mode .level-three-setting,
#pathForm.branch-edit-mode .path-comment-setting {
  display: none;
}

/* Generic hierarchy: source plus levels 2–5 share one compact table. */
.source-table-header,
.source-table-row.source-heading,
.source-table-row.hierarchy-row {
  display: grid;
  min-width: 1170px;
  grid-template-columns: minmax(400px, 1.65fr) 165px 132px 126px minmax(215px, 1fr) 132px;
  gap: 0;
  align-items: center;
}

.source-table-row.hierarchy-row {
  min-height: 56px;
  border-top: 1px solid var(--line-soft);
  background: #fcfcfd;
}

.hierarchy-group.expanded > .source-table-row.hierarchy-row {
  background: #fafbfc;
}

.source-table-row.hierarchy-row > * {
  min-width: 0;
  align-self: stretch;
  border-left: 1px solid var(--line-soft);
  padding: 7px 10px;
}

.source-table-row.hierarchy-row > *:first-child {
  border-left: 0;
  padding-left: calc(48px + (var(--tree-level) - 2) * 28px);
}

.source-table-row.level-4-row,
.source-table-row.level-5-row {
  background: #fdfdfe;
}

.table-toggle-spacer {
  width: 24px;
  min-width: 24px;
  height: 28px;
}

.table-phone-field {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 0;
}

.table-phone-field > span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
}

.table-phone-field .phone-input {
  min-height: 24px;
  border: 0;
  background: transparent;
  font-size: 10px;
  padding: 1px 0;
}

.table-phone-field .phone-input:focus {
  border: 0;
  box-shadow: none;
}

.table-phone-field .phone-input::placeholder {
  color: var(--green);
  opacity: 0.78;
}

.hierarchy-children {
  display: grid;
  overflow: hidden;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 180ms ease, opacity 140ms ease;
}

.hierarchy-children-inner {
  min-height: 0;
  overflow: hidden;
}

.hierarchy-group.expanded > .hierarchy-children {
  grid-template-rows: 1fr;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .hierarchy-children {
    transition: none;
  }
}

/* The main registry controls stay available while working through a long city. */
.registry-toolbar {
  position: sticky;
  z-index: 18;
  top: 64px;
  grid-template-columns: minmax(220px, 340px) auto minmax(360px, 1fr);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 250, 0.98);
  padding: 9px 0;
}

.source-group-add {
  display: flex;
  width: 100%;
  min-height: 42px;
  gap: 7px;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  border-top: 1px dashed var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
  padding: 0 18px;
  text-align: left;
}

.source-group-add span {
  color: var(--green);
  font-size: 15px;
  line-height: 1;
}

.source-group-add:hover,
.source-group-add:focus-visible {
  border-top-color: var(--line);
  background: var(--surface-soft);
  box-shadow: none;
  color: var(--ink);
}

@media (max-width: 1280px) {
  .registry-toolbar {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .registry-toolbar .toolbar-actions {
    grid-column: 1 / -1;
  }

}

@media (max-width: 820px) {
  .registry-toolbar {
    position: static;
  }

  .registry-toolbar {
    grid-template-columns: 1fr;
  }

}

/* AdPilot design-system visual layer. Structure and interaction logic stay unchanged. */
body {
  font-size: 14.5px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums lining-nums;
  font-feature-settings: "tnum" 1, "lnum" 1;
  -webkit-font-smoothing: antialiased;
}

button {
  border-radius: var(--radius);
  font-size: 14px;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  outline: 0;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

select {
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6.25L8 10.25L12 6.25' stroke='%236B778C' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 112, 255, 0.18);
  outline: 0;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
}

.secondary-button:hover {
  border-color: var(--line);
  background: var(--surface-strong);
}

.secondary-button.soft-button,
.secondary-button.soft-button:hover,
.secondary-button.soft-button:active {
  border-color: transparent;
  box-shadow: none;
  color: var(--blue);
}

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

.secondary-button.soft-button:hover {
  background: #e2efff;
}

.secondary-button.soft-button:active {
  background: #d6e8ff;
}

.text-button {
  color: var(--blue);
  font-weight: 500;
}

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

.text-button:active {
  border-color: transparent;
  background: var(--blue-soft);
  color: var(--blue);
}

.icon-button {
  border: 0;
  border-radius: var(--radius);
}

.icon-button:hover {
  border: 0;
  background: var(--surface-strong);
}

.icon-button:active {
  border-color: transparent;
  background: var(--surface-strong);
  color: var(--ink);
}

.eyebrow {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

.topbar {
  min-height: 68px;
  gap: 18px;
  border-bottom-color: var(--line-soft);
  background: rgba(255, 255, 255, 0.98);
  padding: 0 18px;
}

.brand-block {
  gap: 11px;
}

.brand-block h1 {
  font-size: 16px;
  font-weight: 600;
}

.brand-block .eyebrow {
  color: var(--muted);
  font-size: 11.5px;
}

.module-switcher,
.filter-switcher,
.city-tabs,
.dialog-tabs {
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 5px;
}

.module-switcher button,
.filter-switcher button,
.city-tabs button,
.dialog-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-strong);
  color: #000000;
  font-size: 13px;
  font-weight: 500;
  padding: 0 18px;
}

.module-switcher button.active,
.filter-switcher button.active,
.city-tabs button.active,
.dialog-tabs button.active {
  background: #000000;
  box-shadow: none;
  color: #ffffff;
  font-weight: 500;
}

.module-switcher button:hover,
.filter-switcher button:hover,
.city-tabs button:hover,
.dialog-tabs button:hover {
  background: var(--surface-hover);
  color: #000000;
}

.module-switcher button.active:hover,
.filter-switcher button.active:hover,
.city-tabs button.active:hover,
.dialog-tabs button.active:hover {
  background: #000000;
  color: #ffffff;
}

.save-state {
  color: var(--muted);
  font-size: 12px;
}

.workspace,
.process-workspace,
.expense-workspace,
.technical-workspace {
  width: 100%;
  max-width: none;
  padding: 22px 10px 50px;
}

.workspace-header {
  min-height: 58px;
  margin-bottom: 16px;
}

.workspace-header h2 {
  font-size: 28px;
  font-weight: 600;
  line-height: 1.25;
}

.registry-toolbar {
  top: 68px;
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 36px rgba(23, 32, 51, 0);
  backdrop-filter: blur(0);
  margin-bottom: 12px;
  padding: 10px 12px;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    backdrop-filter 180ms ease;
}

.registry-toolbar.is-stuck {
  border-color: rgba(199, 209, 220, 0.92);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 36px rgba(23, 32, 51, 0.13);
  backdrop-filter: blur(16px);
}

.search-field input {
  min-height: 40px;
}

.summary-strip {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 16px;
}

.summary-strip span {
  min-width: 142px;
  border-left-color: var(--line-soft);
  color: var(--muted);
  font-size: 12px;
  padding: 0 16px;
}

.summary-strip b {
  margin-right: 6px;
  font-size: 14.5px;
  font-weight: 600;
}

.source-register,
.validation-panel,
.expense-panel,
.technical-register,
.process-list {
  overflow: hidden;
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.source-register {
  overflow-x: auto;
  overflow-y: hidden;
}

.source-group + .source-group {
  border-top: 1px solid var(--line-soft);
}

.source-subgroup + .source-subgroup {
  border-top: 8px solid var(--page);
}

.source-subgroup-heading {
  display: flex;
  min-height: 44px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface);
  padding: 8px 16px;
  box-shadow: inset 3px 0 0 var(--muted-light);
}

.source-subgroup-heading h4 {
  margin: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.source-subgroup-heading small {
  color: var(--muted);
  font-size: 11px;
}

.source-subgroup-heading-actions {
  display: flex;
  margin-left: auto;
  gap: 12px;
  align-items: center;
}

.source-section-edit-button {
  display: inline-flex;
  min-height: 30px;
  gap: 5px;
  align-items: center;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding: 0 8px;
}

.source-section-edit-button span {
  font-size: 13px;
}

.source-section-edit-button:hover,
.source-section-edit-button:focus-visible {
  background: var(--surface-soft);
  box-shadow: none;
  color: var(--blue);
}

.source-section-add {
  display: flex;
  width: 100%;
  min-height: 52px;
  gap: 8px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-top: 8px solid var(--page);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
}

.source-section-add span {
  color: var(--green-accent);
  font-size: 18px;
}

.source-section-add:hover,
.source-section-add:focus-visible {
  background: var(--surface-soft);
  box-shadow: none;
}

.source-subgroup-contextual .source-subgroup-heading {
  box-shadow: inset 3px 0 0 #8b5cf6;
}

.source-subgroup-geoservices .source-subgroup-heading {
  box-shadow: inset 3px 0 0 var(--blue);
}

.source-subgroup-aggregators .source-subgroup-heading {
  box-shadow: inset 3px 0 0 var(--green);
}

.source-subgroup-review-sites .source-subgroup-heading {
  box-shadow: inset 3px 0 0 var(--amber);
}

.source-subgroup-other .source-subgroup-heading {
  box-shadow: inset 3px 0 0 var(--muted-light);
}

.source-group-heading,
.expense-section-heading,
.technical-section-heading {
  min-height: 48px;
  border-bottom-color: var(--line-soft);
  background: var(--surface-soft);
  padding-right: 16px;
  padding-left: 16px;
}

.source-group-heading h3,
.expense-section-heading h3,
.technical-section-heading h3 {
  font-size: 15px;
  font-weight: 600;
}

.source-group-heading small {
  font-size: 12px;
}

.source-table-header {
  min-height: 40px;
  border-bottom-color: var(--line-soft);
  background: var(--surface);
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

.source-table-row.source-heading {
  min-height: 70px;
}

.source-table-row.hierarchy-row {
  min-height: 62px;
}

.source-table-row.source-heading,
.source-table-row.hierarchy-row,
.source-table-row.branch-heading,
.source-table-row.level-three-row {
  background: var(--surface);
}

.source-block.expanded .source-table-row.source-heading,
.hierarchy-group.expanded > .source-table-row.hierarchy-row,
.branch-group.expanded .source-table-row.branch-heading {
  background: var(--surface-strong);
}

.source-table-row.source-heading > *,
.source-table-row.hierarchy-row > *,
.source-table-row.branch-heading > *,
.source-table-row.level-three-row > * {
  border-left-color: var(--line-soft);
  padding-top: 9px;
  padding-bottom: 9px;
}

.source-table-identity {
  gap: 10px;
}

.source-identity {
  gap: 12px;
}

.source-name-control {
  display: grid;
  min-width: 0;
  height: 50px;
  flex: 1;
  grid-template-rows: 15px 32px;
  gap: 2px;
  align-content: center;
}

.source-name-control > span:first-child {
  color: var(--muted-light);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
}

.source-name-line {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
}

.inline-name-field {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 2px;
  align-content: center;
}

.inline-name-label {
  color: var(--muted-light);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
}

.inline-name-row {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  white-space: nowrap;
}

.source-name-actions {
  display: inline-flex;
  min-width: 46px;
  flex: 0 0 auto;
  gap: 2px;
  align-items: center;
}

.inline-name-value {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-name-line .inline-name-input,
.inline-name-row .inline-name-input {
  width: auto;
  min-width: 0;
  max-width: calc(100% - 28px);
  min-height: 30px;
  flex: 0 1 auto;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  field-sizing: content;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  padding: 3px 0;
  text-overflow: ellipsis;
}

.source-name-line .inline-name-input:hover,
.inline-name-row .inline-name-input:hover {
  border-color: transparent;
  background: transparent;
}

.source-name-line .inline-name-input:focus,
.inline-name-row .inline-name-input:focus,
.source-name-line .inline-name-input:focus-visible,
.inline-name-row .inline-name-input:focus-visible {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  outline: 0;
  padding-right: 0;
  padding-left: 0;
}

.source-name-edit-button {
  display: inline-grid;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  opacity: 0.52;
  padding: 0;
  transition:
    color 160ms ease,
    opacity 160ms ease;
}

.level-settings-button {
  display: inline-grid;
  width: 22px;
  min-width: 22px;
  height: 22px;
  min-height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--muted);
  opacity: 0.46;
  padding: 0;
  transition:
    color 160ms ease,
    opacity 160ms ease;
}

.level-settings-button::before {
  width: 14px;
  height: 14px;
  background: currentColor;
  content: "";
  -webkit-mask: url("./icons/edit-settings.svg") center / contain no-repeat;
  mask: url("./icons/edit-settings.svg") center / contain no-repeat;
}

.source-name-edit-button::before {
  width: 13px;
  height: 13px;
  background: currentColor;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M9.999 1.293a1.001 1.001 0 0 0-1.416 0l-.708.708 2.124 2.124.708-.708a1.001 1.001 0 0 0 0-1.416l-.708-.708Zm-.981 3.813L6.894 2.982 2.556 7.32c-.44.44-.77.975-.967 1.565l-.573 1.72a.3.3 0 0 0 .38.38l1.719-.574a4.005 4.005 0 0 0 1.565-.967l4.338-4.338Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M9.999 1.293a1.001 1.001 0 0 0-1.416 0l-.708.708 2.124 2.124.708-.708a1.001 1.001 0 0 0 0-1.416l-.708-.708Zm-.981 3.813L6.894 2.982 2.556 7.32c-.44.44-.77.975-.967 1.565l-.573 1.72a.3.3 0 0 0 .38.38l1.719-.574a4.005 4.005 0 0 0 1.565-.967l4.338-4.338Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.source-table-row.source-heading:hover .source-name-edit-button,
.source-table-row.hierarchy-row:hover .source-name-edit-button,
.source-name-edit-button:focus-visible {
  opacity: 0.72;
}

.source-table-row.source-heading:hover .level-settings-button,
.source-table-row.hierarchy-row:hover .level-settings-button,
.level-settings-button:focus-visible {
  opacity: 0.78;
}

.source-name-edit-button:hover,
.source-name-edit-button:focus-visible {
  border: 0;
  background: transparent;
  color: var(--blue);
  opacity: 1;
  outline: 0 !important;
}

.level-settings-button:hover,
.level-settings-button:focus-visible {
  border: 0;
  background: transparent;
  color: var(--blue);
  opacity: 1;
  outline: 0 !important;
}

.table-inline-edit-field {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 3px;
}

.table-inline-value-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.table-marker-actions {
  display: inline-flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 2px 12px;
  align-items: center;
}

.table-inline-auto {
  color: var(--blue);
}

.table-inline-auto:hover,
.table-inline-auto:focus-visible {
  color: #055fd5;
}

.table-inline-value {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 22px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-marker-field .table-inline-value {
  font-size: 13px;
}

.table-inline-value.missing {
  color: var(--green);
}

.table-inline-add,
.table-inline-add:hover,
.table-inline-add:focus,
.table-inline-add:focus-visible,
.table-inline-add:active {
  min-height: 22px;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--green);
  font-size: 12.5px;
  font-weight: 400;
  line-height: 22px;
  padding: 0;
  outline: 0;
  transform-origin: left center;
}

.table-inline-add {
  cursor: pointer;
  transition:
    color 160ms ease,
    transform 160ms ease;
}

.table-inline-add:hover,
.table-inline-add:focus-visible {
  color: #078f4a;
  transform: scale(1.045);
}

.table-inline-add:active {
  color: #06763f;
  transform: scale(0.98);
}

.table-field-edit-button {
  opacity: 0;
}

.source-table-row.source-heading:hover .table-field-edit-button,
.source-table-row.hierarchy-row:hover .table-field-edit-button {
  opacity: 0;
}

.source-table-row.source-heading .table-inline-edit-field:hover .table-field-edit-button,
.source-table-row.hierarchy-row .table-inline-edit-field:hover .table-field-edit-button,
.table-field-edit-button:focus-visible {
  opacity: 0.72;
}

.table-field-edit-button:hover,
.table-field-edit-button:focus-visible {
  opacity: 1;
}

.editor-dialog.rename-dialog {
  width: min(520px, calc(100vw - 32px));
  background: #ffffff;
}

.rename-dialog form,
.rename-dialog .dialog-heading,
.rename-dialog .dialog-body,
.rename-dialog .dialog-actions {
  background: #ffffff;
}

.rename-dialog .dialog-heading {
  min-height: 68px;
}

.rename-dialog-body {
  overflow: visible;
  padding: 22px 20px;
}

.rename-dialog-body label {
  display: block;
}

.rename-dialog-body input {
  min-height: 44px;
}

.rename-dialog-actions {
  grid-template-columns: 1fr auto auto;
}

.source-identity label {
  height: 50px;
  grid-template-rows: 15px 32px;
}

.source-table-identity label > span:first-child,
.table-marker-field > span,
.table-final-link > span,
.table-calltracking span,
.table-phone-field > span,
.hierarchy-label {
  color: var(--muted-light);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
  text-transform: none;
}

.source-table-input,
.source-table-identity .source-table-input,
.source-identity .source-table-input {
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
}

.source-table-input.marker-input {
  font-size: 13px;
}

.source-table-input:hover {
  border-color: var(--line);
  background: var(--surface);
}

.source-table-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(36, 83, 212, 0.12);
}

.source-table-row > .table-marker-field,
.source-table-row > .table-final-link,
.source-table-row > .phone-input,
.table-calltracking {
  border-left-color: var(--line-soft);
  padding: 9px 12px;
}

.table-final-link code,
.table-calltracking strong,
.table-phone-field .phone-input {
  color: var(--ink);
  font-size: 12.5px;
}

.table-scope-note,
.table-empty,
.table-expense-empty,
.table-inline-empty {
  color: var(--muted-light);
  font-size: 12px;
}

.table-toggle {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  border-radius: var(--radius-xs);
  color: #000000;
  font-size: 17px;
}

.table-toggle:hover {
  background: var(--surface-strong);
  color: #000000;
}

.table-toggle-spacer {
  width: 30px;
  min-width: 30px;
}

.source-logo {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
}

.source-logo img {
  width: 42px;
  height: 42px;
}

.level-actions {
  flex-direction: column;
  gap: 0;
  align-items: flex-start;
  padding-left: 10px;
}

.text-button.level-action,
.text-button.level-action:hover,
.text-button.level-action:focus,
.text-button.level-action:focus-visible,
.text-button.level-action:active {
  min-height: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  padding: 1px 2px;
}

.text-button.level-action-add,
.text-button.level-action-add:focus,
.text-button.level-action-add:active {
  color: var(--green);
}

.text-button.level-action-remove,
.text-button.level-action-remove:focus,
.text-button.level-action-remove:active {
  color: var(--red);
}

.source-expense-switch {
  gap: 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.source-expense-switch button {
  min-height: 30px;
  border-radius: var(--radius-xs);
  font-size: 11.5px;
}

.source-expense-switch button:hover {
  background: var(--surface-strong);
}

.source-expense-switch button.active {
  background: var(--blue);
  box-shadow: none;
}

.source-group-add {
  min-height: 48px;
  border-top-color: var(--line-soft);
  color: var(--muted);
  font-size: 13px;
  padding: 0 18px;
}

.source-group-add span {
  color: var(--green-accent);
  font-size: 18px;
}

.expense-toolbar,
.technical-toolbar {
  min-height: 54px;
}

.expense-table-header,
.technical-table-header {
  min-height: 40px;
  background: var(--surface);
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

.expense-row,
.technical-row,
.process-row {
  border-bottom-color: var(--line-soft);
}

.expense-row,
.technical-row {
  min-height: 68px;
  font-size: 14px;
}

.expense-channel strong,
.technical-title strong,
.task-copy strong {
  font-size: 14px;
  font-weight: 600;
}

.expense-channel-mark,
.technical-mark {
  background: var(--green-accent);
}

.expense-status,
.expense-frequency,
.technical-status,
.task-status {
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
}

.expense-date span,
.expense-amount small,
.technical-title small,
.task-copy small {
  color: var(--muted);
  font-size: 12px;
}

.expense-date strong,
.expense-amount strong,
.expense-period strong,
.technical-location strong,
.technical-empty,
.technical-code-state {
  font-size: 13px;
}

.technical-value-copy {
  min-height: 40px;
  border-color: var(--line);
  border-radius: var(--radius);
}

.technical-value-copy code {
  font-size: 12px;
}

.process-row {
  min-height: 66px;
}

.task-check span {
  border-color: var(--line);
  border-radius: var(--radius-xs);
}

.task-check input:checked + span {
  border-color: var(--green-accent);
  background: var(--green-accent);
}

.editor-dialog {
  border-color: var(--line-soft);
  border-radius: var(--radius-lg);
}

.dialog-heading {
  min-height: 72px;
  border-bottom-color: var(--line-soft);
  padding: 14px 20px;
}

.dialog-heading h2 {
  font-size: 20px;
  font-weight: 600;
}

.dialog-tabs {
  margin: 12px 20px 0;
}

.dialog-body {
  padding: 20px;
}

.form-grid {
  gap: 16px;
}

.login-form label > span,
.form-grid label > span {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
}

.form-grid label small {
  font-size: 12px;
}

.source-icon-editor {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.source-icon-preview {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.source-icon-preview img {
  display: block;
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.source-icon-editor-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.source-icon-editor-copy > strong {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}

.source-icon-editor-copy > small,
.source-icon-format {
  color: var(--muted);
  font-size: 11px;
}

.source-icon-actions {
  display: flex;
  min-height: 34px;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.source-icon-actions .compact-button {
  min-height: 32px;
}

.source-icon-format {
  margin-left: auto;
  white-space: nowrap;
}

.upload-symbol {
  font-size: 16px;
  line-height: 1;
}

#sourceIconError {
  min-height: 15px;
  font-size: 11px;
}

.dialog-actions {
  border-top-color: var(--line-soft);
  padding: 12px 20px;
}

.login-window {
  border-color: var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 28px;
}

.login-brand h1 {
  font-size: 24px;
  font-weight: 600;
}

.toast {
  border-radius: var(--radius);
  box-shadow: var(--shadow-dialog);
}

/* Buttons stay flat across every state; keyboard focus uses an outline. */
button,
button:hover,
button:active,
button:focus,
button:focus-visible {
  box-shadow: none !important;
}

/* ASO-style tactile feedback: a short, centered press without layout shift. */
button {
  transform-origin: center;
  transition:
    transform 120ms ease,
    background-color 160ms ease,
    border-color 160ms ease,
    color 160ms ease !important;
}

button:active:not(:disabled) {
  transform: scale(0.972) !important;
}

@media (prefers-reduced-motion: reduce) {
  button {
    transition:
      background-color 0ms,
      border-color 0ms,
      color 0ms !important;
  }

  button:active:not(:disabled) {
    transform: none !important;
  }
}

button:focus-visible {
  outline: 2px solid rgba(0, 112, 255, 0.72);
  outline-offset: 2px;
}

/* Form focus is a single blue border without an outer glow. */
input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible {
  border-color: var(--blue) !important;
  box-shadow: none !important;
  outline: 0 !important;
}

/* Shared city branches and per-channel placement controls. */
.source-name-line > strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-name-control.has-branches {
  height: 64px;
  grid-template-rows: 14px 26px 20px;
  gap: 1px;
}

.source-table-row.source-heading:has(.source-name-control.has-branches) {
  min-height: 82px;
}

.source-branches-button {
  min-height: 20px;
  justify-self: start;
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--radius-xs);
  background: #eaf4ff;
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 16px;
  padding: 2px 7px;
  white-space: nowrap;
  transition: background-color 150ms ease, color 150ms ease;
}

.source-branches-button:hover,
.source-branches-button:focus-visible {
  border: 0;
  background: #000000;
  color: #ffffff;
}

.source-branches-button.no-branches {
  border: 1px dashed #b8c3d1;
  background: #f4f6f8;
  color: #637184;
  padding: 1px 7px;
}

.source-branches-button.no-branches:hover,
.source-branches-button.no-branches:focus-visible {
  border: 1px solid #000000;
  background: #000000;
  color: #ffffff;
}

.inline-name-label {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: center;
}

.branch-status-cell {
  display: flex;
  min-width: 0;
  align-items: center;
}

.branch-status-select {
  width: 100%;
  min-width: 0;
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  padding: 0 24px 0 8px;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.branch-status-select.status-success {
  background: #e8f8ef;
  color: #078447;
}

.branch-status-select.status-neutral {
  background: #eef1f5;
  color: #657181;
}

.branch-status-select.status-warning {
  background: #fff3d8;
  color: #946200;
}

.branch-status-select.status-danger {
  background: #fff0f0;
  color: #c92b3a;
}

.branch-status-select:hover {
  border-color: currentColor;
}

.branch-status-select:disabled {
  cursor: default;
  opacity: 1;
}

.branch-status-empty {
  display: flex;
  min-width: 0;
  align-items: center;
  color: var(--muted-light);
  font-size: 12px;
}

.editor-dialog.branch-link-dialog {
  width: min(820px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  background: #ffffff;
}

.branch-link-dialog form,
.branch-link-dialog .dialog-heading,
.branch-link-dialog .dialog-body,
.branch-link-dialog .dialog-actions {
  background: #ffffff;
}

.branch-link-dialog-body {
  display: grid;
  gap: 0;
  padding: 0 20px;
}

.branch-link-toolbar {
  display: flex;
  min-height: 54px;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.branch-link-toolbar > strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
}

.branch-link-toolbar-actions {
  display: flex;
  gap: 8px;
}

.branch-link-toolbar .compact-button {
  min-height: 32px;
  border-radius: var(--radius-xs);
  font-size: 12px;
  padding: 5px 10px;
}

.branch-usage-chooser {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 0 14px;
}

.branch-usage-chooser[hidden],
.branch-usage-empty[hidden] {
  display: none;
}

.branch-usage-chooser button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.branch-usage-chooser button:hover,
.branch-usage-chooser button:focus-visible {
  border-color: var(--blue);
  color: var(--blue);
}

.branch-usage-chooser button.active {
  border-color: var(--blue);
  background: #ffffff;
  color: var(--blue);
}

.branch-usage-chooser button[data-branch-usage="shared"] .add-symbol,
.branch-link-add button .add-symbol {
  color: var(--blue);
}

.branch-usage-chooser button[data-branch-usage="none"].active {
  border-color: #cdd5df;
  background: #eef1f5;
  color: #455264;
}

.branch-usage-empty {
  display: grid;
  min-height: 164px;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}

.branch-usage-empty strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.branch-usage-empty span {
  max-width: 520px;
  font-size: 12px;
  line-height: 1.5;
}

.branch-link-list {
  max-height: min(430px, 52vh);
  overflow: auto;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.branch-link-row {
  display: grid;
  min-height: 64px;
  grid-template-columns: 30px minmax(0, 1fr) 150px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 6px;
  transition: background-color 150ms ease;
}

.branch-link-row.city-branch-row {
  grid-template-columns: minmax(0, 1fr);
}

.branch-link-row:last-child {
  border-bottom: 0;
}

.branch-link-row.selected {
  background: #f5f9ff;
}

.branch-link-check {
  display: grid;
  width: 24px;
  height: 32px;
  place-items: center;
  cursor: pointer;
}

.branch-link-check input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.branch-link-check span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.branch-link-check input:checked + span {
  border-color: var(--blue);
  background: var(--blue);
}

.branch-link-check input:checked + span::after {
  width: 8px;
  height: 4px;
  border-bottom: 2px solid #ffffff;
  border-left: 2px solid #ffffff;
  content: "";
  transform: translateY(-1px) rotate(-45deg);
}

.branch-link-check input:focus-visible + span {
  outline: 2px solid rgba(0, 112, 255, 0.45);
  outline-offset: 2px;
}

.branch-link-fields {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.branch-link-fields input {
  width: 100%;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  padding: 3px 7px;
}

.branch-link-fields input[data-branch-phone] {
  color: var(--muted);
  font-size: 11.5px;
}

.branch-link-fields input[data-branch-code] {
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 11.5px;
}

.branch-link-fields input:hover {
  border-color: var(--line-soft);
}

.branch-link-row select {
  min-height: 36px;
  border-color: var(--line);
  border-radius: var(--radius-xs);
  background: #ffffff;
  font-size: 12px;
  padding: 6px 28px 6px 9px;
}

.branch-link-row select:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--muted-light);
  opacity: 1;
}

.branch-link-empty {
  display: grid;
  min-height: 132px;
  place-content: center;
  gap: 4px;
  color: var(--muted);
  text-align: center;
}

.branch-link-empty strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
}

.branch-link-empty span {
  font-size: 12px;
}

.branch-link-add {
  display: grid;
  grid-template-columns: minmax(190px, 1.4fr) minmax(150px, 0.75fr) minmax(170px, 0.8fr) auto;
  gap: 10px;
  align-items: end;
  padding: 16px 0 18px;
}

.branch-link-add label {
  display: grid;
  gap: 6px;
}

.branch-link-add label > span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.branch-link-add input {
  min-height: 40px;
  border-radius: var(--radius);
}

.branch-link-add button {
  min-height: 40px;
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--blue);
  white-space: nowrap;
}

.branch-link-add button:hover,
.branch-link-add button:focus-visible {
  border-color: var(--blue);
  background: #f4f8ff;
  color: var(--blue);
}

.branch-link-dialog-actions {
  grid-template-columns: 1fr auto auto;
}

@media (max-width: 820px) {
  .workspace,
  .process-workspace,
  .expense-workspace,
  .technical-workspace {
    padding-right: 8px;
    padding-left: 8px;
  }

  .workspace-header h2 {
    font-size: 24px;
  }

  .registry-toolbar {
    top: auto;
  }

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

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .workspace,
  .process-workspace,
  .expense-workspace,
  .technical-workspace {
    padding-top: 16px;
  }

  .editor-dialog,
  .editor-dialog.small-dialog {
    border-radius: var(--radius-lg);
  }

  .branch-link-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
    padding: 12px 0;
  }

  .branch-usage-chooser {
    grid-template-columns: 1fr;
  }

  .branch-link-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .branch-link-row select {
    grid-column: 2;
  }

  .branch-link-add {
    grid-template-columns: 1fr;
  }
}

/* Personal profile. Contact details are stored outside the tracked project database. */
.profile-trigger {
  display: inline-flex;
  min-width: 168px;
  min-height: 48px !important;
  flex: 0 0 auto;
  gap: 12px;
  align-items: center;
  justify-content: flex-start;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  margin-inline: 4px;
  padding: 6px 18px 6px 7px;
  text-align: left;
}

.profile-trigger:hover,
.profile-trigger:focus-visible,
.profile-trigger.active {
  border: 0;
  background: var(--surface-strong);
  color: var(--ink);
}

.profile-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: 50%;
  background: #000000;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  overflow: hidden;
}

.profile-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.profile-trigger-copy {
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 3px;
  line-height: 1.1;
}

.profile-trigger-copy strong,
.profile-trigger-copy small {
  max-width: 132px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-trigger-copy strong {
  font-size: 12.5px;
  font-weight: 600;
}

.profile-trigger-copy small {
  color: var(--muted);
  font-size: 10.5px;
}

.profile-workspace {
  max-width: 1220px;
  margin: 0 auto;
}

.profile-workspace-header {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 16px;
}

.profile-edit-status,
.profile-role-badge {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 11px;
}

.profile-edit-status.denied,
.profile-role-badge.denied {
  background: #fff0f0;
  color: var(--red);
}

.profile-layout {
  display: grid;
  grid-template-columns: minmax(270px, 0.72fr) minmax(0, 1.8fr);
  gap: 16px;
  align-items: start;
}

.profile-sidebar {
  display: grid;
  gap: 16px;
}

.profile-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.profile-summary-card {
  display: grid;
  justify-items: center;
  padding: 28px 20px 0;
  text-align: center;
}

.profile-avatar-large {
  width: 72px;
  height: 72px;
  flex-basis: 72px;
  font-size: 22px;
}

.profile-avatar-editor {
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
}

.profile-avatar-button {
  position: relative;
  display: grid;
  width: 78px;
  height: 78px;
  min-height: 78px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  padding: 3px;
}

.profile-avatar-button:hover,
.profile-avatar-button:focus-visible {
  border: 0;
  background: var(--surface-strong);
}

.profile-avatar-edit-mark {
  position: absolute;
  right: 0;
  bottom: 0;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.profile-avatar-actions {
  display: flex;
  min-height: 30px;
  gap: 6px;
  align-items: center;
  justify-content: center;
  margin: -14px 0 18px;
}

.profile-avatar-actions button {
  min-height: 30px;
  border-radius: 999px;
  font-size: 11.5px;
  padding: 4px 9px;
}

.profile-avatar-remove {
  color: var(--red);
}

.profile-summary-card h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.profile-summary-card > p {
  min-height: 18px;
  margin: 5px 0 22px;
  color: var(--muted);
  font-size: 13px;
}

.profile-summary-meta {
  display: grid;
  width: calc(100% + 40px);
  border-top: 1px solid var(--line-soft);
  text-align: left;
}

.profile-summary-meta > span {
  display: flex;
  min-height: 45px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: 11.5px;
  padding: 9px 20px;
}

.profile-summary-meta > span:last-child {
  border-bottom: 0;
}

.profile-summary-meta strong {
  max-width: 170px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-card-heading {
  display: flex;
  min-height: 68px;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 18px;
}

.profile-card-heading h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.profile-card-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.profile-card-body {
  padding: 18px;
}

.profile-editor-card {
  min-width: 0;
}

.profile-form-grid {
  gap: 18px 16px;
}

.profile-form-grid label {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.profile-form-grid label > span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.profile-form-grid textarea {
  min-height: 126px;
  resize: vertical;
}

.profile-card-actions {
  display: flex;
  min-height: 68px;
  gap: 9px;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--line-soft);
  background: #fafbfc;
  padding: 12px 18px;
}

.profile-form-state {
  min-width: 0;
  flex: 1;
  color: var(--muted);
  font-size: 12px;
}

.profile-form-state[data-mode="ok"] {
  color: var(--green);
}

.profile-form-state[data-mode="bad"] {
  color: var(--red);
}

.profile-updated-at {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.profile-access-list {
  display: grid;
  padding-top: 7px;
  padding-bottom: 7px;
}

.profile-access-row {
  display: flex;
  min-height: 42px;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 0;
}

.profile-access-row:last-child {
  border-bottom: 0;
}

.profile-access-row span {
  color: var(--muted);
  font-size: 12px;
}

.profile-access-row strong {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.profile-access-row strong::before {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  content: "✓";
  font-size: 11px;
  font-weight: 700;
}

.profile-access-row strong.denied::before {
  background: #fff0f0;
  color: var(--red);
  content: "—";
}

.profile-security-card .profile-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 1060px) {
  .profile-trigger {
    min-width: 144px;
    gap: 10px;
    margin-inline: 2px;
    padding-right: 12px;
  }

  .profile-trigger-copy strong,
  .profile-trigger-copy small {
    max-width: 92px;
  }
}

@media (max-width: 820px) {
  .profile-trigger {
    min-width: 132px;
    min-height: 44px !important;
    gap: 9px;
    margin-inline: 0;
    padding: 5px 10px 5px 5px;
  }

  .profile-layout {
    grid-template-columns: 1fr;
  }

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

  .profile-summary-card {
    grid-row: span 2;
  }
}

@media (max-width: 560px) {
  .module-switcher {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .module-switcher::-webkit-scrollbar {
    display: none;
  }

  .module-switcher button {
    flex: 0 0 auto;
    padding-right: 14px;
    padding-left: 14px;
  }

  .profile-trigger {
    width: 44px;
    min-width: 44px;
    min-height: 44px !important;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 5px;
  }

  .profile-trigger-copy {
    display: none;
  }

  .profile-workspace-header {
    align-items: start;
  }

  .profile-edit-status {
    justify-self: start;
  }

  .profile-sidebar {
    grid-template-columns: 1fr;
  }

  .profile-summary-card {
    grid-row: auto;
  }

  .profile-card-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .profile-card-actions button,
  .profile-form-state {
    width: 100%;
  }

  .profile-form-state {
    text-align: center;
  }
}

/* Accounts and role-based access. */
.profile-security-card .profile-card-body {
  display: grid;
  gap: 14px;
}

.profile-security-card .profile-card-body button {
  justify-self: start;
}

.user-management-card {
  overflow: hidden;
  margin-top: 18px;
}

.user-management-heading {
  min-height: 72px;
}

.user-management-heading > button {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.user-management-heading > button span {
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.user-list {
  display: grid;
}

.user-row {
  display: grid;
  min-width: 0;
  min-height: 76px;
  grid-template-columns: 42px minmax(170px, 0.8fr) 104px minmax(260px, 1.5fr) 34px;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 18px;
}

.user-row:last-child {
  border-bottom: 0;
}

.user-row.blocked {
  background: #fafbfc;
}

.user-row-avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.user-row.blocked .user-row-avatar {
  color: var(--muted);
}

.user-row-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.user-row-identity strong,
.user-row-identity span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row-identity strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.user-row-identity span {
  color: var(--muted);
  font-size: 12px;
}

.user-status {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  white-space: nowrap;
}

.user-status.active {
  background: var(--green-soft);
  color: var(--green);
}

.user-status.blocked {
  background: var(--surface-strong);
  color: var(--muted);
}

.user-access-list {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.user-access-chip {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 8px;
  white-space: nowrap;
}

.user-access-chip.edit {
  background: var(--blue-soft);
  color: var(--blue);
}

.user-access-chip.view {
  background: var(--surface-strong);
  color: var(--muted);
}

.user-access-chip.none {
  background: #fafbfc;
  color: var(--muted-light);
}

.user-edit-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: var(--radius-xs);
  color: var(--muted);
  font-size: 17px;
}

.user-list-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 28px 18px;
  text-align: center;
}

.editor-dialog.user-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
}

.user-dialog form {
  display: grid;
  max-height: min(818px, calc(100vh - 34px));
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.user-dialog-body {
  overflow-y: auto;
}

.user-permission-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  margin-top: 20px;
  padding-top: 18px;
}

.user-permission-heading > div {
  display: grid;
  gap: 3px;
}

.user-permission-heading strong {
  font-size: 13px;
  font-weight: 600;
}

.user-active-toggle,
.user-extra-permissions label {
  display: inline-flex;
  min-width: 0;
  gap: 9px;
  align-items: center;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
}

.user-active-toggle input,
.user-extra-permissions input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  appearance: none;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--surface);
  margin: 0;
  padding: 0;
}

.user-active-toggle input:checked,
.user-extra-permissions input:checked {
  border-color: var(--blue);
  background-color: var(--blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.3 6.1 4.8 8.5 9.8 3.5' fill='none' stroke='white' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: center;
  background-repeat: no-repeat;
}

.user-active-toggle input:disabled,
.user-extra-permissions input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.user-permission-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.user-permission-grid label {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.user-permission-grid label > span {
  color: var(--muted);
  font-size: 11.5px;
}

.user-permission-grid select {
  min-height: 40px;
  padding-right: 32px;
  background-position: right 10px center;
  font-size: 12px;
}

.user-permission-grid select:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.user-extra-permissions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 18px;
  border-top: 1px solid var(--line-soft);
  margin-top: 18px;
  padding-top: 16px;
}

.user-form-error {
  margin-top: 12px;
}

.change-password-dialog .dialog-body {
  grid-template-columns: 1fr;
}

[data-read-only="true"] input:not([type="search"]),
[data-read-only="true"] select,
[data-read-only="true"] textarea {
  cursor: default;
}

@media (max-width: 920px) {
  .user-row {
    grid-template-columns: 42px minmax(0, 1fr) 104px 34px;
  }

  .user-access-list {
    grid-column: 2 / 5;
    grid-row: 2;
  }
}

@media (max-width: 680px) {
  .user-management-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .user-management-heading > button {
    align-self: flex-start;
  }

  .user-row {
    grid-template-columns: 38px minmax(0, 1fr) 32px;
    gap: 10px;
    padding: 12px;
  }

  .user-row-avatar {
    width: 36px;
    height: 36px;
  }

  .user-status {
    grid-column: 2;
    grid-row: 2;
    justify-self: start;
  }

  .user-access-list {
    grid-column: 1 / -1;
    grid-row: 3;
  }

  .user-edit-button {
    grid-column: 3;
    grid-row: 1;
  }

  .user-permission-grid,
  .user-extra-permissions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 460px) {
  .editor-dialog.user-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .user-dialog form {
    max-height: calc(100vh - 18px);
  }

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

  .user-permission-grid,
  .user-extra-permissions {
    grid-template-columns: 1fr;
  }

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

  .user-dialog .dialog-actions > span {
    display: none;
  }

  .user-dialog .dialog-actions button {
    width: 100%;
    min-width: 0;
    padding-right: 10px;
    padding-left: 10px;
  }
}

.source-drag-handle,
.source-drag-handle:hover,
.source-drag-handle:focus,
.source-drag-handle:active {
  display: inline-grid;
  width: 24px;
  min-width: 24px;
  height: 38px;
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  box-shadow: none;
  color: var(--muted-light);
  padding: 0;
  place-items: center;
}

.source-drag-handle {
  cursor: grab;
  touch-action: none;
}

.source-drag-handle:hover {
  border-color: transparent;
  background: transparent;
  color: #000000;
}

.source-drag-handle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.source-drag-handle:active {
  cursor: grabbing;
}

.source-drag-handle:disabled {
  cursor: default;
  opacity: 0.35;
}

.source-drag-grip {
  display: grid;
  grid-template-columns: repeat(2, 3px);
  grid-template-rows: repeat(3, 3px);
  gap: 3px;
}

.source-drag-grip > span {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
}

.source-block {
  position: relative;
  transform-origin: 50% 12%;
  transition:
    opacity 140ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

.source-block[data-reorder-enabled="true"] > .source-heading {
  cursor: grab;
}

.source-block.is-dragging {
  z-index: 3;
  opacity: 0.38;
  transform: scale(0.992);
}

.source-block.drag-before::before,
.source-block.drag-after::after {
  position: absolute;
  z-index: 8;
  right: 8px;
  left: 8px;
  height: 3px;
  border-radius: 2px;
  background: var(--blue);
  content: "";
  pointer-events: none;
}

.source-block.drag-before::before {
  top: -2px;
}

.source-block.drag-after::after {
  bottom: -2px;
}

.source-group-list.is-reordering .source-drag-handle {
  color: var(--blue);
}

.source-group-list {
  position: relative;
  transition: background-color 140ms ease;
}

.source-group-list.is-drop-target {
  background: #f5f9ff;
}

.source-group-list.is-drop-empty {
  min-height: 86px;
}

.source-group-list.is-drop-empty .source-group-empty {
  color: var(--blue);
}

.source-subgroup.is-source-drop-target > .source-subgroup-heading,
.source-group.is-source-drop-target > .source-group-heading {
  background: #eef5ff;
}

.source-block.is-drop-wobble-right,
.source-block.is-drop-wobble-left {
  z-index: 4;
  transform-origin: 50% 18%;
  will-change: transform;
}

.source-block.is-drop-wobble-right {
  animation: source-drop-wobble-right 760ms cubic-bezier(0.24, 0.72, 0.28, 1) 80ms 1 both;
}

.source-block.is-drop-wobble-left {
  animation: source-drop-wobble-left 760ms cubic-bezier(0.24, 0.72, 0.28, 1) 80ms 1 both;
}

@keyframes source-drop-wobble-right {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  22% { transform: translate3d(7px, -2px, 0) rotate(2.1deg) scale(1.008); }
  45% { transform: translate3d(-4px, 1px, 0) rotate(-1.3deg) scale(0.999); }
  66% { transform: translate3d(2px, -0.5px, 0) rotate(0.65deg) scale(1.002); }
  84% { transform: translate3d(-0.8px, 0.3px, 0) rotate(-0.25deg) scale(1); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
}

@keyframes source-drop-wobble-left {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  22% { transform: translate3d(-7px, -2px, 0) rotate(-2.1deg) scale(1.008); }
  45% { transform: translate3d(4px, 1px, 0) rotate(1.3deg) scale(0.999); }
  66% { transform: translate3d(-2px, -0.5px, 0) rotate(-0.65deg) scale(1.002); }
  84% { transform: translate3d(0.8px, 0.3px, 0) rotate(0.25deg) scale(1); }
  100% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
}

.source-drag-active,
.source-drag-active * {
  cursor: grabbing !important;
  user-select: none !important;
}

.source-drag-ghost {
  position: fixed !important;
  z-index: 2147483647 !important;
  top: 0;
  left: 0;
  display: block;
  overflow: visible;
  border: 0;
  background: transparent;
  pointer-events: none !important;
  will-change: transform;
}

.source-drag-ghost-card {
  position: absolute !important;
  top: 0;
  left: 0;
  overflow: hidden;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  margin: 0 !important;
  background: var(--surface);
  box-shadow: 0 18px 40px rgba(23, 32, 51, 0.2);
  pointer-events: none !important;
  user-select: none !important;
  animation: source-drag-lift 180ms cubic-bezier(0.22, 0.76, 0.24, 1) both;
}

.source-drag-ghost-card > .source-heading {
  background: var(--surface) !important;
}

@keyframes source-drag-lift {
  from { opacity: 0.72; transform: scale(0.985) rotate(-0.4deg); }
  to { opacity: 1; transform: scale(1) rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .source-block.is-drop-wobble-right,
  .source-block.is-drop-wobble-left,
  .source-drag-ghost-card {
    animation: none;
  }
}

/* Unified custom dropdowns. The native select remains in the form for data and validation. */
.ui-select {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.ui-select-native {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  overflow: hidden !important;
  border: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  padding: 0 !important;
  pointer-events: none !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
}

.ui-select-trigger,
.ui-select-trigger:hover,
.ui-select-trigger:focus,
.ui-select-trigger:active {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--dropdown-trigger-radius);
  justify-content: flex-start;
  align-items: center;
  background: #ffffff;
  box-shadow: none;
  color: var(--ink);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.25;
  padding: 8px 42px 8px 13px;
  text-align: left;
}

.ui-select-trigger:hover {
  border-color: var(--line-strong);
  background: #ffffff;
}

.ui-select-trigger:focus-visible,
.ui-select-trigger[aria-expanded="true"] {
  border-color: var(--blue);
  background: #ffffff;
  outline: 0;
}

.ui-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.ui-select-value {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-select-chevron {
  position: absolute;
  top: 50%;
  right: 15px;
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--muted);
  transform: translateY(-65%) rotate(45deg);
  transition: transform 150ms ease;
  pointer-events: none;
}

.ui-select-trigger[aria-expanded="true"] .ui-select-chevron {
  transform: translateY(-25%) rotate(225deg);
}

.ui-select-status .ui-select-trigger,
.ui-select-status .ui-select-trigger:hover,
.ui-select-status .ui-select-trigger:focus,
.ui-select-status .ui-select-trigger:active {
  min-height: 32px;
  border-color: transparent;
  border-radius: var(--dropdown-compact-radius);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 27px 5px 9px;
}

.ui-select-status .ui-select-chevron {
  right: 10px;
  width: 7px;
  height: 7px;
}

.ui-select-status.tone-neutral .ui-select-trigger {
  background: #eef1f5;
  color: #657181;
}

.ui-select-status.tone-success .ui-select-trigger {
  background: #e8f8ef;
  color: #078447;
}

.ui-select-status.tone-warning .ui-select-trigger {
  background: #fff3d8;
  color: #946200;
}

.ui-select-status.tone-danger .ui-select-trigger {
  background: #fff0f0;
  color: #c92b3a;
}

.ui-select-status .ui-select-trigger:hover,
.ui-select-status .ui-select-trigger[aria-expanded="true"] {
  border-color: currentColor;
}

.branch-link-row > .ui-select .ui-select-trigger {
  min-height: 36px;
  border-radius: var(--dropdown-compact-radius);
  font-size: 12px;
}

.branch-link-row > .ui-select .ui-select-trigger:disabled {
  border-color: transparent;
  background: transparent;
  color: var(--muted-light);
  opacity: 1;
}

.user-permission-grid .ui-select-trigger {
  min-height: 40px;
  font-size: 12px;
}

.ui-select-menu {
  position: fixed;
  inset: auto;
  display: none;
  max-width: calc(100vw - 16px);
  overflow-x: hidden;
  overflow-y: auto;
  grid-auto-flow: row;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--dropdown-menu-radius);
  margin: 0;
  background: #ffffff;
  box-shadow: var(--shadow-dialog);
  color: var(--ink);
  font-family: var(--font);
  padding: 8px;
  overscroll-behavior: contain;
}

.ui-select-menu:popover-open,
.ui-select-menu.fallback-open {
  display: grid;
}

.ui-select-option,
.ui-select-option:hover,
.ui-select-option:focus,
.ui-select-option:focus-visible,
.ui-select-option:active {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 0;
  border-radius: var(--dropdown-option-radius);
  justify-content: flex-start;
  align-items: center;
  background: transparent;
  box-shadow: none !important;
  color: var(--ink);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.25;
  padding: 8px 12px;
  outline: 0;
  text-align: left;
  white-space: normal;
}

.ui-select-option:hover,
.ui-select-option:focus-visible,
.ui-select-option.selected {
  background: #eef1f5;
  color: var(--ink);
}

.ui-select-option.selected {
  font-weight: 500;
}

.ui-select-option:disabled {
  cursor: default;
  opacity: 0.42;
}

.ui-select-menu.status-menu .ui-select-option {
  min-height: 36px;
  gap: 9px;
  font-size: 12px;
  padding: 7px 10px;
}

.ui-select-menu.status-menu .ui-select-option::before {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #aab2bd;
  content: "";
}

.ui-select-menu.status-menu .ui-select-option[data-tone="success"]::before {
  background: #15a461;
}

.ui-select-menu.status-menu .ui-select-option[data-tone="warning"]::before {
  background: #d99a19;
}

.ui-select-menu.status-menu .ui-select-option[data-tone="danger"]::before {
  background: #db4050;
}

/* Messenger availability is configured on the channel; branch icons copy its generated links. */
.table-messenger-field {
  position: relative;
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 4px;
}

.messenger-mode-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
}

.messenger-mode-label {
  display: flex;
  min-width: 0;
  gap: 4px;
  align-items: center;
  color: var(--muted-light);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.messenger-mode-bot-icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 8V4H8'/%3E%3Crect width='16' height='12' x='4' y='8' rx='2'/%3E%3Cpath d='M2 14h2M20 14h2M9 13v2M15 13v2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 8V4H8'/%3E%3Crect width='16' height='12' x='4' y='8' rx='2'/%3E%3Cpath d='M2 14h2M20 14h2M9 13v2M15 13v2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.table-messenger-icons {
  display: flex;
  min-width: 0;
  min-height: 28px;
  gap: 4px;
  align-items: center;
}

.messenger-channel-button,
.messenger-channel-button:hover,
.messenger-channel-button:focus,
.messenger-channel-button:active,
.messenger-link-button,
.messenger-link-button:hover,
.messenger-link-button:focus,
.messenger-link-button:active {
  position: relative;
  display: grid;
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  place-items: center;
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 3px;
  transition: border-color 140ms ease, box-shadow 140ms ease, opacity 140ms ease, transform 120ms ease;
}

.messenger-channel-button img,
.messenger-link-button img {
  display: block;
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.messenger-bot-mark {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  width: 13px;
  height: 13px;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: #161a22;
  pointer-events: none;
}

.messenger-bot-mark::before {
  width: 7px;
  height: 7px;
  background: #ffffff;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='16' height='12' x='4' y='8' rx='2'/%3E%3Cpath d='M9 13v2M15 13v2M12 8V4'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='16' height='12' x='4' y='8' rx='2'/%3E%3Cpath d='M9 13v2M15 13v2M12 8V4'/%3E%3C/svg%3E") center / contain no-repeat;
}

.messenger-channel-button.is-enabled {
  border-color: #c7d8ee;
  box-shadow: 0 1px 3px rgba(23, 32, 51, 0.08);
}

.messenger-channel-button.is-enabled .messenger-control-state {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 6px;
  height: 6px;
  border: 1px solid #ffffff;
  border-radius: 50%;
  background: var(--green);
}

.messenger-channel-button.is-disabled {
  border-style: dashed;
  background: #f5f7fa;
}

.messenger-channel-button.is-disabled img {
  filter: grayscale(1);
  opacity: 0.35;
}

.messenger-channel-button.is-disabled .messenger-control-state {
  position: absolute;
  bottom: -4px;
  right: -4px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.messenger-channel-button.is-readonly-copy {
  cursor: pointer;
}

.messenger-copy-mark {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--blue);
  pointer-events: none;
}

.messenger-copy-mark::before {
  width: 8px;
  height: 8px;
  background: #ffffff;
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.messenger-channel-button:hover,
.messenger-channel-button:focus-visible,
.messenger-link-button:hover,
.messenger-link-button:focus-visible {
  border-color: var(--blue);
  box-shadow: 0 3px 10px rgba(36, 83, 212, 0.14);
  outline: 0;
  transform: translateY(-1px);
}

.messenger-channel-button:active,
.messenger-link-button:active {
  transform: scale(0.96);
}

.messenger-link-button.is-unavailable,
.messenger-link-button.is-disabled-by-channel,
.messenger-link-button:disabled {
  border-color: var(--line-soft);
  background: #f5f7fa;
  box-shadow: none;
  cursor: not-allowed;
  filter: grayscale(1);
  opacity: 0.38;
  transform: none;
}

.messenger-link-button.is-copyable-disabled,
.messenger-link-button.is-copyable-disabled:hover,
.messenger-link-button.is-copyable-disabled:focus-visible,
.messenger-link-button.is-copyable-disabled:active {
  cursor: pointer;
  opacity: 0.72;
}

.messenger-link-button.is-copyable-disabled:hover,
.messenger-link-button.is-copyable-disabled:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 3px 10px rgba(36, 83, 212, 0.14);
  opacity: 1;
  outline: 0;
  transform: translateY(-1px);
}

.source-messenger-menu {
  position: fixed;
  inset: auto;
  display: none;
  max-width: calc(100vw - 16px);
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--dropdown-menu-radius);
  margin: 0;
  background: #ffffff;
  box-shadow: var(--shadow-dialog);
  color: var(--ink);
  font-family: var(--font);
  padding: 8px;
}

.source-messenger-menu:popover-open,
.source-messenger-menu.fallback-open {
  display: grid;
}

.source-messenger-menu-heading {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 6px 8px 8px;
}

.source-messenger-menu-heading > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.source-messenger-menu-heading small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-messenger-menu-heading strong {
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-messenger-menu-brand {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 4px;
}

.source-messenger-menu-brand img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.source-messenger-menu-list {
  display: grid;
  min-height: 0;
  max-height: 330px;
  overflow-y: auto;
  gap: 2px;
  overscroll-behavior: contain;
}

.source-messenger-copy-option,
.source-messenger-copy-option:hover,
.source-messenger-copy-option:focus,
.source-messenger-copy-option:active {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 10px;
  border: 0;
  border-radius: var(--dropdown-option-radius);
  align-items: center;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  padding: 7px 10px 7px 12px;
  text-align: left;
}

.source-messenger-copy-option:hover,
.source-messenger-copy-option:focus-visible {
  background: #eef1f5;
  outline: 0;
}

.source-messenger-copy-option > span:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.source-messenger-copy-option strong,
.source-messenger-copy-option small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-messenger-copy-option strong {
  font-size: 13px;
  font-weight: 500;
}

.source-messenger-copy-option small {
  color: var(--muted);
  font-size: 11px;
}

.source-messenger-copy-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid #bfd4f7;
  border-radius: 8px;
  background: #ffffff;
}

.source-messenger-copy-icon::before {
  width: 14px;
  height: 14px;
  background: var(--blue);
  content: "";
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.source-messenger-menu-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  margin: 0;
  padding: 14px 12px;
}

.source-messenger-actions {
  display: grid;
  min-width: 0;
  border-top: 1px solid var(--line-soft);
  gap: 6px;
  padding-top: 6px;
}

.source-messenger-footer {
  display: flex;
  min-width: 0;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.source-messenger-disable,
.source-messenger-disable:hover,
.source-messenger-disable:focus,
.source-messenger-disable:active {
  display: inline-flex;
  width: auto;
  min-height: 40px;
  min-width: 0;
  flex: 0 1 auto;
  border: 0;
  border-radius: var(--dropdown-option-radius);
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  background: #ffffff;
  box-shadow: none;
  color: var(--red);
  font-size: 12px;
  font-weight: 500;
  padding: 8px 12px;
  text-align: left;
  white-space: nowrap;
}

.source-messenger-disable > span {
  display: grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  border-radius: 50%;
  background: #fff0f0;
  font-size: 16px;
  line-height: 1;
}

.source-messenger-disable:hover,
.source-messenger-disable:focus-visible {
  background: #fff3f3;
  outline: 0;
}

.source-messenger-disable:disabled {
  background: #ffffff;
  color: var(--muted-light);
  cursor: default;
}

.source-messenger-disable:disabled > span {
  background: var(--surface-soft);
}

.source-messenger-add-trigger,
.source-messenger-add-trigger:hover,
.source-messenger-add-trigger:focus,
.source-messenger-add-trigger:active {
  display: inline-flex;
  min-height: 36px;
  flex: 0 0 auto;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  align-items: center;
  background: transparent;
  box-shadow: none;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 11px;
  white-space: nowrap;
}

.source-messenger-add-trigger > span {
  color: var(--blue);
  font-size: 16px;
  line-height: 1;
}

.source-messenger-add-trigger:hover,
.source-messenger-add-trigger:focus-visible,
.source-messenger-add-trigger[aria-expanded="true"] {
  border-color: transparent;
  background: var(--blue-soft);
  color: var(--blue);
  outline: 0;
}

.source-messenger-add-trigger:disabled {
  border-color: var(--line-soft);
  background: transparent;
  color: var(--muted-light);
  cursor: default;
}

.source-messenger-add-trigger:disabled > span {
  color: var(--muted-light);
}

.source-messenger-add-panel {
  display: grid;
  min-width: 0;
  gap: 6px;
  border-top: 1px solid var(--line-soft);
  padding: 9px 6px 3px;
}

.source-messenger-add-panel[hidden] {
  display: none;
}

.source-messenger-add-row {
  display: grid;
  min-width: 0;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.source-messenger-add-label {
  display: inline-flex;
  min-width: 0;
  gap: 4px;
  align-items: center;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.source-messenger-add-options {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 5px;
}

.source-messenger-add-option,
.source-messenger-add-option:hover,
.source-messenger-add-option:focus,
.source-messenger-add-option:active {
  display: inline-flex;
  min-height: 32px;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  align-items: center;
  background: var(--surface-soft);
  box-shadow: none;
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 8px;
  white-space: nowrap;
}

.source-messenger-add-option:hover,
.source-messenger-add-option:focus-visible {
  background: var(--blue-soft);
  color: var(--blue);
  outline: 0;
}

.source-messenger-add-option img {
  display: block;
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.7;
}

.source-messenger-add-option:hover img,
.source-messenger-add-option:focus-visible img {
  opacity: 1;
}

.source-messenger-add-plus {
  color: var(--blue);
  font-size: 15px;
  line-height: 1;
}

.source-messenger-readonly {
  min-height: 40px;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin: 0;
  padding: 10px 12px;
}

.messenger-links-empty strong {
  overflow: hidden;
  color: var(--muted-light);
  font-size: 12px;
  font-weight: 400;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Expense ownership can live on the channel or on each hierarchy branch. */
.source-expense-cell {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 5px;
}

.source-expense-cell .source-expense-switch {
  width: 100%;
}

.expense-scope-toggle,
.source-expense-scope-form-control {
  display: inline-flex;
  min-width: 0;
  gap: 7px;
  align-items: center;
  color: var(--ink);
  cursor: pointer;
}

.expense-scope-toggle input,
.source-expense-scope-form-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.expense-scope-track {
  position: relative;
  width: 30px;
  min-width: 30px;
  height: 18px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #eef1f5;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.expense-scope-track > span {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(23, 32, 51, 0.22);
  transition: transform 150ms ease;
}

.expense-scope-toggle input:checked + .expense-scope-track,
.source-expense-scope-form-control input:checked + .expense-scope-track {
  border-color: var(--blue);
  background: var(--blue);
}

.expense-scope-toggle input:checked + .expense-scope-track > span,
.source-expense-scope-form-control input:checked + .expense-scope-track > span {
  transform: translateX(12px);
}

.expense-scope-toggle input:focus-visible + .expense-scope-track,
.source-expense-scope-form-control input:focus-visible + .expense-scope-track {
  outline: 2px solid rgba(36, 83, 212, 0.24);
  outline-offset: 2px;
}

.expense-scope-toggle:hover .expense-scope-track,
.source-expense-scope-form-control:hover .expense-scope-track {
  border-color: #000000;
}

.expense-scope-toggle:has(input:disabled),
.source-expense-scope-form-control:has(input:disabled) {
  cursor: default;
  opacity: 0.62;
}

.expense-scope-label {
  min-width: 0;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-expense-caption,
.source-expense-mixed,
.shared-expense-note {
  display: flex;
  min-width: 0;
  align-items: center;
  color: var(--muted-light);
  font-size: 10.5px;
  line-height: 1.2;
}

.shared-expense-note {
  padding: 7px 10px;
}

.source-expense-mixed {
  min-height: 30px;
  border-radius: var(--radius-xs);
  justify-content: center;
  background: var(--surface-strong);
  color: var(--ink);
  font-weight: 500;
}

.source-expense-scope-option {
  padding: 2px 0;
}

.source-expense-scope-form-control {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  padding: 8px 12px;
}

.source-expense-scope-form-control strong {
  font-size: 12.5px;
  font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  .expense-scope-track,
  .expense-scope-track > span {
    transition: none;
  }
}

/* Keep registry search and actions in separate layout tracks. */
.registry-toolbar {
  grid-template-columns: minmax(240px, 1fr) max-content;
}

.registry-toolbar .toolbar-actions {
  min-width: 0;
}

.registry-toolbar .toolbar-actions > button {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (min-width: 1050px) and (max-width: 1880px) {
  .registry-toolbar {
    grid-template-areas: "search actions";
    grid-template-columns: minmax(280px, 1fr) max-content;
  }

  .registry-toolbar .search-field {
    grid-area: search;
  }

  .registry-toolbar .toolbar-actions {
    grid-area: actions;
    grid-column: auto;
    justify-self: end;
  }
}

@media (min-width: 821px) and (max-width: 1049px) {
  .registry-toolbar {
    grid-template-areas:
      "search"
      "actions";
    grid-template-columns: minmax(0, 1fr);
    row-gap: 8px;
  }

  .registry-toolbar .search-field {
    grid-area: search;
  }

  .registry-toolbar .toolbar-actions {
    grid-area: actions;
    grid-column: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* City branch CRUD stays visible and explicit even with a long address list. */
.editor-dialog.branch-link-dialog.city-branches-mode {
  width: min(980px, calc(100vw - 32px));
}

.city-branches-mode .branch-link-add {
  order: 1;
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 0 16px;
}

.city-branches-mode .branch-link-list {
  order: 2;
  border-top: 0;
}

.branch-link-row.city-branch-row {
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 6px;
}

.city-branch-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.city-branch-fields {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(220px, 1.4fr) minmax(150px, 0.8fr) minmax(180px, 0.9fr);
  gap: 10px;
}

.city-branch-field {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.city-branch-field > span:first-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.city-branch-field > input,
.city-branch-phone-control > input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

.city-branch-field input[data-branch-code] {
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.city-branch-phone-control {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 4px;
  align-items: center;
}

.city-branch-phone-clear {
  width: 32px;
  min-width: 32px;
  height: 32px;
  color: var(--muted);
  font-size: 18px;
}

.city-branch-phone-control:has(input:placeholder-shown) .city-branch-phone-clear {
  visibility: hidden;
  pointer-events: none;
}

.city-branch-remove {
  min-height: 40px;
  align-self: end;
  border: 0;
  background: transparent;
  color: var(--red);
  padding: 0 8px;
  white-space: nowrap;
}

.city-branch-remove:hover,
.city-branch-remove:focus-visible {
  border: 0;
  background: #fff0f0;
  color: var(--red);
}

@media (max-width: 900px) {
  .city-branch-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .city-branch-address {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .city-branches-mode .branch-link-add,
  .city-branch-fields {
    grid-template-columns: minmax(0, 1fr);
  }

  .city-branch-address {
    grid-column: auto;
  }
}

/* Match both sticky panels to the workspace and keep a visible gap between them. */
.topbar {
  top: 10px;
  width: auto;
  margin: 10px 10px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.registry-toolbar {
  top: 90px;
}

@media (max-width: 820px) {
  .topbar {
    margin-right: 8px;
    margin-left: 8px;
  }

  .registry-toolbar {
    top: auto;
  }
}

/* Quiet hover states for the expense scope and bulk status controls. */
.expense-scope-toggle {
  min-height: 30px;
  border-radius: var(--radius-xs);
  padding: 4px 6px;
  transition: background-color 160ms ease;
}

.expense-scope-toggle:hover .expense-scope-track,
.source-expense-scope-form-control:hover .expense-scope-track {
  border-color: var(--line-strong);
  background: rgba(0, 112, 255, 0.1);
}

.expense-scope-toggle:hover input:checked + .expense-scope-track,
.source-expense-scope-form-control:hover input:checked + .expense-scope-track {
  border-color: var(--blue);
  background: var(--blue);
}

.ui-select:has(.source-bulk-status-select) .ui-select-trigger,
.ui-select:has(.source-bulk-status-select) .ui-select-trigger:hover,
.ui-select:has(.source-bulk-status-select) .ui-select-trigger:focus,
.ui-select:has(.source-bulk-status-select) .ui-select-trigger:focus-visible,
.ui-select:has(.source-bulk-status-select) .ui-select-trigger:active,
.ui-select:has(.source-bulk-status-select) .ui-select-trigger[aria-expanded="true"] {
  border-color: transparent;
  box-shadow: none;
  outline: 0;
}

.ui-select:has(.source-bulk-status-select) .ui-select-trigger:hover,
.ui-select:has(.source-bulk-status-select) .ui-select-trigger[aria-expanded="true"] {
  background: var(--surface-hover);
  color: var(--ink);
}

.secondary-button:not(.soft-button):hover:not(:disabled) {
  border-color: transparent;
  background: var(--surface-strong);
}

#logoutButton,
#logoutButton:hover,
#logoutButton:focus,
#logoutButton:active {
  position: relative;
  display: inline-flex;
  width: 78px;
  min-width: 78px;
  overflow: hidden;
  border: 0;
  justify-content: center;
  align-items: center;
  background: transparent;
  box-shadow: none;
  padding: 3px 24px 3px 8px;
}

#logoutButton:hover,
#logoutButton:focus-visible,
#logoutButton:active {
  border: 0;
  background: transparent;
  color: var(--red);
}

#logoutButton .logout-icon {
  position: absolute;
  top: 50%;
  right: 7px;
  width: 15px;
  height: 15px;
  background: currentColor;
  opacity: 0;
  transform: translate(-8px, -50%);
  transition: opacity 160ms ease, transform 180ms ease;
  -webkit-mask: url("./icons/log-out.svg") center / contain no-repeat;
  mask: url("./icons/log-out.svg") center / contain no-repeat;
  pointer-events: none;
}

#logoutButton:hover .logout-icon,
#logoutButton:focus-visible .logout-icon {
  opacity: 1;
  transform: translate(0, -50%);
}

@media (prefers-reduced-motion: reduce) {
  #logoutButton .logout-icon {
    transition: none;
  }
}

/* The whole-channel link is copied from the row and edited through its focused dialog. */
.source-table-row > .source-channel-link {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 2px;
  align-items: center;
  padding: 0 6px 0 0;
}

.source-channel-link-copy,
.source-channel-link-copy:hover,
.source-channel-link-copy:focus,
.source-channel-link-copy:active {
  display: grid;
  min-width: 0;
  min-height: 54px;
  align-content: center;
  gap: 3px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 4px 8px 12px;
  text-align: left;
  transform: none;
}

.source-channel-link-copy:hover,
.source-channel-link-copy:focus-visible {
  background: var(--surface-soft);
  outline: 0;
}

.source-channel-link-label {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  color: var(--muted-light);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
}

.source-channel-link-label strong {
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 5px;
}

.source-channel-link.is-disabled .source-channel-link-label strong {
  background: var(--surface-strong);
  color: var(--muted);
}

.source-channel-link-copy code {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-channel-link.is-empty .source-channel-link-copy code {
  color: var(--blue);
  font-family: inherit;
}

.source-channel-link.is-disabled .source-channel-link-copy code {
  color: var(--muted);
  font-family: inherit;
}

.source-channel-link .source-channel-link-edit {
  align-self: start;
  margin-top: 8px;
  opacity: 0.68;
}

.source-channel-link:hover .source-channel-link-edit,
.source-channel-link .source-channel-link-edit:focus-visible {
  opacity: 1;
}

.editor-dialog.channel-link-dialog {
  width: min(620px, calc(100vw - 32px));
  background: #ffffff;
}

.channel-link-dialog form,
.channel-link-dialog .dialog-heading,
.channel-link-dialog .dialog-body,
.channel-link-dialog .dialog-actions {
  background: #ffffff;
}

.channel-link-dialog-body {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.channel-link-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.channel-link-field > span:first-child,
.channel-link-mode-field legend {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 500;
}

.channel-link-field > small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.channel-link-field > input,
.channel-link-preview-control > input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

.channel-link-mode-field {
  min-width: 0;
  border: 0;
  margin: 0;
  padding: 0;
}

.channel-link-mode-field legend {
  margin-bottom: 8px;
}

.channel-link-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  padding: 4px;
}

.channel-link-mode-switch label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.channel-link-mode-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.channel-link-mode-switch span {
  display: grid;
  min-height: 38px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.channel-link-mode-switch input:checked + span {
  border-color: var(--line);
  background: #ffffff;
  color: var(--blue);
}

.channel-link-mode-switch input:focus-visible + span {
  outline: 2px solid rgba(20, 111, 238, 0.28);
  outline-offset: 1px;
}

.channel-link-mode-panel[hidden] {
  display: none;
}

.channel-link-preview-control {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.channel-link-preview-control > input[readonly] {
  background: var(--surface-soft);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12px;
}

.channel-link-dialog-actions {
  grid-template-columns: 1fr auto auto;
}

@media (max-width: 560px) {
  .channel-link-mode-switch {
    grid-template-columns: minmax(0, 1fr);
  }

  .channel-link-preview-control {
    grid-template-columns: minmax(0, 1fr);
  }

  .channel-link-preview-control > button {
    justify-self: start;
  }
}

/* Keep topbar controls in separate tracks at every supported width. */
.topbar {
  grid-template-columns: minmax(180px, 1fr) auto max-content;
}

.topbar > .brand-block,
.topbar > .module-switcher,
.topbar > .topbar-actions {
  min-width: 0;
}

.topbar-actions {
  flex-wrap: nowrap;
}

.topbar-actions > * {
  flex: 0 0 auto;
}

#saveButton {
  width: 176px;
  min-width: 176px;
  max-width: 176px;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 1480px) {
  .topbar-actions .save-state {
    display: none;
  }
}

@media (max-width: 1280px) {
  .topbar {
    grid-template-areas:
      "brand actions"
      "nav nav";
    grid-template-columns: minmax(0, 1fr) max-content;
    min-height: 116px;
    gap: 6px 12px;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .topbar > .brand-block {
    grid-area: brand;
  }

  .topbar > .module-switcher {
    width: max-content;
    max-width: 100%;
    grid-area: nav;
    justify-self: center;
    order: 0;
    margin: 0;
  }

  .topbar > .topbar-actions {
    grid-area: actions;
    grid-column: auto;
    grid-row: auto;
  }
}

@media (min-width: 821px) and (max-width: 1280px) {
  .registry-toolbar {
    top: 138px;
  }
}

@media (max-width: 820px) {
  .topbar {
    min-height: auto;
  }

  .registry-toolbar {
    top: auto;
  }
}

@media (max-width: 700px) {
  .profile-trigger {
    width: 44px;
    min-width: 44px;
    min-height: 44px !important;
    justify-content: center;
    gap: 0;
    margin: 0;
    padding: 5px;
  }

  .profile-trigger-copy {
    display: none;
  }
}

/* Password fields provide visible input feedback without exposing the value by default. */
.password-field {
  position: relative;
  display: block;
  width: 100%;
}

.password-field > input {
  padding-right: 48px;
}

.password-visibility-button {
  position: absolute;
  top: 50%;
  right: 7px;
  display: inline-grid;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  transform: translateY(-50%);
}

.password-visibility-button:hover,
.password-visibility-button:focus-visible {
  border: 0;
  background: var(--blue-soft);
  color: var(--blue);
}

.password-visibility-button:active:not(:disabled) {
  transform: translateY(-50%) scale(0.972) !important;
}

@media (prefers-reduced-motion: reduce) {
  .password-visibility-button:active:not(:disabled) {
    transform: translateY(-50%) !important;
  }
}

.password-visibility-icon {
  width: 18px;
  height: 18px;
  background: currentColor;
  mask: url("./icons/eye.svg") center / contain no-repeat;
}

.password-visibility-button[data-password-visible="true"] .password-visibility-icon {
  mask-image: url("./icons/eye-off.svg");
}

#userPasswordHint[data-mode="bad"] {
  color: var(--red);
}

#userPasswordHint[data-mode="ok"] {
  color: var(--green);
}

/* Monthly expense ledger: channels and icons stay derived from the registry. */
.expense-toolbar {
  display: grid;
  grid-template-columns: minmax(330px, 1fr) auto;
}

.expense-month-control {
  display: grid;
  grid-template-columns: 42px minmax(190px, 240px) 42px;
  grid-template-rows: auto auto;
  gap: 3px 7px;
  align-items: end;
  justify-content: center;
}

.expense-month-control label {
  display: grid;
  gap: 3px;
}

.expense-month-control label > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.expense-month-control input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 0 11px;
}

.expense-month-arrow {
  width: 42px;
  min-width: 42px;
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  padding: 0;
}

.expense-month-arrow:hover,
.expense-month-arrow:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.expense-month-control small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.expense-section-heading > div {
  display: grid;
  gap: 3px;
  padding: 9px 0;
}

.expense-section-heading small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.expense-channel-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.expense-channel-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recurring-expense-panel {
  border-bottom: 10px solid var(--page);
  background: var(--surface);
}

.recurring-expense-heading {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}

.recurring-expense-heading > div {
  display: grid;
  gap: 4px;
}

.recurring-expense-heading h4 {
  margin: 0;
  font-size: 14px;
}

.recurring-expense-heading small,
.recurring-expense-schedule span,
.recurring-expense-payment span,
.recurring-expense-empty span {
  color: var(--muted);
  font-size: 11px;
}

.recurring-expense-heading button {
  flex: 0 0 auto;
}

.recurring-expense-list {
  display: grid;
}

.recurring-expense-row {
  min-height: 72px;
  grid-template-columns: minmax(240px, 1.2fr) minmax(205px, 1fr) 130px minmax(140px, 0.72fr) minmax(220px, auto);
}

.recurring-expense-row.is-paused {
  background: color-mix(in srgb, var(--surface-soft) 50%, var(--surface));
  opacity: 0.72;
}

.recurring-expense-schedule,
.recurring-expense-payment {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.recurring-expense-schedule strong,
.recurring-expense-payment strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.recurring-expense-actions .expense-status {
  min-width: 112px;
}

.recurring-expense-empty {
  display: grid;
  min-height: 84px;
  place-content: center;
  gap: 4px;
  padding: 16px;
  text-align: center;
}

.recurring-expense-empty strong {
  font-size: 13px;
}

.monthly-expense-row.is-scheduled {
  background: color-mix(in srgb, var(--blue-soft) 50%, var(--surface));
}

.recurring-active-field {
  display: flex !important;
  min-height: 58px;
  align-items: center;
  gap: 11px !important;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 10px 13px;
}

.recurring-active-field input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  margin: 0;
}

.recurring-active-field > span {
  display: grid;
  gap: 3px;
}

.recurring-active-field > span strong {
  font-size: 12px;
}

.recurring-active-field > span small {
  font-weight: 400;
}

.monthly-expense-category + .monthly-expense-category {
  border-top: 10px solid var(--page);
}

.monthly-expense-category-heading {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 0 16px;
}

.monthly-expense-category-heading h4 {
  margin: 0;
  font-size: 13px;
}

.monthly-expense-category-heading span {
  color: var(--muted);
  font-size: 11px;
}

.monthly-expense-source + .monthly-expense-source {
  border-top: 1px solid var(--line);
}

.monthly-expense-source-heading {
  min-height: 58px;
  border-bottom: 1px solid var(--line-soft);
  background: color-mix(in srgb, var(--surface-soft) 58%, var(--surface));
  padding: 11px 16px;
}

.monthly-expense-source-heading .expense-channel-icon {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.monthly-expense-source-heading .expense-channel-icon img {
  width: 29px;
  height: 29px;
}

.monthly-expense-targets {
  display: grid;
}

.monthly-expense-row {
  grid-template-columns: minmax(250px, 1.4fr) minmax(190px, 0.9fr) 120px minmax(150px, 0.75fr) minmax(190px, auto);
  min-height: 70px;
  padding-left: 20px;
}

.monthly-expense-row.is-empty {
  background: color-mix(in srgb, var(--surface-soft) 32%, var(--surface));
}

.monthly-expense-target-copy {
  display: flex;
  min-width: 0;
  gap: 10px;
  align-items: center;
}

.monthly-expense-target-copy > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.monthly-expense-target-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.monthly-expense-target-copy small {
  color: var(--muted);
  font-size: 11px;
}

.monthly-expense-tree {
  position: relative;
  width: 18px;
  height: 30px;
  flex: 0 0 18px;
  border-bottom: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 0 0 0 8px;
  transform: translateY(-7px);
}

.monthly-expense-entry {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.monthly-expense-entry .expense-status {
  min-width: 92px;
}

.expense-add-button {
  min-height: 36px;
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  padding: 0 13px;
}

.expense-add-button:hover,
.expense-add-button:focus-visible {
  border-color: var(--blue-dark, var(--blue));
  background: var(--blue-dark, var(--blue));
  color: #fff;
}

.expense-auto-period {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 12px 14px;
}

.expense-auto-period > span,
.expense-auto-period small {
  color: var(--muted);
  font-size: 11px;
}

.expense-auto-period strong {
  font-size: 14px;
}

.expense-send-notice {
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid color-mix(in srgb, var(--blue) 30%, var(--line));
  border-radius: var(--radius);
  background: var(--blue-soft);
  padding: 11px 13px;
}

.expense-send-notice-mark {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.expense-send-notice > span:last-child {
  display: grid;
  gap: 3px;
}

.expense-send-notice strong {
  font-size: 12px;
}

.expense-send-notice small {
  color: var(--muted);
  font-size: 11px;
}

#manualExpenseSubmitButton {
  min-width: 224px;
}

@media (max-width: 1060px) {
  .expense-toolbar {
    grid-template-columns: 1fr auto;
  }

  .expense-month-control {
    grid-column: auto;
    grid-row: auto;
    justify-self: start;
  }

  .monthly-expense-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 14px;
    padding: 13px 14px 13px 20px;
  }

  .monthly-expense-target-copy {
    grid-column: 1;
    grid-row: 1;
  }

  .monthly-expense-entry {
    grid-column: 2;
    grid-row: 1;
  }

  .monthly-expense-row .expense-period {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--line-soft);
    padding-top: 9px;
  }

  .monthly-expense-row .expense-date {
    grid-column: 1;
    grid-row: 3;
  }

  .monthly-expense-row .expense-amount {
    grid-column: 2;
    grid-row: 3;
    text-align: right;
  }

  .recurring-expense-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 9px 14px;
    padding: 13px 14px;
  }

  .recurring-expense-row .expense-channel {
    grid-column: 1;
    grid-row: 1;
  }

  .recurring-expense-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .recurring-expense-schedule {
    grid-column: 1 / -1;
    grid-row: 2;
    border-top: 1px solid var(--line-soft);
    padding-top: 9px;
  }

  .recurring-expense-payment {
    grid-column: 1;
    grid-row: 3;
  }

  .recurring-expense-row .expense-amount {
    grid-column: 2;
    grid-row: 3;
    text-align: right;
  }
}

@media (max-width: 700px) {
  .expense-toolbar {
    grid-template-columns: 1fr;
  }

  .expense-toolbar .expense-mode-switcher,
  .expense-toolbar > button,
  .expense-month-control {
    grid-column: 1;
    width: 100%;
  }

  .expense-month-control {
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    justify-self: stretch;
  }

  .monthly-expense-source-heading {
    padding-inline: 12px;
  }

  .monthly-expense-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 13px 12px;
  }

  .monthly-expense-target-copy,
  .monthly-expense-entry,
  .monthly-expense-row .expense-period,
  .monthly-expense-row .expense-date,
  .monthly-expense-row .expense-amount {
    grid-column: 1;
  }

  .monthly-expense-target-copy { grid-row: 1; }
  .monthly-expense-row .expense-period { grid-row: 2; }
  .monthly-expense-row .expense-date { grid-row: 3; }
  .monthly-expense-row .expense-amount { grid-row: 4; text-align: left; }
  .monthly-expense-entry { grid-row: 5; justify-content: space-between; }

  .monthly-expense-tree {
    width: 14px;
    flex-basis: 14px;
  }

  .expense-section-heading {
    padding-inline: 12px;
  }

  #manualExpenseSubmitButton {
    min-width: 0;
  }

  .recurring-expense-heading {
    align-items: stretch;
    flex-direction: column;
    padding: 13px 12px;
  }

  .recurring-expense-heading button {
    width: 100%;
  }

  .recurring-expense-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 13px 12px;
  }

  .recurring-expense-row .expense-channel,
  .recurring-expense-schedule,
  .recurring-expense-payment,
  .recurring-expense-row .expense-amount,
  .recurring-expense-actions {
    grid-column: 1;
  }

  .recurring-expense-row .expense-channel { grid-row: 1; }
  .recurring-expense-schedule { grid-row: 2; }
  .recurring-expense-payment { grid-row: 3; }
  .recurring-expense-row .expense-amount { grid-row: 4; text-align: left; }
  .recurring-expense-actions { grid-row: 5; justify-content: space-between; }
}
