:root {
  --bg: #f4f8fd;
  --panel: #ffffff;
  --ink: #1d2329;
  --muted: #66707a;
  --line: #d7e0ea;
  --accent: #2787f5;
  --accent-dark: #1d6fcb;
  --danger: #b3261e;
  --soft: #eef6ff;
  --soft-strong: #dcecff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 12px;
}

.app {
  width: min(1680px, calc(100% - 18px));
  margin: 0 auto;
  padding: 10px 0 24px;
}

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

.loginView[hidden] {
  display: none;
}

.loginPanel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.loginPanel h1 {
  font-size: 22px;
}

.loginPanel label,
.userForm label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.loginPanel button {
  height: 32px;
}

.topBar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

#currentUserBadge {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.crmTabs {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.crmTab {
  min-height: 30px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.crmTab:hover {
  background: var(--soft);
  color: var(--accent);
}

.crmTab.isActive {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.tabPane[hidden] {
  display: none;
}

.sectionHead p {
  color: var(--muted);
  font-size: 12px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 16px;
  margin-bottom: 9px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  margin-top: 8px;
}

.sectionHead {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 9px;
}

.pill {
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 8px;
  background: var(--soft);
  color: var(--accent-dark);
  font-size: 12px;
  white-space: nowrap;
}

.filters,
.settingsForm {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  align-items: end;
}

.settingsForm {
  grid-template-columns: minmax(220px, 360px) minmax(180px, 260px);
}

.accountsPanel {
  padding: 10px;
}

.accountsSheet {
  display: grid;
  gap: 9px;
}

.accountsAddLabel,
.accountsListTitle {
  padding: 0;
  font-size: 15px;
  font-weight: 650;
}

.accountForm {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(180px, 0.65fr) minmax(180px, 0.65fr) auto 1fr;
  gap: 8px;
  align-items: end;
  padding: 0;
}

.accountForm label {
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  position: relative;
}

.accountForm input {
  border-radius: 6px;
  border: 1px solid var(--line);
  height: 32px;
  padding: 0 9px;
  font-size: 12px;
}

.accountForm button {
  height: 32px;
  align-self: end;
  min-width: 98px;
}

.fieldLabelWithHelp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}

.helpTip {
  position: relative;
  display: inline-flex;
  align-items: center;
  outline: none;
}

.helpTipBtn {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #9aa8ba;
  border-radius: 999px;
  background: #fff;
  color: #526174;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  cursor: help;
}

.helpTipBubble {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  z-index: 90;
  display: none;
  width: 270px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  white-space: normal;
}

.helpTipBubbleWide {
  right: 0;
  left: auto;
  width: min(520px, calc(100vw - 48px));
}

