/* Business surfaces use the current department's color. Phone contents keep
   their own channel typefaces, colors, controls and image proportions. */
.dk-surface #view {
  --module-ink: #25283b;
  --module-muted: #595f73;
  --module-line: #dce0eb;
  --module-accent: var(--workspace-accent, #68458d);
  --module-tint: var(--workspace-tint, #f0eafa);
  --module-border: color-mix(in srgb, var(--module-accent) 25%, #dce0eb);
  --module-shadow: 0 3px 12px -6px #30375829;
  min-width: 0;
  container: workspace-view / inline-size;
}
.dk-surface #view :is(.panel:not(.banner), .channel-peek, .signal-rankings, .channel-planning, .overview-toolbar) {
  min-width: 0;
  border: 1px solid var(--module-line);
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--module-shadow);
}
.dk-surface #view :is(.panel, .signal-rankings, .channel-planning) {
  padding: clamp(16px, 2cqi, 26px);
}
.dk-surface #view :is(.list-title, .rank-heading) {
  align-items: center;
  column-gap: 14px;
  padding-bottom: 13px;
  margin-bottom: 16px;
  border-bottom: 1px solid #e8eaf1;
}
.dk-surface #view :is(.list-title > h2, .rank-heading > h2, .channel-planning > h2) {
  margin: 0;
  color: var(--module-ink);
  font-size: clamp(19px, 2.2cqi, 24px);
  font-weight: 750;
  line-height: 1.38;
  letter-spacing: -.025em;
}
.dk-surface #view .channel-planning > h2 { padding-bottom: 13px; margin-bottom: 17px; border-bottom: 1px solid #e8eaf1; }
.dk-surface #view .content-card {
  border: 1px solid var(--module-line);
  border-radius: 13px;
  background: linear-gradient(155deg, #fff 68%, color-mix(in srgb, var(--module-tint) 52%, #fff));
  padding: clamp(14px, 1.7cqi, 21px);
  gap: 9px;
  overflow-wrap: anywhere;
}
.dk-surface #view .content-card h3 { color: var(--module-ink); line-height: 1.5; font-size: 17px; }
.dk-surface #view .content-card > p,
.dk-surface #view .item > p:not(.item-title) { line-height: 1.7; }
.dk-surface #view .content-card > small { color: var(--module-muted); font-size: 13px; }
.dk-surface #view :is(.empty, .overview-empty, .rank-empty) {
  padding: 17px 19px;
  border: 1px dashed var(--module-border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--module-tint) 33%, #fff);
  color: var(--module-muted);
}
.dk-surface #view .item-title { font-size: 16px; line-height: 1.55; color: var(--module-ink); }
.dk-surface #view .tag:not(.ok, .warn) { background: var(--module-tint); color: var(--module-accent); }
.dk-surface #view .btn { border-color: var(--module-line); color: #48495d; }
.dk-surface #view .btn:not(.primary):hover:enabled {
  color: var(--module-accent); background: var(--module-tint); border-color: var(--module-border);
}
.dk-surface #view .btn.primary, .dk-surface #view .rank-compose {
  color: white; border-color: var(--module-accent); background: var(--module-accent);
  box-shadow: 0 2px 5px color-mix(in srgb, var(--module-accent) 17%, transparent);
}
.dk-surface #view .btn.primary:hover:enabled, .dk-surface #view .rank-compose:hover:enabled {
  background: color-mix(in srgb, var(--module-accent) 84%, #171926);
}
.dk-surface #view .field { gap: 6px; color: var(--module-ink); }
.dk-surface #view :is(.field, .cp-picker, .overview-filter) > :is(input, select, textarea),
.dk-surface #view :is(.plot-select, .overview-ranking-select) {
  border: 1px solid #cfd3df; border-radius: 9px; background-color: #fdfdff;
  color: var(--module-ink); min-width: 0; max-width: 100%;
}
.dk-surface #view :is(.field, .cp-picker, .overview-filter) > :is(input, select, textarea):focus-visible,
.dk-surface #view :is(.btn, .channel, .signal-rankings button, .cp-channels button):focus-visible {
  outline: 2px solid var(--module-accent); outline-offset: 2px;
}
.dk-surface #view .field > textarea { line-height: 1.75; }
.dk-surface #view :is(.channel.sel, .day.sel, .slot.sel) {
  color: var(--module-accent); background: var(--module-tint); border-color: var(--module-border);
}
.dk-surface .journey {
  flex-wrap: wrap; gap: 5px; padding: 6px;
  border: 1px solid #dcdfea; border-radius: 13px; background: #f8f9fd;
}
.dk-surface .journey .channel {
  min-height: 36px; padding: 5px 9px; color: #51576c;
  font-size: 14px; font-weight: 600; line-height: 1.4;
}
.dk-surface .journey .channel.sel { border-color: #dce0eb; color: var(--workspace-accent, #68458d); }
.dk-surface .journey .channel b { color: #51596a; background: #e6e8f0; }
.dk-surface .journey .channel.sel b { color: #fff; background: var(--workspace-accent, #68458d); }

/* Put the two radar configuration summaries side by side when content width permits. */
.dk-surface #view:has(> .signal-rankings) {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, max(325px, 45%)), 1fr));
  gap: 14px; align-items: stretch;
}
.dk-surface #view:has(> .signal-rankings) > :is(.signal-rankings, .panel:has(.card-grid)) { grid-column: 1/-1; }
.dk-surface #view:has(> .signal-rankings) > section { margin: 0; }
.dk-surface #view .rank-industries button { padding: 5px 12px; }
.dk-surface #view :is(.rank-industries, .rank-actions) [aria-pressed=true],
.dk-surface #view .rank-create {
  color: var(--module-accent); background: var(--module-tint); border-color: var(--module-border);
}
.dk-surface #view .rank-tabs button { padding: 8px 13px; }
.dk-surface #view .rank-tabs [aria-pressed=true] {
  background: var(--module-accent); border-color: var(--module-accent); color: #fff;
}
.dk-surface #view .rank-position {
  display: inline-grid; place-items: center;
  width: 1.85em; min-height: 1.85em; border-radius: 8px;
  font-size: 15px; color: #595f73; background: #f0f2f7;
}
.dk-surface #view .rank-item:nth-child(-n+3) .rank-position {
  background: var(--module-tint); color: var(--module-accent); font-weight: 750;
}
.dk-surface #view .rank-item:first-child .rank-position {
  background: var(--module-accent); color: #fff;
}
.dk-surface #view :is(.rank-score strong, .rank-source a, .marketing-date time) { color: var(--module-accent); }
.dk-surface #view .rank-more { padding-inline: 20px; min-height: 36px; }

