/* ═══════════════════════════════════════════════════════════════
   CorkBoard Studio · Ad Suite v12
   Seamless light-mode campaign management design system
   ═══════════════════════════════════════════════════════════════ */

/* ── Force light tokens inside the ad treatment panel ────────── */
#adtreatment-app {
  --adt-bg:          #f0f2f6;
  --adt-surface:     #ffffff;
  --adt-surface2:    #f8f9fb;
  --adt-surface3:    #f0f2f6;
  --adt-border:      #e5e7eb;
  --adt-border-h:    #d1d5db;
  --adt-accent:      #2563eb;
  --adt-accent-dim:  rgba(37,99,235,.09);
  --adt-accent-h:    #1d4ed8;
  --adt-text:        #111827;
  --adt-muted:       #6b7280;
  --adt-muted2:      #9ca3af;
  --adt-green:       #16a34a;
  --adt-green-bg:    #f0fdf4;
  --adt-red:         #dc2626;
  --adt-red-bg:      #fef2f2;
  --adt-amber:       #d97706;
  --adt-amber-bg:    #fffbeb;
  --adt-purple:      #7c3aed;
  --adt-purple-bg:   #f5f3ff;
  --adt-teal:        #0d9488;
  --adt-teal-bg:     #f0fdfa;
  --adt-r:           12px;
  --adt-r-sm:        8px;
  --adt-r-xs:        6px;
  --adt-sh:          0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.05);
  --adt-sh-md:       0 4px 16px rgba(0,0,0,.09), 0 2px 6px rgba(0,0,0,.05);
  --adt-sh-lg:       0 10px 30px rgba(0,0,0,.12), 0 4px 10px rgba(0,0,0,.06);
  background: var(--adt-bg) !important;
  color: var(--adt-text) !important;
}

/* ── Shell ──────────────────────────────────────────────────── */
.v12-shell {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  background: var(--adt-bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--adt-text);
  overflow: hidden;
}

