* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: #1f2430;
  background: #ffffff;
}

.app {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 40px;
  border-bottom: 1px solid #e5e7eb;
}

.brand-link {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 18px;
  font-weight: 500;
  color: #111827;
  text-decoration: none;
}

.brand-link:hover {
  color: #374151;
}

.topbar-brand {
  font-size: 18px;
  font-weight: 500;
  color: #111827;
  font-family: inherit;
}

.back-bar {
  margin-bottom: 24px;
}
.topbar .back-bar {
  margin-bottom: 0;
}
.topbar .back-bar .btn-secondary {
  color: #000000;
}
.back-bar .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  color: #000000;
  background: transparent;
  border-radius: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: text-decoration 0.2s ease, opacity 0.2s ease;
}
.back-bar .btn-secondary:hover {
  text-decoration: underline;
  opacity: 0.8;
}
.back-bar .btn-secondary svg {
  flex-shrink: 0;
}

.brand-text {
  font-family: "Sometype Mono", "SFMono-Regular", Menlo, Consolas,
    "Liberation Mono", monospace;
  font-weight: 500;
  color: #111827;
  font-size: 18px;
}

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

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #4b5563;
  font-size: 14px;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
}

.icon-button::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: #f3f4f6;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.icon-button:hover::before {
  opacity: 1;
}

.icon-button img {
  width: 36px;
  height: 36px;
  display: block;
  position: relative;
  z-index: 1;
  pointer-events: none;
}

.icon-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  top: 100%;
  transform: translate(-50%, 6px);
  background: #111827;
  color: #fff;
  padding: 6px 8px;
  font-size: 11px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
}

.icon-button:hover::after {
  opacity: 1;
}

.account-menu {
  position: relative;
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 260px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 18px 30px rgba(15, 23, 42, 0.14);
  padding: 12px;
  display: none;
  z-index: 5;
}

.account-dropdown.open {
  display: block;
}

.account-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 8px;
}

.account-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #c2410c;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
}

.account-name {
  font-weight: 600;
  color: #111827;
}

.account-email {
  font-size: 13px;
  color: #6b7280;
}

.account-item {
  padding: 8px 4px;
  font-size: 14px;
  color: #111827;
  cursor: pointer;
}

.account-item:hover {
  color: #1d4ed8;
}

.content {
  padding: 28px 56px 48px;
}

.header h1 {
  margin: 0 0 12px;
  font-size: 28px;
  font-weight: 600;
}

.tabs {
  display: flex;
  gap: 20px;
  font-size: 14px;
  border-bottom: 1px solid #eef0f4;
  padding-bottom: 12px;
}

.tab {
  background: transparent;
  border: none;
  color: #6b7280;
  padding-bottom: 10px;
  position: relative;
  font: inherit;
  cursor: pointer;
}

.tab.active {
  color: #3f5bf6;
  font-weight: 600;
}

.tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 2px;
  background: #3f5bf6;
}

.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}

.filters-left {
  display: flex;
  gap: 12px;
  flex: 1;
}

.filters-advertisers {
  justify-content: space-between;
}

.filters-jobs {
  justify-content: space-between;
}

.search-input {
  flex: 1;
  display: flex;
  align-items: center;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  gap: 8px;
  background: #fff;
  color: #9ca3af;
  position: relative;
}

.search-input input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: #1f2937;
}

