/* One font for the whole admin (Latin and Arabic; --font-ui is defined in tokens.css). The theme sets its own fonts on many selectors, so this wins over them; it also reaches SVG <text> in the charts. */
*, *::before, *::after { font-family: var(--font-ui) !important; }

/* Additions to the Adminator template (adminator.css). Colours come from tokens.css, fonts from fonts.css. */

/* the template tables have no horizontal cell padding */
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions form { display: inline-block; }
.table .wrap { white-space: normal; word-break: break-word; max-width: 420px; }
.break-all { word-break: break-all; }
.muted { color: var(--t-muted); }

/* grid spans the template does not have (it ships col-6 and col-12 only) */
.col-4 { grid-column: span 4; }
.col-8 { grid-column: span 8; }
.col-3 { grid-column: span 3; }
@media (max-width: 1100px) { .col-4, .col-8, .col-3 { grid-column: span 12; } }

/* stacked cards inside a page */
.stack { display: flex; flex-direction: column; gap: 20px; }
.card + .card { margin-top: 20px; }
.grid > .card + .card { margin-top: 0; }

/* forms: more columns than the template's two */
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-4 { grid-column: span 4; }
@media (max-width: 900px) {
    .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid .span-3, .form-grid .span-4 { grid-column: span 2; }
}
@media (max-width: 600px) {
    .form-grid.cols-2, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr; }
    .form-grid .span-3, .form-grid .span-4 { grid-column: span 1; }
}
.form-grid .field-end { justify-content: flex-end; }
/* a fieldset only groups (and disables) the fields: no browser border, padding or minimum width */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.form-section { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }
.document-rows { display: flex; flex-direction: column; gap: 12px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
.form-actions .btn { width: auto; flex: 0 0 auto; }
.input.is-invalid, .select.is-invalid, textarea.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.input.is-invalid, .select.is-invalid, textarea.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 18%, transparent); }
.field-error:empty { display: none; }
.field-validation-valid { display: none; }
.validation-summary-valid { display: none; }
.validation-summary-errors ul { margin: 0; padding: 0; list-style: none; }

/* filter bar above a table */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 18px; }
.filters .field { min-width: 160px; }
.filters .field.grow { flex: 1; min-width: 220px; }

/* one-line forms (a button next to an input) and small inline forms inside table cells */
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form .input, .inline-form .select { min-width: 0; }
.row-actions { display: inline-flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.row-actions form { display: inline-flex; gap: 6px; align-items: center; }
/* a button inside a column flex box (.field, form) keeps its own width instead of stretching */
.field > .btn, form > .btn { align-self: flex-start; }
/* ...except in a filter bar, where the buttons sit on the line of the inputs, not of their labels */
.filters > .btn { align-self: flex-end; }

/* paging under a table */
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 16px; margin-top: 8px; border-top: 1px solid var(--border-soft); font-size: 12px; color: var(--t-muted); }

/* key/value list on the campaign page */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; margin: 0; }
.facts > div { min-width: 0; }
.facts dt { color: var(--t-muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 4px; }
.facts dd { margin: 0; color: var(--t-base); font-size: 13.5px; }
@media (max-width: 720px) { .facts { grid-template-columns: 1fr; } }

/* the dashboard numbers: three wide cards per row; the template cuts long labels off, here they wrap */
.kpi-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.cols-3 .kpi-value small { color: var(--t-muted); font-size: 18px; font-weight: 500; letter-spacing: 0; }
@media (max-width: 900px) { .kpi-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpi-grid.cols-3 { grid-template-columns: 1fr; } }

/* four tiles per row: the headline numbers; the compact variant is the quieter row of volumes under the funnel */
.kpi-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpi-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .kpi-grid.cols-4 { grid-template-columns: 1fr; } }
.kpi-grid--compact .kpi-value { font-size: 24px; }
.kpi-grid--compact .kpi-card { padding-block: 14px; }

/* status tags: the template ships a few colors; these cover the rest of the states */

/* messages of the layout: the page-level alert should sit above the hero content */
.flash { margin-bottom: 20px; }

/* sidebar user block: the template workspace row, without the chevron */
.sidebar-footer .workspace-text { overflow: hidden; }
.sidebar-footer .workspace-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the sign-out button inside the profile dropdown looks like the other menu items */
.dd-menu form { margin: 0; }
.dd-menu form button.dd-menu-item { width: 100%; text-align: left; }

/* the template hides the sidebar brand text on narrow screens through its own rules; nothing to add */
.error-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.inline-form .spacer { flex: 1; }
.alert + .grid, .alert + .stack, .alert + .card, .alert + .kpi-grid { margin-top: 20px; }

/* the approve/reject form of a creative: reason box on its own line above the two buttons, so the cell stays narrow */
.table .actions .review-form { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 6px; width: 230px; white-space: normal; }
.review-form .input { flex: 1 1 100%; width: 100%; min-width: 0; }
.review-form .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }
.table .actions { text-align: left; }

/* long labels in the dashboard tables wrap instead of being cut */
.table td.label { white-space: normal; word-break: break-word; min-width: 180px; }

/* the one series palette: s1 to s8 set --series, and each chart part reads it (colors are classes, because the CSP does not allow inline styles) */
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s1 { --series: var(--series-s1); }
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s2 { --series: var(--series-s2); }
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s3 { --series: var(--series-s3); }
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s4 { --series: var(--series-s4); }
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s5 { --series: var(--series-s5); }
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s6 { --series: var(--series-s6); }
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s7 { --series: var(--series-s7); }
:is(.chart-path, .legend-swatch, .bar-fill, .donut-slice, .hbar-fill).s8 { --series: var(--series-s8); }
.chart-path { stroke: var(--series, var(--info)); }
.legend-swatch { background: var(--series, var(--info)); }
.bar-fill { fill: var(--series, var(--info)); }
.donut-slice { stroke: var(--series, var(--info)); }
.hbar-fill { background: var(--series, var(--info)); }
.hbar-row:hover .hbar-fill { opacity: .85; }