/* ── Top Bar ─────────────────────────────────────────────────── */
.v12-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  height: 58px;
  background: var(--adt-surface);
  border-bottom: 1px solid var(--adt-border);
  flex-shrink: 0;
  box-shadow: var(--adt-sh);
  z-index: 20;
}
.v12-topbar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
  color: var(--adt-text);
  white-space: nowrap;
  flex-shrink: 0;
}
.v12-topbar-brand .brand-icon {
  width: 30px; height: 30px;
  border-radius: var(--adt-r-sm);
  background: var(--adt-accent);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.v12-sep { width: 1px; height: 24px; background: var(--adt-border); flex-shrink: 0; }
.v12-campaign-name-input {
  flex: 1;
  min-width: 100px;
  max-width: 280px;
  border: 1.5px solid var(--adt-border);
  border-radius: var(--adt-r-sm);
  padding: 6px 12px;
  font-size: 14px;
  font-weight: 600;
  background: var(--adt-surface2);
  color: var(--adt-text);
  outline: none;
  transition: all .15s;
}
.v12-campaign-name-input:focus {
  border-color: var(--adt-accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--adt-accent-dim);
}
.v12-campaign-name-input::placeholder { color: var(--adt-muted2); font-weight: 400; }
.v12-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid var(--adt-accent);
  background: var(--adt-accent-dim);
  color: var(--adt-accent);
  transition: all .15s;
  flex-shrink: 0;
}
.v12-type-chip:hover { background: rgba(37,99,235,.15); }
.v12-status-select {
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid var(--adt-border);
  background: var(--adt-surface2);
  color: var(--adt-text);
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
}
.v12-topbar-end { display: flex; gap: 8px; margin-left: auto; flex-shrink: 0; }
.v12-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--adt-r-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid var(--adt-border);
  background: var(--adt-surface);
  color: var(--adt-text);
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.v12-btn:hover { background: var(--adt-surface2); border-color: var(--adt-border-h); }
.v12-btn.primary { background: var(--adt-accent); color: #fff; border-color: var(--adt-accent); }
.v12-btn.primary:hover { background: var(--adt-accent-h); border-color: var(--adt-accent-h); }
.v12-btn.sm { padding: 5px 10px; font-size: 12px; }
.v12-btn.ghost { border-color: transparent; background: transparent; }
.v12-btn.ghost:hover { background: var(--adt-surface2); border-color: var(--adt-border); }
.v12-btn.danger { color: var(--adt-red); border-color: var(--adt-red); }
.v12-btn.danger:hover { background: var(--adt-red-bg); }

/* ── Tab Nav ─────────────────────────────────────────────────── */
.v12-tabnav {
  display: flex;
  align-items: stretch;
  padding: 0 20px;
  background: var(--adt-surface);
  border-bottom: 1px solid var(--adt-border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.v12-tabnav::-webkit-scrollbar { display: none; }
.v12-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 13px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--adt-muted);
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  transition: all .15s;
  margin-bottom: -1px;
  user-select: none;
}
.v12-tab:hover { color: var(--adt-text); background: var(--adt-surface2); }
.v12-tab.active {
  color: var(--adt-accent);
  border-bottom-color: var(--adt-accent);
  font-weight: 600;
}
.v12-tab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  background: var(--adt-accent-dim);
  color: var(--adt-accent);
}
.v12-tab.active .v12-tab-pill { background: var(--adt-accent); color: #fff; }

/* ── Stage layout ────────────────────────────────────────────── */
.v12-stage {
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
  min-height: 0;
}
.v12-sidebar {
  width: 254px;
  flex-shrink: 0;
  background: var(--adt-surface);
  border-right: 1px solid var(--adt-border);
  overflow-y: auto;
  min-height: 0;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.v12-main {
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  min-height: 0;
}

/* ── Sidebar Widgets ─────────────────────────────────────────── */
.v12-sw {
  background: var(--adt-surface2);
  border: 1px solid var(--adt-border);
  border-radius: var(--adt-r);
  padding: 13px;
}
.v12-sw-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--adt-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.v12-sw-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--adt-border);
}
.v12-kpi-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--adt-border);
}
.v12-kpi-row:last-child { border-bottom: none; }
.v12-kpi-row .lbl { color: var(--adt-muted); }
.v12-kpi-row .val { font-weight: 700; color: var(--adt-text); }
.v12-kpi-row .val.green { color: var(--adt-green); }
.v12-kpi-row .val.amber { color: var(--adt-amber); }
.v12-kpi-row .val.red   { color: var(--adt-red); }
.v12-mini-bar-wrap {
  height: 5px;
  background: var(--adt-border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 3px;
}
.v12-mini-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--adt-accent);
  transition: width .4s;
}
.v12-mini-bar.green  { background: var(--adt-green); }
.v12-mini-bar.amber  { background: var(--adt-amber); }
.v12-mini-bar.red    { background: var(--adt-red); }
.v12-sw-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: var(--adt-r-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--adt-accent);
  cursor: pointer;
  border: 1.5px dashed var(--adt-accent);
  background: var(--adt-accent-dim);
  transition: all .15s;
  text-align: left;
}
.v12-sw-link:hover { background: rgba(37,99,235,.15); }
.v12-completeness {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--adt-text);
}
.v12-completeness-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--adt-border);
  border-radius: 4px;
  overflow: hidden;
}
.v12-completeness-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--adt-accent), #7c3aed);
  transition: width .5s;
}

