:root {
  color-scheme: light;
  --background: #f7f8fa;
  --foreground: #171717;
  --card: #ffffff;
  --card-foreground: #171717;
  --muted: #f3f4f6;
  --muted-foreground: #6f7278;
  --accent: #f4f6f8;
  --accent-foreground: #171717;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --secondary: #f3f4f6;
  --secondary-foreground: #171717;
  --border: #e2e5e9;
  --input: #d4d4d4;
  --ring: #a3a3a3;
  --destructive: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --blue: #2563eb;
  --sidebar: #fafafa;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  --content-max: 1520px;
  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.35;
  font-weight: 650;
}

h2 {
  font-size: 14px;
  line-height: 1.4;
  font-weight: 650;
}

p {
  color: var(--muted-foreground);
  font-size: 14px;
  line-height: 1.45;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
}

.workspace {
  min-width: 0;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f7f7f7;
}

.auth-panel {
  width: min(100%, 420px);
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-brand > div {
  display: grid;
  gap: 1px;
}

.auth-brand strong {
  font-size: 14px;
  font-weight: 700;
}

.auth-brand small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.auth-head {
  display: grid;
  gap: 6px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: var(--muted);
}

.auth-tabs button:not(.nav-item):not(.brand):not(.icon-button) {
  height: 32px;
  min-height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-foreground);
  padding: 0;
  font-size: 13px;
  font-weight: 650;
}

.auth-tabs button:not(.nav-item):not(.brand):not(.icon-button).active {
  background: var(--card);
  color: var(--foreground);
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-google {
  width: 100%;
}

.auth-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  line-height: 1.4;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

.sidebar-header {
  padding: 16px;
}

.brand {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 8px;
  background: transparent;
  color: var(--foreground);
  text-align: left;
}

.brand:hover {
  background: transparent;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 14px;
  font-weight: 700;
}

.brand-copy small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.sidebar-nav {
  display: grid;
  gap: 2px;
  padding: 0 10px;
}

.nav-item {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  color: #525252;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: var(--accent);
  color: var(--accent-foreground);
}

.nav-icon {
  width: 18px;
  color: var(--muted-foreground);
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  font-size: 11px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px 16px 16px;
  display: grid;
  gap: 10px;
}

.sidebar-footer > p {
  font-size: 12px;
}

.runtime {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.45;
}

.runtime strong {
  color: var(--foreground);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  padding: 0 16px;
  backdrop-filter: blur(10px);
}

.topbar-separator {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.topbar-status {
  color: var(--muted-foreground);
  font-size: 13px;
}

.topbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-foreground);
  font-size: 13px;
}

.topbar-user[hidden] {
  display: none;
}

.icon-button {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: transparent;
  color: var(--foreground);
  padding: 0;
}

#mobile-menu {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.icon-button:hover {
  background: var(--accent);
}

.icon-button span:not(.chevron-left) {
  width: 14px;
  height: 1.5px;
  display: block;
  border-radius: 999px;
  background: currentColor;
}

.icon-button span + span {
  margin-top: 3px;
}

.icon-button.bordered {
  border: 1px solid var(--border);
  background: var(--card);
}