/* line chart drawn by _TimeSeriesChart (the colors are classes, because the CSP does not allow inline styles) */
.line-chart { width: 100%; height: auto; display: block; }
.chart-grid { stroke: var(--border-soft); stroke-width: 1; stroke-dasharray: 2 4; }
.chart-axis-text { fill: var(--t-light); font-size: 11px; }
.chart-path { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: chart-draw 1s ease-out forwards; }
@keyframes chart-draw { to { stroke-dashoffset: 0; } }
.chart-hit { fill: transparent; }
.chart-hit:hover { fill: var(--bg-card); stroke: var(--t-base); stroke-width: 1.5; }
.chart-legend-row { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; font-size: 12.5px; color: var(--t-muted); }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-item strong { color: var(--t-base); font-variant-numeric: tabular-nums; }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; stroke: none; }

/* funnel bars (SVG) and range selector */
.funnel-bar { height: 10px; display: block; }
.funnel-bar rect.track { fill: var(--bg-muted); }
.funnel-bar rect.fill { fill: var(--primary); transition: width .7s ease; }
.range-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin: 32px 0 20px; }
.range-bar .range-note { color: var(--t-muted); font-size: 12.5px; }
.range-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; }
.range-tabs a { padding: 6px 12px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--t-muted); }
.range-tabs a:hover { background: var(--bg-hover); color: var(--t-base); }
.range-tabs a.is-active { background: var(--primary); color: var(--on-fill); }
.stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.stat-row .stat-label { color: var(--t-muted); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.stat-row .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat-row .stat-value small { color: var(--t-muted); font-size: 14px; font-weight: 500; }

/* live updates */
.range-bar .live-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 7px; color: var(--t-muted); font-size: 12.5px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); animation: live-pulse 2s ease-in-out infinite; }
.live-pill.is-offline .live-dot { background: var(--danger); animation: none; }
@keyframes live-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.count { border-radius: 4px; }
.count.is-changed { animation: count-flash 1.4s ease-out; }
@keyframes count-flash { 0% { background: color-mix(in srgb, var(--primary) 24%, transparent); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) {
    .chart-path { animation: none; stroke-dasharray: none; stroke-dashoffset: 0; }
    .live-dot, .count.is-changed { animation: none; }
    .funnel-bar rect.fill { transition: none; }
}
.table tr.is-selected td { background: var(--primary-soft); }

/* bar, funnel, stacked bar, donut, sparkline, heatmap and progress charts (colors are classes, because the CSP does not allow inline styles) */
.bar-track { fill: var(--bg-muted); }
.bar-fill:hover { opacity: .85; }
.donut-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 28px; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-track, .donut-slice { fill: none; stroke-width: 5; }
.donut-track { stroke: var(--bg-muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; }
.sparkline { display: inline-block; vertical-align: middle; }
.sparkline-path { fill: none; stroke: var(--series-s1); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.sparkline-end { fill: var(--series-s1); stroke: var(--bg-card); stroke-width: 1.5; }
.heat.h0 { fill: var(--bg-muted); }
.heat.h1 { fill: var(--primary); fill-opacity: .3; }
.heat.h2 { fill: var(--primary); fill-opacity: .48; }
.heat.h3 { fill: var(--primary); fill-opacity: .66; }
.heat.h4 { fill: var(--primary); fill-opacity: .84; }
.heat.h5 { fill: var(--primary); }
.progress-item { display: grid; gap: 6px; padding: 6px 0; }
.progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.progress-head .num { color: var(--t-muted); font-variant-numeric: tabular-nums; }
.hbar-fill.progress-fill { background: var(--chart-success); }
.progress-item.is-warning .hbar-fill.progress-fill { background: var(--chart-warning); }
.progress-item.is-critical .hbar-fill.progress-fill { background: var(--danger); }
@media (prefers-reduced-motion: reduce) { .bar-fill { transition: none; } }

/* change against the previous window, and the small trend line, under a key number */
.kpi-trend { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 24px; margin-top: 4px; }
.kpi-delta { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi-delta.is-good { color: var(--text-good); }
.kpi-delta.is-bad { color: var(--text-bad); }
.kpi-delta.is-flat { color: var(--t-muted); }

/* ranked bars, funnel and progress bars drawn with HTML; the bar width is a class from w-0 to w-100 */
.hbar-list { display: grid; gap: 2px; }
.hbar-row { display: grid; grid-template-columns: minmax(130px, 38%) minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; padding: 5px 0; font-size: 13px; }
.hbar-label { color: var(--t-base); overflow-wrap: anywhere; line-height: 1.3; }
.hbar-track { display: block; height: 12px; background: var(--bg-muted); border-radius: 6px; overflow: hidden; }
.is-funnel .hbar-track { display: flex; justify-content: center; }
.hbar-fill { display: block; height: 100%; border-radius: 6px; }
.hbar-value { color: var(--t-muted); font-size: 12px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; min-width: 56px; }
@media (max-width: 560px) { .hbar-row { grid-template-columns: minmax(0, 1fr) auto; } .hbar-label { grid-column: 1 / -1; } }
.w-0 { width: 0%; }
.w-1 { width: 1%; }
.w-2 { width: 2%; }
.w-3 { width: 3%; }
.w-4 { width: 4%; }
.w-5 { width: 5%; }
.w-6 { width: 6%; }
.w-7 { width: 7%; }
.w-8 { width: 8%; }
.w-9 { width: 9%; }
.w-10 { width: 10%; }
.w-11 { width: 11%; }
.w-12 { width: 12%; }
.w-13 { width: 13%; }
.w-14 { width: 14%; }
.w-15 { width: 15%; }
.w-16 { width: 16%; }
.w-17 { width: 17%; }
.w-18 { width: 18%; }
.w-19 { width: 19%; }
.w-20 { width: 20%; }
.w-21 { width: 21%; }
.w-22 { width: 22%; }
.w-23 { width: 23%; }
.w-24 { width: 24%; }
.w-25 { width: 25%; }
.w-26 { width: 26%; }
.w-27 { width: 27%; }
.w-28 { width: 28%; }
.w-29 { width: 29%; }
.w-30 { width: 30%; }
.w-31 { width: 31%; }
.w-32 { width: 32%; }
.w-33 { width: 33%; }
.w-34 { width: 34%; }
.w-35 { width: 35%; }
.w-36 { width: 36%; }
.w-37 { width: 37%; }
.w-38 { width: 38%; }
.w-39 { width: 39%; }
.w-40 { width: 40%; }
.w-41 { width: 41%; }
.w-42 { width: 42%; }
.w-43 { width: 43%; }
.w-44 { width: 44%; }
.w-45 { width: 45%; }
.w-46 { width: 46%; }
.w-47 { width: 47%; }
.w-48 { width: 48%; }
.w-49 { width: 49%; }
.w-50 { width: 50%; }
.w-51 { width: 51%; }
.w-52 { width: 52%; }
.w-53 { width: 53%; }
.w-54 { width: 54%; }
.w-55 { width: 55%; }
.w-56 { width: 56%; }
.w-57 { width: 57%; }
.w-58 { width: 58%; }
.w-59 { width: 59%; }
.w-60 { width: 60%; }
.w-61 { width: 61%; }
.w-62 { width: 62%; }
.w-63 { width: 63%; }
.w-64 { width: 64%; }
.w-65 { width: 65%; }
.w-66 { width: 66%; }
.w-67 { width: 67%; }
.w-68 { width: 68%; }
.w-69 { width: 69%; }
.w-70 { width: 70%; }
.w-71 { width: 71%; }
.w-72 { width: 72%; }
.w-73 { width: 73%; }
.w-74 { width: 74%; }
.w-75 { width: 75%; }
.w-76 { width: 76%; }
.w-77 { width: 77%; }
.w-78 { width: 78%; }
.w-79 { width: 79%; }
.w-80 { width: 80%; }
.w-81 { width: 81%; }
.w-82 { width: 82%; }
.w-83 { width: 83%; }
.w-84 { width: 84%; }
.w-85 { width: 85%; }
.w-86 { width: 86%; }
.w-87 { width: 87%; }
.w-88 { width: 88%; }
.w-89 { width: 89%; }
.w-90 { width: 90%; }
.w-91 { width: 91%; }
.w-92 { width: 92%; }
.w-93 { width: 93%; }
.w-94 { width: 94%; }
.w-95 { width: 95%; }
.w-96 { width: 96%; }
.w-97 { width: 97%; }
.w-98 { width: 98%; }
.w-99 { width: 99%; }
.w-100 { width: 100%; }

/* a last tile that would stand alone in its row (the seventh of three columns, or of two) takes the whole row */
.kpi-grid.cols-3 > .kpi-card:last-child:nth-child(3n+1) { grid-column: 1 / -1; }
@media (max-width: 900px) { .kpi-grid.cols-3 > .kpi-card:last-child:nth-child(odd) { grid-column: 1 / -1; } }
@media (max-width: 560px) { .kpi-grid.cols-3 > .kpi-card:last-child { grid-column: auto; } }

/* tile accent colors the theme does not define */
.c-warning { color: var(--warning); }
.c-info { color: var(--info); }

/* creative thumbnails (9:16, like the ad on the subscriber's phone) */
.creative-thumb { display: block; width: 40px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 6px; background: var(--bg-muted); border: 1px solid var(--border); }
.creative-thumb.is-empty { display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; line-height: 1.2; color: var(--t-muted); padding: 2px; }

.creatives-table { min-width: 820px; }
.creatives-table th, .creatives-table td { padding-right: 24px; vertical-align: top; padding-top: 12px; padding-bottom: 12px; }
.creatives-table th:last-child, .creatives-table td:last-child { padding-right: 0; }
.creatives-table .col-preview { width: 56px; }
.creatives-table .col-actions { width: 240px; }
.creative-meta { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.creative-file { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--t-muted); white-space: nowrap; }
.table td.actions { vertical-align: top; }
.creatives-table .tag { white-space: nowrap; margin-top: 2px; }

/* confirmation dialog (site.js: data-confirm); a native <dialog>, themed with the same tokens as the cards */
.confirm-dialog { border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--bg-card); color: var(--t-base); box-shadow: var(--shadow-lg); animation: confirm-in .18s ease-out; }
.confirm-dialog::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(3px); animation: confirm-fade .18s ease-out; }
.confirm-body { display: flex; gap: 16px; padding: 24px 24px 8px; align-items: flex-start; }
.confirm-icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.confirm-icon svg { width: 22px; height: 22px; }
.confirm-dialog.is-danger .confirm-icon { background: var(--danger-soft); color: var(--danger); }
.confirm-dialog.is-warning .confirm-icon { background: var(--warning-soft); color: var(--warning); }
.confirm-dialog.is-primary .confirm-icon { background: var(--primary-soft); color: var(--primary); }
.confirm-title { margin: 2px 0 6px; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.confirm-message { margin: 0; color: var(--t-muted); font-size: 14px; line-height: 1.55; }
.confirm-buttons { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 22px; }
@media (max-width: 420px) { .confirm-buttons { flex-direction: column-reverse; } .confirm-buttons .btn { width: 100%; justify-content: center; } }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes confirm-fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .confirm-dialog, .confirm-dialog::backdrop { animation: none; } }

/* a drop-down panel with check boxes, to pick several items by name (site.js updates the summary) */
.multi-select { position: relative; min-width: 220px; }
.multi-select > summary { list-style: none; cursor: pointer; display: flex; align-items: center; } /* the arrow is the one of .select */
.multi-select > summary::-webkit-details-marker { display: none; }
.multi-select-panel { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; min-width: 100%; max-width: 360px; max-height: 280px; overflow: auto; padding: 6px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); }
.multi-select-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.multi-select-item[hidden] { display: none; }
.multi-select-item:hover { background: var(--bg-hover); }
.multi-select-item input { accent-color: var(--primary); width: 16px; height: 16px; flex: none; }

/* filter bars: every control the same height, so the labels and the button line up */
.filters .input, .filters .select { height: 40px; }
.filters .btn { height: 40px; }


/* the Maksab mark in the sidebar: its own colors on a soft tile */
.brand-logo { background: var(--bg-muted); box-shadow: none; }
.brand-logo svg { width: 26px; height: 26px; }

/* SMS template editor: typed text with draggable Link and MB tokens */
.tpl-editor { display: flex; flex-direction: column; gap: 8px; }
.tpl-tokens { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tpl-canvas { min-height: 76px; padding: 10px 12px; line-height: 2; white-space: pre-wrap; overflow-wrap: anywhere; cursor: text; }
.tpl-canvas:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.tpl-chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: var(--primary); color: var(--on-fill); font-weight: 700; font-size: 13px; line-height: 1.7; user-select: none; cursor: grab; }
.tpl-chip.is-used { opacity: 0.4; cursor: not-allowed; }
.tpl-chip--placed { margin: 0 3px; cursor: default; }
.tpl-chip-remove { border: 0; background: transparent; color: inherit; font-size: 15px; line-height: 1; padding: 0 0 0 2px; cursor: pointer; }
.tpl-meta { font-size: 12.5px; color: var(--t-muted, #667); }
.tpl-meta .is-over { color: var(--danger); font-weight: 700; }
.tpl-preview { white-space: pre-wrap; padding: 10px 12px; border: 1px dashed var(--border, #cbd); border-radius: 8px; }
.tpl-preview-label { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--t-muted, #667); margin-bottom: 4px; }

/* readability pass: the template's 10-13px text is too small for a dashboard, so the common parts are one step larger */
body { font-size: 15px; }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table .cell-date, .table .mono, .mono { font-size: 13px; }
.table tbody tr:hover td { background: var(--bg-hover); }
.card-title { font-size: 18px; }
.eyebrow { font-size: 11.5px; }
.field-label { font-size: 13px; }
.field-help { font-size: 13px; }
.input, .select, textarea.input { font-size: 14px; }
.range-tabs a { font-size: 13.5px; }
.table-foot { font-size: 13px; }

/* sidebar: larger, clearer menu (the template's 10px mono section labels and 13px links were hard to read) */
.nav-label { font-size: 11.5px; font-weight: 600; letter-spacing: .08em; padding: 0 12px 8px; }
.nav-section { gap: 3px; }
.nav-link { font-size: 14.5px; padding: 10px 12px; gap: 12px; }
.nav-link > svg { width: 19px; height: 19px; }
.nav-submenu a { font-size: 14px; padding: 8px 12px; }
.nav-submenu-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .6; padding: 10px 12px 4px; }
.nav-submenu-label:first-child { padding-top: 4px; }
.nav-badge { font-size: 11px; padding: 2px 8px; }

/* funnel "All counts": event types down the side, one column per campaign/day, zeros dimmed */
.counts-table td.is-zero { color: var(--t-light); }
.counts-table .counts-code { font-size: 12px; font-weight: 400; color: var(--t-muted); }
.counts-table th.num { white-space: nowrap; vertical-align: bottom; } /* each column is as wide as its label */
/* one row per campaign (or hour), one column per event type: it grows downwards. The first column and the header stay in view while it scrolls. */
.counts-scroll { max-height: 70vh; overflow: auto; }
.counts-table th, .counts-table td:first-child { background: var(--bg-card); }
.counts-table thead th { position: sticky; top: 0; z-index: 2; }
.counts-table th:first-child, .counts-table td:first-child { position: sticky; left: 0; z-index: 1; min-width: 180px; max-width: 260px; }
.counts-table thead th:first-child { z-index: 3; }
.counts-table tr.counts-total td { font-weight: 600; }

/* ui-ux pass: aligned digits everywhere numbers are compared, visible keyboard focus, wide tables scroll instead of breaking the page */
.table td, .kpi-value, .stat-value { font-variant-numeric: tabular-nums; }
.table a:focus-visible, .nav-link:focus-visible, .nav-submenu a:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.table-scroll { max-width: 100%; }
@media (prefers-reduced-motion: reduce) { .table tbody tr, .nav-link, .nav-submenu a { transition: none; } }

/* ---- visual refresh (tables, tags, cards). Same font and colors; only spacing, weight, contrast and depth change. ---- */

/* tables: a tinted header band, even padding on every cell, soft zebra rows, clear hover */
.table thead th {
    background: var(--bg-muted);
    color: var(--t-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.table thead th:first-child { border-top-left-radius: 10px; border-bottom-left-radius: 10px; }
.table thead th:last-child { border-top-right-radius: 10px; border-bottom-right-radius: 10px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table tbody tr:nth-child(even) td { background: color-mix(in oklab, var(--bg-muted) 45%, transparent); }
.table tbody tr:hover td { background: var(--bg-hover); }
.table tbody tr.is-selected td { background: var(--primary-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-name { font-weight: 600; color: var(--t-base); }
.table td.num { color: var(--t-base); }
.table .cell-date { color: var(--t-muted); }
.table td.is-zero { color: var(--t-light); }

/* IDs, codes and phone numbers read as code, so they line up and look different from prose */
.mono, .table .mono { font-family: var(--font-mono) !important; font-size: 12.5px; letter-spacing: -.01em; }

/* wide tables: a visible scrollbar says there is more to the right */
.table-scroll { scrollbar-width: thin; scrollbar-color: var(--border) transparent; padding-bottom: 4px; }
.table-scroll::-webkit-scrollbar { height: 8px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--t-light); }

/* status tags: a dot before the text, so meaning is not carried by color alone */

/* cards: a firmer edge and a little lift so blocks separate from the page */
.card, .kpi-card { box-shadow: var(--shadow-card), 0 0 0 1px color-mix(in oklab, var(--border) 40%, transparent); }
.card-head { margin-bottom: 16px; }
.card-title { letter-spacing: -.01em; }
.eyebrow { color: var(--t-muted); }
.kpi-label { color: var(--t-muted); font-weight: 600; }
.kpi-card:hover { box-shadow: var(--shadow-lg); }

/* empty text inside a card reads as a quiet note, not as a stray line */
.card > p.muted { padding: 12px 0 0; text-align: left; }
/* a line of facts above a form is text, not an empty state */
.card > p.muted.note { padding: 0; margin: 0 0 12px; text-align: left; }
.stack > .card + .card { margin-top: 0; }
.table-foot { border-top-color: var(--border); }

/* chart axis text: fixed size on screen (12px), whatever the card width; --chart-scale is set by site.js (1 until then) */
.chart-axis-text { font-size: calc(12px / var(--chart-scale, 1)); fill: var(--t-muted); font-variant-numeric: tabular-nums; }
.chart-grid { stroke-width: calc(1px / var(--chart-scale, 1)); }

/* ---- mobile and tablet ---- */

/* tablet (721-1100px): the template shrinks the sidebar to an icon rail and hides the Reports and Fraud submenus, so those pages could not be reached.
   Use the same slide-in drawer as on phones instead. */
@media (min-width: 721px) and (max-width: 1100px) {
    .shell { display: block; }
    .d-sidebar { position: fixed; top: 0; left: 0; height: 100vh; height: 100dvh; width: 280px; padding: 22px 16px 18px; z-index: 100; overflow-y: auto; transform: translateX(-100%); transition: transform .24s cubic-bezier(.2, .7, .2, 1); box-shadow: 0 12px 40px -8px rgba(0, 0, 0, .4); }
    body.has-drawer-open .d-sidebar { transform: translateX(0); }
    body.has-drawer-open { overflow: hidden; }
    .brand-tag, .brand-text, .nav-label, .nav-link .chev, .nav-link .nav-badge, .nav-link > span:not(.nav-badge), .nav-submenu, .workspace-chev, .workspace-text { display: revert; }
    .brand { padding: 4px 10px 20px; }
    .brand, .nav-link, .workspace { justify-content: flex-start; }
    .nav-link { padding: 9px 12px; }
    .hamburger { display: inline-flex; }
}

/* the drawer scrolls on its own and fits the visible height under the browser bars */
.d-sidebar { overscroll-behavior: contain; }

@media (max-width: 720px) {
    .d-sidebar { height: 100dvh; overflow-y: auto; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

    /* notches and home indicators */
    .d-topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
    .content { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
    .d-footer { padding-bottom: calc(20px + env(safe-area-inset-bottom)); }

    /* 16px inputs: iOS zooms the page in on anything smaller when it gets focus */
    .input, .select, textarea, input:not([type=checkbox]):not([type=radio]) { font-size: 16px; }
    .select { padding-top: 9px; padding-bottom: 9px; }

    /* finger-sized targets */
    .btn { min-height: 40px; }
    .btn--sm { min-height: 36px; }
    .icon-btn, .hamburger { width: 40px; height: 40px; }
    .nav-link, .nav-submenu a { min-height: 40px; display: flex; align-items: center; }
    .range-tabs a { padding: 9px 14px; }
    .dd-menu-item { min-height: 44px; }

    /* page header: actions under the title, as full-width buttons */
    .hero-title { font-size: 26px; overflow-wrap: anywhere; }
    .hero-actions { width: 100%; }
    .hero-actions > .btn, .hero-actions > form, .hero-actions > a { flex: 1 1 auto; }
    .hero-actions .btn { justify-content: center; }

    /* filters: one control per row instead of a fixed minimum width that pushes past the screen */
    .filters { align-items: stretch; }
    .filters .field, .filters .field.grow { min-width: 0; flex: 1 1 100%; }
    .filters .btn { width: 100%; justify-content: center; }
    .multi-select { min-width: 0; width: 100%; }
    .multi-select-panel { max-width: calc(100vw - 48px); }
    .inline-form { flex-wrap: wrap; }
    .inline-form .input, .inline-form .select { flex: 1 1 100%; }

    /* the big numbers */
    .kpi-value { font-size: 34px; }
    .kpi-grid.cols-3 .kpi-value small { font-size: 15px; }
    .card { padding: 16px; }
    .card-head { align-items: flex-start; }

    /* range tabs scroll sideways instead of wrapping into a tall block */
    .range-bar { margin: 20px 0 16px; }
    .range-tabs { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
    .range-tabs::-webkit-scrollbar { display: none; }
    .range-tabs a { white-space: nowrap; }
    .range-bar .live-pill { margin-left: 0; }

    /* tables keep their columns and scroll inside the card; tighter cells so more fits */
    .table thead th { padding: 10px 12px; }
    .table tbody td { padding: 12px; }
    .table .wrap { max-width: 260px; min-width: 160px; }
    .table .actions .review-form { width: 200px; }
    .table-foot { flex-wrap: wrap; justify-content: center; text-align: center; }
    .row-actions { justify-content: flex-start; }

    /* donut centered above its legend */
    .donut-wrap { justify-content: center; }
    .donut-legend { width: 100%; }

    /* the SMS template editor */
    .tpl-tokens .tpl-chip { padding: 6px 12px; }
}

@media (max-width: 400px) {
    .hero-title { font-size: 23px; }
    .kpi-value { font-size: 30px; }
    .content { padding-top: 16px; }
}

/* ---- mobile, second pass ---- */

/* wide charts (line, stacked bars, heatmap) are drawn on an 800-unit canvas. On a phone that shrinks bars and cells to a sliver, so the chart keeps a readable
   width and scrolls sideways inside its card */
.chart-scroll { max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
@media (max-width: 720px) {
    .chart-scroll .line-chart { min-width: 640px; }
    .chart-axis-text { font-size: calc(10px / var(--chart-scale, 1)); }
}

/* long ids, urls and code never push a card wider than the screen */
.card, .kpi-card, .alert .body, .facts dd, .field { min-width: 0; }
.facts dd, .alert .body, .card-title { overflow-wrap: anywhere; }
pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.input, .select, textarea { max-width: 100%; }
input[type=date], input[type=time], input[type=datetime-local] { min-width: 0; }

/* the page itself never scrolls sideways: whatever is wider scrolls in its own box */
.content { overflow-x: clip; }

@media (max-width: 720px) {
    /* alert: icon and text on the first line, the action (if any) under the text */
    .alert { grid-template-columns: 24px minmax(0, 1fr); }
    .alert > :nth-child(n+3) { grid-column: 2; }

    /* form buttons and card heads */
    .form-actions .btn, .form-actions form { width: 100%; }
    .card-head .btn, .card-head form { flex: 1 1 auto; }

    /* the dashboard's live numbers and the key-number cards use the full width */
    .kpi-grid, .kpi-grid.cols-3, .kpi-grid.cols-4 { grid-template-columns: 1fr; }
    .kpi-compare { flex-wrap: wrap; }

    /* funnel / ranked bars: value under the label, bar below */
    .hbar-value { min-width: 0; }

    /* page footer row */
    .d-footer { text-align: left; }

    /* the open submenu inside the drawer is indented and easy to tap */
    .nav-submenu a { padding: 8px 12px 8px 40px; }

    /* sticky topbar: the bar stays small and the account menu opens inside the screen */
    .dd-menu.dd-profile { right: 0; }
}

/* report notes under a table: a readable line length */
.table-scroll + p.muted { max-width: 90ch; line-height: 1.55; margin: 14px 0 0; }

/* sidebar: submenus are not cut off (long Reports list), labels stay on one line, and the menu keeps its size instead of shrinking inside the scrolling sidebar */
.d-sidebar > * { flex-shrink: 0; }
.nav-item-group.is-open .nav-submenu { max-height: 1600px; }
.nav-submenu { margin-left: 14px; padding-left: 8px; }
.nav-submenu a { white-space: nowrap; padding: 8px 8px; font-size: 13.5px; }
.nav-submenu a:hover { padding-left: 10px; }
.nav-submenu-label { padding-left: 8px; }
@media (min-width: 1101px) { .shell { grid-template-columns: 268px 1fr; } }
.nav-submenu a { font-size: 13px; }

/* an alert without an icon (just a .body, or a title and a body) uses the whole width instead of the 24px icon column */
.alert > .body:first-child, .alert > .title:first-child { grid-column: 1 / -1; }
.alert:not(:has(> .ico)) { grid-template-columns: minmax(0, 1fr); }

/* even vertical rhythm: blocks that follow each other on a page are 20px apart, whichever mix of cards, grids, KPI rows and alerts they are */
.content > .grid + .card, .content > .card + .grid, .content > .grid + .grid, .content > .kpi-grid + .card, .content > .kpi-grid + .grid,
.content > .stack + .card, .content > .card + .stack, .content > .alert + .alert, .content > .grid + .kpi-grid, .content > .card + .kpi-grid,
.content > .alert + .kpi-grid { margin-top: 20px; }
/* the dashboard blocks sit inside #live-reports, not directly in .content, so they get the same rhythm here */
#live-reports > .grid + .kpi-grid, #live-reports > .kpi-grid + .grid, #live-reports > .kpi-grid + .kpi-grid { margin-top: 20px; }
.content > .alert + .alert { margin-top: 12px; }
.content > .kpi-grid:last-child, .content > .grid:last-child { margin-bottom: 0; }
.card > .table-scroll + .table-foot, .card > .table-scroll + .muted { margin-top: 14px; }
.card > .card-head + .alert { margin-top: 0; }
.card > * + .alert, .card > .alert + * { margin-top: 12px; }
.card > .alert:first-child { margin-top: 0; }

/* Reports submenu: each section folds, the one with the current page is open */
.nav-sub { margin: 2px 0; }
.nav-sub > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; opacity: .7; padding: 8px 8px; border-radius: 6px; }
.nav-sub > summary::-webkit-details-marker { display: none; }
.nav-sub > summary::after { content: ""; width: 6px; height: 6px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(-45deg); transition: transform .15s; }
.nav-sub[open] > summary::after { transform: rotate(45deg); }
.nav-sub > summary:hover { opacity: 1; }
.nav-sub > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.nav-sub > a { display: block; }

/* Pager links and the disabled / gap cells follow the template's .pager-btn (buttons there, links and spans here). */
a.pager-btn { text-decoration: none; }
span.pager-btn[aria-disabled="true"] { cursor: not-allowed; opacity: .4; }
.pager-gap { color: var(--t-light); }

/* text for screen readers only (the data table behind a chart) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* the advertiser's balance is the first thing on their page: a wide tile of its own, with the state in words */
.kpi-grid--lead { grid-template-columns: 1fr; }
.kpi-card--hero .kpi-value { font-size: 40px; }

/* readable text: the line under a key number flows as normal text (the template made it a flex row, which split a sentence into separate columns), and small captions use the muted text color, which has enough contrast */
.kpi-card .kpi-compare { display: block; color: var(--t-muted); font-size: 12.5px; line-height: 1.5; overflow-wrap: anywhere; }
.kpi-card .kpi-compare strong { color: var(--t-base); font-weight: 600; }
.table thead th { color: var(--t-muted); font-size: 11px; line-height: 1.35; }
.facts dt, .stat-row .stat-label { color: var(--t-muted); }

/* funnel rows: the name and the numbers share the first line, the bar gets the full width below, so long numbers never squeeze the bar */
.hbar-row.is-funnel { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
.hbar-row.is-funnel .hbar-track { grid-column: 1 / -1; grid-row: 2; }
.hbar-row.is-funnel .hbar-label { grid-row: 1; }
.hbar-row.is-funnel .hbar-value { grid-row: 1; grid-column: 2; }
@media (max-width: 560px) { .hbar-row.is-funnel .hbar-label { grid-column: 1; } .hbar-row.is-funnel .hbar-value { white-space: normal; } }

/* keyboard use: a visible focus ring on every link, button and summary (the field rings come from the theme), and a link at the top that jumps past the sidebar */
:where(a, button, summary, [tabindex]):focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
.content:focus { outline: none; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 1000; padding: 10px 16px; background: var(--primary); color: var(--on-fill); border-radius: 8px; font-weight: 600; transition: top .15s ease; }
.skip-link:focus { top: 12px; }
@media (prefers-reduced-motion: reduce) { .skip-link { transition: none; } }

/* a long caption above a card title wraps inside the card instead of running past its edge (seen on a phone, on the Campaigns card of the dashboard) */
.card-title-wrap { max-width: 100%; }
.card-title-wrap .eyebrow { overflow-wrap: anywhere; line-height: 1.5; }
/* on a phone the quieter row of numbers is two per row, so it does not take four screens */
@media (max-width: 560px) { .kpi-grid--compact.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpi-grid--compact .kpi-value { font-size: 22px; } }

/* a note under a table or a chart reads as text (left, no big padding); only the short "Nothing to show." lines are centered */
.table-scroll + p.muted, .hbar-list + p.muted, .chart-scroll + p.muted, .card > .muted + .muted { text-align: left; padding: 0; }
/* a row of tiles shares the whole width, whether it holds three or four of them */
.kpi-grid:not(.cols-3):not(.cols-4):not(.kpi-grid--lead) { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

/* table headers may wrap onto two lines and the cells are a little tighter, so a five or six column table fits a half-width card before it has to scroll */
.table th, .table td { padding-right: 12px; }

/* the note under a heatmap comes after its hidden data table */
.sr-only + p.muted, .chart-scroll + .sr-only + p.muted { text-align: left; padding: 0; }

/* a number and its unit in bold ("0 s", "10,000 MB") stay on one line */
.card p strong, .kpi-compare strong { white-space: nowrap; }

/* the forms in a row of actions keep their full size and wrap onto the next line, instead of shrinking and letting the buttons overlap (seen on Outside accounts: Link over Unlink) */
.row-actions > form { flex: 0 0 auto; }
.row-actions > form > .select { min-width: 150px; }
/* dates and times in a table stay on one line ("2026-11-15 12:27" was split over three lines in Creatives) */
.table .cell-date { white-space: nowrap; }
.table .cell-nowrap { white-space: nowrap; }
/* a short note above a card is body text, not a larger heading-like line; and a note that is followed by a form is text, not an empty-state message */
.content > p.muted { font-size: 14px; line-height: 1.6; max-width: 90ch; }
.card > p.muted:not(:last-child) { text-align: left; padding: 0 0 14px; }
/* the table rule ".table .actions form" (inline-block) was stronger than the row-actions and inline-form rules, so a select and its button did not sit side by side */
.table .actions .row-actions > form, .table .actions .row-actions > form.inline-form { display: inline-flex; align-items: center; gap: 8px; }
.stack > p.muted { font-size: 14px; line-height: 1.6; max-width: 90ch; margin: 0; }


/* a table whose cells never wrap (dates, amounts); the table scrolls sideways if it is too wide */
.table--nowrap td { white-space: nowrap; }
/* wide tables: the column names may wrap onto two lines (the cells below never do), so the table fits the card instead of scrolling */
.table--wide thead th { white-space: normal; vertical-align: bottom; line-height: 1.25; }
/* a card that is only as tall as its content, not stretched to the row */
.card--fit, .grid > .card--fit { align-self: start; }

/* funnel: one row per step; the bar is the share of the step before that reached it */
.funnel-steps { list-style: none; margin: 0; padding: 0; display: grid; container-type: inline-size; }
.funnel-head, .funnel-row { display: grid; grid-template-columns: minmax(140px, 22%) minmax(100px, 1fr) 80px 130px 70px; align-items: center; gap: 4px 16px; padding: 10px 0; }
.funnel-head { font-size: 12.5px; color: var(--t-light); border-bottom: 1px solid var(--border-soft); padding-top: 0; }
.funnel-row { border-bottom: 1px solid var(--border-soft); }
.funnel-row:last-child { border-bottom: 0; }
.funnel-label { font-weight: 600; color: var(--t-base); min-width: 0; overflow-wrap: anywhere; }
.funnel-track { display: block; height: 14px; border-radius: 7px; background: var(--bg-muted); overflow: hidden; }
.funnel-fill { display: block; height: 100%; border-radius: 7px; background: var(--series, var(--info)); }
.funnel-count, .funnel-share, .funnel-lost { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--t-base); }
.funnel-lost { color: var(--t-muted); }
.funnel-fill.s1 { --series: var(--series-s1); }
/* in a narrow card (half width, tablet, phone): name and numbers on the first line, the bar full width under them */
@container (max-width: 620px) {
    .funnel-head { display: none; }
    .funnel-row { grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px 14px; }
    .funnel-label { grid-column: 1; }
    .funnel-track { grid-column: 1 / -1; grid-row: 2; }
}
.funnel-lost::after { content: " lost"; color: var(--t-light); }
.funnel-share::after { content: " of the step before"; color: var(--t-light); display: none; }
.funnel-lost.is-none::after { content: none; }
@container (min-width: 621px) { .funnel-lost::after { content: none; } }
@container (max-width: 620px) { .funnel-share:not(.is-none)::after { display: inline; content: " reached it"; } }
.row-actions--wrap { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-start; width: 176px; white-space: normal; }
.table .actions .row-actions--wrap form { display: contents; }
.row-actions--wrap { width: 230px; }

/* creatives: one card per creative (9:16 preview on the left, tags, facts and review on the right) */
.creative-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.creative-card { display: flex; gap: 16px; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-card); }
.creative-media { position: relative; flex: none; width: 96px; }
.creative-media .creative-thumb { width: 96px; border-radius: 10px; }
.creative-media .creative-thumb.is-empty { font-size: 12px; }
.creative-play { position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px; border-radius: 50%; background: rgba(15, 23, 42, .72); color: #fff; display: grid; place-items: center; pointer-events: none; }
.creative-play svg { width: 12px; height: 12px; fill: currentColor; }
.creative-body { min-width: 0; flex: 1; display: grid; align-content: start; gap: 10px; }
.creative-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.creative-reason { margin: 0; font-size: 13px; color: var(--danger); overflow-wrap: anywhere; }
.creative-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.creative-actions .input { flex: 1 1 100%; min-width: 0; }
.creative-actions .btn { flex: 1 1 auto; justify-content: center; white-space: nowrap; }
.creative-file { flex-direction: row; gap: 12px; }
.creative-upload { margin-top: 24px; display: grid; gap: 12px; }
.creative-upload-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.creative-upload-row .field { flex: 1 1 360px; max-width: 560px; }
.upload-progress { display: grid; gap: 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-md, 10px); background: var(--bg-muted); }
.upload-progress-head { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.upload-progress-label { overflow-wrap: anywhere; }
.upload-progress-head .num { color: var(--t-muted); font-variant-numeric: tabular-nums; text-align: right; }
.upload-progress-bar { width: 100%; height: 10px; appearance: none; border: 0; border-radius: var(--radius-pill); overflow: hidden; background: var(--border); accent-color: var(--chart-success); }
.upload-progress-bar::-webkit-progress-bar { background: var(--border); }
.upload-progress-bar::-webkit-progress-value { background: var(--chart-success); transition: width .2s ease; }
.upload-progress-bar::-moz-progress-bar { background: var(--chart-success); }
.upload-progress.is-processing .upload-progress-bar { opacity: .7; }
.upload-progress-error { margin: 0; font-size: 13px; color: var(--danger); }
.upload-progress.is-failed { border-color: var(--danger); }
.upload-progress-actions { display: flex; gap: 8px; }
.upload-progress[hidden], .upload-progress-bar[hidden], .upload-progress-error[hidden] { display: none; }
.creative-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.creative-rules li { padding: 4px 10px; border-radius: var(--radius-pill); background: var(--bg-muted); color: var(--t-muted); font-size: 12.5px; }


/* the system-wide creatives list reuses the cards of the campaign page, a little wider */
.creative-grid--page { grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); }
.creative-campaign { font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.creative-file { flex-wrap: wrap; }
/* a card that is a column, so its content can spread over its height (the live status next to the taller queues) */
.card--column { display: flex; flex-direction: column; }
.stack--spread { flex: 1; justify-content: space-between; }

/* two-step setup: the QR code is drawn on the server as inline SVG; it stays black on white in every theme so a camera can read it */
.qr-code { width: min(240px, 100%); margin: 8px 0 16px; background: #fff; border-radius: 8px; line-height: 0; }
.qr-code svg { display: block; width: 100%; height: auto; }

/* Local users: a photo in place of the name tile, and the preview on the edit page */
.name-tile--photo { object-fit: cover; background: var(--bg-muted); }
.photo-preview { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; display: block; }
.photo-preview--initial { display: grid; place-items: center; font: 700 32px var(--font-display); background: var(--bg-muted); color: var(--t-muted); }
.avatar-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar:has(.avatar-img), .workspace-avatar:has(.avatar-img) { overflow: hidden; padding: 0; }

/* A text to copy (temporary password, keys, scripts) with its Copy button; used on many pages */
.code-block { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--bg-muted); border: 1px solid var(--border-soft); }
.code-block code { flex: 1; min-width: 0; font-size: 13px; line-height: 1.5; white-space: pre-wrap; user-select: all; }
.code-block .btn { flex: none; }

/* Recovery codes: one chip per code, two columns */
.recovery-codes { list-style: none; margin: 0 0 4px; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 420px; }
.recovery-codes li { padding: 10px 14px; border-radius: 10px; background: var(--bg-muted); border: 1px solid var(--border-soft); font-family: var(--font-mono); font-size: 15px; letter-spacing: .06em; text-align: center; user-select: all; overflow-wrap: anywhere; }
@media (max-width: 480px) { .recovery-codes { grid-template-columns: 1fr; } }

/* sign-in page: one centred column, both ways to sign in have the same width */
.login { display: grid; gap: 16px; width: min(100%, 360px); margin-inline: auto; text-align: center; }
.login h1 { margin: 0; }
.login .alert { text-align: start; }
.login-form { text-align: start; }
.login .login-button { width: 100%; align-self: stretch; }
.login-divider { display: flex; align-items: center; gap: 12px; color: var(--t-light); font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-brand { display: grid; justify-items: center; gap: 10px; margin-bottom: 8px; }
.login-logo svg { width: 72px; height: 72px; display: block; }
.login-name { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: -.01em; }

/* API key scopes: "All permissions" on top, then sections of scope tiles for the chosen owner kind. */
.scope-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; margin-bottom: 12px; }
.scope-group { margin-top: 20px; }
.scope-group[hidden] { display: none; }
.scope-group-intro { margin: 0 0 12px; }
.scope-section { margin-top: 16px; }
.scope-section-title { margin: 0 0 8px; font-size: 13px; font-weight: 600; }
.scope-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px; }
.scope-tile { display: grid; grid-template-columns: auto 1fr auto; column-gap: 10px; row-gap: 2px; align-items: center; padding: 10px 12px; border: 1px solid var(--border, rgba(0,0,0,.12)); border-radius: 10px; cursor: pointer; }
.scope-tile:has(input:checked) { border-color: var(--primary); background: rgba(37, 99, 235, .06); }
.scope-tile .box { grid-row: 1 / span 2; align-self: start; margin-top: 2px; }
.scope-tile-name { font-family: var(--font-mono, monospace); font-size: 13px; overflow-wrap: anywhere; }
.scope-tile-kind { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--t-muted); text-align: right; }
.scope-tile--write .scope-tile-kind { color: var(--warning, #b45309); }
.scope-tile-text { grid-column: 2 / span 2; font-size: 12px; color: var(--t-muted); }
.scope-tile--static { cursor: default; grid-template-columns: 1fr auto; }
.scope-tile--static .scope-tile-text { grid-column: 1 / -1; }
