:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --ink: #1d2524;
  --muted: #66716f;
  --line: #dbe1dc;
  --panel: #ffffff;
  --accent: #126b5d;
  --accent-dark: #0d5148;
  --warn: #a35b15;
  --danger: #a43838;
  --soft: #e9f2ef;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

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

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 84%), rgb(246 247 244 / 96%)),
    var(--bg);
}

.login-screen[hidden],
#appShell[hidden] {
  display: none !important;
}

.login-box {
  width: min(380px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(29 37 36 / 14%);
  padding: 22px;
}

.login-box h1 {
  margin: 4px 0;
}

.login-error {
  min-height: 18px;
  color: var(--danger);
  font-weight: 700;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0 14px;
  cursor: pointer;
}

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

button:disabled {
  border-color: #c8cfca;
  background: #d9dfda;
  color: #7f8985;
  cursor: not-allowed;
}

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

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

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

.topbar strong {
  display: inline-block;
  margin-right: 12px;
  font-size: 16px;
}

#statusText {
  color: var(--muted);
  font-size: 13px;
}

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

.user-text {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.app-tabs {
  height: 44px;
  display: flex;
  align-items: end;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 0 14px;
}

.app-tabs button {
  min-height: 36px;
  border-color: transparent;
  border-bottom: 3px solid transparent;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.app-tabs button:hover,
.app-tabs button.active {
  border-bottom-color: var(--accent);
  background: #eef2ee;
  color: var(--ink);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(640px, 1fr) minmax(320px, 33vw);
  height: calc(100vh - 102px);
}

.app-view[hidden] {
  display: none !important;
}

.logs-view {
  height: calc(100vh - 102px);
  overflow: hidden;
  background: #fbfcfa;
}

.users-view {
  height: calc(100vh - 102px);
  overflow: auto;
  background: #fbfcfa;
}

.evolution-view {
  height: calc(100vh - 102px);
  overflow: auto;
  background: #fbfcfa;
}

.events-pane,
.editor-pane {
  min-width: 0;
  overflow: hidden;
}

.events-pane {
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

.filters {
  display: grid;
  grid-template-columns: 1.1fr 150px 1fr 130px auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.table-shell {
  height: calc(100% - 83px);
  overflow: auto;
}

.table-shell table,
.logs-table {
  min-width: 680px;
}

.event-section {
  border-bottom: 1px solid var(--line);
}

.section-toggle {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #eef2ee;
  color: #31413d;
  font-weight: 800;
  text-align: left;
}

.section-toggle:hover {
  background: #e2ebe6;
  color: #31413d;
}

.section-toggle span::before {
  content: "v";
  display: inline-block;
  width: 18px;
}

.event-section.collapsed .section-toggle span::before {
  content: ">";
}

.event-section.collapsed .section-body {
  display: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2ee;
  color: #44504d;
  font-size: 11px;
  text-transform: uppercase;
}

th:nth-child(1),
td:nth-child(1) {
  width: 42%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 20%;
}

th:nth-child(n+3),
td:nth-child(n+3) {
  width: 12%;
  text-align: right;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: var(--soft);
}

.event-name {
  color: var(--ink);
  font-weight: 700;
}

.event-title-cell {
  --favorite-col: 36px;
}

.event-main-line {
  display: grid;
  grid-template-columns: var(--favorite-col) minmax(0, 1fr);
  align-items: center;
  column-gap: 6px;
}

.event-main-line .event-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.favorite-btn {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: #9a8d63;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.favorite-btn:hover {
  border-color: #d2bf67;
  background: #fff8d8;
  color: #8a6a00;
}

.favorite-btn.active {
  color: #b88400;
}

.event-sub {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.event-title-cell .event-sub {
  margin-left: 42px;
}

.editor-pane {
  overflow: auto;
  background: var(--panel);
  padding: 18px;
}

.event-log-pane {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  padding: 0;
}

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

.event-log-head button {
  flex: 0 0 auto;
}

.event-log-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
  padding: 10px 18px;
}

.event-log-summary strong {
  color: var(--accent-dark);
}

.event-log-summary span {
  color: var(--muted);
  font-size: 12px;
}

.event-change-log-list {
  min-height: 0;
  overflow: auto;
  padding: 8px 18px 18px;
}

.event-change-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.event-change-item strong {
  align-self: start;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-dark);
  padding: 6px 8px;
  text-align: center;
}

.event-change-item span,
.event-change-item small,
.event-change-item code {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-change-item span {
  font-weight: 800;
}

.event-change-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.event-change-item code {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

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

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 4px 0;
  font-size: 22px;
  line-height: 1.18;
  letter-spacing: 0;
}

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

.toggles {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.toggles label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 9px;
  color: var(--ink);
  background: #fbfcfa;
}

.toggles input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.odds-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.odds-toolbar div {
  display: flex;
  gap: 8px;
}

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

.odd-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 78px 92px 86px;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfa;
}

.odd-label {
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.odd-current {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  padding-bottom: 9px;
}

.odd-update-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  color: var(--ink);
  font-size: 12px;
}

.odd-update-toggle input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.odd-row.disabled {
  background: #f4f6f3;
}

.odd-row.disabled .odd-label {
  color: var(--muted);
}

.log {
  min-height: 44px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: pre-wrap;
}

.log strong {
  color: var(--ink);
}

.logs-head {
  display: none;
  height: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 0 18px;
}

.logs-head h1 {
  margin: 0 0 4px;
  font-size: 20px;
}

.logs-table-shell {
  height: 100%;
  overflow: auto;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  padding: 16px;
}

.users-table-shell {
  min-width: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.users-table {
  min-width: 620px;
}

.users-table tbody tr {
  cursor: pointer;
}

.users-table tbody tr:hover {
  background: #f3f8f6;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 20%;
  text-align: left;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  width: 28%;
  text-align: left;
  overflow-wrap: anywhere;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3),
.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  width: 18%;
  text-align: left;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  width: 16%;
  text-align: right;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.row-actions button {
  min-height: 32px;
  padding: 0 10px;
}

.user-form {
  align-self: start;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.user-form h1 {
  margin: 4px 0 0;
  font-size: 20px;
}

.evolution-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  padding: 16px;
}

.evolution-groups-shell,
.evolution-config-shell {
  min-width: 0;
}

.evolution-groups-shell,
.evolution-config-form,
.evolution-sender-form,
.evolution-senders-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.evolution-head h1,
.evolution-config-form h1,
.evolution-sender-form h1 {
  margin: 4px 0 0;
  font-size: 20px;
}

.evolution-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.evolution-status-grid div {
  min-width: 0;
  display: grid;
  gap: 4px;
  background: #f8faf8;
  padding: 12px 14px;
}

.evolution-status-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.evolution-status-grid strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.evolution-table-shell {
  overflow: auto;
}

.evolution-groups-table,
.evolution-senders-table {
  min-width: 720px;
}

.evolution-groups-table th:nth-child(1),
.evolution-groups-table td:nth-child(1) {
  width: 24%;
  text-align: left;
}

.evolution-groups-table th:nth-child(2),
.evolution-groups-table td:nth-child(2) {
  width: 34%;
  text-align: left;
  overflow-wrap: anywhere;
}

.evolution-groups-table th:nth-child(3),
.evolution-groups-table td:nth-child(3),
.evolution-groups-table th:nth-child(4),
.evolution-groups-table td:nth-child(4) {
  width: 12%;
}

.evolution-groups-table th:nth-child(5),
.evolution-groups-table td:nth-child(5) {
  width: 18%;
  text-align: right;
}

.evolution-config-shell {
  display: grid;
  align-content: start;
  gap: 16px;
}

.evolution-config-form,
.evolution-sender-form {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.evolution-senders-shell {
  overflow: auto;
}

.evolution-senders-table {
  min-width: 520px;
}

.evolution-senders-table th:nth-child(1),
.evolution-senders-table td:nth-child(1),
.evolution-senders-table th:nth-child(2),
.evolution-senders-table td:nth-child(2) {
  width: 28%;
  text-align: left;
}

.evolution-senders-table th:nth-child(3),
.evolution-senders-table td:nth-child(3) {
  width: 18%;
}

.evolution-senders-table th:nth-child(4),
.evolution-senders-table td:nth-child(4) {
  width: 26%;
  text-align: right;
}

.form-note {
  font-size: 12px;
  line-height: 1.35;
}

.form-message {
  min-height: 18px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.form-message.success {
  color: var(--accent);
}

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

.user-sites-field {
  display: grid;
  gap: 8px;
}

.inline-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inline-field-head strong {
  font-size: 12px;
}

.inline-field-head button {
  min-height: 30px;
  padding: 0 10px;
}

.user-sites-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.user-site-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  padding: 8px;
  color: var(--ink);
}

.user-site-item input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.user-site-item span {
  min-width: 0;
}

.user-site-item strong,
.user-site-item small {
  display: block;
}

.user-site-item strong {
  font-size: 12px;
  line-height: 1.2;
}

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

.user-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.user-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 34;
  display: grid;
  place-items: center;
  background: rgb(29 37 36 / 42%);
  padding: 18px;
}

.user-edit-modal[hidden] {
  display: none;
}

.user-edit-dialog {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(29 37 36 / 18%);
}

.user-edit-form {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  max-height: min(760px, calc(100vh - 36px));
}

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

.user-edit-head h2 {
  margin: 2px 0 4px;
  font-size: 22px;
}

.user-edit-head p {
  margin: 0;
  color: var(--muted);
}

.user-edit-body {
  min-height: 0;
  display: grid;
  gap: 12px;
  overflow: auto;
  padding: 16px;
}

.user-edit-body .user-sites-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: 310px;
}

.user-edit-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.logs-table th:nth-child(1),
.logs-table td:nth-child(1) {
  width: 145px;
  text-align: left;
}

.logs-table th:nth-child(2),
.logs-table td:nth-child(2) {
  width: 26%;
  text-align: left;
}

.logs-table th:nth-child(3),
.logs-table td:nth-child(3) {
  width: 16%;
  text-align: left;
}

.logs-table th:nth-child(4),
.logs-table td:nth-child(4) {
  width: 16%;
  text-align: left;
}

.logs-table th:nth-child(n+5),
.logs-table td:nth-child(n+5) {
  width: 10%;
  text-align: right;
}

.logs-table td:last-child {
  color: var(--accent);
  font-weight: 800;
}

.loading-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgb(29 37 36 / 42%);
  padding: 18px;
}

.loading-modal[hidden] {
  display: none;
}

.loading-dialog {
  width: min(420px, 100%);
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(29 37 36 / 18%);
  padding: 18px;
}

.loading-modal.done .loading-dialog {
  width: min(560px, 100%);
  align-items: start;
}

.loading-dialog h2 {
  margin: 0 0 4px;
  font-size: 17px;
  letter-spacing: 0;
}

.loading-dialog p {
  max-height: min(280px, 45vh);
  overflow: auto;
  line-height: 1.35;
  white-space: pre-line;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #dbe1dc;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.loading-modal.success .spinner,
.loading-modal.error .spinner {
  display: grid;
  place-items: center;
  border: 0;
  background: var(--accent);
  color: #fff;
  animation: none;
}

.loading-modal.error .spinner {
  background: #b42318;
}

.loading-modal.success .spinner::before {
  content: "OK";
  font-weight: 900;
  font-size: 12px;
}

.loading-modal.error .spinner::before {
  content: "!";
  font-weight: 900;
  font-size: 22px;
}

.loading-close {
  margin-top: 12px;
}

.loading-close[hidden] {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.site-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgb(29 37 36 / 42%);
  padding: 18px;
}

.site-modal[hidden] {
  display: none;
}

.site-dialog {
  width: min(860px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(29 37 36 / 18%);
}

.site-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 16px;
}

.site-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.site-manager {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.site-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.site-item {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfa;
  color: var(--ink);
  text-align: left;
  padding: 9px 10px;
}

.site-item:hover,
.site-item.selected {
  border-color: var(--accent);
  background: var(--soft);
}

.site-item strong,
.site-item span {
  display: block;
}

.site-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

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

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

.site-active {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.site-active input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.site-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
  grid-column: 1 / -1;
}

.bulk-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  background: rgb(29 37 36 / 42%);
  padding: 18px;
}

.bulk-modal[hidden] {
  display: none;
}

.bulk-dialog {
  width: min(1320px, calc(100vw - 36px));
  max-height: min(820px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(29 37 36 / 18%);
}

.bulk-head,
.bulk-foot,
.bulk-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bulk-head {
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
}

.bulk-head h2 {
  margin: 2px 0 3px;
  font-size: 20px;
}

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

.bulk-body {
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.bulk-sites,
.bulk-markets {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.bulk-sites {
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

.bulk-panel-head {
  position: sticky;
  top: -14px;
  z-index: 1;
  margin-bottom: 10px;
  padding-bottom: 6px;
}

.bulk-sites .bulk-panel-head {
  background: #fbfcfa;
}

.bulk-markets .bulk-panel-head {
  background: #fff;
}

.bulk-panel-head button {
  min-height: 30px;
  padding: 0 10px;
}

.bulk-sites-list,
.bulk-odds-list {
  display: grid;
  gap: 8px;
}

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

.bulk-site-item,
.bulk-odd-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 10px;
}

.bulk-site-item {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
}

.bulk-site-item input,
.bulk-odd-check input {
  width: 16px;
  min-height: 16px;
  padding: 0;
}

.bulk-site-item span,
.bulk-current {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.bulk-odd-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  min-height: 74px;
  gap: 4px 8px;
  align-items: center;
  overflow: hidden;
}

.bulk-odd-check {
  display: flex;
  align-items: center;
  gap: 8px;
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  color: var(--ink);
  font-weight: 750;
}

.bulk-odd-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-odd-check em {
  color: var(--warn);
  font-style: normal;
  font-weight: 800;
}

.bulk-current {
  grid-column: 1;
  grid-row: 2;
  text-align: left;
}

.bulk-odd-item > label:not(.bulk-odd-check) {
  grid-column: 2;
  grid-row: 1 / span 2;
  gap: 4px;
  min-width: 0;
}

.bulk-odd-item > label:not(.bulk-odd-check) input {
  width: 100%;
  min-height: 36px;
}

.bulk-odd-item.disabled {
  opacity: .58;
}

.bulk-odd-item.auto-off {
  background: #f7f8f6;
}

.bulk-odd-item.auto-off .bulk-odd-check span {
  color: var(--muted);
}

.bulk-odd-item.has-new-value {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent);
}

.bulk-site-item.disabled {
  opacity: .55;
}

.bulk-foot {
  border-top: 1px solid var(--line);
  background: #fbfcfa;
  padding: 12px 16px;
}

.bulk-foot span {
  color: var(--muted);
  font-size: 13px;
}

.live-odds-view {
  height: calc(100vh - 102px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #fbfcfa;
}

.live-odds-head {
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.live-odds-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) 90px 112px 100px 150px auto;
  gap: 10px;
  align-items: end;
  padding: 12px 14px 8px;
}

.live-check {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.live-check input {
  width: auto;
  min-height: auto;
}

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

.live-summary {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #eef2ee;
  padding: 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.live-summary strong {
  color: var(--ink);
}

.live-auto-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.live-odds-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(520px, 32vw);
}

.live-odds-table-shell,
.live-log-panel {
  min-width: 0;
  overflow: hidden;
}

.live-odds-table-shell {
  overflow: auto;
  border-right: 1px solid var(--line);
}

.live-filter-row {
  height: 50px;
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: #fff;
  padding: 7px 12px;
}

.live-filter-row span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-odds-table {
  min-width: 760px;
}

.live-odds-table th:nth-child(1),
.live-odds-table td:nth-child(1) {
  width: 44%;
  text-align: left;
}

.live-odds-table th:nth-child(2),
.live-odds-table td:nth-child(2) {
  width: 12%;
  text-align: right;
}

.live-odds-table th:nth-child(3),
.live-odds-table td:nth-child(3) {
  width: 12%;
  text-align: right;
}

.live-odds-table th:nth-child(4),
.live-odds-table td:nth-child(4) {
  width: 12%;
  text-align: right;
}

.live-odds-table th:nth-child(5),
.live-odds-table td:nth-child(5) {
  width: 20%;
  text-align: center;
}

.live-odds-table tbody tr {
  cursor: default;
}

.live-odd-value,
.live-odd-cell {
  color: var(--accent-dark);
  font-weight: 900;
}

.live-odd-cell.muted {
  color: var(--muted);
  font-weight: 700;
}

.live-more-cell {
  text-align: center !important;
}

.live-more-btn {
  min-width: 72px;
  min-height: 32px;
  padding: 0 10px;
}

.live-changed {
  animation: livePulse 2.8s ease-out;
  background: #fff0bd;
}

.live-event-changed {
  box-shadow: inset 3px 0 0 var(--warn);
}

@keyframes livePulse {
  0% {
    background: #ffe08a;
  }
  100% {
    background: transparent;
  }
}

.live-log-panel {
  display: grid;
  grid-template-rows: 50px minmax(0, 1fr);
  background: #fff;
}

.live-log-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
}

.live-log-head div {
  min-width: 0;
}

.live-log-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.live-log-head button {
  min-height: 32px;
  padding: 0 10px;
}

.live-log-list {
  overflow: auto;
  padding: 8px;
}

.empty-log {
  margin: 8px;
  color: var(--muted);
  font-size: 13px;
}

.live-log-item {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 8px 4px;
}

.live-log-item strong {
  align-self: start;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-dark);
  padding: 5px 7px;
  text-align: center;
}

.live-log-item span,
.live-log-item small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.live-log-item span {
  color: var(--ink);
  font-weight: 800;
}

.live-log-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.live-origin-badge {
  display: inline-block;
  border-radius: 4px;
  background: #e6f2ef;
  color: var(--accent-dark);
  padding: 1px 5px;
  font-size: 10px;
  line-height: 1.3;
}

.live-origin-obs {
  white-space: normal;
  overflow: visible;
  text-overflow: initial;
}

.live-odds-modal {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: grid;
  place-items: center;
  background: rgb(29 37 36 / 38%);
  padding: 18px;
}

.live-odds-modal[hidden] {
  display: none !important;
}

.live-odds-dialog {
  width: min(980px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgb(29 37 36 / 28%);
}

.live-odds-dialog-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.live-odds-dialog-head h2 {
  margin: 2px 0;
  font-size: 20px;
}

.live-odds-dialog-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.live-odds-dialog-body {
  overflow: auto;
}

.live-extra-table {
  min-width: 760px;
}

.live-extra-table th:nth-child(1),
.live-extra-table td:nth-child(1) {
  width: 30%;
  text-align: left;
}

.live-extra-table th:nth-child(2),
.live-extra-table td:nth-child(2) {
  width: 36%;
  text-align: left;
}

.live-extra-table th:nth-child(3),
.live-extra-table td:nth-child(3) {
  width: 12%;
  text-align: right;
}

.live-extra-table th:nth-child(4),
.live-extra-table td:nth-child(4) {
  width: 22%;
  text-align: left;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
    height: auto;
  }

  .logs-view {
    height: auto;
    min-height: calc(100vh - 102px);
  }

  .users-view {
    height: auto;
    min-height: calc(100vh - 102px);
  }

  .live-odds-view {
    height: auto;
    min-height: calc(100vh - 102px);
    overflow: visible;
  }

  .live-odds-controls {
    grid-template-columns: 1fr 100px 120px;
  }

  .live-actions {
    grid-column: 1 / -1;
  }

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

  .live-odds-table-shell {
    min-height: 520px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .live-log-panel {
    min-height: 360px;
  }

  .events-pane {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .table-shell {
    height: 46vh;
  }

  .filters,
  .details-grid,
  .toggles,
  .odds-grid {
    grid-template-columns: 1fr;
  }

  .editor-head,
  .event-log-head,
  .topbar {
    align-items: stretch;
    flex-direction: column;
    height: auto;
    padding: 12px;
  }

  .top-actions,
  .editor-actions,
  .site-actions,
  .user-actions,
  .bulk-foot {
    width: 100%;
  }

  .top-actions button,
  .editor-actions button,
  .site-actions button,
  .user-actions button,
  .bulk-foot button {
    flex: 1 1 130px;
  }

  .site-manager,
  .site-form,
  .users-layout,
  .evolution-layout,
  .bulk-body {
    grid-template-columns: 1fr;
  }

  .evolution-status-grid {
    grid-template-columns: 1fr;
  }

  .site-form .wide {
    grid-column: auto;
  }

  .bulk-sites {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .bulk-odd-item {
    grid-template-columns: minmax(0, 1fr) 88px;
  }
}

@media (max-width: 640px) {
  button {
    min-height: 40px;
  }

  .app-tabs {
    height: auto;
    padding: 6px 8px 0;
  }

  .app-tabs button {
    flex: 1 1 0;
  }

  .filters {
    padding: 10px;
  }

  .table-shell {
    height: 50vh;
  }

  .editor-pane {
    padding: 12px;
  }

  .event-log-pane {
    padding: 0;
  }

  .editor-head {
    gap: 10px;
  }

  .event-log-summary {
    grid-template-columns: 1fr;
  }

  .event-log-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 19px;
  }

  .odd-row {
    grid-template-columns: 1fr 72px;
  }

  .odd-row label,
  .odd-update-toggle {
    grid-column: 1 / -1;
  }

  .logs-table-shell {
    overflow: auto;
  }

  .live-odds-controls,
  .live-filter-row,
  .live-summary {
    grid-template-columns: 1fr;
  }

  .live-summary {
    align-items: flex-start;
    flex-direction: column;
    padding: 8px 12px;
  }

  .live-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .live-actions button {
    flex: 0 0 auto;
  }

  .live-log-item {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .users-layout {
    gap: 10px;
    padding: 10px;
  }

  .evolution-layout {
    gap: 10px;
    padding: 10px;
  }

  .users-table-shell {
    border-radius: 6px;
  }

  .users-table {
    min-width: 560px;
  }

  .user-form {
    order: -1;
    padding: 12px;
  }

  .user-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .evolution-head {
    align-items: stretch;
    flex-direction: column;
  }

  .user-actions button {
    flex: 0 0 auto;
  }

  .site-modal,
  .user-edit-modal,
  .bulk-modal,
  .loading-modal {
    padding: 0;
  }

  .site-dialog,
  .user-edit-dialog,
  .bulk-dialog,
  .loading-dialog {
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }

  .user-edit-form {
    max-height: 100dvh;
  }

  .user-edit-head,
  .user-edit-foot {
    align-items: stretch;
    flex-direction: column;
    padding: 12px;
  }

  .user-edit-body {
    padding: 12px;
  }

  .user-edit-body .user-sites-list {
    grid-template-columns: 1fr;
    max-height: 260px;
  }

  .bulk-dialog {
    height: 100dvh;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .bulk-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    padding: 10px 12px;
  }

  .bulk-head > div {
    min-width: 0;
  }

  .bulk-head h2 {
    margin: 2px 0;
    font-size: 18px;
  }

  .bulk-head p {
    font-size: 11px;
    line-height: 1.25;
  }

  .bulk-head button {
    grid-column: 2;
    grid-row: 1;
    width: auto;
    min-width: 72px;
    min-height: 34px;
    padding: 0 10px;
    flex: 0 0 auto;
  }

  .bulk-body {
    display: block;
    min-height: 0;
    overflow: auto;
  }

  .site-head {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-sites,
  .bulk-markets {
    overflow: visible;
    padding: 10px 12px;
  }

  .bulk-sites {
    max-height: 190px;
    overflow: auto;
  }

  .bulk-panel-head {
    margin-bottom: 7px;
  }

  .bulk-panel-head button {
    min-height: 32px;
    padding: 0 9px;
  }

  .bulk-sites-list,
  .bulk-odds-list {
    gap: 6px;
  }

  .bulk-odds-list {
    grid-template-columns: 1fr;
  }

  .bulk-site-item {
    min-height: 42px;
    gap: 7px;
    padding: 7px 8px;
  }

  .bulk-site-item div {
    min-width: 0;
  }

  .bulk-site-item strong {
    display: block;
    overflow: hidden;
    font-size: 11px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bulk-site-item span {
    margin-top: 1px;
    font-size: 10px;
  }

  .bulk-odd-item {
    grid-template-columns: minmax(0, 1fr) 88px;
    gap: 4px 8px;
    align-items: center;
    padding: 8px;
  }

  .bulk-odd-check {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    font-size: 12px;
    line-height: 1.2;
  }

  .bulk-current {
    grid-column: 1;
    grid-row: 2;
    font-size: 11px;
  }

  .bulk-odd-item > label:not(.bulk-odd-check) {
    grid-column: 2;
    grid-row: 1 / span 2;
    gap: 3px;
    font-size: 10px;
  }

  .bulk-odd-item > label:not(.bulk-odd-check) input {
    min-height: 34px;
    padding: 6px 7px;
  }

  .bulk-foot {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }

  .bulk-foot span {
    font-size: 11px;
    line-height: 1.25;
  }

  .bulk-foot button {
    min-height: 44px;
    flex: 0 0 auto;
  }

  .login-box {
    padding: 18px;
  }
}