/* ── Cards ───────────────────────────────────────────────────── */
.v12-card {
  background: var(--adt-surface);
  border: 1px solid var(--adt-border);
  border-radius: var(--adt-r);
  box-shadow: var(--adt-sh);
  overflow: hidden;
  flex-shrink: 0;   /* CRITICAL: never let flex parent squish card content */
}
.v12-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--adt-border);
}
.v12-card-icon {
  width: 34px; height: 34px;
  border-radius: var(--adt-r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: var(--adt-accent-dim);
  flex-shrink: 0;
}
.v12-card-title { font-size: 14px; font-weight: 700; color: var(--adt-text); }
.v12-card-sub   { font-size: 12px; color: var(--adt-muted); margin-top: 1px; }
.v12-card-head-end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.v12-card-body { padding: 18px; }
.v12-card-body.no-pad { padding: 0; }

/* ── Collapsible card head ───────────────────────────────────── */
.v12-card-head.collapsible {
  cursor: pointer;
  user-select: none;
  transition: background .12s;
}
.v12-card-head.collapsible:hover { background: var(--adt-surface2); }
.v12-card-head.collapsible .v12-card-chevron {
  margin-left: auto;
  font-size: 12px;
  color: var(--adt-muted2);
  transition: transform .2s;
  flex-shrink: 0;
}
.v12-card.collapsed .v12-card-body { display: none; }
.v12-card.collapsed .v12-card-chevron { transform: rotate(-90deg); }

/* ── Dropdown + live tip pattern (Objective, Tone, etc.) ─────── */
.v12-sel-tip {
  display: none;
  gap: 9px;
  padding: 10px 13px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--adt-r-sm);
  font-size: 12px;
  color: #1e40af;
  line-height: 1.5;
  margin-top: 8px;
}
.v12-sel-tip.show { display: flex; }
.v12-sel-tip .ti  { flex-shrink: 0; font-size: 15px; }
.v12-sel-tip.green  { background: var(--adt-green-bg); border-color: #bbf7d0; color: #14532d; }
.v12-sel-tip.purple { background: var(--adt-purple-bg); border-color: #ddd6fe; color: #4c1d95; }

/* ── Pill-badge selection (type-adaptive chip strip) ─────────── */
.v12-pill-sel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.v12-pill-sel-item {
  padding: 5px 12px;
  border: 1.5px solid var(--adt-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .12s;
  background: var(--adt-surface);
  color: var(--adt-muted);
  white-space: nowrap;
  user-select: none;
}
.v12-pill-sel-item:hover { border-color: var(--adt-accent); color: var(--adt-accent); }
.v12-pill-sel-item.on {
  border-color: var(--adt-accent);
  background: var(--adt-accent-dim);
  color: var(--adt-accent);
  font-weight: 700;
}

/* ── Expandable opt-grid (click "Show all" to reveal full list) ─ */
.v12-opt-grid-wrap { position: relative; }
.v12-opt-grid-overflow {
  max-height: 220px;
  overflow: hidden;
  transition: max-height .3s;
}
.v12-opt-grid-overflow.expanded { max-height: none; }
.v12-opt-grid-fade {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60px;
  background: linear-gradient(transparent, var(--adt-surface));
  pointer-events: none;
}
.v12-opt-grid-overflow.expanded + .v12-opt-grid-fade { display: none; }
.v12-show-more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  margin-top: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--adt-accent);
  cursor: pointer;
  border: 1.5px dashed var(--adt-accent);
  border-radius: var(--adt-r-sm);
  background: var(--adt-accent-dim);
  transition: all .12s;
}
.v12-show-more-btn:hover { background: rgba(37,99,235,.15); }

/* ── Campaign Type Selector ──────────────────────────────────── */
.v12-type-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.v12-type-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 16px 10px;
  border: 2px solid var(--adt-border);
  border-radius: var(--adt-r);
  cursor: pointer;
  transition: all .18s;
  background: var(--adt-surface);
  text-align: center;
  user-select: none;
}
.v12-type-tile:hover {
  border-color: var(--adt-accent);
  background: var(--adt-accent-dim);
  transform: translateY(-1px);
  box-shadow: var(--adt-sh-md);
}
.v12-type-tile.selected {
  border-color: var(--adt-accent);
  background: var(--adt-accent-dim);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
.v12-type-tile .t-emoji { font-size: 26px; line-height: 1; }
.v12-type-tile .t-name  { font-size: 12px; font-weight: 700; color: var(--adt-text); }
.v12-type-tile .t-desc  { font-size: 10px; color: var(--adt-muted); line-height: 1.3; }

/* ── Form system ─────────────────────────────────────────────── */
.v12-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.v12-grid.g1 { grid-template-columns: 1fr; }
.v12-grid.g3 { grid-template-columns: 1fr 1fr 1fr; }
.v12-grid.g4 { grid-template-columns: 1fr 1fr 1fr 1fr; }
.v12-field { display: flex; flex-direction: column; gap: 4px; }
.v12-field.s2 { grid-column: span 2; }
.v12-field.s3 { grid-column: span 3; }
.v12-field.s4 { grid-column: span 4; }
.v12-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--adt-text);
  display: flex;
  align-items: center;
  gap: 5px;
}
.v12-label .req { color: var(--adt-red); font-size: 10px; }
.v12-hint {
  font-size: 11px;
  color: var(--adt-muted);
  line-height: 1.45;
}
.v12-input, .v12-select, .v12-textarea {
  padding: 8px 11px;
  border: 1.5px solid var(--adt-border);
  border-radius: var(--adt-r-sm);
  font-size: 13px;
  background: var(--adt-surface2);
  color: var(--adt-text);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.v12-input:focus, .v12-select:focus, .v12-textarea:focus {
  border-color: var(--adt-accent);
  background: #fff;
  box-shadow: 0 0 0 3px var(--adt-accent-dim);
}
.v12-input::placeholder, .v12-textarea::placeholder { color: var(--adt-muted2); }
.v12-textarea {
  resize: vertical;
  min-height: 76px;
  line-height: 1.55;
}
.v12-textarea.script {
  font-family: 'Courier Prime', Courier, monospace;
  min-height: 130px;
  font-size: 13px;
  line-height: 1.6;
  background: #fafafa;
}
.v12-select { cursor: pointer; }
.v12-char-hint {
  font-size: 10px;
  text-align: right;
  color: var(--adt-muted2);
  margin-top: 1px;
}
.v12-char-hint.warn { color: var(--adt-amber); font-weight: 600; }
.v12-char-hint.over { color: var(--adt-red); font-weight: 600; }
.v12-tip-box {
  display: flex;
  gap: 9px;
  padding: 10px 13px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--adt-r-sm);
  font-size: 12px;
  color: #1e40af;
  line-height: 1.5;
}
.v12-tip-box .ti { flex-shrink: 0; font-size: 15px; }
.v12-tip-box.amber { background: var(--adt-amber-bg); border-color: #fde68a; color: #92400e; }
.v12-tip-box.green { background: var(--adt-green-bg); border-color: #bbf7d0; color: #14532d; }
.v12-tip-box.purple { background: var(--adt-purple-bg); border-color: #ddd6fe; color: #4c1d95; }

/* ── Section dividers ────────────────────────────────────────── */
.v12-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.v12-section-head h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--adt-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
  margin: 0;
}
.v12-section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--adt-border);
}