.chevron-left {
  width: 9px;
  height: 9px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

main {
  min-height: calc(100vh - 48px);
  background: var(--background);
}

.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

.page-stack {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 28px 40px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-head > div:first-child {
  display: grid;
  gap: 4px;
}

.page-actions,
.toolbar-actions,
.editor-actions,
.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-actions {
  justify-content: flex-end;
}

.button,
button:not(.nav-item):not(.brand):not(.icon-button):not(.connection-option) {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  background: var(--primary);
  color: var(--primary-foreground);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}

.button:hover,
button:not(.nav-item):not(.brand):not(.icon-button):not(.connection-option):hover {
  background: #262626;
}

.button.is-loading,
button.is-loading {
  position: relative;
  opacity: 0.82;
}

.button.is-loading::before,
button.is-loading::before {
  content: "";
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.72s linear infinite;
}

.button.secondary,
button.secondary {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
}

.button.secondary:hover,
button.secondary:hover {
  background: var(--accent);
}

.button.ghost {
  min-height: 32px;
  padding: 6px 10px;
  background: transparent;
  color: var(--foreground);
}

.button.ghost:hover {
  background: var(--accent);
}

.button.compact {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.button.tiny-action,
button.tiny-action {
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
}

.button.danger,
button.danger {
  border: 1px solid var(--destructive);
  background: var(--destructive);
  color: #ffffff;
}

.button.danger:hover,
button.danger:hover {
  background: #b91c1c;
  border-color: #b91c1c;
}

button:disabled,
.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

input,
select,
textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--input);
  border-radius: 7px;
  background: var(--card);
  color: var(--foreground);
  padding: 8px 10px;
  outline: 0;
  font-size: 13px;
  line-height: 1.25;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(163, 163, 163, 0.22);
}

.search-input {
  width: min(360px, 42vw);
}

.notice,
.status-note {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f0f2f4;
  color: var(--foreground);
  padding: 10px 12px;
  font-size: 13px;
}

.notice {
  margin: 0 24px;
}

.notice.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.notice.error {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--destructive);
}

.toast-stack {
  position: fixed;
  z-index: 80;
  top: 64px;
  right: 18px;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--foreground);
  padding: 12px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
  pointer-events: auto;
  animation: toastIn 0.18s ease-out;
}

.toast.leaving {
  animation: toastOut 0.18s ease-in forwards;
}

.toast-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.toast.success .toast-dot {
  background: var(--success);
}

.toast.error .toast-dot {
  background: var(--destructive);
}

.toast-copy {
  display: grid;
  gap: 2px;
}

.toast-copy strong {
  font-size: 13px;
  line-height: 1.35;
}

.toast-copy small {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.35;
}

.toast-close {
  width: 22px;
  height: 22px;
  min-height: 22px !important;
  border-radius: 6px;
  background: transparent !important;
  color: var(--muted-foreground) !important;
  padding: 0 !important;
  font-size: 16px !important;
  line-height: 1 !important;
}

.toast-close:hover {
  background: var(--accent) !important;
  color: var(--foreground) !important;
}

.status-note span {
  color: var(--muted-foreground);
}

.card,
.card-panel,
.table-panel,
.editor-panel,
.settings-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow);
}

.card-header,
.table-toolbar,
.editor-head,
.settings-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.card-header p,
.table-toolbar span,
.editor-head span,
.settings-head p {
  margin-top: 2px;
  font-size: 12px;
}

