:root {
  --violet: #673ab7;
  --violet-light: #ede7ff;
  --violet-dark: #5e35b1;
  --border: #d1c4e9;
  --text: #222;
  --bg: #f5f5f5;
  --success: #4caf50;
  --warning: #ff9800;
  --danger: #f44336;
  --info: #2196f3;
  --sidebar-width: 240px;
  --sidebar-collapsed: 60px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

/* ==================== APP LAYOUT ==================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
  width: var(--sidebar-width);
  background: white;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: width 0.25s ease;
  overflow: hidden;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  min-height: 56px;
}

.sidebar-logo {
  font-size: 1.4rem;
  flex-shrink: 0;
}

.sidebar-title {
  font-weight: 700;
  color: var(--violet);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-title {
  display: none;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 16px 8px;
}

.sidebar.collapsed .sidebar-logo {
  display: none;
}

.sidebar.collapsed .sidebar-toggle {
  margin-left: 0;
}

.sidebar-toggle {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: #666;
  flex-shrink: 0;
}

.sidebar-toggle:hover {
  background: var(--violet-light);
  color: var(--violet);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.sidebar-section {
  padding: 0 8px;
}

.sidebar-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #999;
  padding: 8px 12px 6px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .sidebar-section-title {
  display: none;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  color: #555;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-item:hover {
  background: var(--violet-light);
  color: var(--violet);
}

.sidebar-item.active {
  background: var(--violet);
  color: white;
}

.sidebar-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  width: 24px;
  text-align: center;
}

.sidebar-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .sidebar-label {
  display: none;
}

/* Sidebar app list */
/* App groups in sidebar */
.sidebar-app-group {
  margin-bottom: 2px;
}

.sidebar-app-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: #555;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-app-item:hover {
  background: #f3f0ff;
  color: var(--violet);
}

.sidebar-app-item .app-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ccc;
  flex-shrink: 0;
}

.sidebar-app-group.expanded > .sidebar-app-item .app-dot {
  background: var(--violet);
}

.sidebar-app-arrow {
  margin-left: auto;
  font-size: 0.7rem;
  color: #999;
  flex-shrink: 0;
}

/* Feature sub-items */
.sidebar-app-features {
  padding-left: 12px;
  padding-bottom: 4px;
}

.sidebar-feature-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: #777;
  font-size: 0.8rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-feature-item:hover {
  background: #f3f0ff;
  color: var(--violet);
}

.sidebar-feature-item.active {
  background: var(--violet);
  color: #fff;
}

.sidebar-feature-item .sidebar-icon {
  font-size: 0.9rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar.collapsed #sidebarApps {
  display: none;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 20px 24px;
  transition: margin-left 0.25s ease;
  min-height: 100vh;
}

.sidebar.collapsed ~ .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* Page switching */
.page {
  display: none;
}

.page.active {
  display: block;
}

/* ==================== SYNC PROGRESS BAR ==================== */
.sync-progress {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.sync-progress.hidden {
  display: none;
}

.sync-progress .progress-bar {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.sync-progress .progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--violet), var(--violet-dark));
  border-radius: 3px;
  transition: width 0.5s ease;
}

.sync-progress .progress-text {
  font-size: 0.82rem;
  color: #666;
  white-space: nowrap;
  font-weight: 500;
}

/* ==================== HOME SUMMARY ==================== */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.home-header h2 {
  margin: 0;
  color: var(--violet);
  font-size: 1.4rem;
}

.last-sync-badge {
  font-size: 0.82rem;
  color: #888;
  display: flex;
  align-items: center;
  gap: 6px;
}

.last-sync-badge.stale {
  color: var(--warning);
}

.home-app-section {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}

.home-app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.home-app-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: var(--violet);
}