.helpTipBubble img {
  display: block;
  width: 100%;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.helpTip:hover .helpTipBubble,
.helpTip:focus .helpTipBubble,
.helpTip:focus-within .helpTipBubble {
  display: block;
}

.accountsListTitle {
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.accountsList {
  margin: 0;
}

.hiddenAccounts {
  width: min(820px, 100%);
  margin-top: 8px;
}

.hiddenAccounts summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 5px 0;
}

.accountsTable {
  width: min(820px, 100%);
  min-width: 0;
  border-collapse: collapse;
  background: transparent;
}

.accountsTable td {
  height: 30px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.accountsTable td:first-child {
  width: 42%;
}

.accountsTable td:nth-child(2) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.accountsTable td:nth-child(3) {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.accountsTable td:last-child {
  width: 96px;
  text-align: right;
}

.accountNameView {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.clientLink {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.clientLink:hover {
  color: var(--accent-dark);
}

.editIconBtn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.editIconBtn:hover {
  background: var(--soft);
}

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

.accountEditForm[hidden] {
  display: none;
}

.accountEditForm input {
  width: min(220px, 100%);
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  font: inherit;
}

.saveAccountBtn,
.deleteAccountBtn {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.saveAccountBtn {
  background: var(--soft);
  color: var(--accent);
  border: 1px solid #bfdcff;
}

.saveAccountBtn:hover {
  background: var(--soft-strong);
}

.deleteAccountBtn {
  background: #f3f4f6;
  color: #9f1d1d;
  border: 1px solid #e3e6eb;
}

.deleteAccountBtn:hover {
  background: #fee2e2;
}

.filters {
  grid-template-columns: minmax(230px, 1.2fr) repeat(5, minmax(150px, 1fr)) minmax(160px, 1fr);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dateRangeField {
  position: relative;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.dateRangeBtn {
  width: 100%;
  height: 38px;
  justify-content: flex-start;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 13px;
}

.dateRangeBtn:hover {
  background: #f9fbff;
}

.dateRangePicker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 20;
  width: min(620px, calc(100vw - 48px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.14);
  padding: 10px;
  overflow: hidden;
}

.calendarTop {
  height: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: -28px;
  pointer-events: none;
}

.iconBtn {
  position: relative;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  padding: 0;
  background: #eef3fb;
  color: #51606f;
  font-size: 16px;
  line-height: 1;
  pointer-events: auto;
}

.iconBtn:hover {
  background: #dfe9f8;
}

.calendarGridWrap {
  display: grid;
  grid-template-columns: 226px 226px 128px;
  gap: 8px;
}

.calendarPane {
  min-width: 0;
}

.calendarTitle {
  text-align: center;
  color: #4b5563;
  font-size: 13px;
  margin: 10px 0 10px;
}

.weekdays,
.calendarGrid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}

.weekdays span {
  text-align: center;
  color: #8a929c;
  font-size: 11px;
}

.calendarEmpty,
.calendarDay {
  width: 24px;
  height: 24px;
  justify-self: center;
}

.calendarDay {
  border-radius: 999px;
  padding: 0;
  background: #fff;
  color: #4b5563;
  font-size: 12px;
}

.calendarDay:hover {
  background: #eef3fb;
  color: var(--ink);
}

.calendarDay.inRange {
  background: #eef3fb;
}

.calendarDay.selected {
  background: #ffe000;
  color: #111827;
}

.periodPresets {
  border-left: 1px solid var(--line);
  padding-left: 10px;
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
}

.periodPresets h3 {
  margin: 10px 0 6px;
  font-size: 12px;
  font-weight: 500;
  color: #8a929c;
}

.periodPresets button {
  width: fit-content;
  max-width: 100%;
  height: auto;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: #209ce8;
  border-bottom: 1px dotted #209ce8;
  font-size: 12px;
  text-align: left;
  white-space: normal;
}

.periodPresets button:hover {
  background: transparent;
  color: #1378ba;
}

.periodPresets .applyRangeBtn {
  margin-top: 8px;
  height: 32px;
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  border-radius: 6px;
  border-bottom: 0;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.periodPresets .applyRangeBtn:hover {
  background: var(--accent-dark);
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 8px;
}

button {
  height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}

button:hover {
  background: var(--accent-dark);
}

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

.dangerBtn {
  background: #fee2e2;
  color: #9f1d1d;
  border: 1px solid #fecaca;
  font-weight: 700;
}

.dangerBtn:hover {
  background: #fecaca;
}

.dangerBtn:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  border-color: #e5e7eb;
}

.accountItem {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  display: grid;
  gap: 5px;
}

.accountItem strong {
  font-size: 12px;
}

.accountItem span,
.empty,
.status {
  color: var(--muted);
  font-size: 12px;
}

.filtersPanel {
  padding-bottom: 8px;
}

.status {
  min-height: 16px;
  margin: 7px 0;
}

.status.error {
  color: var(--danger);
}

.statsFilters {
  display: grid;
  grid-template-columns: 148px 190px 132px 190px auto;
  gap: 7px;
  align-items: end;
  margin: 8px 0 8px;
}

.statsActions {
  display: flex;
  gap: 5px;
  align-items: center;
  min-width: 0;
  height: 32px;
  overflow: hidden;
}

.statsFilters .secondaryBtn {
  min-height: 32px;
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  line-height: 1.12;
  white-space: nowrap;
  align-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
}

#bulkAutoRulesBtn,
#bulkActionsBtn,
#bulkBudgetBtn {
  min-width: 0;
}

#bulkAutoRulesBtn {
  width: 104px;
}

#bulkActionsBtn {
  width: 82px;
}

#bulkBudgetBtn {
  width: 112px;
}

#refreshStatsBtn,
#resetStatsFilters {
  width: 86px;
}

.bulkActionsBlock {
  position: relative;
}

#bulkActionsMenu {
  width: 220px;
  padding: 6px;
}

#bulkActionsMenu button {
  width: 100%;
  min-height: 30px;
  height: auto;
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}

#bulkActionsMenu button:hover {
  background: var(--soft);
  color: var(--accent);
}

.statsLogsControls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.filterBlock {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  align-content: end;
}