.row-header,
.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.stat-card {
  min-height: 128px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.stat-card span,
.stat-card small {
  color: var(--muted-foreground);
  font-size: 13px;
}

.stat-card strong {
  display: block;
  color: var(--foreground);
  font-size: 32px;
  line-height: 1;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.stat-card.attention strong {
  color: var(--destructive);
}

.stat-icon {
  width: 18px;
  height: 18px;
  position: relative;
  color: var(--muted-foreground);
}

.stat-card.attention .stat-icon {
  color: var(--destructive);
}

.stat-icon::before,
.stat-icon::after {
  content: "";
  position: absolute;
  display: block;
}

.stat-icon.calendar::before {
  inset: 3px 2px 2px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.stat-icon.calendar::after {
  left: 4px;
  right: 4px;
  top: 7px;
  height: 1.7px;
  background: currentColor;
}

.stat-icon.play::before {
  left: 5px;
  top: 3px;
  border-left: 10px solid currentColor;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.stat-icon.film::before {
  inset: 1px 3px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.stat-icon.check::before {
  width: 7px;
  height: 12px;
  left: 5px;
  top: 1px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(42deg);
}

.stat-icon.alert::before {
  inset: 2px;
  border: 1.8px solid currentColor;
  border-radius: 50%;
}

.stat-icon.alert::after {
  width: 2px;
  height: 8px;
  left: 8px;
  top: 5px;
  background: currentColor;
  border-radius: 2px;
  box-shadow: 0 10px 0 currentColor;
}

.stat-icon.share::before {
  width: 4px;
  height: 4px;
  left: 2px;
  top: 7px;
  border: 1.7px solid currentColor;
  border-radius: 50%;
  box-shadow: 10px -5px 0 -1.7px var(--card), 10px -5px 0 0 currentColor,
    10px 5px 0 -1.7px var(--card), 10px 5px 0 0 currentColor;
}

.stat-icon.share::after {
  width: 12px;
  height: 12px;
  left: 4px;
  top: 3px;
  border-top: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: skewY(-27deg);
}

.stat-icon.user::before {
  width: 7px;
  height: 7px;
  left: 5px;
  top: 2px;
  border: 1.7px solid currentColor;
  border-radius: 50%;
}

.stat-icon.user::after {
  width: 14px;
  height: 7px;
  left: 2px;
  bottom: 2px;
  border: 1.7px solid currentColor;
  border-radius: 9px 9px 2px 2px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
  gap: 24px;
}

.dashboard-side {
  display: grid;
  align-content: start;
  gap: 24px;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 11px 18px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-table th {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
}

.data-table tr:hover td {
  background: #fafafa;
}

.link-button {
  min-height: auto !important;
  justify-content: flex-start !important;
  background: transparent !important;
  color: var(--foreground) !important;
  padding: 0 !important;
  text-align: left;
  white-space: normal !important;
}

.link-button:hover {
  color: var(--blue) !important;
}

.analytics-controls {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(220px, 1fr) minmax(160px, 180px);
  gap: 10px;
}

.analytics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.analytics-panel {
  min-width: 0;
}

.analytics-table {
  font-size: 13px;
}

.analytics-table th,
.analytics-table td {
  padding: 10px 12px;
}

.analytics-table strong {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-table .muted {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.analytics-insights {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.analytics-insight-list {
  display: grid;
  gap: 8px;
}

.analytics-insight-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
  padding: 10px;
}

.analytics-insight-row div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.analytics-insight-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-insight-row span {
  color: var(--muted-foreground);
  font-size: 12px;
}

.analytics-mini-heading {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
}

.card-list {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.mini-row,
.provider-row,
.compact-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px;
  box-shadow: var(--shadow);
}

.mini-row,
.provider-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mini-row {
  cursor: pointer;
}

.mini-row:hover,
.compact-item:hover {
  background: #fafafa;
}

.mini-row strong,
.mini-row span,
.provider-row strong,
.provider-row span {
  display: block;
}

.mini-row span,
.provider-row span,
.muted {
  color: var(--muted-foreground);
  font-size: 12px;
}

.pill,
.badge {
  display: inline-flex;
  width: fit-content;
  min-height: 22px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--secondary-foreground);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
}

.pill.green,
.badge.green {
  background: #dcfce7;
  color: #15803d;
}

.pill.red,
.badge.red {
  background: #fee2e2;
  color: #b91c1c;
}

.pill.attention,
.badge.attention {
  background: #fef3c7;
  color: #b45309;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted-foreground);
}

.status-dot.ok {
  background: var(--success);
}

.status-dot.warn {
  background: var(--warning);
}

.schedule-table {
  overflow-x: auto;
}

.schedule-row {
  display: grid;
  grid-template-columns: minmax(240px, 1.35fr) minmax(150px, 0.85fr) 100px 116px 118px 118px 172px;
  align-items: center;
  gap: 12px;
  min-width: 980px;
  border-bottom: 1px solid var(--border);
  padding: 12px 18px;
  font-size: 14px;
}

.schedule-row.header {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
}

.schedule-row:not(.header) {
  cursor: pointer;
}

.schedule-row:not(.header):hover,
.schedule-row.selected {
  background: #fafafa;
}

.schedule-status-cell {
  display: none;
}

.schedule-name {
  display: grid;
  gap: 2px;
}

.schedule-name strong {
  font-size: 14px;
  font-weight: 600;
}

.schedule-name span {
  color: var(--muted-foreground);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-row.ad-row {
  grid-template-columns: minmax(240px, 1.35fr) minmax(150px, 0.85fr) 100px 160px 118px 118px 172px;
}

.campaigns-list {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.campaign-summary-row {
  width: 100%;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) repeat(4, minmax(90px, 0.5fr));
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  padding: 10px 12px;
  text-align: left;
}

.campaign-summary-row:hover,
.campaign-summary-row.selected {
  border-color: #cbd5e1;
  background: #fbfdff;
}

.campaign-summary-row span,
.campaign-summary-row small,
.campaign-summary-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-summary-row span:first-child {
  display: grid;
  gap: 2px;
}

.campaign-summary-row strong {
  font-size: 13px;
}

.campaign-summary-row small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.campaign-detail {
  display: grid;
  gap: 18px;
}

.campaign-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.campaign-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px 0;
}

.campaign-kpi {
  min-width: 0;
  display: grid;
  gap: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
  padding: 10px;
}

.campaign-kpi span {
  color: var(--muted-foreground);
  font-size: 12px;
}

.campaign-kpi strong {
  font-size: 20px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.campaign-meta,
.campaign-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 18px 0;
}

.campaign-sources {
  padding-bottom: 16px;
}

.campaign-meta span,
.campaign-sources a {
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fafafa;
  color: var(--muted-foreground);
  padding: 6px 9px;
  font-size: 12px;
  text-decoration: none;
}

.campaign-meta strong {
  color: var(--foreground);
}

.campaign-channel-list {
  display: grid;
  gap: 16px;
}

.campaign-channel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.campaign-channel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}

.campaign-channel-head h3 {
  margin: 0 0 2px;
  font-size: 15px;
  line-height: 1.35;
}

.campaign-channel-head p {
  font-size: 12px;
}

.campaign-channel-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 18px;
}

.campaign-channel-grid > div {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
  padding: 10px;
}

.campaign-channel-grid strong {
  font-size: 12px;
}

.campaign-channel-grid span {
  min-width: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.campaign-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 18px 14px;
}

.campaign-tags span {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted-foreground);
  padding: 4px 8px;
  font-size: 11px;
}

.campaign-variant-table {
  border-top: 1px solid var(--border);
  overflow-x: auto;
}

.campaign-variant-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(190px, 1fr) minmax(220px, 1fr) minmax(360px, 1.5fr) 70px;
  align-items: start;
  gap: 12px;
  min-width: 1080px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}

.campaign-variant-row.header {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 600;
  background: #fafafa;
}

.campaign-variant-row:last-child {
  border-bottom: 0;
}

.campaign-variant-copy,
.campaign-utm {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.campaign-variant-copy strong,
.campaign-utm a {
  min-width: 0;
  color: var(--foreground);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campaign-variant-copy span,
.campaign-variant-copy small,
.campaign-utm small {
  min-width: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.campaign-metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.campaign-metric-grid label {
  gap: 3px;
  font-size: 11px;
}

.campaign-metric-grid input,
.campaign-metric-grid select {
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.campaign-variant-actions {
  display: flex;
  justify-content: flex-end;
}

.schedule-actions {
  gap: 6px;
}

.type-chip {
  display: inline-flex;
  min-height: 18px;
  align-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
}

.ad-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.voice-preset-card {
  min-height: 88px;
  display: grid;
  align-content: center;
  gap: 5px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 16px;
  box-shadow: var(--shadow);
}

.voice-preset-card strong {
  font-size: 14px;
  font-weight: 650;
}

.voice-preset-card span {
  color: var(--muted-foreground);
  font-size: 12px;
}

.ad-settings-card.hidden,
.hidden {
  display: none;
}

.preset-upload-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}

.preset-upload-box .button {
  min-height: 42px;
  white-space: nowrap;
}

.tiny-action {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 650;
}

.compact-select {
  min-height: 36px;
  min-width: 150px;
}

.editor-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.editor-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.editor-title-row > div {
  display: grid;
  gap: 2px;
}

.editor-switch {
  margin-left: auto;
}

.editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.automation-flow-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.automation-flow-step {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 10px;
  row-gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

.automation-flow-step span {
  width: 26px;
  height: 26px;
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--foreground);
  color: var(--primary-foreground);
  font-size: 12px;
  font-weight: 700;
}

.automation-flow-step strong {
  min-width: 0;
  color: var(--foreground);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.automation-flow-step small {
  min-width: 0;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.35;
}

.schedule-modal-body > .destination-card {
  order: 1;
}

.schedule-modal-body > .generation-settings-card {
  order: 2;
}

.schedule-modal-body > .ad-settings-card {
  order: 3;
}

.schedule-modal-body > .advanced-card {
  order: 4;
}

.schedule-modal-body > .schedule-settings-card {
  order: 5;
}

.destination-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.65fr) minmax(320px, 1fr);
  align-items: end;
  gap: 16px;
  padding: 18px 18px 0;
}

.destination-provider {
  min-height: 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafafa;
  padding: 12px;
}

.destination-provider > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.destination-provider strong {
  font-size: 13px;
  font-weight: 700;
}

.destination-provider small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.destination-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 800;
}

.destination-options {
  padding-top: 12px;
}

.destination-guidance {
  margin: 12px 18px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #f7f7f7;
  color: var(--muted-foreground);
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.4;
}

.platform-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 12px 18px 0;
}

.platform-setting {
  min-width: 0;
  display: grid;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 10px;
}

.platform-setting strong,
.platform-setting span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-setting strong {
  color: var(--foreground);
  font-size: 12px;
  font-weight: 700;
}

.platform-setting span {
  color: var(--muted-foreground);
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

label {
  display: grid;
  gap: 6px;
  color: #525252;
  font-size: 13px;
  font-weight: 500;
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}

.checkbox-card input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.checkbox-card span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.checkbox-card strong {
  color: var(--foreground);
  font-size: 13px;
}

.checkbox-card small {
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.35;
}

.label-row,
.settings-item-label {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.label-text {
  min-width: 0;
}

.help-button {
  width: 18px;
  height: 18px;
  min-height: 18px !important;
  flex: 0 0 auto;
  border: 1px solid var(--border) !important;
  border-radius: 50% !important;
  background: var(--card) !important;
  color: var(--muted-foreground) !important;
  padding: 0 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
}

.help-button:hover,
.help-button[aria-expanded="true"] {
  border-color: var(--ring) !important;
  background: var(--accent) !important;
  color: var(--foreground) !important;
}

.field-help-panel,
.settings-help-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  color: var(--muted-foreground);
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.field-help-panel[hidden],
.settings-help-panel[hidden] {
  display: none;
}

.required {
  color: var(--destructive);
}

.wide {
  grid-column: 1 / -1;
}

.advanced-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

.advanced-card summary {
  cursor: pointer;
  padding: 16px 18px;
  color: var(--foreground);
  font-size: 14px;
  font-weight: 600;
}

.advanced-grid {
  border-top: 1px solid var(--border);
}

.advanced-section {
  padding: 16px 18px;
  border-top: 1px solid var(--border);
}

.advanced-section:first-child {
  border-top: 0;
}

.advanced-section h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--foreground);
}

.editor-actions {
  padding-bottom: 4px;
}

.switch-label {
  display: inline-flex;
  align-items: center;
}

.switch-label input {
  display: none;
}

.switch {
  width: 42px;
  height: 24px;
  position: relative;
  display: inline-block;
  border-radius: 999px;
  background: #d4d4d4;
  transition: background 0.16s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
  transition: transform 0.16s ease;
}

.switch-label input:checked + .switch {
  background: var(--primary);
}

.switch-label input:checked + .switch::after {
  transform: translateX(18px);
}

.channels-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  align-items: stretch;
  gap: 12px;
}

.connection-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 8px;
}

button.connection-option {
  min-width: 0;
  min-height: 44px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  padding: 7px 8px;
  text-align: left;
  box-shadow: none;
  transition: background 0.14s ease, border-color 0.14s ease, opacity 0.14s ease;
}

button.connection-option:hover {
  background: var(--accent);
  border-color: #cfd5dd;
}

button.connection-option:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.connection-mark {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fff1f2;
  color: #b91c1c;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.connection-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.connection-copy strong,
.connection-copy small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-copy strong {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.15;
}

.connection-copy small {
  color: var(--muted-foreground);
  font-size: 11px;
  line-height: 1.15;
}

.connection-action {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--muted);
  color: var(--foreground);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}

.connection-action.ready {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #15803d;
}

.channel-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 10px;
}