.home-app-countries {
  font-size: 0.82rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 4px 10px;
  border-radius: 6px;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.summary-card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.summary-card-icon {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.summary-card-label {
  font-size: 0.72rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.summary-card-period {
  font-size: 0.68rem;
  color: #aaa;
  margin-bottom: 4px;
}

.summary-card-value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
}

.summary-card.profitable {
  border-color: var(--success);
  background: #f0fdf4;
}

.summary-card.profitable .summary-card-value {
  color: var(--success);
}

.summary-card.unprofitable {
  border-color: var(--danger);
  background: #fef2f2;
}

.summary-card.unprofitable .summary-card-value {
  color: var(--danger);
}

/* Keywords grid */
.summary-keywords-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.summary-keywords-countries {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.country-keywords-section {
  background: white;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.country-keywords-section h4 {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--violet);
}

.summary-keywords-section {
  background: white;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.summary-keywords-section h3 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--text);
}

.summary-keywords-section.profitable h3 {
  color: #2e7d32;
}

.summary-keywords-section.unprofitable h3 {
  color: #c62828;
}

.summary-kw-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.summary-kw-table th {
  background: #fafafa;
  padding: 8px 6px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: #888;
  font-weight: 600;
  border-bottom: 1px solid #eee;
  position: static;
  cursor: default;
}

.summary-kw-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #f5f5f5;
  border: none;
}

.summary-kw-table .kw-profitable td {
  background: #f0fdf4;
}

.summary-kw-table .kw-unprofitable td {
  background: #fef2f2;
}

.summary-kw-empty {
  text-align: center;
  padding: 24px;
  color: #aaa;
  font-size: 0.85rem;
}

/* ==================== CONFIG SECTIONS ==================== */
.config-section {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}

.config-section h3 {
  margin: 0 0 16px 0;
  color: var(--violet);
  font-size: 1.1rem;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #333;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.1);
}

.form-group .help-text {
  font-size: 0.8rem;
  color: #666;
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.weight-slider {
  display: flex;
  align-items: center;
  gap: 12px;
}

.weight-slider input[type="range"] {
  flex: 1;
}

.weight-slider .value {
  min-width: 50px;
  text-align: right;
  font-weight: 600;
  color: var(--violet);
}

.country-config-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #eee;
  border-radius: 8px;
}

.country-config-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.country-config-item:last-child {
  border-bottom: none;
}

.country-config-item .flag {
  font-size: 1.5rem;
}

.country-config-item .name {
  flex: 1;
  font-weight: 500;
}

.country-config-item input {
  width: 80px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.country-config-item select {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.search-box {
  margin-bottom: 12px;
}

.search-box input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
}

.snapshots-list {
  max-height: 250px;
  overflow-y: auto;
}

.snapshot-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border-bottom: 1px solid #eee;
}

.snapshot-item:last-child {
  border-bottom: none;
}

.snapshot-item .date {
  font-weight: 600;
}

.snapshot-item .meta {
  font-size: 0.8rem;
  color: #666;
}

.snapshot-item .actions {
  display: flex;
  gap: 8px;
}

.snapshot-item .actions button {
  padding: 4px 8px;
  font-size: 0.8rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.status-badge.connected {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-badge.disconnected {
  background: #ffebee;
  color: #c62828;
}

.status-badge.pending {
  background: #fff3e0;
  color: #ef6c00;
}

/* ==================== DASHBOARD (existing) ==================== */
h1 {
  font-size: 1.6rem;
  margin-bottom: 1rem;
  color: var(--violet);
}

.dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}

.card.highlight {
  background: linear-gradient(135deg, var(--violet-light), #fff);
  border-color: var(--violet);
}

.card-label {
  font-size: 0.75rem;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--violet);
}

.card-sub {
  font-size: 0.8rem;
  color: #888;
  margin-top: 4px;
}

/* Control Bars */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 14px;
  align-items: center;
}

.field {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.field.numeric {
  background: var(--violet-light);
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.field.numeric label {
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.85rem;
}

.field.numeric input {
  width: 72px;
  padding: 6px;
  border: 1px solid #bbb;
  border-radius: 6px;
}

.icon {
  font-size: 1.2rem;
}

.field.file {
  padding: 0;
}

.upload-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  color: var(--violet);
  font-size: 0.85rem;
}

.upload-btn:hover {
  background: #f4f4ff;
}

.field.file input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Info Tooltip */
.info {
  position: relative;
  display: inline-block;
  cursor: pointer;
  color: var(--violet);
  font-weight: 700;
}

.info::after {
  content: 'i';
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--violet);
  border-radius: 50%;
  font-size: 0.75rem;
  line-height: 1;
  margin-left: 4px;
}

.tooltip {
  visibility: hidden;
  opacity: 0;
  position: absolute;
  top: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  transition: opacity 0.2s ease;
  z-index: 100;
}

.tooltip img {
  max-width: 400px;
  height: auto;
  display: block;
  margin-top: 8px;
}

.info:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

/* Table */
.table-wrapper {
  max-height: 70vh;
  overflow: auto;
  border: 1px solid #ccc;
  border-radius: 8px;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th, td {
  border: 1px solid #ddd;
  padding: 8px 6px;
  text-align: center;
}

th {
  background: var(--violet-light);
  position: sticky;
  top: 0;
  z-index: 2;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

th:hover {
  background: #d4c8eb;
}

.sort-icon {
  margin-left: 4px;
  font-size: 0.7rem;
  opacity: 0.6;
}

/* Country Cell */
.country-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  text-align: left;
  padding-left: 8px;
}

.flag {
  font-size: 1.2rem;
  min-width: 1.5rem;
}

/* Inputs */
input[type=text],
input[type=number] {
  width: 100%;
  box-sizing: border-box;
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.85rem;
}

input[readonly] {
  background: #f5f5f5;
  color: #666;
}

.input-sm {
  width: 70px !important;
}

/* Score/Rank columns */
.score-bar {
  width: 100%;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.tier-excellent .score-bar-fill { background: var(--success); }
.tier-good .score-bar-fill { background: #8bc34a; }
.tier-average .score-bar-fill { background: var(--warning); }
.tier-poor .score-bar-fill { background: var(--danger); }

.rank-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.8rem;
}

.rank-1 { background: #ffd700; color: #333; }
.rank-2 { background: #c0c0c0; color: #333; }
.rank-3 { background: #cd7f32; color: #fff; }
.rank-other { background: #eee; color: #666; }

/* Color-coded values */
.value-excellent { color: var(--success); font-weight: 600; }
.value-good { color: #689f38; }
.value-average { color: var(--warning); }
.value-poor { color: var(--danger); font-weight: 600; }

/* Buttons */
button {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--violet);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

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

button.secondary {
  background: #fff;
  color: var(--violet);
  border: 2px solid var(--violet);
}

button.secondary:hover {
  background: var(--violet-light);
}

button.danger {
  background: var(--danger);
}

button.danger:hover {
  background: #d32f2f;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

/* Footer */
footer {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: #555;
}

footer code {
  background: var(--violet-light);
  padding: 2px 6px;
  border-radius: 4px;
}

/* Loading & Messages */
.loading {
  display: none;
  text-align: center;
  padding: 40px;
  color: #666;
}

.loading.active {
  display: block;
}

.message {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: none;
}

.message.active {
  display: block;
}

.message.success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
}

.message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: #666;
  cursor: pointer;
  font-weight: 600;
  margin-bottom: -2px;
}

.tab:hover {
  color: var(--violet);
}

.tab.active {
  color: var(--violet);
  border-bottom-color: var(--violet);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Attribution Expand Button */
.expand-btn {
  background: none;
  border: none;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--violet);
  transition: transform 0.2s;
}

.expand-btn:hover {
  background: var(--violet-light);
  border-radius: 4px;
}

.expand-btn.expanded {
  transform: rotate(90deg);
}

/* Attribution Sub-Row */
.attribution-row td {
  padding: 0 !important;
  border-top: none !important;
  background: #fafafa;
}

.attribution-container {
  padding: 12px 16px;
}

.attribution-loading {
  text-align: center;
  padding: 16px;
  color: #888;
}

.attribution-empty {
  text-align: center;
  padding: 16px;
  color: #aaa;
  font-style: italic;
}

/* Attribution Nested Table */
.attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin: 0;
  table-layout: fixed;
}

.attr-table th {
  background: #f0eaf8;
  font-size: 0.75rem;
  padding: 6px 8px;
  position: static;
  border: 1px solid #e0d8ec;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: relative;
}

.attr-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Column resize handle */
.col-resize-handle {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  cursor: col-resize;
  background: transparent;
  z-index: 2;
}
.col-resize-handle:hover,
.col-resize-handle.active {
  background: var(--violet);
  opacity: 0.4;
}

.attr-table td {
  padding: 6px 8px;
  border: 1px solid #eee;
  background: white;
  overflow: hidden;
  text-overflow: ellipsis;
}

.attr-campaign {
  font-weight: 600;
  background: #f5f0ff !important;
}

.attr-adgroup td {
  padding-left: 24px !important;
  background: #fafafa !important;
}

.attr-keyword td {
  padding-left: 40px !important;
}

.attr-keyword td:first-child {
  font-style: italic;
}

.attr-profitable {
  color: var(--success);
  font-weight: 600;
}

.attr-unprofitable {
  color: var(--danger);
  font-weight: 600;
}

.attr-match-type {
  font-size: 0.7rem;
  color: #888;
  background: #f0f0f0;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
}

/* Keyword profitability color coding */
.attr-kw-excellent td { background: #f0fdf4 !important; }
.attr-kw-good td { background: #fefce8 !important; }
.attr-kw-poor td { background: #fef2f2 !important; }
.attr-estimated { color: #999; font-size: 0.7rem; font-style: italic; }

/* Top Keywords Summary */
.top-keywords-summary {
  margin-bottom: 16px;
  padding: 12px;
  background: linear-gradient(135deg, #f5f0ff, #ede9fe);
  border-radius: 8px;
  border: 1px solid #e0d8ec;
}

.top-keywords-summary h4 {
  margin: 0 0 10px;
  color: var(--violet);
  font-size: 0.85rem;
}

.top-keywords-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.top-keyword-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  font-size: 0.8rem;
  border: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.top-keyword-card.best {
  border-color: var(--success);
  box-shadow: 0 0 0 1px var(--success);
}

.top-keyword-card .rank {
  font-weight: 700;
  color: var(--violet);
  min-width: 20px;
}

.top-keyword-card .keyword-name {
  font-weight: 600;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-keyword-card .roi.positive {
  color: var(--success);
  font-weight: 600;
}

.top-keyword-card .roi.negative {
  color: var(--danger);
  font-weight: 600;
}

.top-keyword-card .profit {
  color: #666;
  font-size: 0.75rem;
}

.top-keyword-card .campaign-tag {
  font-size: 0.65rem;
  color: #999;
  background: #f5f5f5;
  padding: 1px 5px;
  border-radius: 3px;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .sidebar {
    width: var(--sidebar-collapsed);
  }

  .sidebar .sidebar-title,
  .sidebar .sidebar-label,
  .sidebar .sidebar-section-title,
  .sidebar .sidebar-sub {
    display: none;
  }

  .main-content {
    margin-left: var(--sidebar-collapsed);
    padding: 16px;
  }

  .dashboard {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .field {
    width: 100%;
  }

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

  .summary-keywords-countries {
    grid-template-columns: 1fr;
  }

  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Full-Screen Keywords Modal ── */

.fullscreen-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.fullscreen-modal.hidden {
  display: none;
}

.fullscreen-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg);
  flex-wrap: wrap;
}

.fullscreen-header h2 {
  margin: 0;
  font-size: 1.1rem;
  white-space: nowrap;
}

.fullscreen-filters {
  display: flex;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}

.fullscreen-filters input,
.fullscreen-filters select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
}

.fullscreen-filters input[type="text"] {
  min-width: 200px;
}

.fullscreen-filters input[type="number"] {
  width: 120px;
}

.fullscreen-close {
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  margin-left: auto;
  color: var(--text-muted);
  padding: 4px 8px;
  border-radius: 4px;
}

.fullscreen-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 24px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  gap: 12px;
  flex-wrap: wrap;
}
.fullscreen-toolbar-left,
.fullscreen-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.funnel-summary-cards {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.funnel-card {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary, #f5f5f5);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
}
.funnel-card-label {
  color: #666;
  font-weight: 500;
}
.funnel-card-value {
  font-weight: 700;
  color: var(--violet, #6b21a8);
  font-size: 1rem;
}
/* Column toggle menu */
.col-toggle-menu {
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 8px 0;
  z-index: 100;
  min-width: 200px;
  max-height: 400px;
  overflow-y: auto;
}
.col-toggle-menu.hidden { display: none; }
.col-toggle-group {
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.82rem;
  white-space: nowrap;
}
.col-toggle-group:hover { background: #f5f0ff; }
.col-toggle-group input { accent-color: var(--violet); }
.col-toggle-divider {
  border-top: 1px solid #eee;
  margin: 4px 0;
}
.fullscreen-date-presets {
  display: flex;
  gap: 4px;
}
.fullscreen-date-presets .date-range-btn {
  padding: 4px 10px;
  font-size: 0.75rem;
}
.fs-custom-date {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.fs-custom-date.hidden {
  display: none !important;
}
.fs-custom-date input[type="date"] {
  padding: 4px 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.8rem;
}

.fullscreen-close:hover {
  background: #f3f4f6;
  color: var(--text);
}

.fullscreen-body {
  flex: 1;
  overflow: auto;
  padding: 16px 24px;
}

.fullscreen-table {
  width: 100%;
  min-width: 2400px;
  table-layout: auto;
}

.fullscreen-table th {
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  background: #f0eaf8;
  z-index: 1;
  font-size: 0.8rem;
  padding: 8px 12px;
  white-space: nowrap;
}

.fullscreen-table td {
  font-size: 0.85rem;
  padding: 8px 12px;
  white-space: nowrap;
}

/* Sticky first column (Keyword) */
.fullscreen-table .sticky-col {
  position: sticky;
  left: 0;
  z-index: 1;
  background: white;
  border-right: 2px solid var(--border);
}
.fullscreen-table th.sticky-col {
  z-index: 2;
  background: #f0eaf8;
}
.fullscreen-table tr:hover .sticky-col {
  background: #f5f3ff;
}
.fullscreen-table tr.attr-kw-excellent .sticky-col { background: #f0fdf4; }
.fullscreen-table tr.attr-kw-good .sticky-col { background: #fefce8; }
.fullscreen-table tr.attr-kw-poor .sticky-col { background: #fef2f2; }
.fullscreen-table tr:hover.attr-kw-excellent .sticky-col { background: #dcfce7; }
.fullscreen-table tr:hover.attr-kw-good .sticky-col { background: #fef9c3; }
.fullscreen-table tr:hover.attr-kw-poor .sticky-col { background: #fee2e2; }

/* Drag-drop column reorder styles */
.fullscreen-table th[draggable="true"] {
  cursor: grab;
}
.fullscreen-table th.drag-over {
  border-left: 3px solid var(--violet);
}
.fullscreen-table th.dragging {
  opacity: 0.4;
}

.fullscreen-table th:hover {
  background: #ede9fe;
}

.fullscreen-table th.sort-asc::after {
  content: ' ▲';
  font-size: 0.7rem;
}

.fullscreen-table th.sort-desc::after {
  content: ' ▼';
  font-size: 0.7rem;
}

.btn-fullscreen {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: var(--violet);
  cursor: pointer;
  font-size: 0.8rem;
  white-space: nowrap;
}

.btn-fullscreen:hover {
  background: #f5f0ff;
  border-color: var(--violet);
}

/* Keyword status circles */
.kw-status-circle {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  cursor: pointer;
  vertical-align: middle;
  margin-right: 6px;
  transition: background 0.2s, box-shadow 0.2s;
}

.kw-status-circle:hover {
  box-shadow: 0 0 0 3px rgba(0,0,0,0.1);
  transform: scale(1.2);
}

.kw-circle-active {
  background: #22c55e;
}

.kw-circle-paused {
  background: #ef4444;
}

/* ── Graphs Page ── */

.graphs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.graph-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}

.graph-card h4 {
  margin: 0;
  color: var(--violet);
  font-size: 0.85rem;
}
.graph-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.graph-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.graph-fullscreen-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  color: #888;
  transition: all 0.15s;
  line-height: 1;
}
.graph-fullscreen-btn:hover {
  background: var(--violet-light);
  color: var(--violet);
  border-color: var(--violet);
}
.graph-labels-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: #888;
  cursor: pointer;
  user-select: none;
}
.graph-labels-toggle input {
  margin: 0;
  width: 13px;
  height: 13px;
  cursor: pointer;
}

.graph-country-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.graph-country-tab {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: white;
  color: var(--violet);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  transition: all 0.2s;
}

.graph-country-tab:hover {
  background: var(--violet-light);
}

.graph-country-tab.active {
  background: var(--violet);
  color: white;
  border-color: var(--violet);
}

.graph-loading {
  text-align: center;
  padding: 40px;
  color: #666;
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .graphs-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Inline Edit & Bid/Budget ── */

.editable-cell {
  cursor: pointer;
  border-bottom: 1px dashed #999;
  padding-bottom: 1px;
}

.editable-cell:hover {
  color: var(--violet);
  border-color: var(--violet);
}

.inline-edit-input {
  width: 70px;
  padding: 2px 4px;
  border: 1px solid var(--violet);
  border-radius: 4px;
  font-size: 0.8rem;
  text-align: center;
  outline: none;
}

.inline-edit-input:focus {
  box-shadow: 0 0 0 2px rgba(103, 58, 183, 0.2);
}

/* ── Suggested Bid ── */

.suggestion-bid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.suggestion-pause {
  color: #888;
  font-size: 0.75rem;
  font-style: italic;
}

.btn-apply-bid {
  padding: 1px 6px;
  font-size: 0.65rem;
  border: 1px solid currentColor;
  background: transparent;
  border-radius: 3px;
  cursor: pointer;
  color: inherit;
}

.btn-apply-bid:hover {
  background: rgba(0,0,0,0.05);
}

/* ── Search Terms ── */

.btn-search-terms, .btn-optimize-all {
  padding: 4px 12px;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  color: var(--violet);
  font-weight: 600;
}

.btn-search-terms:hover, .btn-optimize-all:hover {
  background: var(--violet-light);
}

.search-term-good {
  background: rgba(76, 175, 80, 0.06) !important;
}

.search-term-bad {
  background: rgba(244, 67, 54, 0.06) !important;
}

.search-term-warn {
  background: rgba(255, 152, 0, 0.06) !important;
}

.btn-add-kw, .btn-add-neg {
  padding: 2px 8px;
  font-size: 0.7rem;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
  margin-right: 4px;
}

.btn-add-kw { color: var(--success); }
.btn-add-neg { color: var(--danger); }
.btn-add-kw:hover { background: rgba(76, 175, 80, 0.1); }
.btn-add-neg:hover { background: rgba(244, 67, 54, 0.1); }

/* ── Toast Notification ── */

.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: none;
}

.toast-success {
  background: var(--success);
  color: white;
}

.toast-error {
  background: var(--danger);
  color: white;
}

/* ── Date Range Bar ── */
.date-range-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.date-range-presets,
.graph-date-presets {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.date-range-btn {
  background: white;
  border: none;
  border-right: 1px solid var(--border);
  padding: 5px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}
.date-range-btn:last-child { border-right: none; }
.date-range-btn:hover { background: var(--violet-light); color: var(--violet); }
.date-range-btn.active {
  background: var(--violet);
  color: white;
}
.custom-date-range {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: #666;
}
.custom-date-range input[type="date"] {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 0.78rem;
  color: #333;
}
.date-range-apply {
  background: var(--violet);
  color: white;
  border: none;
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.date-range-apply:hover { background: var(--violet-dark); }

/* ── Sync Overlay ── */
.sync-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}
.sync-overlay-content {
  background: white;
  border-radius: 14px;
  padding: 36px 48px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}
.sync-overlay-content p {
  margin: 8px 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: #333;
}
.sync-overlay-sub {
  font-size: 0.8rem !important;
  font-weight: 400 !important;
  color: #888 !important;
}

/* ── Keyword Discovery Tabs ── */
.kd-tabs {
  display: flex;
  gap: 4px;
  background: #f3f0ff;
  border-radius: 8px;
  padding: 3px;
}
.kd-tab {
  padding: 7px 16px;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.82rem;
  transition: all 0.15s;
}
.kd-tab:hover { color: var(--violet); background: rgba(124, 58, 237, 0.06); }
.kd-tab.active {
  background: var(--violet);
  color: white;
}
.kd-tab-content { display: none; }
.kd-tab-content.active { display: block; }

/* App Store metadata info */
.app-store-info {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  background: #f9f5ff;
  border-radius: 10px;
  margin-bottom: 14px;
}
.app-store-icon {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  flex-shrink: 0;
}
.app-store-genre {
  display: inline-block;
  background: var(--violet-light);
  color: var(--violet);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  margin-left: 8px;
}
.app-store-desc {
  font-size: 0.78rem;
  color: #666;
  margin: 6px 0 0;
  line-height: 1.4;
}

/* Source badge */
.kd-source-badge {
  display: inline-block;
  background: #f0f0f0;
  color: #666;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
}

/* Relevance badges */
.relevance-high { color: #16a34a; font-weight: 600; }
.relevance-med { color: #d97706; font-weight: 600; }
.relevance-low { color: #dc2626; font-weight: 600; }

/* ── Ask Claude Button ── */
.btn-ask-claude {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-ask-claude:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-ask-claude:disabled { opacity: 0.6; cursor: wait; }

.btn-sync-attribution {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-sync-attribution:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-sync-attribution:disabled { opacity: 0.6; cursor: wait; }

/* RC Lifetime Metrics Warning */
.rc-lifetime-badge {
  color: #f59e0b;
  cursor: help;
}
.rc-metric-cell {
  color: #f59e0b;
}

/* ── Claude Panel ── */
.claude-panel {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 12px;
  display: none;
}
.claude-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.claude-header h3 {
  font-size: 1rem;
  color: #7c3aed;
  margin: 0;
}
.claude-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #888;
  padding: 0 4px;
}
.claude-close:hover { color: #333; }
.claude-summary {
  background: #f5f0ff;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #333;
  margin-bottom: 14px;
}
.claude-loading {
  text-align: center;
  padding: 32px 16px;
}
.claude-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #e5e7eb;
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.claude-loading p {
  margin: 4px 0;
  font-size: 0.9rem;
  color: #555;
}

/* ── Claude Recommendation Groups ── */
.claude-group {
  margin-bottom: 14px;
}
.claude-group-title {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: #444;
}
.claude-rec-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-left: 4px solid #ccc;
  border-radius: 0 6px 6px 0;
  margin-bottom: 4px;
  background: #fafafa;
  transition: all 0.2s;
}
.claude-rec-row:hover { background: #f0f0f0; }
.claude-rec-row:hover .claude-rec-actions { opacity: 1; }
.claude-rec-bid { border-left-color: #6366f1; }
.claude-rec-new_keyword { border-left-color: #22c55e; }
.claude-rec-budget { border-left-color: #f59e0b; }
.claude-rec-pause { border-left-color: #ef4444; }
.claude-rec-negate { border-left-color: #ef4444; }

.claude-rec-content {
  flex: 1;
  font-size: 0.82rem;
}
.claude-rec-content strong { color: #333; }
.claude-highlight { color: #7c3aed; font-weight: 700; }

.claude-rec-reason {
  width: 100%;
  font-size: 0.75rem;
  color: #888;
  margin-top: -4px;
}
.claude-rec-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.btn-apply-rec {
  background: #7c3aed;
  color: white;
  border: none;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}
.btn-apply-rec:hover { background: #6d28d9; }
.btn-apply-rec:disabled { opacity: 0.5; cursor: wait; }
.btn-skip-rec {
  background: none;
  border: 1px solid #ccc;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  color: #888;
}
.btn-skip-rec:hover { background: #f3f3f3; }

.claude-rec-applied {
  background: #ecfdf5 !important;
  border-left-color: #22c55e !important;
  opacity: 0.8;
}
.claude-rec-applied .claude-rec-actions { opacity: 1; }
.claude-rec-skipped {
  opacity: 0.4;
  text-decoration: line-through;
}
.claude-rec-skipped .claude-rec-actions { display: none; }

.claude-footer {
  font-size: 0.7rem;
  color: #aaa;
  text-align: right;
  margin-top: 8px;
}

/* ── Bid History Panel ── */
.bid-history-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 520px;
  max-height: 80vh;
  background: white;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.2);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.bid-history-panel.hidden { display: none; }
.bid-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #f9f5ff;
}
.bid-history-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--violet);
}
.bid-history-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: #888;
  padding: 0 4px;
}
.bid-history-close:hover { color: #333; }
.bid-history-body {
  overflow-y: auto;
  padding: 12px 16px;
  flex: 1;
}
.bid-history-empty {
  text-align: center;
  color: #888;
  font-size: 0.85rem;
  padding: 24px;
}

/* Bid change entry */
.bid-change-entry {
  padding: 10px 12px;
  border-left: 3px solid #ddd;
  border-radius: 0 6px 6px 0;
  margin-bottom: 8px;
  background: #fafafa;
  font-size: 0.82rem;
}
.bid-change-entry .bid-change-amounts {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.bid-change-arrow { color: #888; }
.bid-change-old { color: #888; text-decoration: line-through; }
.bid-change-new { font-weight: 700; }
.bid-change-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.75rem;
  color: #888;
}
.bid-change-perf {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.75rem;
}
.bid-improved { color: #16a34a; font-weight: 600; }
.bid-worsened { color: #dc2626; font-weight: 600; }
.bid-neutral { color: #888; }
.bid-change-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.btn-measure, .btn-restore {
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.72rem;
  cursor: pointer;
  font-weight: 600;
  border: 1px solid var(--border);
  background: white;
}
.btn-measure { color: var(--violet); }
.btn-measure:hover { background: var(--violet-light); }
.btn-restore { color: var(--danger); }
.btn-restore:hover { background: rgba(244, 67, 54, 0.08); }
.btn-measure:disabled, .btn-restore:disabled { opacity: 0.5; cursor: wait; }

/* Source badges */
.source-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}
.source-badge-ai_suggestion { background: #f3e8ff; color: #7c3aed; }
.source-badge-app_store { background: #dbeafe; color: #2563eb; }
.source-badge-search_term { background: #dcfce7; color: #16a34a; }
.source-badge-claude_rec { background: #fef3c7; color: #d97706; }
.source-badge-manual { background: #f3f4f6; color: #6b7280; }
.source-badge-restore { background: #fee2e2; color: #dc2626; }

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
}
.status-badge-applied { background: #dcfce7; color: #16a34a; }
.status-badge-discovered { background: #dbeafe; color: #2563eb; }
.status-badge-rejected { background: #fee2e2; color: #dc2626; }

/* Bid history icon in keyword row */
.btn-bid-history {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: #888;
  padding: 0 2px;
  vertical-align: middle;
}
.btn-bid-history:hover { color: var(--violet); }

.spend-original {
  text-decoration: line-through;
  color: #999;
  font-size: 0.75rem;
}
.spend-effective {
  color: var(--violet-dark);
  font-weight: 600;
}

.getback-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 6px;
  background: #f3f0ff;
  border: 1px solid #d1c4e9;
  white-space: nowrap;
  user-select: none;
}
.getback-toggle input[type="checkbox"] {
  accent-color: var(--violet);
  cursor: pointer;
  margin: 0;
}
.getback-toggle-label {
  color: #555;
  font-weight: 500;
}
.getback-toggle:has(input:checked) {
  background: var(--violet-light);
  border-color: var(--violet);
}
.getback-toggle:has(input:checked) .getback-toggle-label {
  color: var(--violet-dark);
}
.getback-toggle:has(input:disabled) {
  opacity: 0.5;
  cursor: not-allowed;
}

.campaign-paused-badge {
  background: #fee2e2;
  color: #dc2626;
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 600;
}

/* History section in keyword discovery */
.history-section {
  padding: 0;
}

/* ==================== LOGIN ==================== */
.login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(135deg, #673ab7 0%, #512da8 50%, #311b92 100%);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px 40px;
  width: 380px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  text-align: center;
}

.login-logo {
  font-size: 48px;
  margin-bottom: 8px;
}

.login-title {
  margin: 0 0 4px;
  font-size: 1.5rem;
  color: var(--violet-dark);
}

.login-subtitle {
  margin: 0 0 28px;
  color: #888;
  font-size: 0.9rem;
}

.login-field {
  text-align: left;
  margin-bottom: 16px;
}

.login-field label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.login-field input:focus {
  border-color: var(--violet);
  box-shadow: 0 0 0 3px rgba(103, 58, 183, 0.1);
}

.login-error {
  background: #fef2f2;
  color: #dc2626;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  margin-bottom: 16px;
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.login-btn:hover {
  background: var(--violet-dark);
}

.login-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Sidebar footer */
.sidebar-footer {
  margin-top: auto;
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

.sidebar-footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.sidebar-footer-grid .sidebar-item {
  justify-content: center;
  text-align: center;
  padding: 8px 4px;
}

.sidebar-footer .sidebar-item {
  cursor: pointer;
  opacity: 0.7;
}

.sidebar-footer .sidebar-item:hover {
  opacity: 1;
}

/* Graph style toggle */
.graph-style-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--white);
  transition: all 0.2s;
}

.graph-style-toggle:has(input:checked) {
  background: var(--violet);
  color: white;
  border-color: var(--violet);
}

.graph-style-toggle input {
  display: none;
}

/* ══════════════════════════════════════════════════════
   Keyword Measurement Page
   ══════════════════════════════════════════════════════ */

.measurement-tabs {
  display: flex;
  gap: 8px;
}

.measurement-tab {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  color: #222;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.measurement-tab.active {
  background: var(--violet);
  color: #fff;
  border-color: var(--violet);
}

.measurement-tab:hover:not(.active) {
  border-color: var(--violet);
  color: var(--violet);
}

.measurement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(480px, 1fr));
  gap: 16px;
}

.measurement-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 40px 20px;
  font-size: 0.95rem;
}

.measurement-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}

.measurement-card:hover {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.measurement-card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.measurement-card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.measurement-keyword {
  font-weight: 600;
  font-size: 1rem;
  color: var(--violet);
}

.measurement-card-meta {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.measurement-source {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
}

.measurement-source.claude {
  background: #ede9fe;
  color: var(--violet);
}

.measurement-source.manual {
  background: #e0f2fe;
  color: #0284c7;
}

.measurement-status {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.measurement-status.monitoring {
  background: #fef3c7;
  color: #b45309;
}

.measurement-outcome {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.measurement-outcome.success {
  background: #d1fae5;
  color: #059669;
}

.measurement-outcome.fail {
  background: #fee2e2;
  color: #dc2626;
}

.measurement-outcome.restored {
  background: #e0e7ff;
  color: #4f46e5;
}

.metric-comparison {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}

.metric-col {
  padding: 10px 14px;
}

.metric-col:first-child {
  border-right: 1px solid var(--border);
}

.metric-col-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
  font-size: 0.82rem;
}

.metric-row span:first-child {
  color: var(--text-secondary);
}

.metric-row span:last-child {
  font-weight: 500;
}

.metric-improved {
  color: #059669;
  font-weight: 600;
  font-size: 0.75rem;
}

.metric-worsened {
  color: #dc2626;
  font-weight: 600;
  font-size: 0.75rem;
}

.metric-neutral {
  color: var(--text-secondary);
  font-size: 0.75rem;
}

.metric-not-measured {
  color: var(--text-secondary);
  font-size: 0.82rem;
  padding: 16px 0;
  text-align: center;
  font-style: italic;
}

.measurement-auto-suggestion {
  padding: 8px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}

.suggestion-success {
  background: #ecfdf5;
  color: #059669;
}

.suggestion-fail {
  background: #fef2f2;
  color: #dc2626;
}

.measurement-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  flex-wrap: wrap;
}

.measurement-actions button {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.btn-measure-action {
  background: var(--violet);
  color: white;
  border-color: var(--violet) !important;
}

.btn-measure-action:hover {
  opacity: 0.9;
}

.btn-restore-action {
  background: white;
  color: #4f46e5;
}

.btn-restore-action:hover {
  background: #e0e7ff;
}

.btn-restore-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-done-success {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0 !important;
}

.btn-done-success:hover {
  background: #d1fae5;
}

.btn-done-fail {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca !important;
}

.btn-done-fail:hover {
  background: #fee2e2;
}

.btn-reopen-action {
  background: white;
  color: var(--violet);
}

.btn-reopen-action:hover {
  background: #f5f3ff;
}

/* ==================== FB ADS CREATOR ==================== */

.fbads-tab-content { display: none; }
.fbads-tab-content.active { display: block; }

.fbads-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.fbads-search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}
.fbads-search-bar input:focus {
  border-color: var(--violet);
  outline: none;
}
.fbads-search-bar button {
  padding: 10px 20px;
  background: linear-gradient(135deg, var(--violet), var(--violet-dark));
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.fbads-search-bar button:hover { opacity: 0.9; }

.fbads-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.fbads-filters select,
.fbads-filters input[type="date"] {
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 0.82rem;
  background: white;
  color: var(--text);
  cursor: pointer;
}
.fbads-filters select:focus,
.fbads-filters input[type="date"]:focus {
  border-color: var(--violet);
  outline: none;
}

.fbads-company-results,
.fbads-rivals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}

.fbads-company-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  gap: 12px;
  align-items: center;
  transition: box-shadow 0.2s;
}
.fbads-company-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.fbads-company-card.clickable { cursor: pointer; }
.fbads-company-img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: #eee;
}
.fbads-company-info {
  flex: 1;
  min-width: 0;
}
.fbads-company-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
}
.fbads-company-meta {
  font-size: 0.78rem;
  color: #888;
  margin-top: 2px;
}
.fbads-company-actions {
  flex-shrink: 0;
}

.fbads-ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.fbads-ad-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.fbads-ad-card:hover {
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.fbads-ad-media {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: #f0f0f0;
  display: block;
}
.fbads-ad-media-placeholder {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, #f0eaf8, #e8e0f0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 0.85rem;
}
.fbads-ad-body {
  padding: 14px;
}
.fbads-ad-page {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--violet);
}
.fbads-ad-text {
  font-size: 0.85rem;
  color: #555;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  line-height: 1.4;
}
.fbads-ad-cta {
  display: inline-block;
  padding: 3px 8px;
  background: var(--violet-light);
  color: var(--violet);
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}
.fbads-ad-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.fbads-fav-btn {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.15s;
  padding: 4px;
  line-height: 1;
}
.fbads-fav-btn:hover { transform: scale(1.2); }
.fbads-detail-btn {
  padding: 5px 12px;
  background: white;
  color: var(--violet);
  border: 1.5px solid var(--violet);
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.fbads-detail-btn:hover {
  background: var(--violet-light);
}

.fbads-empty {
  text-align: center;
  color: #888;
  padding: 40px 20px;
  font-size: 0.95rem;
}

.fbads-loading {
  text-align: center;
  padding: 30px;
  color: #888;
}

/* Ad detail modal content */
.fbads-detail-section {
  margin-bottom: 20px;
}
.fbads-detail-section h4 {
  margin: 0 0 8px;
  color: var(--violet);
  font-size: 0.95rem;
}
.fbads-detail-media-grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.fbads-detail-media-grid img,
.fbads-detail-media-grid video {
  max-width: 100%;
  max-height: 400px;
  border-radius: 8px;
  object-fit: contain;
}
.fbads-detail-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.fbads-detail-info-item {
  background: #f9f7fd;
  padding: 10px 14px;
  border-radius: 8px;
}
.fbads-detail-info-item label {
  font-size: 0.75rem;
  color: #888;
  display: block;
  margin-bottom: 2px;
}
.fbads-detail-info-item span {
  font-weight: 600;
  font-size: 0.9rem;
}
.fbads-rival-remove {
  padding: 4px 10px;
  background: white;
  color: var(--danger);
  border: 1.5px solid var(--danger);
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.fbads-rival-remove:hover {
  background: #fef2f2;
}
.fbads-add-btn {
  padding: 5px 12px;
  background: linear-gradient(135deg, var(--success), #43a047);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.fbads-add-btn:hover { opacity: 0.9; }
.fbads-add-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.fbads-download-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
.fbads-download-btn:hover {
  background: rgba(0,0,0,0.8);
}

/* FB Ads Folder Bar */
.fbads-folder-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.fbads-folder-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
.fbads-folder-tab {
  padding: 6px 16px;
  border: 1px solid #ddd;
  border-radius: 20px;
  background: #fff;
  color: #555;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.fbads-folder-tab:hover {
  border-color: var(--violet);
  color: var(--violet);
}
.fbads-folder-tab.active {
  background: var(--violet);
  color: #fff;
  border-color: var(--violet);
}
.fbads-folder-add-btn {
  padding: 6px 14px;
  border: 1px dashed #aaa;
  border-radius: 20px;
  background: transparent;
  color: #666;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.fbads-folder-add-btn:hover {
  border-color: var(--violet);
  color: var(--violet);
}
.fbads-folder-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.fbads-folder-action-btn {
  padding: 4px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fff;
  color: #555;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.fbads-folder-action-btn:hover {
  background: #f5f5f5;
}
.fbads-folder-delete-btn:hover {
  border-color: #e53935;
  color: #e53935;
}
.fbads-folder-select {
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 11px;
  color: #555;
  background: #fff;
  cursor: pointer;
  max-width: 120px;
}
.fbads-folder-select:hover {
  border-color: var(--violet);
}
.fbads-saved-date {
  font-size: 11px;
  color: #999;
  margin-top: 6px;
}

/* Ad Recreate Modal */
.recreate-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recreate-modal-overlay.hidden,
.recreate-loading.hidden,
.recreate-error.hidden,
.recreate-result.hidden {
  display: none;
}
.recreate-modal {
  background: #fff;
  border-radius: 12px;
  max-width: 620px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.recreate-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eee;
}
.recreate-modal-header h3 {
  margin: 0;
  color: var(--violet);
  font-size: 16px;
}
.recreate-modal-body {
  padding: 20px;
}
.recreate-source-preview {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.recreate-source-preview img {
  max-height: 120px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid #eee;
}
.recreate-prompt-section {
  margin-bottom: 12px;
}
.recreate-prompt-section label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}
.recreate-prompt-input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  box-sizing: border-box;
}
.recreate-prompt-input:focus {
  outline: none;
  border-color: var(--violet);
}
.recreate-generate-btn {
  width: 100%;
  padding: 12px;
  background: var(--violet);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.recreate-generate-btn:hover {
  opacity: 0.9;
}
.recreate-loading {
  text-align: center;
  padding: 24px;
}
.recreate-loading p {
  color: #666;
  font-size: 13px;
  margin-top: 12px;
}
.recreate-spinner {
  width: 36px;
  height: 36px;
  border: 3px solid #eee;
  border-top-color: var(--violet);
  border-radius: 50%;
  margin: 0 auto;
  animation: recreate-spin 0.8s linear infinite;
}
@keyframes recreate-spin {
  to { transform: rotate(360deg); }
}
.recreate-error {
  color: #c62828;
  padding: 12px;
  background: #ffeaea;
  border-radius: 8px;
  margin-top: 12px;
  font-size: 13px;
}
.recreate-result {
  margin-top: 16px;
  text-align: center;
}
.recreate-result h4 {
  margin: 0 0 12px;
  color: #333;
  font-size: 14px;
}
.recreate-result img {
  max-width: 100%;
  border-radius: 8px;
  margin-bottom: 12px;
}
.recreate-download-btn {
  padding: 8px 20px;
  border: 1px solid var(--violet);
  border-radius: 8px;
  background: #fff;
  color: var(--violet);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.recreate-download-btn:hover {
  background: var(--violet);
  color: #fff;
}
.recreate-trigger-btn {
  padding: 8px 16px;
  border: 1px solid var(--violet);
  border-radius: 8px;
  background: #fff;
  color: var(--violet);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 8px;
}
.recreate-trigger-btn:hover {
  background: var(--violet);
  color: #fff;
}

/* Recreated Ads Grid */
.fbads-recreated-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.fbads-recreated-card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.fbads-recreated-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.fbads-recreated-img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}
.fbads-recreated-info {
  padding: 12px 14px 6px;
}
.fbads-recreated-prompt {
  font-size: 13px;
  color: #444;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fbads-recreated-actions {
  display: flex;
  gap: 8px;
  padding: 8px 14px 14px;
}
.fbads-recreated-delete {
  border-color: #e53935 !important;
  color: #e53935 !important;
}
.fbads-recreated-delete:hover {
  background: #e53935 !important;
  color: #fff !important;
}

/* Recreated Ad Multi-Size Preview (in recreate modal) */
.recreate-multi-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.recreate-size-preview {
  text-align: center;
}
.recreate-size-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid #eee;
}
.recreate-size-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-top: 4px;
}

/* Badge on recreated card for multi-sizes */
.fbads-recreated-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--violet);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

/* Recreated Ad Detail Page */
.recreated-detail-section {
  padding: 0;
}
.recreated-detail-prompt {
  font-size: 14px;
  color: #555;
  line-height: 1.5;
  margin-bottom: 20px;
  background: #f8f8f8;
  padding: 12px 16px;
  border-radius: 8px;
}
.recreated-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}
.recreated-detail-grid-single {
  grid-template-columns: 1fr;
  max-width: 500px;
}
.recreated-detail-item {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
  text-align: center;
}
.recreated-detail-label {
  padding: 8px 12px;
  font-weight: 700;
  font-size: 14px;
  color: var(--violet);
  border-bottom: 1px solid #eee;
}
.recreated-detail-item img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  padding: 8px;
}
.recreated-detail-item-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid #eee;
  font-size: 12px;
  color: #888;
}

@media (max-width: 600px) {
  .recreated-detail-grid {
    grid-template-columns: 1fr;
  }
  .recreate-multi-preview {
    grid-template-columns: 1fr;
  }
}