/* ── Platform / Channel Chips ────────────────────────────────── */
.v12-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.v12-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border: 1.5px solid var(--adt-border);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  background: var(--adt-surface);
  color: var(--adt-muted);
  user-select: none;
}
.v12-chip:hover { border-color: var(--adt-accent); color: var(--adt-accent); }
.v12-chip.on {
  border-color: var(--adt-accent);
  background: var(--adt-accent-dim);
  color: var(--adt-accent);
  font-weight: 600;
}

/* ── Objective + Tone cards ──────────────────────────────────── */
.v12-opt-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.v12-opt-card {
  padding: 12px;
  border: 2px solid var(--adt-border);
  border-radius: var(--adt-r-sm);
  cursor: pointer;
  transition: all .15s;
  background: var(--adt-surface);
}
.v12-opt-card:hover { border-color: var(--adt-accent); background: var(--adt-accent-dim); }
.v12-opt-card.selected { border-color: var(--adt-accent); background: var(--adt-accent-dim); }
.v12-opt-card .oc-name { font-size: 12px; font-weight: 700; color: var(--adt-text); margin-bottom: 3px; }
.v12-opt-card .oc-tip  { font-size: 11px; color: var(--adt-muted); line-height: 1.4; }
.v12-opt-card.selected .oc-name { color: var(--adt-accent); }