.channel-card {
  min-width: 0;
  min-height: 164px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
  box-shadow: var(--shadow);
}

.compact-channel-card {
  align-content: stretch;
}

.channel-card.add-card {
  min-height: 164px;
  place-items: center;
  border-style: dashed;
  text-align: center;
}

.channels-grid > button.channel-card.add-card {
  width: 100%;
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px dashed var(--border);
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
}

.channels-grid > button.channel-card.add-card:hover {
  border-color: var(--ring);
  background: #fafafa;
}

.channel-card.add-card span {
  color: var(--muted-foreground);
}

.compact-head,
.channel-head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: flex-start;
  column-gap: 10px;
  row-gap: 4px;
}

.channel-title {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.channel-title strong {
  display: -webkit-box;
  min-height: 32px;
  overflow: hidden;
  color: var(--foreground);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.18;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.channel-thumb {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--muted);
  object-fit: cover;
}

.channel-badges {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 4px;
  max-width: 118px;
}

.channel-badges .pill {
  max-width: 118px;
  min-height: 20px;
  overflow: hidden;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.channel-actions {
  align-self: end;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: auto;
}

.channel-action-button {
  width: 100%;
  min-width: 0;
  min-height: 30px;
  justify-content: center;
  text-align: center;
}

.channel-actions button.secondary.channel-action-button {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
}

.channel-actions button.secondary.channel-action-button:hover {
  background: var(--accent);
}

.channel-actions button.danger.channel-action-button {
  border-color: #dc2626;
  background: #dc2626;
  color: #ffffff;
}

.channel-actions button.danger.channel-action-button:hover {
  background: #b91c1c;
}

.channel-details-form {
  display: grid;
  gap: 14px;
}

.channel-details-form .form-grid {
  gap: 10px;
  padding: 0;
}

.full-span {
  grid-column: 1 / -1;
}

.channel-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
}

.channel-thumb.large {
  width: 48px;
  height: 48px;
}

body.modal-open {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.34);
}

