/* Meta Asset Mirror View — page-specific styles. Tokens, base form controls,
   button variants, and the .rb-topnav primitive come from /shared/brand.css. */

html, body { min-height: 100%; }
body { background: var(--rb-black-05); }

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 64px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#page-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0 8px 0;
}
#page-head h1 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.page-sub {
  margin: 0;
  color: var(--fg-muted);
  font-size: 14px;
  max-width: 70ch;
}

.banner {
  padding: 12px 16px;
  border-radius: 4px;
  background: #FBE9E7;
  color: var(--state-error);
  border: 1px solid var(--state-error);
  font-size: 13px;
  line-height: 1.4;
}
.banner code {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 4px;
  border-radius: 2px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.filter-bar input {
  max-width: 420px;
}

#status {
  min-height: 1.2em;
  color: var(--fg-muted);
  font-size: 13px;
}
#status.warn { color: var(--state-warning); }
#status.error { color: var(--state-error); }

.runs {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.run {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.run-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--surface);
  transition: background 0.15s ease;
}
.run-summary::-webkit-details-marker { display: none; }
.run-summary:hover { background: var(--surface-alt); }

.run-caret {
  display: inline-block;
  width: 10px;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 12px;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}
details[open] .run-caret { transform: rotate(90deg); }

.run-title {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
}
.run-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.run-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.run-refresh,
.run-push {
  padding: 4px 10px;
  font-size: 12px;
}

.action-bar {
  margin: 12px 0;
  display: flex;
  justify-content: flex-end;
}
.action-primary {
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  background: var(--fg);
  color: var(--rb-white);
  border: 1px solid var(--fg);
  border-radius: 3px;
  cursor: pointer;
}
.action-primary:hover { opacity: 0.9; }
.run-push {
  background: var(--fg);
  color: var(--rb-white);
  border: 1px solid var(--fg);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.run-push:hover { opacity: 0.9; }
.run-push:disabled {
  background: var(--rb-black-50);
  border-color: var(--rb-black-50);
  cursor: not-allowed;
}

.run-pushed-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: #1f9d55;
  background: #e8f5ec;
  border: 1px solid #b9dec4;
  border-radius: 4px;
}

/* Push-to-Ad-Set modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border-radius: 6px;
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: 18px;
  font-weight: 700;
  color: var(--fg);
}
.modal-head .modal-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--fg-muted);
}
.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.modal-field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
}
.modal-field select,
.modal-field input[type="text"],
.modal-field input[type="url"],
.modal-field > textarea {
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
}
.modal-field > textarea {
  resize: vertical;
  min-height: 44px;
  font-family: var(--font-mono);
  word-break: break-all;
}
.modal-field .field-hint {
  font-size: 11px;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}
.combobox {
  position: relative;
}
.combobox input[type="text"] {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  box-sizing: border-box;
}
.combobox input[type="text"]:focus {
  outline: none;
  border-color: var(--fg);
}
.combobox input[type="text"]:disabled {
  background: var(--surface-alt);
  color: var(--fg-muted);
  cursor: not-allowed;
}
.combobox-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  max-height: 320px;
  overflow-y: auto;
  z-index: 210;
}
.combobox-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  cursor: pointer;
  border-left: 2px solid transparent;
}
.combobox-item.active,
.combobox-item:hover {
  background: var(--surface-alt);
  border-left-color: var(--fg);
}
.combobox-name {
  font-size: 13px;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combobox-meta {
  font-size: 11px;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.combobox-empty,
.combobox-more {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--fg-muted);
  font-style: italic;
}
.combobox-retry {
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.combobox-retry:hover { background: var(--surface-alt); }

/* Destination toggle in the push modal — radio between "create new ad
   set" (default) and "use existing running ad set". */
.dest-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dest-toggle .dest-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
}
.dest-toggle .dest-option input[type="radio"] {
  margin: 0;
}
.dest-note {
  font-size: 11px;
  color: var(--fg-subtle);
  font-style: italic;
}
.combobox-name .running-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2ea44f;
  margin-right: 6px;
  vertical-align: middle;
}

