.cw-ad {
  --ad-ink: #18243a;
  --ad-muted: #5a6980;
  --ad-line: #e1e6ef;
  --ad-surface: #fff;
  --ad-soft: #f5f7fb;
  --ad-accent: #5744c8;
  color: var(--ad-ink);
}
.cw-ad button, .cw-ad-drawer button {
  white-space: nowrap;
  font-size: .85rem;
  font-weight: 650;
}
.cw-ad .primary, .cw-ad-drawer .primary {
  color: white;
  background: #5744c8;
  border-color: #5744c8;
}
.cw-ad-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: .25rem 0 1.35rem;
}
.cw-ad-kicker {
  color: #5744c8;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .13em;
}
.cw-ad-heading h1 {
  margin: .35rem 0 .45rem;
  font: 750 clamp(1.8rem, 4vw, 2.65rem)/1.12 system-ui, sans-serif;
  letter-spacing: -.04em;
}
.cw-ad-heading p, .cw-ad-panel-head p, .cw-ad-drawer-head p {
  color: #5a6980;
  margin: 0;
  font-size: .89rem;
}
.cw-ad-local, .cw-ad-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  white-space: nowrap;
  border-radius: 999px;
  padding: .3rem .65rem;
  font-size: .73rem;
  font-weight: 700;
  background: #eef1f7;
  color: #4b5b74;
}
.cw-ad-local span {
  background: #4c937e;
  border-radius: 50%;
  width: 7px;
  height: 7px;
}
.cw-ad-badge.good { background: #e6f6ee; color: #25624c; }
.cw-ad-badge.warn { background: #fff1dc; color: #855017; }
.cw-ad-notice { color: #4a3baa; font-size: .87rem; margin: .6rem 0; }
.cw-ad-notice:empty { display: none; }
.cw-ad-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  overflow: hidden;
  padding: clamp(1.15rem, 3vw, 2rem);
  border-radius: 15px;
  background: radial-gradient(ellipse at 100% 10%, #594aa1, transparent 75%), #24274c;
  color: white;
}
.cw-ad-banner span { color: #dcd3ff; font-size: .73rem; font-weight: 730; letter-spacing: .12em; }
.cw-ad-banner h2 {
  margin: .45rem 0;
  color: white;
  font: 720 clamp(1.45rem, 3vw, 2.1rem)/1.14 system-ui, sans-serif;
  letter-spacing: -.03em;
}
.cw-ad-banner p { margin: 0; color: #ebe8ff; font-size: .89rem; max-width: 33rem; }
.cw-ad-banner .cw-ad-light { color: #30266b; background: white; border-color: white; }
.cw-ad-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .85rem;
  margin: 1rem 0;
}
.cw-ad-kpi, .cw-ad-panel {
  background: var(--ad-surface);
  border: 1px solid var(--ad-line);
  border-radius: 13px;
  min-width: 0;
  box-shadow: 0 2px 8px #2c375a07;
}
.cw-ad-kpi { padding: 1rem; }
.cw-ad-kpi > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #52627a;
  font-size: .83rem;
  font-weight: 680;
}
.cw-ad-kpi b {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 8px;
  color: var(--ad-accent);
  background: #f0edff;
}
.cw-ad-kpi strong { display: block; margin: .12rem 0; font-size: 1.95rem; line-height: 1.25; }
.cw-ad-kpi small, .cw-ad-panel small { display: block; color: var(--ad-muted); }
.cw-ad .cw-ad-text, .cw-ad .cw-ad-danger {
  background: transparent;
  border-color: transparent;
  color: var(--ad-accent);
}
.cw-ad .cw-ad-danger { color: #a34552; }
.cw-ad .cw-ad-text:hover { background: #f2efff; }
.cw-ad .cw-ad-danger:hover { background: #fff1f2; }
.cw-ad-kpi .cw-ad-text { padding: .35rem 0 0; font-size: .77rem; }
.cw-ad-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: .9rem;
}
.cw-ad-panel-head, .cw-ad-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .7rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--ad-line);
}
.cw-ad-panel-head h2 {
  margin: 0 0 .2rem;
  font: 720 1.03rem/1.25 system-ui, sans-serif;
  letter-spacing: -.02em;
}
.cw-ad-banks, .cw-ad-activity { margin: 0; padding: 0 1.15rem; list-style: none; }
.cw-ad-banks li, .cw-ad-activity li {
  display: grid;
  align-items: center;
  gap: .6rem;
  padding: .8rem 0;
  border-bottom: 1px solid var(--ad-line);
  font-size: .85rem;
}
.cw-ad-banks li { grid-template-columns: minmax(6rem, 1fr) minmax(2.5rem, .65fr) auto; }
.cw-ad-activity li { grid-template-columns: minmax(0, 1fr) auto; }
.cw-ad-banks li:last-child, .cw-ad-activity li:last-child { border: 0; }
.cw-ad-banks progress { accent-color: var(--ad-accent); height: .6rem; }
.cw-ad-toolbar { justify-content: flex-start; align-items: end; }
.cw-ad-toolbar label { margin: 0; color: var(--ad-muted); font-size: .76rem; }
.cw-ad-toolbar label input, .cw-ad-toolbar label select {
  border-color: var(--ad-line);
  background: var(--ad-soft);
  font-size: .86rem;
}
.cw-ad-search { flex: 1; max-width: 24rem; }
.cw-ad-filter { min-width: min(11rem, 100%); }
.cw-ad-table-wrap { overflow-x: auto; }
.cw-ad table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.cw-ad th, .cw-ad td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--ad-line); }
.cw-ad th { background: #f6f7fb; color: #50617a; font-size: .75rem; white-space: nowrap; }
.cw-ad td strong { display: block; max-width: 32rem; }
.cw-ad td small { margin-top: .2rem; }
.cw-ad td:last-child, .cw-ad th:last-child { text-align: right; }
.cw-ad .cw-ad-empty { text-align: center; color: var(--ad-muted); padding-block: 2rem; }
.cw-ad-actions { display: flex; justify-content: end; gap: .1rem; }
.cw-ad-actions button { padding: .3rem .45rem; }
.cw-ad-table-foot { padding: .8rem 1rem; color: var(--ad-muted); font-size: .8rem; }
.cw-ad-drawer {
  color: #18243a;
  inset: 0 0 0 auto;
  height: 100%;
  max-height: 100%;
  width: min(100%, 35rem);
  max-width: 100%;
  margin: 0;
  border: 0;
  border-radius: 15px 0 0 15px;
  padding: 0;
  overflow-y: auto;
  box-shadow: -16px 0 80px #18243a25;
}
.cw-ad-drawer::backdrop { background: #18243a70; }
.cw-ad-drawer-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  padding: 1.4rem 1.5rem 1.15rem;
  border-bottom: 1px solid #e1e6ef;
}
.cw-ad-drawer-head h2 { margin: .35rem 0; font: 720 1.55rem system-ui, sans-serif; }
.cw-ad-drawer-head button { line-height: 1; font-size: 1.4rem; }
.cw-ad-form-body { padding: .5rem 1.5rem 1.2rem; }
.cw-ad-form-body textarea { resize: vertical; }
.cw-ad-form-body label { color: #283851; }
.cw-ad-form-body input, .cw-ad-form-body select, .cw-ad-form-body textarea { border-color: #d4dce9; }
.cw-ad-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 .85rem; }
.cw-ad-field-note { color: #5a6980; font-size: .8rem; }
.cw-ad-form-foot {
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
  position: sticky;
  bottom: 0;
  padding: 1rem 1.5rem;
  background: #fff;
  border-top: 1px solid #e1e6ef;
}
.cw-ad-question-image { display: block; margin-top: 1rem; max-height: 9rem; }
.cw-ad-check { display: flex; align-items: center; gap: .5rem; }
.cw-ad-check input { display: inline-block; width: auto; margin: 0; }
.cw-ad-drawer .cw-ad-delete { background: #a03c4d; border-color: #a03c4d; color: white; }

@media (max-width: 1000px) {
  .cw-ad-overview { grid-template-columns: 1fr; }
  .cw-ad-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 540px) {
  .cw-ad-heading, .cw-ad-banner, .cw-ad-toolbar { flex-wrap: wrap; align-items: start; }
  .cw-ad-toolbar label { flex: 1 1 100%; }
  .cw-ad-kpi { padding: .65rem; }
  .cw-ad-form-body, .cw-ad-drawer-head, .cw-ad-form-foot { padding-inline: 1rem; }
  .cw-ad-form-grid { grid-template-columns: 1fr; }
}
.cw-ad-heading-actions,
.cw-ad-pagination,
.cw-ad-pagination > div {
  display: flex;
  align-items: center;
  gap: .55rem;
}
.cw-ad-pagination {
  justify-content: space-between;
  border-bottom: 1px solid var(--ad-line);
  padding: .65rem 1rem;
  color: var(--ad-muted);
  font-size: .8rem;
}
.cw-ad-pagination button { padding: .35rem .65rem; }
.cw-ad-pagination button:disabled { opacity: .55; cursor: default; }
.cw-ad-bank-status { color: var(--ad-muted); padding: .3rem 1.15rem; }
.cw-ad-bank-status.error { color: #a03c4d; }
.cw-ad-import-note {
  margin: .6rem 0 1rem;
  padding: .85rem 1rem;
  border: 1px solid #e5e0fa;
  border-radius: 10px;
  background: #f7f5ff;
  font-size: .88rem;
}
.cw-ad-import-note p { margin: .35rem 0; color: #5a6980; }
.cw-ad-import-note a { display: inline-block; color: #5744c8; font-weight: 650; margin-top: .25rem; }
.cw-ad-import-status { color: #3a5472; font-size: .87rem; }
.cw-ad-import-status:empty { display: none; }
.cw-ad-import-status.error { color: #a03c4d; }
.cw-ad-import-errors {
  max-height: 13rem;
  overflow: auto;
  margin: .6rem 0;
  padding: .65rem 1rem .65rem 2rem;
  border: 1px solid #f2d9de;
  border-radius: 8px;
  background: #fff8f9;
  color: #872f3c;
  font-size: .83rem;
}
.cw-ad-import-errors li + li { margin-top: .3rem; }
#cwAdImported .cw-ad-table-foot { display: none; }
.cw-ad-heading-actions { flex-wrap: wrap; }
.cw-ad-drawer [aria-busy="true"] { cursor: progress; }
.cw-ad-drawer button:disabled { opacity:.6; cursor:wait; }
.cw-ad-panel .cw-ad-check { align-items:flex-start; }
.cw-ad-panel .cw-ad-check input { margin-top:.2rem; }