.modal-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-head,
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
}

.modal-head {
  border-bottom: 1px solid var(--border);
}

.modal-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  background: #fafafa;
}

.modal-title-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modal-title-row h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.modal-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.schedule-editor-modal {
  width: min(1460px, calc(100vw - 48px));
}

.schedule-modal-head {
  align-items: center;
}

.schedule-modal-head .modal-title-row {
  flex: 1 1 auto;
}

.schedule-modal-head .editor-switch {
  margin-left: 0;
}

.schedule-modal-body {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 18px;
}

.schedule-modal-body .card,
.schedule-modal-body .advanced-card {
  min-width: 0;
}

.schedule-modal-foot {
  justify-content: flex-end;
}

.icon-button {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  color: var(--foreground);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover {
  background: var(--accent);
}

.channel-details-modal .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.data-table-lite {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.data-table-lite div {
  display: grid;
  gap: 3px;
}

.data-table-lite span {
  color: var(--muted-foreground);
  font-size: 12px;
}

.data-table-lite strong {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.run-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.run-filters .active {
  background: var(--primary);
  color: var(--primary-foreground);
}

.runs-list {
  display: grid;
  gap: 10px;
}

.runs-load-more {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 4px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.run-card {
  overflow: hidden;
  padding: 0;
}

.run-summary {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  cursor: pointer;
}

.run-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.run-summary-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.run-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.run-title strong {
  min-width: 0;
  max-width: min(100%, 780px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--foreground);
  font-size: 14px;
  font-weight: 720;
  line-height: 1.25;
}

.run-meta,
.run-updated {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.run-details {
  display: grid;
  gap: 12px;
  margin: 0 16px 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.run-steps {
  display: grid;
  gap: 0;
}

.run-step {
  position: relative;
  min-height: 42px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 0;
}

.run-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 7px;
  top: 27px;
  bottom: -8px;
  width: 1px;
  background: var(--border);
}

.step-dot {
  position: relative;
  z-index: 1;
  width: 15px;
  height: 15px;
  margin-top: 2px;
  flex: 0 0 auto;
  border: 2px solid #d4d4d4;
  border-radius: 50%;
  background: var(--card);
}

.run-step.done .step-dot {
  border-color: var(--success);
  background: var(--success);
}

.run-step.running .step-dot {
  border-color: var(--blue);
  background: var(--blue);
}

.run-step.failed .step-dot {
  border-color: var(--destructive);
  background: var(--destructive);
}

.run-step strong,
.run-step span {
  display: block;
}

.run-step span {
  margin-top: 2px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.run-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.run-cost-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.65fr) minmax(0, 1.35fr);
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  padding: 10px;
}

.run-cost-total,
.run-cost-grid div {
  min-width: 0;
}

.run-cost-total span,
.run-cost-total strong,
.run-cost-total small,
.run-cost-grid strong,
.run-cost-grid span,
.run-cost-grid small {
  display: block;
}

.run-cost-total span,
.run-cost-grid small {
  color: var(--muted-foreground);
  font-size: 12px;
}

.run-cost-total strong {
  margin-top: 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.run-cost-total small {
  margin-top: 3px;
}

.run-cost-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.run-cost-grid div {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  padding: 9px;
}

.run-cost-grid span {
  margin-top: 4px;
  font-weight: 800;
}

.run-cost-grid small {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.run-detail-grid div,
.settings-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  padding: 10px;
}

.run-detail-grid strong,
.run-detail-grid span,
.settings-item span,
.settings-item strong {
  display: block;
}

.run-detail-grid span,
.settings-item span {
  margin-top: 3px;
  color: var(--muted-foreground);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.event-list {
  display: grid;
  gap: 6px;
}

.event-row {
  display: grid;
  grid-template-columns: 170px 220px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
  padding: 8px;
}

.event-row.error {
  border-color: #fecaca;
  background: #fef2f2;
}

.event-row span,
.event-row code {
  color: var(--muted-foreground);
  font-size: 12px;
}

.event-row code,
pre {
  font-family: var(--font-mono);
}

.event-row code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

pre {
  max-height: 180px;
  overflow: auto;
  border-radius: 8px;
  background: #171717;
  color: #fafafa;
  padding: 10px;
  font-size: 12px;
}

.output-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.output-links a {
  color: var(--foreground);
  font-size: 12px;
  font-weight: 600;
}

.run-error {
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: var(--destructive);
  padding: 10px;
  font-size: 12px;
  font-weight: 600;
}

.review-sections {
  display: grid;
  gap: 24px;
}

.review-section {
  display: grid;
  gap: 12px;
}

.review-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.review-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}

.review-media {
  position: relative;
  aspect-ratio: 9 / 16;
  max-height: 430px;
  background: #171717;
}

.review-media video,
.review-placeholder {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.review-placeholder {
  display: grid;
  place-items: center;
  color: #fafafa;
  font-size: 13px;
}

.review-media .pill {
  position: absolute;
  right: 10px;
  bottom: 10px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
}

.review-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.review-body strong,
.review-body span {
  display: block;
}

.review-body span {
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
}

.settings-view {
  max-width: 768px;
  display: grid;
  gap: 24px;
}

.settings-card {
  overflow: hidden;
}

.settings-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
}

.settings-item {
  position: relative;
  min-height: 72px;
  padding-right: 36px;
}

.settings-item-label {
  padding-right: 18px;
}

.settings-item .status-dot {
  position: absolute;
  top: 14px;
  right: 14px;
}

.settings-help-panel {
  margin-top: 10px;
}

.worker-queues-card {
  display: grid;
}

.queue-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 18px 0;
}

.queue-metric {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}

.queue-metric span {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 700;
}

.queue-metric strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--foreground);
  font-size: 16px;
}

.worker-queue-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.worker-queue-row {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
}

.worker-queue-main,
.worker-task-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.worker-queue-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.worker-queue-main div,
.worker-task-row div {
  min-width: 0;
}

.worker-queue-main strong,
.worker-task-row strong {
  display: block;
  overflow-wrap: anywhere;
}

.worker-queue-main span,
.worker-task-row span,
.worker-task-row small {
  display: block;
  margin-top: 4px;
  color: var(--muted-foreground);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.worker-failed-list {
  display: grid;
  gap: 8px;
}

.worker-task-row {
  padding: 10px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff7f7;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.empty-state {
  padding: 28px 18px;
  color: var(--muted-foreground);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .analytics-layout,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .search-input {
    width: 100%;
  }
}

@media (max-width: 820px) {
  .topbar {
    background: #fff;
    backdrop-filter: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    z-index: 30;
    top: 0;
    bottom: 0;
    left: -256px;
    width: 256px;
    transform: none;
    transition: left 0.16s ease;
  }

  body.sidebar-open .sidebar,
  .sidebar.open {
    left: 0;
    transform: none;
  }

  .page-stack {
    gap: 16px;
    padding: 18px;
  }

  .page-head,
  .page-actions,
  .row-header,
  .table-header,
  .toolbar-actions,
  .run-summary {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .page-actions,
  .run-summary-actions {
    justify-content: stretch;
  }

  .page-actions > *,
  .run-summary-actions > *,
  .channel-actions > * {
    width: 100%;
  }

  .dashboard-grid,
  .analytics-controls,
  .ad-overview-grid,
  .automation-flow-card,
  .channels-grid,
  .campaign-summary-row,
  .campaign-kpis,
  .campaign-channel-grid,
  .channel-filters,
  .destination-row,
  .review-grid,
  .queue-summary-strip,
  .settings-list,
  .form-grid,
  .channel-details-modal .form-grid,
  .preset-upload-box,
  .run-detail-grid {
    grid-template-columns: 1fr;
  }

  .run-cost-card,
  .run-cost-grid {
    grid-template-columns: 1fr;
  }

  .campaign-detail-head,
  .campaign-channel-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .campaign-summary-row {
    justify-items: stretch;
  }

  .campaign-summary-row span,
  .campaign-summary-row small,
  .campaign-summary-row strong {
    white-space: normal;
  }

  .run-summary {
    gap: 12px;
    padding: 12px;
  }

  .run-summary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .run-title strong,
  .run-meta,
  .run-updated {
    white-space: normal;
  }

  .run-details {
    margin: 0 12px 12px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal-panel {
    max-height: calc(100vh - 20px);
  }

  .schedule-modal-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .schedule-editor-modal {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .schedule-modal-head {
    align-items: flex-start;
  }

  .modal-head,
  .modal-body,
  .modal-foot {
    padding: 12px;
  }

  .modal-foot {
    flex-wrap: wrap;
  }

  .schedule-row,
  .schedule-row.header {
    min-width: 0;
    grid-template-columns: 1fr;
  }

  .schedule-row.header {
    display: none;
  }

  .wide {
    grid-column: auto;
  }

  .event-row {
    grid-template-columns: 1fr;
  }

  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    border-bottom: 1px solid var(--border);
    padding: 12px 18px;
  }

  .data-table td {
    border: 0;
    padding: 3px 0;
  }

  .data-table td + td {
    margin-top: 4px;
  }
}