/* ── Budget / Allocation bars ────────────────────────────────── */
.v12-alloc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--adt-border);
  font-size: 13px;
}
.v12-alloc-row:last-child { border-bottom: none; }
.v12-alloc-label { width: 110px; flex-shrink: 0; font-weight: 500; }
.v12-alloc-bar-wrap {
  flex: 1;
  height: 8px;
  background: var(--adt-border);
  border-radius: 4px;
  overflow: hidden;
}
.v12-alloc-bar {
  height: 100%;
  border-radius: 4px;
  transition: width .4s;
}
.v12-alloc-pct { width: 38px; text-align: right; font-weight: 600; color: var(--adt-muted); font-size: 12px; }
.v12-alloc-input {
  width: 90px;
  padding: 5px 8px;
  border: 1.5px solid var(--adt-border);
  border-radius: var(--adt-r-xs);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  background: var(--adt-surface2);
  color: var(--adt-text);
  outline: none;
}
.v12-alloc-input:focus { border-color: var(--adt-accent); background: #fff; }

/* ── Asset / Deliverable checklist ───────────────────────────── */
.v12-asset-list { display: flex; flex-direction: column; }
.v12-asset-row {
  display: grid;
  grid-template-columns: 20px 1fr 130px 120px 90px;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--adt-border);
  font-size: 13px;
}
.v12-asset-row:last-child { border-bottom: none; }
.v12-asset-row.header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--adt-muted);
  padding-bottom: 8px;
  border-bottom: 1.5px solid var(--adt-border);
}
.v12-asset-row input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--adt-accent);
  cursor: pointer;
}
.v12-asset-name { font-weight: 500; }
.v12-asset-spec { font-size: 11px; color: var(--adt-muted); margin-top: 2px; }
.v12-asset-status-sel {
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  border: 1.5px solid var(--adt-border);
  background: var(--adt-surface2);
  cursor: pointer;
  outline: none;
}
.v12-date-input {
  padding: 5px 8px;
  border: 1.5px solid var(--adt-border);
  border-radius: var(--adt-r-xs);
  font-size: 11px;
  background: var(--adt-surface2);
  color: var(--adt-text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.v12-date-input:focus { border-color: var(--adt-accent); }

/* ── KPI / Reporting table ───────────────────────────────────── */
.v12-report-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.v12-report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.v12-report-table th {
  padding: 9px 12px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--adt-muted);
  background: var(--adt-surface2);
  border-bottom: 1.5px solid var(--adt-border);
}
.v12-report-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--adt-border);
  vertical-align: middle;
}
.v12-report-table tr:last-child td { border-bottom: none; }
.v12-report-table tbody tr:hover td { background: var(--adt-surface2); }
.v12-perf-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}
.v12-perf-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--adt-border);
  border-radius: 3px;
  overflow: hidden;
  min-width: 70px;
}
.v12-perf-bar-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.v12-perf-bar-fill.hit  { background: var(--adt-green); }
.v12-perf-bar-fill.near { background: var(--adt-amber); }
.v12-perf-bar-fill.miss { background: var(--adt-red); }
.v12-perf-pct { font-size: 12px; font-weight: 700; min-width: 38px; }
.v12-perf-pct.hit  { color: var(--adt-green); }
.v12-perf-pct.near { color: var(--adt-amber); }
.v12-perf-pct.miss { color: var(--adt-red); }
.v12-kpi-input {
  padding: 5px 8px;
  border: 1.5px solid var(--adt-border);
  border-radius: var(--adt-r-xs);
  font-size: 12px;
  font-weight: 600;
  background: var(--adt-surface2);
  color: var(--adt-text);
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.v12-kpi-input:focus { border-color: var(--adt-accent); background: #fff; }

/* ── Score card ──────────────────────────────────────────────── */
.v12-score-ring {
  width: 90px; height: 90px;
  border-radius: 50%;
  border: 6px solid var(--adt-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--adt-text);
  flex-shrink: 0;
  position: relative;
}
.v12-score-ring.a { border-color: var(--adt-green); color: var(--adt-green); }
.v12-score-ring.b { border-color: var(--adt-amber); color: var(--adt-amber); }
.v12-score-ring.c { border-color: var(--adt-red); color: var(--adt-red); }

/* ── Storyboard link ─────────────────────────────────────────── */
.v12-sb-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 2px dashed var(--adt-border);
  border-radius: var(--adt-r);
  cursor: pointer;
  transition: all .18s;
  background: var(--adt-surface2);
}
.v12-sb-card:hover {
  border-color: var(--adt-accent);
  background: var(--adt-accent-dim);
  transform: translateY(-1px);
  box-shadow: var(--adt-sh-md);
}
.v12-sb-card .sb-icon { font-size: 32px; flex-shrink: 0; }
.v12-sb-card .sb-title { font-size: 14px; font-weight: 700; color: var(--adt-text); }
.v12-sb-card .sb-desc  { font-size: 12px; color: var(--adt-muted); margin-top: 3px; line-height: 1.4; }
.v12-sb-card .sb-arrow { margin-left: auto; font-size: 18px; color: var(--adt-muted2); flex-shrink: 0; }

/* ── Add row button ──────────────────────────────────────────── */
.v12-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px dashed var(--adt-accent);
  border-radius: var(--adt-r-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--adt-accent);
  cursor: pointer;
  background: var(--adt-accent-dim);
  transition: all .15s;
  margin-top: 10px;
}
.v12-add-btn:hover { background: rgba(37,99,235,.16); }