.dk-surface #view .studio-grid { grid-template-columns: minmax(0, 1.35fr) minmax(282px, .85fr); gap: clamp(14px, 2cqi, 25px); }
.dk-surface #view .peek { position: static; padding: clamp(13px, 1.6cqi, 20px); }
.dk-surface #view .preview-channels { grid-template-columns: repeat(auto-fit, minmax(68px, 1fr)); }
.dk-surface #view :is(.draft-rule, .checks-box, .cp-facts) {
  padding: 13px 15px; border: 1px solid var(--module-border); border-radius: 10px;
  background: color-mix(in srgb, var(--module-tint) 50%, #fff);
  color: var(--module-ink);
}
.dk-surface #view .draft-rule { border-inline-start: 3px solid var(--module-accent); }
.dk-surface #view .cp-facts { margin-block: 12px 17px; }
.dk-surface #view .cp-channels button { border-radius: 10px; min-height: 51px; }
.dk-surface #view .cp-channels [aria-pressed=true] {
  border-color: var(--module-accent); background: var(--module-tint); color: var(--module-accent);
}
.dk-surface #view .phone-area {
  padding: 17px 6px; border: 1px solid #e1e2ed; border-radius: 14px;
  background-color: #f5f5fb;
  background-image: radial-gradient(circle, #d1d1e1 1px, transparent 1.1px);
  background-size: 13px 13px;
}
.dk-surface #view #preview-note:not(:empty) { margin-top: 10px; }
.dk-surface #view .channel-fields { border-color: var(--module-line); }
.dk-surface #view .gallery-list li { background: #f9faff; }
.dk-surface #view .marketing-day.has-event { background: var(--module-tint); border-color: var(--module-border); color: var(--module-accent); }
.dk-surface #view .marketing-day.sel { box-shadow: inset 0 0 0 1px var(--module-accent); border-color: var(--module-accent); }
.dk-surface #view .marketing-day.is-today b { background: var(--module-accent); }