.columnsFilterBlock,
.statusFilterBlock,
.clientFilterBlock,
.campaignFilterBlock,
.statsLogTypeFilterBlock {
  position: relative;
}

.columnsMenu,
.statusMenu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 10;
  width: 240px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
}

.statusMenu {
  width: 210px;
  gap: 0;
  padding: 6px;
}

.columnsMenu[hidden],
.statusMenu[hidden] {
  display: none;
}

.columnsMenu label,
.statusMenu label {
  min-height: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  color: var(--ink);
  font-weight: 500;
  border-radius: 6px;
}

.columnsMenu label:hover,
.statusMenu label:hover {
  background: var(--soft);
}

.statusMenu label {
  min-height: 26px;
  gap: 6px;
  padding: 3px 5px;
  font-size: 13px;
}

.columnsMenu input,
.statusMenu input {
  width: 14px;
  height: 14px;
}

#columnsMenu input[type="checkbox"] {
  width: 13px;
  height: 13px;
  min-height: 13px;
  padding: 0;
}

#statusMenu input[type="checkbox"] {
  width: 13px;
  height: 13px;
  min-height: 13px;
  padding: 0;
}

.columnsMenu {
  width: 220px;
  gap: 0;
  padding: 6px;
}

.columnsMenu label {
  min-height: 26px;
  gap: 6px;
  padding: 3px 5px;
  font-size: 13px;
}

#statusMenuBtn {
  overflow: hidden;
  justify-content: flex-start;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#campaignFilterBtn {
  width: 100%;
  height: 32px;
  overflow: hidden;
  justify-content: flex-start;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaignMenu {
  width: 320px;
  max-height: 320px;
}

.campaignMenu label {
  align-items: flex-start;
}

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

.campaignMenuText strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.15;
}

.campaignMenuText small {
  max-width: 250px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#clientFiltersBtn {
  width: 100%;
  height: 32px;
  overflow: hidden;
  justify-content: flex-start;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.clientMenu {
  width: 190px;
}

#statsLogTypeMenuBtn {
  width: 220px;
  overflow: hidden;
  justify-content: flex-start;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filterBlock input,
.filterBlock select {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

.checkboxList {
  min-height: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.checkboxList label {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--ink);
  background: #fff;
  font-size: 12px;
  font-weight: 500;
}

.checkboxList input {
  width: 14px;
  height: 14px;
}

.secondaryBtn {
  min-height: 32px;
  padding: 0 10px;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--line);
}

.secondaryBtn:hover {
  background: var(--soft);
}

.reportDateControl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.reportDateControl input {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--ink);
  font: inherit;
  background: #fff;
}

.tableWrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 5px;
}

table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  background: #fff;
}

#todayStatsTable {
  min-width: 1620px;
}

#conversionLogsTable {
  min-width: 1180px;
}

.rawQueryCell {
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
}

th,
td {
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  font-size: 12px;
  line-height: 1.15;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #eaf4ff;
  color: #334a63;
  font-weight: 650;
}

#todayStatsTable .col_group_status {
  width: 150px;
  min-width: 150px;
}

#todayStatsTable .col_select {
  width: 42px;
  min-width: 42px;
  text-align: center;
}

.rowSelectInput {
  width: 13px;
  height: 13px;
  min-height: 13px;
  padding: 0;
  vertical-align: middle;
}