/* Copy variants <details> section in the push modal. */
.modal-copy {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 12px;
  background: var(--surface);
}
.modal-copy > summary {
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  padding: 10px 0;
  list-style: revert;
}
.modal-copy[open] > summary {
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.modal-copy-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 14px;
}
.copy-repeater {
  position: relative;
}
.copy-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.copy-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.copy-row > input[type="text"],
.copy-row > textarea {
  flex: 1;
  padding: 7px 10px;
  font-size: 13px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  box-sizing: border-box;
  width: auto;
}
.copy-row > textarea {
  min-height: 44px;
  resize: vertical;
}
.copy-remove {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  padding: 0 8px;
  height: 28px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
  flex: 0 0 auto;
}
.copy-remove:hover {
  background: var(--surface-alt);
  color: var(--fg);
}
.copy-counter {
  margin-top: 4px;
}
.copy-add {
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.copy-add:hover { background: var(--surface-alt); }
.copy-add:disabled { opacity: 0.5; cursor: not-allowed; }

.modal-warning {
  padding: 10px 12px;
  background: #FFF6E6;
  border: 1px solid #f3d68a;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.45;
  color: #6b4708;
}
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-alt);
}
.modal-foot .modal-status {
  margin-right: auto;
  font-size: 12px;
  color: var(--fg-muted);
}
.modal-foot .modal-status.error { color: var(--state-error); }
.modal-cancel,
.modal-push {
  padding: 7px 14px;
  font-size: 13px;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
}
.modal-cancel {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--fg);
}
.modal-push {
  background: var(--fg);
  border: 1px solid var(--fg);
  color: var(--rb-white);
}
.modal-push:disabled,
.modal-cancel:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.modal-success {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
  color: var(--fg);
}
.modal-success code {
  font-family: var(--font-mono);
  background: var(--rb-black-05);
  padding: 1px 5px;
  border-radius: 2px;
  font-size: 12px;
}
.modal-success a {
  color: var(--fg);
  text-decoration: underline;
}
.modal-success .errors-list {
  font-size: 12px;
  color: var(--state-warning);
  margin: 4px 0 0;
  padding-left: 18px;
}

.run-error {
  padding: 10px 16px;
  background: #FFF6E6;
  color: var(--state-warning);
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.run-body {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.card:hover {
  border-color: var(--fg);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.06);
}

.card-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 180px;
  background: var(--rb-black-05);
  border-bottom: 1px solid var(--border);
  cursor: zoom-in;
  overflow: hidden;
}
.card-thumb img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.card-thumb-empty {
  font-size: 11px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: default;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
}

.card-name {
  display: flex;
  font-size: 12px;
  color: var(--fg);
  min-width: 0;
}
.card-name-head {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}
.card-name-tail {
  flex: 0 0 auto;
  white-space: nowrap;
}

.card-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--fg-muted);
  font-family: var(--font-mono);
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
  color: var(--rb-white);
  background: var(--rb-black-50);
}
.pill-active   { background: #1f9d55; }
.pill-deleted  { background: #c0392b; }
.pill-missing  { background: #888888; }

.card-hash {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-subtle);
}
.card-hash button {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--fg-muted);
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 3px;
  cursor: pointer;
  font-family: var(--font-mono);
}
.card-hash button:hover {
  background: var(--fg);
  color: var(--rb-white);
  border-color: var(--fg);
}
.card-hash code {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.empty {
  padding: 24px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.5;
}
.empty pre {
  background: var(--rb-black-05);
  padding: 12px;
  border-radius: 4px;
  font-size: 11px;
  overflow-x: auto;
  margin: 12px 0 0;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  background: var(--fg);
  color: var(--rb-white);
  border-radius: 4px;
  font-size: 13px;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

.placement-coverage {
  background: var(--surface-alt, var(--rb-black-05));
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 10px 12px;
}
.placement-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.placement-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: var(--font-mono);
}
.placement-list .placement-mark { width: 16px; }
.placement-list .placement-text { color: var(--fg); }
.placement-list .placement-missing .placement-text {
  color: var(--fg-muted);
  text-decoration: line-through;
}
.placement-list .placement-note {
  margin-left: 6px;
  color: var(--state-warning, #b76e00);
  font-size: 11px;
  font-family: var(--font-body, inherit);
}
