.ad-video-dialog { box-sizing: border-box; width: min(400px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 24px 20px 20px; border: 1px solid #d1d2d5; border-radius: 18px; background: #fff; color: #222326; text-align: center; font-family: Arial, sans-serif; box-shadow: 0 18px 70px #0004; overflow: auto; }
.ad-video-dialog::backdrop { background: #0007; backdrop-filter: blur(2px); }
.ad-video-dialog [hidden] { display: none !important; }
.ad-video-dialog button { cursor: pointer; font: inherit; }
.ad-video-close { position: absolute; top: 7px; right: 9px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: transparent; color: #676767; font-size: 26px !important; }
.ad-video-brand { margin: 4px 0 12px; color: #df2521; font-size: clamp(24px, 5vw, 36px); line-height: 1.05; font-weight: 950; letter-spacing: -1px; overflow-wrap: anywhere; }
.ad-video-dialog h2 { margin: 0 0 10px; font-size: 23px; line-height: 1.2; }
.ad-video-description { color: #898989; line-height: 1.5; font-size: 14px; margin: 0 0 16px; overflow-wrap: anywhere; }
.ad-video-start { display: flex; align-items: center; gap: 16px; text-align: left; width: 100%; padding: 12px; border: 2px solid #ccced3; border-radius: 13px; background: white; color: #222326; }
.ad-video-start strong { font-weight: 800; display: block; font-size: 16px; margin-bottom: 4px; }
.ad-video-start span span { display: block; font-size: 13px; line-height: 1.4; color: #656970; }
.ad-video-play { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border-radius: 50%; background: #3159a7; color: #fff; font-size: 20px; margin-left: auto; }
.ad-video-player video, .ad-video-player iframe { display: block; width: 100%; aspect-ratio: 16/9; min-height: 200px; height: auto; border: 0; border-radius: 10px; background: #111; }
.ad-video-progress { font-size: 14px; line-height: 1.5; color: #656970; margin: 14px 0 0; }
.ad-video-progress:empty { display: none; }
.ad-video-continue { margin-top: 16px; border: 0; border-radius: 9px; padding: 12px 22px; background: #3159a7; color: white; }
.ad-video-continue:disabled { opacity: .45; cursor: default; }
.ad-video-dialog button:focus-visible { outline: 3px solid #3159a7; outline-offset: 3px; }
.ad-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
#adVideoSettings label { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
#adVideoSettings .ad-enabled-field { display: grid; grid-template-columns: auto 1fr; align-content: start; align-items: center; column-gap: 10px; }
#adVideoSettings .ad-enabled-field .ad-field-help { grid-column: 2; }
#adVideoSettings .ad-field-help { display: block; color: #737373; font-size: 13px; font-weight: 400; line-height: 1.5; }
#adVideoSettings input[type="checkbox"] { width: auto; }
.ad-settings-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 540px) { .ad-video-dialog { padding: 24px 16px 18px; } .ad-settings-grid { grid-template-columns: 1fr; } .ad-video-start { padding: 13px; gap: 10px; } }

/* Keep the settings usable inside the panel's narrow mobile content area. */
#adVideoSettings { min-width: 0; max-width: 100%; box-sizing: border-box; }
#adVideoSettings label, #adVideoSettings .ad-settings-grid, #adVideoSettings .ad-settings-actions { min-width: 0; }
#adVideoSettings label, #adVideoSettings .help, #adVideoStatus { overflow-wrap: anywhere; }
#adVideoSettings input:not([type="checkbox"]), #adVideoSettings textarea { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; }
#adVideoSettings textarea { resize: vertical; }
#adVideoSettings .ad-settings-actions button { min-height: 44px; white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 768px) {
  #adVideoSettings { padding: 16px; }
  #adVideoSettings .ad-settings-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  #adVideoSettings label { margin-bottom: 20px; }
  #adVideoSettings input:not([type="checkbox"]), #adVideoSettings textarea { font-size: 16px; min-height: 44px; }
  #adVideoSettings .ad-enabled-field { min-height: 44px; grid-template-columns: 24px minmax(0, 1fr); }
  #adVideoSettings input[type="checkbox"] { width: 22px; height: 22px; margin: 0; }
  #adVideoSettings .ad-field-help { font-size: 14px; line-height: 1.55; }
  #adVideoSettings .ad-settings-actions { flex-direction: column; gap: 10px; }
  #adVideoSettings .ad-settings-actions button { width: 100%; margin: 0; padding: 12px 16px; }
  .ad-video-close { width: 44px; height: 44px; top: 2px; right: 2px; }
  .ad-video-dialog h2, .ad-video-start > span:first-child { min-width: 0; overflow-wrap: anywhere; }
}
@media (max-width: 768px) {
  html body #panelView.panel-layout:has(#adVideoSettings.active, #adVideoLibrary.active) { grid-template-columns: minmax(0, 1fr) !important; width: 100% !important; min-width: 0 !important; transform: none !important; }
  html body #panelView:has(#adVideoSettings.active, #adVideoLibrary.active) > .panel-main { zoom: 1; width: 100% !important; min-width: 0 !important; padding: 8px !important; }
  html body #panelView:has(#adVideoSettings.active, #adVideoLibrary.active) .panel-header { flex-wrap: wrap !important; gap: 12px !important; }
  html body #panelView:has(#adVideoSettings.active, #adVideoLibrary.active) .panel-header > div { min-width: 0 !important; max-width: 100% !important; }
  html body #panelView:has(#adVideoSettings.active, #adVideoLibrary.active) .header-actions { flex-wrap: wrap !important; }
  html body #panelView:has(#adVideoSettings.active, #adVideoLibrary.active) .content-stack { min-width: 0 !important; width: 100% !important; }
}

#adVideoSettings #adVideoChoose { min-height: 44px; padding: 12px 16px; margin-bottom: 12px; max-width: 100%; white-space: normal; }
@media (max-width: 768px) { #adVideoSettings #adVideoChoose { width: 100%; } }
#adVideoLibrary { min-width: 0; }
#adVideoList { border: 1px solid #e0e3e9; background: #fff; margin-top: 16px; }
.ad-video-list-row { display: grid; grid-template-columns: minmax(140px, 1fr) 44px auto; align-items: center; gap: 14px; padding: 14px; border-bottom: 1px solid #e0e3e9; }
.ad-video-list-row:last-child { border-bottom: 0; }
.ad-video-list-details { min-width: 0; overflow-wrap: anywhere; }
.ad-video-list-details strong, .ad-video-list-details span { display: block; }
.ad-video-list-details span { margin-top: 6px; font-size: 13px; color: #737373; }
.ad-video-list-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-video-list-actions button { min-height: 44px; padding: 8px 10px; margin: 0; }
.ad-video-list-badge { font-size: 13px; font-weight: 600; }
@media (max-width: 1100px) {
  .ad-video-list-row { grid-template-columns: minmax(0, 1fr) auto; }
  .ad-video-list-actions { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  #adVideoLibrary { padding: 16px; overflow-wrap: anywhere; }
  .ad-video-list-actions button { flex: 1 1 auto; }
}

.ad-video-brand .ad-video-logo { display: block; width: min(190px, 75%); height: auto; max-height: 100px; object-fit: contain; margin: 0 auto; }

#adVideoSettings [hidden] { display: none !important; }
#adVideoSettings select { width: 100%; min-height: 44px; font-size: 16px; }
#adVideoSave[aria-busy="true"] { opacity: .7; cursor: progress; }

/* Dense, aligned editing rows without removing the field guidance. */
html body #panelView #adVideoSettings { padding: 14px !important; }
html body #panelView #adVideoSettings > h3 { margin: 6px 0 !important; }
html body #panelView #adVideoSettings > .help { margin: 4px 0 10px !important; }
html body #panelView #adVideoSettings .ad-settings-grid { gap: 0 16px; }
html body #panelView #adVideoSettings label {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  align-items: center;
  align-content: start;
  gap: 3px 10px;
  margin: 0 !important;
  padding: 7px 0;
  border-bottom: 1px solid #e7eaf0;
  font-size: 13px;
}
html body #panelView #adVideoSettings .ad-field-title { line-height: 1.3; }
html body #panelView #adVideoSettings .ad-field-help { grid-column: 2; font-size: 12px !important; line-height: 1.35; margin: 0 !important; }
html body #panelView #adVideoSettings :is(input:not([type="checkbox"]), select, textarea) {
  min-height: 32px !important;
  padding: 6px 8px !important;
  margin: 0 !important;
  font-size: 14px !important;
  line-height: 1.35;
}
html body #panelView #adVideoSettings textarea { height: 62px !important; min-height: 62px !important; }
html body #panelView #adVideoSettings .ad-enabled-field { grid-template-columns: 22px minmax(0, 1fr); }
html body #panelView #adVideoSettings .ad-settings-actions { flex-direction: row; gap: 8px; margin-top: 10px; }
html body #panelView #adVideoSettings :is(#adVideoBack, #adVideoChoose, .ad-settings-actions button) { width: auto; min-height: 34px; padding: 7px 12px; margin: 4px 0; }
html body #panelView #adVideoSettings #adVideoStatus { margin: 6px 0 0; }
html body #panelView #adVideoSettings #adVideoStatus:empty { display: none; }
@media (min-width: 769px) and (max-width: 1100px) {
  html body #panelView #adVideoSettings .ad-settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  html body #panelView #adVideoSettings label { grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 8px 0; }
  html body #panelView #adVideoSettings .ad-field-help { grid-column: 1; }
  html body #panelView #adVideoSettings .ad-enabled-field .ad-field-help { grid-column: 2; }
  html body #panelView #adVideoSettings :is(input:not([type="checkbox"]), select, textarea) { min-height: 44px !important; font-size: 16px !important; }
  html body #panelView #adVideoSettings :is(#adVideoBack, #adVideoChoose, .ad-settings-actions button) { min-height: 44px; }
  html body #panelView #adVideoSettings .ad-settings-actions button { flex: 1 1 130px; }
}

/* Keep the access-duration caption on one line within the compact prompt. */
.ad-video-start > span:first-child { flex: 1 1 auto; min-width: 0; container-type: inline-size; }
.ad-video-start > span:first-child > span { white-space: nowrap; font-size: clamp(8px, 3.55cqi, 12px); }

.ad-video-description { white-space: pre-line; }

.ad-video-dialog.is-playing { padding: 8px; border-radius: 12px; }
.ad-video-dialog.is-playing .ad-video-player video, .ad-video-dialog.is-playing .ad-video-player iframe { min-height: 0; }
.ad-video-dialog.is-playing .ad-video-close { z-index: 2; background: #ffffffdf; }
.ad-video-dialog.is-playing .ad-video-continue { margin: 8px 0 0; width: 100%; }

.ad-video-analytics { margin: 16px 0; padding: 16px; border: 1px solid #dce3ec; background: #fff; }
.ad-analytics-metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.ad-analytics-metrics > div { background: #f4f7fa; padding: 12px; }
.ad-analytics-metrics strong, .ad-analytics-metrics span { display: block; }
.ad-analytics-metrics strong { font-size: 24px; color: #198444; }
.ad-analytics-metrics span { font-size: 13px; margin-top: 6px; }
.ad-analytics-table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 13px; }
.ad-analytics-table th, .ad-analytics-table td { text-align: left; padding: 8px 4px; border-bottom: 1px solid #e2e7ed; }
@media(max-width:640px) { .ad-analytics-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); } .ad-video-analytics { padding: 10px; } }
.ad-analytics-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ad-analytics-heading h3 { margin: 0 auto 0 0; }
.ad-analytics-heading select, .ad-analytics-heading button { min-height: 32px; }
.ad-analytics-table-wrap { overflow-x: auto; }
.ad-analytics-table th, .ad-analytics-table td { padding: 4px; height: 32px; }
.ad-analytics-stages { display: grid; gap: 4px; margin: 12px 0; }
.ad-analytics-stages > div { display: grid; grid-template-columns: 120px minmax(80px, 1fr) 50px; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; }
.ad-analytics-stages progress { width: 100%; accent-color: #198444; }
