.bundle-dialog{width:min(1040px,calc(100vw - 32px));max-width:none;max-height:calc(100dvh - 32px);margin:auto;padding:0;overflow:hidden;border:1px solid var(--line);background:var(--surface);color:var(--text);border-radius:12px;box-shadow:0 16px 80px #0007}
.bundle-dialog::backdrop{background:#0e1011c9;backdrop-filter:blur(2px)}
.bundle-edit-form{display:flex;flex-direction:column;max-height:inherit;min-width:0}
.bundle-dialog-head{display:flex;justify-content:space-between;align-items:center;padding:15px 22px;background:var(--surface-2);min-height:62px}
.bundle-dialog-head h2{margin:0}
.bundle-close{font-size:21px;line-height:1}
.bundle-dialog-body{min-height:0;overflow-y:auto;max-height:calc(100dvh - 172px);display:grid;gap:16px;padding:18px 22px}
.bundle-edit-section{min-width:0;border:1px solid var(--line);border-radius:8px;background:var(--surface);padding:16px}
.bundle-edit-section h3{color:var(--text);font-weight:500;font-size:14px;margin:0 0 14px}
.bundle-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;align-items:start}
.bundle-grid-two{grid-template-columns:repeat(2,minmax(0,1fr))}
.bundle-span{grid-column:1/-1}
.bundle-grid .field{min-width:0}
.bundle-grid .field input,.bundle-grid .field select{min-width:0;width:100%}
.bundle-grid .field-help{font-size:11px;line-height:1.45;margin-top:0}
.bundle-edit-form [hidden],.bundle-list [hidden]{display:none !important}
.bundle-picker-row{display:grid;grid-template-columns:1fr 1.4fr auto;gap:8px;min-width:0}
.bundle-picker-row input,.bundle-picker-row select,.bundle-location-row input,.bundle-location-row select,.bundle-asset-toolbar input{background:var(--surface-2);border:1px solid var(--line);border-radius:6px;color:var(--text);min-width:0;padding:9px 10px}
.bundle-picker-row .btn{white-space:nowrap}
.bundle-chips{min-height:30px;display:flex;flex-wrap:wrap;align-items:center;gap:7px}
.bundle-chip{display:inline-flex;align-items:center;gap:5px;border:1px solid #3b4d62;border-radius:6px;background:#26323d;color:#c7d5e1;padding:3px 6px 3px 9px;max-width:100%;overflow-wrap:anywhere}
.bundle-chip-remove{border:0;background:transparent;padding:0 3px;font-size:19px;line-height:1.15;color:#c7d5e1}
.bundle-placeholder{color:var(--subtle);font-size:12px;margin:0}
.bundle-language-results{display:grid;gap:2px;max-height:190px;overflow-y:auto;padding:5px;border:1px solid var(--line);border-radius:6px;background:var(--surface-2);margin-top:2px}
.bundle-language-choice{width:100%;min-height:32px;text-align:left;font:inherit;color:var(--text);padding:7px 9px;border:0;border-radius:4px;background:transparent;cursor:pointer}
.bundle-language-choice:hover,.bundle-language-choice:focus-visible{background:#2b3947;outline:1px solid var(--blue)}
.bundle-language-results .bundle-placeholder{padding:8px 9px}
.bundle-warning{margin:0;color:var(--amber);font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.bundle-asset-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.bundle-asset-toolbar input{width:auto;flex:1 1 180px}
.bundle-assets{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px 14px;max-height:190px;overflow:auto;padding:10px;border:1px solid var(--line);background:#181b1d;border-radius:6px}
.bundle-assets>p{grid-column:1/-1}
.bundle-check{display:flex;align-items:center;gap:8px;min-width:0;line-height:1.4;font-size:12px;color:var(--text);cursor:pointer;overflow-wrap:anywhere}
.bundle-check input[type=checkbox]{width:15px;height:15px;accent-color:var(--blue);flex-shrink:0;margin:0}
.bundle-asset-format{color:var(--subtle);font-size:10px;margin-left:auto;white-space:nowrap}
.bundle-asset-invalid{color:var(--amber)}
.bundle-placement-group,.bundle-location-search{margin-bottom:7px;border:1px solid var(--line);border-radius:6px;background:#1f2224;padding:11px 12px;min-width:0}
.bundle-placement-group summary,.bundle-location-search summary{cursor:pointer;font-weight:500;list-style-position:inside;color:var(--text)}
.bundle-placement-checks{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px 10px;padding-top:13px}
.bundle-location-row{display:flex;gap:8px;margin-top:12px;flex-wrap:wrap}
.bundle-location-row input{flex:1 1 160px}
.bundle-location-results{display:grid;gap:5px;margin-top:8px;max-height:150px;overflow:auto;color:var(--muted)}
.bundle-location-results button{white-space:normal;text-align:left;justify-content:flex-start}
.bundle-toggle-field{display:grid;align-content:center;gap:8px;padding-top:25px}
.bundle-preview-text{display:block;border:1px solid var(--line);padding:9px 12px;background:#191c1f;border-radius:6px;overflow-wrap:anywhere;color:#b3d7e3;font-family:ui-monospace,SFMono-Regular,Consolas,monospace;font-size:12px;white-space:normal}
.bundle-dialog-footer{display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--surface-2);padding:13px 22px}
.bundle-error{color:var(--red);font-size:12px;flex:1 1 160px;overflow-wrap:anywhere}
@media(max-width:900px){.bundle-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:640px){.bundle-dialog{width:calc(100vw - 18px);max-height:calc(100dvh - 18px)}.bundle-dialog-body{padding:12px;gap:12px;max-height:calc(100dvh - 172px)}.bundle-dialog-head,.bundle-dialog-footer{padding:12px 14px}.bundle-edit-section{padding:13px}.bundle-grid,.bundle-grid-two,.bundle-assets,.bundle-placement-checks{grid-template-columns:minmax(0,1fr)}.bundle-picker-row{grid-template-columns:1fr auto}.bundle-picker-row input{grid-column:1/-1}.bundle-toggle-field{padding-top:0}.bundle-error{flex:1 1 100%;min-width:0}.bundle-error:empty{display:none}.bundle-dialog-footer .btn{flex:1}.bundle-asset-format{margin-left:auto}}

.bundle-heading {
  gap: 14px;
  margin-bottom: 20px;
}

.bundle-title-line,
.bundle-heading .heading-actions,
.bundle-geo,
.bundle-actions {
  display: flex;
  align-items: center;
}

.bundle-title-line {
  gap: 10px;
  margin-bottom: 4px;
}

.bundle-title-line h1 {
  margin: 0;
  font-size: clamp(25px, 2.5vw, 32px);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -.025em;
}

.bundle-count {
  padding: 2px 9px;
  border-radius: 6px;
  background: #272a2d;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.bundle-heading .heading-actions { flex: none; gap: 8px; }
.bundle-heading .btn { min-height: 38px; }
.bundle-heading #refresh-section { width: 40px; padding-inline: 0; }
.bundle-heading #refresh-section .button-label { display: none; }

.bundle-filters {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  margin: 0 0 18px;
}

.bundle-filters .bundle-search {
  position: relative;
  min-width: 0;
}

.bundle-search > .icon {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.bundle-filters select,
.bundle-search input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 38px;
  border: 1px solid #454a50;
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--text);
  background-color: #1b1d1f;
  font: inherit;
  font-size: 14px;
  text-overflow: ellipsis;
}

.bundle-filters select { cursor: pointer; }
.bundle-filters > select:nth-child(2):last-child { grid-column: span 2; }
.bundle-search input { padding-left: 36px; }
.bundle-search input::placeholder { color: var(--muted); }

.bundle-list {
  background: #1b1e20;
  border: 1px solid #3d4247;
  border-radius: 9px;
}

.bundle-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

.bundle-table th, .bundle-table td {
  padding-inline: clamp(7px, 1vw, 18px);
}

.bundle-table th {
  padding-block: 12px;
  border-color: #3b4044;
  background: #1d2022;
  color: #c9cfd6;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: normal;
  text-transform: none;
  white-space: normal;
}

.bundle-table td {
  height: 56px;
  padding-block: 8px;
  border-color: #34393d;
  font-size: 14px;
  line-height: 1.3;
}

.bundle-table th[data-col=geo]      { width: 7.6%; }
.bundle-table th[data-col=name]     { width: 15.4%; }
.bundle-table th[data-col=goal]     { width: 12%; }
.bundle-table th[data-col=budget]   { width: 12%; }
.bundle-table th[data-col=cpl]      { width: 10.8%; }
.bundle-table th[data-col=fd]       { width: 12%; }
.bundle-table th[data-col=audience] { width: 21.2%; }
.bundle-table th[data-col=actions]  { width: 9%; }

.bundle-table [data-col=budget],
.bundle-table [data-col=cpl],
.bundle-table [data-col=fd] { text-align: right; }

.bundle-table th[data-col=actions] { text-align: center; }
.bundle-actions { justify-content: center; gap: 6px; }
.bundle-geo { gap: 7px; font-weight: 500; }
.bundle-geo-flag { line-height: 1; font-size: 17px; }
.bundle-table td[data-col=geo] { position: relative; }
.bundle-table td[data-col=geo]::after {
  position: absolute;
  content: '';
  right: 0;
  inset-block: 12px;
  border-right: 1px solid #393d41;
}

.bundle-primary,
.bundle-secondary {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bundle-primary { color: var(--text); }
.bundle-secondary {
  margin-top: 3px;
  color: var(--muted);
  font-size: .9em;
}
.bundle-fd-check {
  display: inline-flex;
  vertical-align: middle;
  margin-inline-start: 4px;
  align-items: center;
  color: var(--green);
}
.bundle-table td[data-col=fd] > .bundle-primary {
  display: inline-block;
  max-width: calc(100% - 1.3em);
  vertical-align: middle;
}
.bundle-table td[data-col=fd] > .bundle-secondary { margin: 0; }
.bundle-fd-check .icon { width: 13px; height: 13px; }
.bundle-actions .bundle-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  flex: none;
  margin: 0;
  padding: 0;
  border: 1px solid #454b51;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
}
.bundle-actions .bundle-action:hover,
.bundle-actions .bundle-action[aria-expanded=true] {
  background: #2b3035;
  border-color: #626b73;
}
.bundle-action .icon { width: 15px; height: 15px; }

.bundle-menu {
  position: fixed;
  z-index: 45;
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: 4px;
  background: #26292c;
  border: 1px solid #4b5157;
  border-radius: 7px;
  box-shadow: 0 6px 20px #0006;
}
.bundle-menu[hidden],
.bundle-table .bundle-details-toggle { display: none; }
.bundle-menu button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  width: 100%;
  padding: 6px 12px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.bundle-menu button:is(:hover,:focus-visible) { background: #353a3e; }

@media (min-width: 821px) and (max-width: 1280px) {
  .bundle-table td, .bundle-table th { padding-inline: 7px; }
  .bundle-table td { font-size: 13px; }
  .bundle-table th { font-size: 11px; }
  .bundle-table [data-col=actions] { padding-inline: 2px; }
  .bundle-actions { gap: 4px; }
  .bundle-actions .bundle-action { width: 28px; height: 30px; min-height: 30px; }
}

@media (min-width: 821px) and (max-width: 1050px) {
  .bundle-table th, .bundle-table td { padding-inline: 4px; }
  .bundle-table td { font-size: 12px; }
  .bundle-table [data-col=actions] { padding-inline: 0; }
  .bundle-table th[data-col=actions] { width: 11%; }
  .bundle-table th[data-col=name] { width: 13.4%; }
  .bundle-geo { gap: 4px; }
  .bundle-geo-flag { font-size: 14px; }
  .bundle-actions { gap: 2px; }
  .bundle-actions .bundle-action { width: 26px; height: 28px; min-height: 28px; }
}

@media (max-width: 820px) {
  .bundle-heading .heading-actions { gap: 5px; }
  .bundle-filters { gap: 8px; padding: 10px; }
  .bundle-filters select, .bundle-search input { font-size: 13px; }
  .bundle-table, .bundle-table tbody { display: block; }
  .bundle-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .bundle-table tbody tr {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) minmax(8em, auto) max-content;
    align-items: center;
    gap: 6px 12px;
    padding: 10px 12px;
  }
  .bundle-table tbody tr + tr { border-top: 1px solid #34393d; }
  .bundle-table td {
    display: block;
    min-width: 0;
    height: auto;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .bundle-table td[data-col=geo] { grid-area: 1 / 1; }
  .bundle-table td[data-col=name] { grid-area: 1 / 2; }
  .bundle-table td[data-col=budget] { grid-area: 1 / 3; }
  .bundle-table td[data-col=actions] { grid-area: 1 / 4; }
  .bundle-table td[data-col=geo]::after { display: none; }
  .bundle-table .bundle-name-label { display: none; }
  .bundle-table .bundle-name-toggle {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-height: 26px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text);
    font: inherit;
    text-align: left;
  }
  .bundle-name-toggle::after {
    content: '';
    flex: none;
    width: 6px;
    height: 6px;
    margin-right: 2px;
    border-right: 1px solid var(--muted);
    border-bottom: 1px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
  }
  [data-expanded=true] .bundle-name-toggle::after { transform: rotate(225deg); }
  .bundle-table tbody tr { cursor: pointer; }
  .bundle-table .bundle-actions .bundle-action { width: 34px; height: 34px; min-height: 34px; }
  .bundle-table td[data-col=goal],
  .bundle-table td[data-col=cpl],
  .bundle-table td[data-col=fd],
  .bundle-table td[data-col=audience] { display: none; }
  .bundle-table tr[data-expanded=true] td[data-col=goal],
  .bundle-table tr[data-expanded=true] td[data-col=cpl],
  .bundle-table tr[data-expanded=true] td[data-col=fd],
  .bundle-table tr[data-expanded=true] td[data-col=audience] {
    display: block;
    grid-column: 1 / -1;
    text-align: left;
  }
  .bundle-table tr[data-expanded=true] td[data-col=goal] { margin-top: 4px; }
  .bundle-table tr[data-expanded=true] td[data-col=goal]::before,
  .bundle-table tr[data-expanded=true] td[data-col=cpl]::before,
  .bundle-table tr[data-expanded=true] td[data-col=fd]::before,
  .bundle-table tr[data-expanded=true] td[data-col=audience]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 11px;
  }
  .bundle-table tr[data-expanded=true] :is(.bundle-primary,.bundle-secondary) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 529px) {
  .bundle-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .bundle-heading .heading-actions { flex-wrap: nowrap; }
  .bundle-title-line { gap: 5px; }
  .bundle-title-line h1 { font-size: 23px; }
  .bundle-heading .btn { font-size: 12px; padding-inline: 8px; min-height: 34px; }
  .bundle-heading #refresh-section { width: 32px; }
  .bundle-count { font-size: 12px; padding-inline: 6px; }
  .bundle-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bundle-search { grid-column: 1 / -1; }
  .bundle-table tbody tr {
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    padding: 9px;
    gap: 6px 8px;
  }
  .bundle-table td[data-col=actions] { grid-column: 3; }
  .bundle-table td[data-col=budget] { display: none; }
  .bundle-table tr[data-expanded=true] td[data-col=budget] {
    display: block;
    grid-area: auto / 1 / auto / -1;
    text-align: left;
  }
  .bundle-table tr[data-expanded=true] td[data-col=budget]::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    color: var(--muted);
  }
}