.dk-surface #view .overview { --accent: var(--module-accent); --fine: var(--module-line); }
.dk-surface #view .overview-toolbar { background: linear-gradient(110deg, #fff, #fafaff); }
.dk-surface #view :is(.kpi, .overview-kpi) {
  min-width: 0; border: 1px solid var(--module-line); border-radius: 14px;
  padding: clamp(13px, 1.8cqi, 22px);
  background: linear-gradient(130deg, #fff 47%, color-mix(in srgb, var(--tone, var(--module-accent)) 8%, #fff));
  box-shadow: var(--module-shadow);
}
.dk-surface #view .overview-kpi strong, .dk-surface #view .kpi b {
  color: var(--tone, var(--module-accent)); letter-spacing: -.04em;
  font-size: clamp(27px, 3.5cqi, 42px); line-height: 1.3; margin-block: 3px;
}
.dk-surface #view .overview-kpi:nth-child(2) { --tone: #287469; }
.dk-surface #view .overview-kpi:nth-child(3) { --tone: #3d6494; }
.dk-surface #view .overview-kpi:nth-child(4) { --tone: #955f31; }
.dk-surface #view button.overview-kpi:hover { border-color: var(--tone); }
.dk-surface #view .plot-line { stroke: var(--module-accent); }
.dk-surface #view .plot-dot, .dk-surface #view .plot-area { fill: var(--module-accent); }
.dk-surface #view .plot-grid { stroke: #e1e4ed; }
.dk-surface #view .plot-legend::before { background: var(--module-accent); }
.dk-surface #view :is(.crm-filters, .feedback-grid section) { background: #f7f8fc; padding: 12px; border-radius: 11px; }
.dk-surface #view :is(.tablebox, .crm-table-wrap) { border-radius: 9px; min-width: 0; }
.dk-surface #view :is(.tablebox, .crm-table-wrap) thead th {
  background: #f2f4f9; color: #545c71; font-size: 13px; letter-spacing: .015em;
}
.dk-surface #view :is(.crm-directory .crm-name:hover, .cp-work > h3) { color: var(--module-accent); }

/* Adapt to the module's available space, including a narrow in-app preview. */
@container workspace-view (max-width: 675px) {
  .dk-surface #view :is(.studio-grid, .twocol, .marketing-layout, .overview-grid, .overview-ranks) { grid-template-columns: minmax(0, 1fr); }
  .dk-surface #view :is(.kpi, .overview-kpi) { padding: 13px; }
  .dk-surface #view :is(.overview-kpis, .metrics) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .dk-surface #view .overview-toolbar { gap: 8px; }
  .dk-surface #view .overview-period { flex-basis: 100%; }
  .dk-surface #view .marketing-day { min-height: 48px; }
}
@container workspace-view (max-width: 415px) {
  .dk-surface #view :is(.panel, .channel-planning, .signal-rankings, .channel-peek) { padding: 13px; }
  .dk-surface #view :is(.fields, .crm-form-grid, .feedback-grid) { grid-template-columns: 1fr; }
  .dk-surface #view .rank-item { grid-template-columns: 1.8em minmax(0, 1fr); }
  .dk-surface #view .rank-side { grid-column: 2; justify-items: start; }
  .dk-surface #view .marketing-grid { gap: 2px; }
  .dk-surface #view .marketing-day { padding: 3px; }
  .dk-surface #view .calendar { overflow-x: auto; grid-template-columns: repeat(7, minmax(38px, 1fr)); }
}
@media (max-width: 650px) {
  .dk-surface .journey .channel { flex: 1 0 3.5em; padding: 3px 2px; font-size: 12px; min-height: 40px; }
}

#modal {
  border-color: #d6d8e5; border-radius: 18px;
  box-shadow: 0 22px 80px #29283e35; padding: clamp(17px, 3vw, 26px);
}
#modal::backdrop { background: #27273f57; }
#modal .dialog-head { border-bottom: 1px solid #e5e7ef; padding-bottom: 12px; }
#modal .dialog-head h2 { color: #29273c; line-height: 1.4; }
.auth-box { background: linear-gradient(140deg,#f2f0f8,#fafaff 64%); }
.auth-form { padding: clamp(19px, 3vw, 34px); width: min(440px, 100%); border-radius: 17px; border: 1px solid #dde0eb; background: #fff; box-shadow: 0 8px 26px #3037580d; }