.clear-btn {
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.select {
  min-width: 160px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  color: #6b7280;
  background: #fff;
  background-image: linear-gradient(45deg, transparent 50%, #9ca3af 50%),
    linear-gradient(135deg, #9ca3af 50%, transparent 50%),
    linear-gradient(to right, #fff, #fff);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%,
    calc(100% - 36px) 0.5em;
  background-size: 6px 6px, 6px 6px, 1px 1.8em;
  background-repeat: no-repeat;
  padding-right: 36px;
}

.primary {
  min-width: 120px;
  background: #2d46f6;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-family: "SF Pro Text", "SF Pro Display", -apple-system, "Segoe UI",
    system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.primary.is-disabled {
  background: #c7d2fe;
  color: #f8fafc;
  cursor: not-allowed;
}

.secondary {
  border: 1px solid #c7d2fe;
  color: #2d46f6;
  background: #fff;
  border-radius: 8px;
  padding: 10px 16px;
  font-family: "SF Pro Text", "SF Pro Display", -apple-system, "Segoe UI",
    system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.table-card {
  margin-top: 18px;
  border: 1px solid #eef0f4;
  border-radius: 10px;
  overflow-x: auto;
  overflow-y: hidden;
}

.hidden {
  display: none !important;
}

.alert-banner {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  color: #3730a3;
  font-size: 13px;
}

.state-message {
  padding: 16px;
  border-top: 1px solid #eef0f4;
  font-size: 13px;
  color: #6b7280;
}

.error-state {
  color: #b91c1c;
}

.table-header,
.table-row {
  display: grid;
  grid-template-columns: 2.6fr 1fr 1fr 1fr 1fr 1fr 0.8fr;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  font-size: 13px;
}

.table-row {
  min-height: 68px;
}

.table-header {
  background: #f9fafb;
  color: #6b7280;
  font-weight: 600;
}

.table-row {
  border-top: 1px solid #eef0f4;
  font-size: 13px;
  color: #1f2937;
  background: #fff;
}

.table-header.partners,
.table-row.partners {
  grid-template-columns: 240px 1.2fr 0.9fr 1fr 1.2fr 0.9fr 1fr;
  min-width: 980px;
}

.table-header.advertisers,
.table-row.advertisers {
  grid-template-columns: 1.1fr 2fr 0.7fr 0.7fr 0.3fr 0.3fr;
  min-width: 980px;
}

.table-header.jobs,
.table-row.jobs {
  grid-template-columns: 1.1fr 2.4fr 0.2fr;
  min-width: 980px;
}

.table-row.jobs {
  align-items: flex-start;
}

.table-header.main-table,
.table-row.main-table {
  grid-template-columns: 0.4fr 1.6fr 1.1fr 1fr 1fr 1fr 0.3fr;
}

.table-header.main-table div:first-child,
.table-row.main-table div:first-child {
  padding-right: 16px;
}

.link {
  color: #2d46f6;
  text-decoration: none;
  font-weight: 500;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  color: #3f5bf6;
  background: #eef2ff;
  justify-self: start;
}

.status-pill.status-active {
  color: #0f766e;
  background: #ccfbf1;
}

.status-pill.status-archived {
  color: #6b7280;
  background: #f3f4f6;
}

.status-pill.status-pending {
  color: #b45309;
  background: #fef3c7;
}

.status-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: space-between;
}

.two-line div:first-child {
  color: #6b7280;
}

.muted {
  color: #6b7280;
  font-weight: 500;
}

.row-actions {
  position: relative;
  display: flex;
}

.table-row.advertisers .row-actions,
.table-row.jobs .row-actions {
  width: 100%;
  justify-content: flex-end;
}

.more-btn {
  border: none;
  background: transparent;
  color: #4f46e5;
  font-size: 16px;
  cursor: pointer;
  padding: 4px 6px;
}

.menu {
  position: absolute;
  top: 28px;
  right: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
  min-width: 140px;
  display: none;
  z-index: 5;
}

.menu.open {
  display: grid;
}

.menu-item {
  background: transparent;
  border: none;
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  color: #1f2937;
}

.menu-item:hover {
  background: #f3f4f6;
}

.setup-details {
  color: #6b7280;
  font-size: 12px;
  line-height: 1.6;
}

.tv-check {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #5b6bff;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.place-id-cell,
.editable-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.place-id-editor,
.editable-editor {
  display: none;
  align-items: center;
  gap: 6px;
}

.place-id-cell:hover .place-id-value,
.place-id-cell.editing .place-id-value,
.editable-cell:hover .editable-value,
.editable-cell.editing .editable-value {
  display: none;
}

.place-id-cell:hover .place-id-editor,
.place-id-cell.editing .place-id-editor,
.editable-cell:hover .editable-editor,
.editable-cell.editing .editable-editor {
  display: inline-flex;
}

.place-id-editor input,
.editable-editor input {
  width: 140px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
  color: #111827;
  height: 40px;
}

.table-row.advertisers div:nth-child(2) .editable-editor input {
  width: 400px;
}

.edit-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 6px;
  padding: 0 8px;
  font-size: 12px;
  cursor: pointer;
  color: #4b5563;
  height: 32px;
}

.edit-btn:hover {
  background: #f3f4f6;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
  color: #6b7280;
  font-size: 13px;
}

.page-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.page-btn.active {
  border-color: #3f5bf6;
  color: #3f5bf6;
  font-weight: 600;
}

.page-btn.muted {
  color: #9ca3af;
}

.dots {
  padding: 0 4px;
}

.main-page h1 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}

.main-page p {
  margin: 0 0 18px;
  color: #6b7280;
  font-size: 13px;
}

.main-tabs {
  display: flex;
  gap: 16px;
  border-bottom: 1px solid #eef0f4;
  margin-bottom: 14px;
}

.main-tab {
  background: transparent;
  border: none;
  padding: 8px 2px 12px;
  font-size: 13px;
  color: #6b7280;
  cursor: pointer;
  position: relative;
}

.main-tab.active {
  color: #2d46f6;
  font-weight: 600;
}

.main-tab.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #2d46f6;
}

.main-filters {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 0.6fr auto auto auto;
  gap: 10px;
  align-items: center;
  margin: 10px 0 8px;
}

.date-input {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #6b7280;
  background: #fff;
}

.date-input input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 13px;
  color: #1f2937;
}

.results-count {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 8px;
}

.logo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.status-dot.pending {
  background: #a855f7;
}

.status-dot.complete {
  background: #22c55e;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  display: grid;
  place-items: center;
  padding: 24px;
  z-index: 20;
}

.modal {
  width: 520px;
  max-width: 100%;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 40px rgba(15, 23, 42, 0.2);
  padding: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  color: #6b7280;
}

.modal-body {
  display: grid;
  gap: 14px;
}

.modal-field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: #6b7280;
}

.modal-field input,
.modal-field select,
.modal-field textarea {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  color: #111827;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #111827;
  color: #fff;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.2);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 30;
}

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

@media (max-width: 1100px) {
  .content {
    padding: 24px;
  }

  .filters {
    flex-wrap: wrap;
  }

  .filters-advertisers {
    gap: 16px;
  }

  .filters-jobs {
    gap: 16px;
  }

  .filters-left {
    width: 100%;
    flex-wrap: wrap;
  }

  .table-header,
  .table-row {
    grid-template-columns: 2fr 1fr 1fr 0.8fr;
    gap: 8px;
  }

  .table-header.partners,
  .table-row.partners {
    grid-template-columns: 1.6fr 1fr 0.7fr 0.5fr;
  }

  .table-header.advertisers,
  .table-row.advertisers {
    grid-template-columns: 1.4fr 1.2fr 0.6fr 0.4fr;
  }

  .table-header.jobs,
  .table-row.jobs {
    grid-template-columns: 1.4fr 1.6fr 0.3fr;
  }
}
