﻿:root {
  color-scheme: light;
  --bg: #f4f3fb;
  --ink: #111022;
  --muted: #5f6074;
  --card: #ffffff;
  --accent: #5d5fef;
  --accent-2: #2c6e63;
  --border: #e5e6f0;
  --shadow: 0 22px 50px rgba(26, 22, 56, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

html {
  overflow: hidden;
}

body {
  min-height: 100%;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: radial-gradient(circle at 20% 20%, #f9f7ff 0%, var(--bg) 45%, #eef1fb 100%);
  color: var(--ink);
  padding: 32px 24px 56px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
}

.layout {
  max-width: 1220px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.bg-orb {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  opacity: 0.25;
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
}
.orb-a {
  background: #c7d6ff;
  top: -80px;
  right: -60px;
}
.orb-b {
  background: #c6f1e6;
  bottom: -120px;
  left: -60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar h1 {
  margin: 0 0 6px;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 0;
  color: var(--muted);
}
.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

button {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink);
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(26, 22, 56, 0.16);
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
}
button.ghost {
  background: transparent;
}
button.small {
  padding: 6px 10px;
  font-size: 0.8rem;
  border-radius: 10px;
}
.toggle {
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  color: #fff;
}
.toggle.on {
  background: #2c6e63;
}
.toggle.off {
  background: #c44a3d;
}
.toggle:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.status {
  margin: 16px 0;
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 10px 24px rgba(26, 22, 56, 0.08);
}
.status.ok {
  border-left: 4px solid var(--accent-2);
}
.status.error {
  border-left: 4px solid #d1543b;
  color: #8f2c22;
  background: #fff5f3;
}
.status.neutral {
  border-left: 4px solid var(--border);
  color: var(--muted);
}

.grid {
  margin-top: 20px;
  display: grid;
  gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  position: relative;
  z-index: 1;
  min-width: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.card.wide {
  grid-column: span 2;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 700;
}
.section-title {
  margin: 4px 0 0;
  font-size: 1.2rem;
}

.chip {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f1f2f6;
  color: var(--muted);
}
.chip.neutral {
  background: #eef0f7;
  color: #4f5b66;
}
.chip.warn {
  background: #fff4e5;
  color: #a35b00;
  border: 1px solid #f1c27d;
}
.chip-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.metric-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(140deg, #fff, #f8f9ff);
}
.metric-card[data-tone="primary"] {
  border-color: #d5d8ff;
  background: linear-gradient(140deg, #f3f4ff, #ffffff);
}
.metric-label {
  color: var(--muted);
  font-size: 0.8rem;
}
.metric-value {
  font-weight: 700;
  font-size: 1.4rem;
  margin: 6px 0;
}
.metric-helper {
  color: var(--muted);
  font-size: 0.85rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--ink);
}
.field input,
.field select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fbfbff;
  font-size: 0.95rem;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 0.85rem;
}

.table-wrapper {
  overflow-x: auto;
  position: relative;
  border-radius: 12px;
  -webkit-overflow-scrolling: touch;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
.table-wrapper table th {
  text-align: left;
  font-size: 0.85rem;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 14px 10px;
  white-space: nowrap;
}
tbody td {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover td {
  background: #f7f8ff;
}
tbody tr:last-child td {
  padding-bottom: 4px;
}
.summary-row td {
  border-top: 2px solid var(--border);
  background: #f5f7ff;
}

.url-cell .url {
  word-break: break-all;
  color: var(--ink);
  font-weight: 600;
}
.url-cell .muted {
  margin-top: 4px;
}

.budget-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.budget-cell input {
  width: 96px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fbfbff;
  font-size: 0.85rem;
}
.budget-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.budget-meta {
  line-height: 1.1;
}

.actions.presets {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.logs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 240px;
  overflow: auto;
}
.log-line {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8f9ff;
}
.log-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.log-message {
  font-weight: 700;
  color: var(--ink);
}
.log-detail {
  background: #fff;
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: 8px;
  font-size: 0.8rem;
  margin-top: 6px;
  white-space: pre-wrap;
  word-break: break-word;
}
.pill.neutral {
  background: #eef0f7;
  color: #4f5b66;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.tabs {
  display: inline-flex;
  gap: 10px;
  margin: 12px 0 4px;
}
.tab {
  border: 1px solid var(--border);
  background: #f7f8ff;
  color: var(--muted);
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tab:not(.active):hover {
  background: #eef0ff;
  color: var(--ink);
}

.dup-grid {
  margin-top: 20px;
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 24px;
}
.dup-campaign {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #f8f9ff;
  margin-bottom: 14px;
}
.dup-campaign-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.dup-adset {
  border-top: 1px dashed var(--border);
  padding-top: 10px;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dup-adset-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.dup-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dup-actions input {
  width: 70px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.dup-ads {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}
.dup-ads li {
  font-size: 0.9rem;
  color: var(--muted);
}
.draft-list {
  display: grid;
  gap: 14px;
}
.draft-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.draft-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.draft-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.draft-card .table-wrapper input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fbfbff;
}

@media (max-width: 900px) {
  .card.wide {
    grid-column: span 1;
  }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .dup-grid {
    grid-template-columns: 1fr;
  }
}

.totals-row { margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 12px; background: #f8f9ff; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; font-size: 0.95rem; }

/* Mobile refinements */
@media (max-width: 720px) {
  body {
    padding: 18px 14px 32px;
  }
  .layout {
    width: 100%;
  }
  .topbar h1 {
    font-size: 1.6rem;
  }
  .subtitle {
    font-size: 0.95rem;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .card {
    padding: 16px;
  }
  .card-head {
    gap: 8px;
  }
  .metrics-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
  }
  .filters {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
  }
  .actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .actions.presets button {
    flex: 1 1 140px;
  }
  .tabs {
    width: 100%;
    flex-wrap: wrap;
  }
  .tab {
    flex: 1 1 140px;
    text-align: center;
  }
  .table-wrapper {
    margin: 0;
    width: 100%;
    max-width: 100%;
  }
 .table-wrapper table th,
  tbody td {
    padding: 8px 8px;
    font-size: 0.85rem;
  }
  .table-wrapper table th {
    white-space: nowrap;
    word-break: normal;
  }
.table-wrapper table td {
  white-space: normal;
  word-break: break-word;
}
  .table-wrapper table {
    table-layout: auto;
  }
}

.table-wrapper {
  width: 100%;
  max-width: 100%;
}
.table-wrapper table {
  width: 100%;
  table-layout: auto;
}
.scroll-x {
  overflow-x: auto;
  overflow-y: visible;
  -webkit-overflow-scrolling: auto;
  overscroll-behavior-x: contain;
}
.scroll-x table {
  width: max-content;
  min-width: 980px;
}
.scroll-x table th {
  white-space: nowrap;
}
.meta-campaigns .table-wrapper.scroll-x table {
  min-width: 1350px;
}
.meta-campaigns .filters {
  margin-top: 2px;
}
@media (max-width: 720px) {
  .table-wrapper {
    margin: 0;
    width: 100%;
    max-width: 100%;
  }
  .table-wrapper table {
    width: 100%;
    table-layout: auto;
  }
  .table-wrapper table th {
    white-space: nowrap;
    word-break: normal;
  }
  .table-wrapper table td {
    white-space: normal;
    word-break: break-word;
  }
  .scroll-x table {
    min-width: 980px;
    table-layout: auto;
  }
}