/* ── Flight / Timeline ───────────────────────────────────────── */
.v12-flight-row {
  display: grid;
  grid-template-columns: 1fr 160px 160px 90px;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--adt-border);
  font-size: 13px;
}
.v12-flight-row:last-child { border-bottom: none; }
.v12-flight-row.header {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--adt-muted);
  padding-bottom: 6px;
}

/* ── Badge system ────────────────────────────────────────────── */
.v12-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.v12-badge.draft     { background: #f1f5f9; color: #475569; }
.v12-badge.brief     { background: #eff6ff; color: #1d4ed8; }
.v12-badge.progress  { background: var(--adt-amber-bg); color: #92400e; }
.v12-badge.review    { background: var(--adt-purple-bg); color: #5b21b6; }
.v12-badge.approved  { background: var(--adt-green-bg); color: #166534; }
.v12-badge.delivered { background: #dcfce7; color: #15803d; }
.v12-badge.live      { background: #dcfce7; color: #15803d; }

/* ── Empty state ─────────────────────────────────────────────── */
.v12-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 24px;
  text-align: center;
}
.v12-empty .e-icon  { font-size: 42px; opacity: .35; }
.v12-empty .e-title { font-size: 16px; font-weight: 700; color: var(--adt-muted); }
.v12-empty .e-desc  { font-size: 13px; color: var(--adt-muted2); max-width: 280px; line-height: 1.55; }

/* ── Inline colour swatches for mood board ───────────────────── */
.v12-mood-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.v12-mood-card {
  border: 1.5px solid var(--adt-border);
  border-radius: var(--adt-r-sm);
  overflow: hidden;
  background: var(--adt-surface);
}
.v12-mood-img {
  width: 100%;
  aspect-ratio: 16/9;
  background: var(--adt-surface3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--adt-muted2);
}
.v12-mood-info { padding: 8px 10px; }
.v12-mood-info input {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--adt-text);
  outline: none;
  box-sizing: border-box;
}

/* ── Competitor card ─────────────────────────────────────────── */
.v12-comp-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--adt-border);
}
.v12-comp-row:last-child { border-bottom: none; }

/* ── Nuclear override: v11 injects color:#fff on all inputs when
      ad11-active class is present. v12 always wins inside its shell. ── */
#adtreatment-app .v12-shell input,
#adtreatment-app .v12-shell textarea,
#adtreatment-app .v12-shell select {
  color: var(--adt-text) !important;
  background: var(--adt-surface2) !important;
  border-color: var(--adt-border) !important;
  border-radius: var(--adt-r-sm) !important;
}
#adtreatment-app .v12-shell input:focus,
#adtreatment-app .v12-shell textarea:focus,
#adtreatment-app .v12-shell select:focus {
  border-color: var(--adt-accent) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px var(--adt-accent-dim) !important;
}
#adtreatment-app .v12-shell input::placeholder,
#adtreatment-app .v12-shell textarea::placeholder {
  color: var(--adt-muted2) !important;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .v12-sidebar { width: 220px; }
  .v12-grid.g3 { grid-template-columns: 1fr 1fr; }
  .v12-grid.g4 { grid-template-columns: 1fr 1fr; }
  .v12-type-grid { grid-template-columns: repeat(4, 1fr); }
  .v12-opt-grid  { grid-template-columns: repeat(2, 1fr); }
  .v12-asset-row { grid-template-columns: 20px 1fr 110px 90px; }
  .v12-asset-row > *:last-child { display: none; }
}
@media (max-width: 860px) {
  /* ── Stage: keep overflow hidden so inner scroll chain works ── */
  .v12-stage {
    flex-direction: column;
    overflow: hidden;          /* was "visible" — broke scroll containment */
  }

  /* ── Sidebar becomes a compact horizontal scroll strip ─────── */
  .v12-sidebar {
    width: 100%;
    flex-shrink: 0;
    flex-direction: row;
    flex-wrap: nowrap;
    border-right: none;
    border-bottom: 1px solid var(--adt-border);
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-height: 76px;
    min-height: 60px;
    padding: 8px 12px;
    gap: 8px;
    align-items: flex-start;
  }
  .v12-sidebar::-webkit-scrollbar { display: none; }
  .v12-sw {
    flex: 0 0 auto;
    min-width: 130px;
    max-width: 200px;
    padding: 7px 10px;
  }
  .v12-sw-title { margin-bottom: 4px; font-size: 9px; }
  .v12-kpi-row  { padding: 2px 0; font-size: 11px; }
  .v12-sw-link  { padding: 6px 8px; font-size: 11px; }

  /* ── Main: fill remaining height, scroll properly ─────────── */
  .v12-main {
    flex: 1 1 0;               /* 0 base so it fills what's left */
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px;
  }

  .v12-grid { grid-template-columns: 1fr; }
  .v12-field.s2, .v12-field.s3 { grid-column: span 1; }
  .v12-type-grid { grid-template-columns: repeat(3, 1fr); }
  .v12-opt-grid  { grid-template-columns: repeat(2, 1fr); }
}
#adtreatment-app,
#adtreatment-app #v12-shell,
#adtreatment-app .v12-stage,
#adtreatment-app .v12-main {
  min-height: 0;
}