.sortHeaderBtn {
  width: 100%;
  min-height: auto;
  height: auto;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.sortHeaderBtn:hover {
  background: transparent;
  color: var(--accent);
}

.sortHeaderBtn.isActive {
  color: var(--accent);
}

.sortIcon {
  font-size: 12px;
  line-height: 1;
}

.budgetActionBtn {
  height: auto;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 650;
  text-align: left;
}

.budgetActionBtn:hover {
  background: transparent;
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.autoRulesAttachBtn {
  min-height: 21px;
  height: 21px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.autoRulesAttachBtn:hover {
  background: var(--soft);
}

tbody tr:hover {
  background: #f7fbff;
}

.totalRow {
  background: #f0f7ff;
  font-weight: 700;
}

.totalRow td {
  position: sticky;
  top: 29px;
  z-index: 2;
  background: #f0f7ff;
  border-bottom: 2px solid var(--accent);
}

tbody tr.totalRow:hover {
  background: #f0f7ff;
}

.statusBadge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

.statusCell {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
}

.statusCell .statusBadge {
  justify-self: start;
}

.statusMain {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.statusActionBadge {
  height: auto;
  min-height: 18px;
  padding: 1px 6px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.statusActionBadge:hover {
  background: #dcfce7;
  color: #15803d;
  filter: brightness(0.97);
  box-shadow: 0 0 0 1px rgba(203, 17, 171, 0.24);
}

.statusBadge_blocked.statusActionBadge:hover {
  background: #dcecff;
  color: #1d6fcb;
}

.statusConfirmBtn {
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.groupActionPopup,
.budgetPopup {
  position: absolute;
  z-index: 80;
  width: min(420px, calc(100vw - 24px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.22);
}

.popupTitle {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 750;
}

.popupText {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  white-space: normal;
}

.budgetPopupLabel {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.budgetPopupInput {
  height: 36px;
  border-radius: 6px;
  font-size: 14px;
}

.budgetPopupHint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.groupActionPopupActions,
.budgetPopupActions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.ruleAssignList {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
  padding: 2px 0;
}

.ruleAssignList label {
  min-height: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
}

.ruleAssignList label:hover {
  background: var(--soft);
}

.ruleAssignList input {
  width: 14px;
  height: 14px;
  min-height: 14px;
}

.statusInfoBtn {
  width: 20px;
  min-width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  border: 1px solid #94a3b8;
  border-radius: 999px;
  background: #fff;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  justify-self: end;
}

.statusInfoBtn:hover {
  background: var(--soft);
  color: var(--accent);
}

.statusHistoryPopover {
  position: absolute;
  z-index: 50;
  width: 280px;
  max-height: 320px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
}

.statusHistoryTitle {
  margin-bottom: 8px;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.statusHistoryList {
  display: grid;
  gap: 6px;
}

.statusHistoryItem {
  display: grid;
  gap: 2px;
  padding: 6px;
  border-radius: 6px;
  background: #f8fafc;
  font-size: 12px;
}

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

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

.statusHistoryEmpty {
  color: var(--muted);
  font-size: 13px;
}

.statusBadge_moderation {
  color: #a15c00;
  background: #fff4cc;
}

.statusBadge_deleted {
  color: #374151;
  background: #e5e7eb;
}

.statusBadge_rejected {
  color: #b91c1c;
  background: #fee2e2;
}

.statusBadge_active {
  color: #15803d;
  background: #dcfce7;
}

.statusBadge_blocked {
  color: #1d6fcb;
  background: #dcecff;
}

.statusBadge_unknown {
  color: #64748b;
  background: #f1f5f9;
}

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

.autoRuleBuilder {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.autoRuleBuilder[hidden] {
  display: none;
}

.autoRuleGrid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(180px, 0.8fr) minmax(150px, 0.55fr) auto;
  gap: 12px;
  align-items: end;
}

.autoRuleActiveLabel {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 650;
}

.autoRuleActiveLabel input {
  width: 14px;
  height: 14px;
}

.autoRuleConditionsHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.autoRuleConditions {
  display: grid;
  gap: 8px;
}

.autoRuleConditionRow {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(90px, 0.4fr) minmax(150px, 0.7fr) auto;
  gap: 8px;
  align-items: center;
}

.autoRuleConditionRow .secondaryBtn {
  min-height: 38px;
}

.autoRuleBuilderActions,
.autoRuleActionsCell {
  display: flex;
  gap: 8px;
  align-items: center;
}

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

.autoRuleBuilderActions {
  justify-content: flex-end;
}

#autoRulesTable {
  min-width: 1000px;
}

.offerForm,
.userForm {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(220px, 320px) auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.offerForm label,
.userForm label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.offerForm button,
.userForm button {
  height: 38px;
  white-space: nowrap;
}

#offersTable,
#usersTable {
  min-width: 720px;
}

@media (max-width: 760px) {
  .app {
    width: min(100% - 20px, 1420px);
  }

  .sectionHead {
    display: grid;
  }

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

  .dateRangePicker {
    position: fixed;
    inset: 12px;
    width: auto;
    overflow: auto;
  }

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

  .calendarTop {
    display: flex;
    justify-content: space-between;
    height: 34px;
  }

  .iconBtn {
    position: static;
  }

  .periodPresets {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 12px;
  }

  .autoRuleGrid,
  .autoRuleConditionRow {
    grid-template-columns: 1fr;
  }

  .autoRuleBuilderActions,
  .autoRuleActionsCell {
    flex-wrap: wrap;
  }
}