@media (max-width: 560px) {
  /* Topbar */
  .v12-topbar { padding: 0 10px; gap: 6px; height: 52px; }
  .v12-topbar-brand .brand-word { display: none; }
  .v12-sep { display: none; }
  .v12-campaign-name-input { max-width: 130px; font-size: 13px; padding: 5px 9px; }
  .v12-type-chip { padding: 4px 8px; font-size: 11px; }
  .v12-status-select { padding: 4px 7px; font-size: 11px; }
  .v12-btn .btn-text { display: none; }
  .v12-btn { padding: 6px 10px; font-size: 15px; gap: 0; }

  /* Sidebar tighter when horizontal */
  .v12-sidebar { max-height: 72px; min-height: 56px; padding: 6px 8px; gap: 6px; }
  .v12-sw { min-width: 120px; max-width: 160px; padding: 6px 8px; }

  /* Main area */
  .v12-main { padding: 10px; gap: 12px; }
  .v12-card-body { padding: 12px; }
  .v12-card-head { padding: 11px 14px; }

  /* Campaign type tiles */
  .v12-type-grid { grid-template-columns: repeat(2, 1fr); }

  /* Option cards (tone, objective, platform) */
  .v12-opt-grid { grid-template-columns: 1fr; }

  /* Competitor rows → stacked */
  .v12-comp-row { grid-template-columns: 1fr; gap: 6px; }

  /* Mood board → 2 col */
  .v12-mood-grid { grid-template-columns: repeat(2, 1fr); }

  /* Flight/schedule rows */
  .v12-flight-row { grid-template-columns: 1fr 140px; }
  .v12-flight-row > *:nth-child(3), .v12-flight-row > *:nth-child(4) { display: none; }

  /* Budget allocation → hide visual bar, keep label + amount */
  .v12-alloc-bar-wrap { display: none; }
  .v12-alloc-pct { display: none; }

  /* Asset rows → 3 cols (drop owner column) */
  .v12-asset-row { grid-template-columns: 20px 1fr 100px; gap: 6px; }
  .v12-asset-row > *:nth-child(4) { display: none; }
  .v12-asset-row > *:last-child { display: none; }

  /* KPI report table — hide VS Target column, redistribute widths */
  .v12-report-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .v12-report-table { table-layout: fixed; width: 100%; }
  .v12-report-table th:last-child,
  .v12-report-table td:last-child { display: none; }
  .v12-report-table th:nth-child(1),
  .v12-report-table td:nth-child(1) { width: 35%; }
  .v12-report-table th:nth-child(2),
  .v12-report-table td:nth-child(2) { width: 18%; }
  .v12-report-table th:nth-child(3),
  .v12-report-table td:nth-child(3) { width: 23%; }
  .v12-report-table th:nth-child(4),
  .v12-report-table td:nth-child(4) { width: 24%; }
  .v12-report-table th, .v12-report-table td { padding: 7px 6px; }
  .v12-kpi-input { font-size: 11px !important; padding: 4px 6px !important; width: 100% !important; box-sizing: border-box !important; }

  /* Storyboard card */
  .v12-sb-card { gap: 10px; padding: 14px; }
  .v12-sb-card .sb-desc { display: none; }
}

/* ── Ultra-small (≤ 420px) ───────────────────────────────────── */
@media (max-width: 420px) {
  /* Tab bar — tighter */
  .v12-tab { padding: 10px 9px; font-size: 11px; gap: 3px; }
  .v12-tab-pill { display: none; }

  /* Topbar even more compact */
  .v12-campaign-name-input { max-width: 95px; min-width: 70px; padding: 5px 7px; }
  .v12-topbar-end { gap: 4px; }

  /* Asset rows — fully stacked (2 col: checkbox + everything) */
  .v12-asset-row { grid-template-columns: 20px 1fr; }
  .v12-asset-row > *:nth-child(3) { grid-column: 2; justify-self: start; margin-top: 4px; }

  /* Mood board → single column */
  .v12-mood-grid { grid-template-columns: 1fr; }

  /* Type tiles — very compact */
  .v12-type-tile { padding: 12px 8px; }
  .v12-type-tile .t-emoji { font-size: 22px; }

  /* Sidebar collapse more */
  .v12-sidebar { max-height: 100px; }
}
