/* ============================================================
   Client dashboard (white-label). Ported from the approved design.

   Everything is scoped to .cd and prefixed cd- so it can't collide with legacy.css, which still styles
   the sign-in pages and the inbox/modals reused from the main dashboard. The agency accent is the single
   --accent variable below; change it (or set it on .cd) to re-brand the whole dashboard.
   ============================================================ */

.cd {
  --accent: #1f5e8c;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 35%, var(--surface));

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fa;
  --ink: #16191f;
  --ink-2: #4a505c;
  --ink-3: #7a808c;
  --line: #e3e5e9;
  --good: #1e7f4f;
  --good-soft: #e3f3ea;
  --warn: #9a6200;
  --warn-soft: #fbf0da;
  --bad: #b42318;
  --bad-soft: #fbe7e5;

  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 6px;
  --font: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* legacy.css pieces reused inside the dashboard (inbox, modals, pagination) read these names. */
  --text: var(--ink);
  --text-soft: var(--ink-2);
  --muted: var(--ink-3);
  --border: var(--line);
  --border-soft: var(--line);
  --success: var(--good);
  --success-soft: var(--good-soft);
  --error: var(--bad);
  --error-soft: var(--bad-soft);
  --accent-2: var(--accent);
  --accent-dark: color-mix(in srgb, var(--accent) 85%, #000);
  --ring: color-mix(in srgb, var(--accent) 30%, transparent);
  --radius-lg: var(--r-lg);
  --radius: var(--r-md);
  --radius-sm: var(--r-sm);
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(16, 20, 31, 0.04);

  color-scheme: light;
}

[data-theme="dark"] .cd {
  --bg: #121418;
  --surface: #1a1d23;
  --surface-2: #20242b;
  --ink: #eceef2;
  --ink-2: #b4b9c3;
  --ink-3: #868c98;
  --line: #2c313a;
  --good: #5cc48e;
  --good-soft: #18322a;
  --warn: #e3b04b;
  --warn-soft: #352b16;
  --bad: #f07a6e;
  --bad-soft: #3a1e1c;
  --accent-soft: color-mix(in srgb, var(--accent) 22%, var(--surface));
  --accent-line: color-mix(in srgb, var(--accent) 55%, var(--surface));
  color-scheme: dark;
}

/* ---------- Base ---------- */

.cd {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(to right, var(--surface) 248px, var(--bg) 248px);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

.cd *,
.cd *::before,
.cd *::after {
  box-sizing: border-box;
}

.cd button {
  font: inherit;
  color: inherit;
}

.cd a {
  color: var(--accent);
}

[data-theme="dark"] .cd a {
  color: color-mix(in srgb, var(--accent) 55%, #fff);
}

.cd :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.cd-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Sidebar ---------- */

.cd-side {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 22px 16px;
  overflow-y: auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.cd-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
}

.cd-brand-text {
  min-width: 0;
}

.cd-brand-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.cd-brand-sub {
  font-size: 12px;
  color: var(--ink-3);
}

.cd-drawer-close,
.cd-scrim,
.cd-mbar {
  display: none;
}

/* website switcher */
.cd-switcher {
  position: relative;
}

.cd-switcher-k {
  padding: 0 2px 5px;
  font-size: 12px;
  color: var(--ink-3);
}

.cd-switcher-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
}

.cd-switcher-btn:hover {
  border-color: var(--ink-3);
}

.cd-switcher-btn:disabled {
  cursor: default;
}

.cd-switcher-btn:disabled:hover {
  border-color: var(--line);
}

.cd-switcher-btn:disabled .cd-chev {
  display: none;
}

.cd-sw-text {
  flex: 1;
  min-width: 0;
}

.cd-sw-name,
.cd-sw-domain {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cd-sw-name {
  font-size: 14px;
  font-weight: 600;
}

.cd-sw-domain {
  font-size: 12.5px;
  color: var(--ink-2);
}

.cd-chev {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 2;
  transition: transform 0.15s;
}

.cd-switcher-btn[aria-expanded="true"] .cd-chev {
  transform: rotate(180deg);
}

/* Drawn in its own fixed layer (see SiteSwitcher) so it sits in front of the page, the sidebar and the mobile
   drawer. Position, minimum width and maximum height are set inline from the button's place on screen. */
.cd-menu {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  width: max-content;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(16, 20, 31, 0.14);
}

[data-theme="dark"] .cd-menu {
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.cd-menu-search {
  display: block;
  flex-shrink: 0;
  width: 100%;
  margin-bottom: 6px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.cd-menu-search:focus-visible {
  outline-offset: -1px;
}

.cd-menu-list {
  flex: 1;
  min-height: 0;
  max-height: 320px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.cd-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.cd-menu-item:hover,
.cd-menu-item:focus-visible {
  background: var(--surface-2);
  outline-offset: -2px;
}

.cd-fav {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 28px;
  height: 28px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.cd-menu-text {
  flex: 1;
  min-width: 0;
}

.cd-menu-name,
.cd-menu-domain {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cd-menu-name {
  font-size: 14px;
  font-weight: 600;
}

.cd-menu-domain {
  font-size: 12.5px;
  color: var(--ink-3);
}

.cd-tick {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  visibility: hidden;
}

[data-theme="dark"] .cd-tick {
  stroke: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-menu-item[aria-selected="true"] .cd-tick {
  visibility: visible;
}

.cd-menu-empty {
  padding: 10px;
  font-size: 13px;
  color: var(--ink-3);
}

/* navigation */
.cd-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cd-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  font-size: 14.5px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.cd .cd-nav-link {
  color: var(--ink-2);
}

.cd-nav-link svg {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cd-nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.cd .cd-nav-link:hover {
  color: var(--ink);
}

.cd-nav-link[aria-current="page"],
.cd .cd-nav-link[aria-current="page"] {
  font-weight: 600;
  color: var(--ink);
  background: var(--accent-soft);
}

.cd-nav-link[aria-current="page"] svg {
  color: var(--accent);
}

[data-theme="dark"] .cd-nav-link[aria-current="page"] svg {
  color: color-mix(in srgb, var(--accent) 55%, #fff);
}

.cd-nav-link[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.cd-side-foot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: auto;
}

.cd-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  margin-bottom: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.cd-user-avatar {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 32px;
  height: 32px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 50%;
}

.cd-user-text {
  min-width: 0;
}

.cd-user-name,
.cd-user-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cd-user-name {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
}

.cd-user-email {
  font-size: 12px;
  color: var(--ink-3);
}

.cd-side-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  font-size: 13px;
  color: var(--ink-2);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.cd-side-btn:hover:not(:disabled) {
  background: var(--surface-2);
}

.cd-side-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.cd-side-btn svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* the label follows the current theme without any state */
.cd-theme-btn .when-dark {
  display: none;
}

[data-theme="dark"] .cd-theme-btn .when-dark {
  display: inline;
}

[data-theme="dark"] .cd-theme-btn .when-light {
  display: none;
}

/* ---------- Main ---------- */

/* A column as tall as the window, so the footer can sit at the bottom of a short page (see .cd-foot). */
.cd-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  padding: 28px 36px 24px;
}

.cd-topbar {
  margin-bottom: 22px;
}

.cd-topbar h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cd-topbar p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink-3);
}

.cd-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  /* Pushed to the bottom of the window on a short page, and just after the content on a long one. */
  margin-top: auto;
  padding-top: 28px;
  font-size: 12.5px;
  color: var(--ink-3);
}

.cd-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  color: var(--surface);
  background: var(--ink);
  border-radius: 999px;
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
}

.cd-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Overview ---------- */

.cd-digest {
  padding: 26px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-lg);
}

.cd-digest-when {
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--ink-3);
}

.cd-digest-lede {
  max-width: 62ch;
  margin: 0;
  font-size: clamp(20px, 2.1vw, 25px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

.cd-digest-by {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-3);
}

/* ---------- Stat row ---------- */

.cd-stats {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.cd-stat {
  min-width: 0;
  padding: 18px 22px;
  background: var(--surface);
}

.cd-stat-k {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}

.cd-stat-v {
  margin: 4px 0 2px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  overflow-wrap: anywhere;
}

.cd-stat-s {
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------- Panels ---------- */

.cd-grid {
  display: grid;
  gap: 20px;
}

.cd-g-2-1 {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.cd-g-1-1 {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* A page's blocks (toolbar, stats, panels) are spaced by the container, not by their own margins. */
.cd-stack {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.cd-panel {
  min-width: 0;
  padding: 20px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.cd-panel-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cd-panel-h h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cd-panel-h .note {
  font-size: 12.5px;
  color: var(--ink-3);
}

.cd-note {
  margin: 0;
  font-size: 13px;
  color: var(--ink-3);
}

/* ---------- Toolbar, segmented control, inputs ---------- */

.cd-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cd-toolbar-end {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cd-seg {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cd-seg button {
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  background: none;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}

.cd-seg button:hover:not([aria-pressed="true"]):not([aria-selected="true"]) {
  color: var(--ink);
}

.cd-seg button[aria-pressed="true"],
.cd-seg button[aria-selected="true"] {
  color: var(--surface);
  background: var(--ink);
}

.cd-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.cd-icon-btn:hover {
  border-color: var(--ink-3);
  color: var(--ink);
}

.cd-icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cd-input {
  width: 360px;
  max-width: 100%;
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cd-input::placeholder {
  color: var(--ink-3);
}

.cd-input:focus-visible {
  outline-offset: 0;
}

.cd-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.cd .cd-btn {
  color: var(--ink);
}

.cd-btn:hover {
  border-color: var(--ink-3);
}

.cd-btn.primary,
.cd .cd-btn.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

.cd-btn.primary:hover {
  filter: brightness(1.08);
}

/* ---------- Tags and chart ---------- */

.cd-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border-radius: 999px;
}

.cd-tag.good {
  color: var(--good);
  background: var(--good-soft);
}

.cd-tag.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.cd-tag.bad {
  color: var(--bad);
  background: var(--bad-soft);
}

.cd-tag.neutral {
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.cd-tag.accent {
  color: var(--ink);
  background: var(--accent-soft);
}

.cd-tag.accent .cd-dot {
  background: var(--accent);
}

[data-theme="dark"] .cd-tag.accent .cd-dot {
  background: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-dot {
  display: inline-block;
  flex-shrink: 0;
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
}

.cd-chart-wrap {
  position: relative;
}

.cd-chart {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: pan-y;
}

.cd-chart:focus {
  outline: none;
}

.cd-chart:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.cd-chart .gridline {
  stroke: var(--line);
  stroke-width: 1;
}

.cd-chart .axis {
  fill: var(--ink-3);
  font-family: var(--font);
  font-size: 11px;
}

.cd-chart .area {
  fill: var(--accent);
  opacity: 0.09;
}

.cd-chart .line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cd-chart .line-2 {
  fill: none;
  stroke: var(--ink-3);
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
  opacity: 0.7;
}

[data-theme="dark"] .cd-chart .line {
  stroke: color-mix(in srgb, var(--accent) 60%, #fff);
}

[data-theme="dark"] .cd-chart .area {
  fill: color-mix(in srgb, var(--accent) 60%, #fff);
  opacity: 0.1;
}

.cd-chart .hover-line {
  stroke: var(--ink-3);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.cd-chart .hover-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2.5;
}

[data-theme="dark"] .cd-chart .hover-dot {
  stroke: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-chart .hover-dot.second {
  stroke: var(--ink-3);
  stroke-width: 2;
}

.cd-tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 5;
  min-width: 160px;
  padding: 10px 12px;
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(16, 20, 31, 0.14);
  pointer-events: none;
}

[data-theme="dark"] .cd-tip {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.cd-tip .d {
  margin-bottom: 6px;
  font-weight: 700;
}

.cd-tip .r {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink-2);
}

.cd-tip .r b {
  font-weight: 700;
  color: var(--ink);
}

.cd-tip .r i,
.cd-legend i {
  display: inline-block;
  width: 12px;
  height: 2px;
  margin-right: 6px;
  vertical-align: middle;
  background: var(--accent);
}

.cd-tip .r i.dashed,
.cd-legend i.dashed {
  height: 0;
  background: none;
  border-top: 2px dashed var(--ink-3);
}

.cd-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ---------- Bar lists and tables ---------- */

.cd-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cd-bar-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  font-size: 14px;
}

.cd-bar-lbl {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

.cd-bar-num {
  font-weight: 600;
}

.cd-bar-track {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cd-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

[data-theme="dark"] .cd-bar-fill {
  background: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-empty-line {
  margin: 0;
  font-size: 14px;
  color: var(--ink-3);
}

.cd-tbl-wrap {
  margin: 0 -22px;
  padding: 0 22px;
  overflow-x: auto;
}

.cd-tbl {
  width: 100%;
  min-width: 520px;
  font-size: 14px;
  border-collapse: collapse;
}

.cd-tbl th {
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  color: var(--ink-3);
  border-bottom: 1px solid var(--line);
}

.cd-tbl td {
  padding: 11px 10px;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
}

.cd-tbl tr:last-child td {
  border-bottom: 0;
}

.cd-tbl .num {
  text-align: right;
}

.cd-tbl .lbl {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Website details ---------- */

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

.cd-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.cd-info-ic {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 12px;
  background: var(--accent-soft);
  border-radius: 11px;
}

.cd-info-ic svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="dark"] .cd-info-ic svg {
  stroke: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-info-ic.good {
  background: var(--good-soft);
}

.cd-info-ic.good svg {
  stroke: var(--good);
}

.cd-info-ic.warn {
  background: var(--warn-soft);
}

.cd-info-ic.warn svg {
  stroke: var(--warn);
}

.cd-info-body {
  width: 100%;
  min-width: 0;
}

.cd-info-k {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
}

.cd-info-v {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.cd-info-v a {
  text-decoration: none;
}

.cd-info-v a:hover {
  text-decoration: underline;
}

.cd-info-s {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

/* ---------- Empty, error and loading states ---------- */

.cd-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.cd-state-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 12px;
}

[data-theme="dark"] .cd-state-icon {
  color: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-state h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cd-state p {
  max-width: 52ch;
  margin: 0;
  font-size: 14px;
  color: var(--ink-3);
}

.cd-state .cd-btn {
  margin-top: 12px;
}

.cd-state.error {
  border-color: color-mix(in srgb, var(--bad) 40%, var(--line));
}

.cd-state.error p {
  color: var(--bad);
}

/* ---------- Loading skeletons ---------- */

/* Tones are derived from the ink colour, so the shimmer reads on white panels and the page background in
   light mode, and on the dark surfaces in dark mode. */
.cd-bone {
  display: block;
  max-width: 100%;
  background: linear-gradient(90deg, var(--sk-base) 0%, var(--sk-shine) 50%, var(--sk-base) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: cd-shimmer 1.5s ease-in-out infinite;
}

.cd {
  --sk-base: color-mix(in srgb, var(--ink) 11%, var(--surface));
  --sk-shine: color-mix(in srgb, var(--ink) 5%, var(--surface));
}

@keyframes cd-shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.cd-sk-stat-value {
  margin: 8px 0 7px;
}

.cd-sk-icon {
  margin-bottom: 12px;
}

.cd-sk-fill {
  background: var(--sk-base);
}

.cd-sk-chart {
  position: relative;
  height: 200px;
  background: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 50px);
}

/* An area-chart silhouette. */
.cd-sk-chart .cd-bone {
  position: absolute;
  inset: 0;
  border-radius: 0;
  opacity: 0.75;
  clip-path: polygon(0 68%, 14% 52%, 28% 60%, 42% 36%, 57% 50%, 72% 28%, 86% 44%, 100% 34%, 100% 100%, 0 100%);
}

.cd-sk-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
}

.cd-sk-row:last-child {
  border-bottom: 0;
}

.cd-sk-row-text {
  display: grid;
  flex: 1;
  gap: 8px;
  min-width: 0;
}

.cd-sk-table {
  display: grid;
}

.cd-sk-table-row {
  display: grid;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cd-sk-table-row:last-child {
  border-bottom: 0;
}

.cd-sk-inbox {
  display: flex;
  min-height: 480px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.cd-sk-inbox-list {
  flex-shrink: 0;
  width: 340px;
  border-right: 1px solid var(--line);
}

.cd-sk-inbox-item {
  display: flex;
  gap: 11px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.cd-sk-inbox-detail {
  display: grid;
  flex: 1;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 24px;
}

.cd-sk-inbox-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* ---------- Traffic: sections, Moz, AI search, ranking keywords ---------- */

.cd-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.cd-section-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cd-section-head p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--ink-3);
}

.cd-seg button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.cd-seg-icon {
  display: inline-flex;
}

.cd-panel-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

/* A pill group inside a panel hugs its buttons instead of stretching across the grid. */
.cd-panel-stack > .cd-seg {
  justify-self: start;
}

.cd-select {
  padding: 8px 14px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cd-count {
  font-size: 13px;
  color: var(--ink-3);
}

.cd-stat-with-trend {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.cd-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}

.cd-trend.up {
  color: var(--good);
}

.cd-trend.down {
  color: var(--bad);
}

.cd-trend.new {
  padding: 1px 8px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}

[data-theme="dark"] .cd-trend.new {
  color: color-mix(in srgb, var(--accent) 55%, #fff);
}

.cd-trend.flat {
  color: var(--ink-3);
}

/* Smaller tiles for inside a panel */
.cd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.cd-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.cd-kpi-k {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
}

.cd-kpi-v {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cd-kpi-h {
  font-size: 12px;
  color: var(--ink-3);
}

.cd-split-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px 28px;
}

.cd-split {
  min-width: 0;
}

.cd-split-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 600;
}

.cd-split-total {
  font-weight: 500;
  color: var(--ink-3);
}

.cd-split-bar {
  height: 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--ink-3) 35%, var(--surface));
  border-radius: 999px;
}

.cd-split-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

[data-theme="dark"] .cd-split-bar span {
  background: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-split-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.cd-split-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 4px;
  border-radius: 50%;
}

.cd-split-legend i.major {
  background: var(--accent);
}

.cd-split-legend i.minor {
  background: color-mix(in srgb, var(--ink-3) 55%, var(--surface));
}

.cd-split-legend em {
  font-style: normal;
  color: var(--ink-3);
}

.cd-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cd-facts div {
  display: flex;
  gap: 8px;
  font-size: 13.5px;
}

.cd-facts dt {
  color: var(--ink-3);
}

.cd-facts dd {
  margin: 0;
  font-weight: 700;
}

.cd-score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.cd-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 20px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.cd-score-card h3 {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
}

.cd-score-card p {
  max-width: 30ch;
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
}

.cd-ring {
  position: relative;
  width: 120px;
  height: 120px;
  --ring: var(--ink-3);
}

.cd-score-card.tone-good .cd-ring {
  --ring: var(--good);
}

.cd-score-card.tone-ok .cd-ring {
  --ring: var(--accent);
}

.cd-score-card.tone-warn .cd-ring {
  --ring: var(--warn);
}

.cd-score-card.tone-bad .cd-ring {
  --ring: var(--bad);
}

.cd-ring circle {
  fill: none;
  stroke-width: 9;
}

.cd-ring .track {
  stroke: var(--surface-2);
}

[data-theme="dark"] .cd-ring .track {
  stroke: var(--line);
}

.cd-ring .fill {
  stroke: var(--ring);
  stroke-linecap: round;
}

.cd-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cd-ring-value small {
  margin-left: 1px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
}

/* AI search */
.cd-op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.cd-op-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.cd-op-card.idle {
  background: var(--surface-2);
}

.cd-op-card.idle .cd-op-value {
  color: var(--ink-3);
}

.cd-op-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.cd-op-head h4 {
  min-width: 0;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.cd-op-logo {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.cd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cd-chip {
  max-width: 100%;
  padding: 2px 9px;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cd-op-label {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}

.cd-op-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.cd-op-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-height: 20px;
}

.cd-op-blocked {
  font-size: 12px;
  color: var(--bad);
}

.cd-crawler-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.cd-opt-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.cd-opt-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.cd-opt-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--ink-3);
}

.cd-opt-icon {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
}

[data-theme="dark"] .cd-opt-icon {
  color: color-mix(in srgb, var(--accent) 60%, #fff);
}

.cd-opt-figure {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}

.cd-opt-figure > span:first-child {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.cd-mini-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}

/* Ranking keywords */
.cd-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  background: none;
  border: 0;
  cursor: pointer;
}

.cd-sort:hover,
.cd-sort.active {
  color: var(--ink);
}

.cd-tbl th.num .cd-sort {
  justify-content: flex-end;
}

.cd-rank {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  padding: 2px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cd-rank.top3 {
  color: var(--good);
  background: var(--good-soft);
  border-color: transparent;
}

.cd-rank.top10 {
  color: var(--ink);
  background: var(--accent-soft);
  border-color: transparent;
}

.cd-rank.top20 {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: transparent;
}

.cd-diff {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.cd-diff-bar {
  width: 56px;
  height: 6px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.cd-diff-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.cd-diff.easy .cd-diff-bar span {
  background: var(--good);
}

.cd-diff.medium .cd-diff-bar span {
  background: var(--warn);
}

.cd-diff.hard .cd-diff-bar span {
  background: var(--bad);
}

.cd-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cd-more-error {
  margin: 0;
  font-size: 13px;
  color: var(--bad);
}

.cd-sk-gap {
  margin-top: 16px;
}

/* ---------- Sign-in ---------- */

/* The same chassis as the dashboard: a surface panel on the left like the sidebar, the page background on the right. */
.cd.cd-auth {
  grid-template-columns: minmax(340px, 460px) minmax(0, 1fr);
  background: var(--bg);
}

.cd-auth-aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 100vh;
  padding: 28px 36px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.cd-auth-mid {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 8vh;
}

.cd-auth-mid h2 {
  max-width: 20ch;
  margin: 0 0 12px;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.cd-auth-mid p {
  max-width: 40ch;
  margin: 0;
  font-size: 15px;
  color: var(--ink-2);
}

.cd-auth-pane {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 32px 20px;
}

.cd-auth-theme {
  position: absolute;
  top: 20px;
  right: 20px;
}

.cd-auth-card {
  width: min(420px, 100%);
}

.cd-auth-card h1 {
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.cd-auth-lead {
  margin: 0 0 22px;
  font-size: 14.5px;
  color: var(--ink-3);
}

.cd-auth-mark {
  display: none;
  margin-bottom: 28px;
}

.cd-auth-mark .cd-brand {
  padding: 0;
}

/* The error region is always present for screen readers; it takes no room until it has a message. */
.cd-auth-form > [role="alert"]:empty {
  display: none;
}

.cd-ws-mark {
  display: inline-grid;
  flex-shrink: 0;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 22%;
}

.cd-auth-form {
  display: grid;
  gap: 16px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}

.cd-field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}

.cd-text-input {
  width: 100%;
  padding: 11px 14px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color 0.15s;
}

.cd-text-input::placeholder {
  color: var(--ink-3);
}

.cd-text-input:hover:not(:disabled) {
  border-color: var(--ink-3);
}

.cd-text-input:focus-visible {
  border-color: var(--accent);
  outline: 2px solid var(--accent-line);
  outline-offset: 0;
}

.cd-text-input[aria-invalid="true"] {
  border-color: var(--bad);
}

.cd-text-input:disabled {
  opacity: 0.6;
}

.cd-pw {
  position: relative;
}

.cd-pw .cd-text-input {
  padding-right: 48px;
}

.cd-pw-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--ink-3);
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transform: translateY(-50%);
}

.cd-pw-toggle:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.cd-field-error {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--bad);
}

.cd-form-error {
  margin: 0;
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--bad);
  background: var(--bad-soft);
  border-radius: var(--r-md);
}

.cd-btn.wide {
  width: 100%;
}

.cd-auth-form .cd-btn,
.cd-auth-card > .cd-btn {
  padding: 12px 16px;
  font-size: 14.5px;
}

.cd-btn:disabled {
  opacity: 0.65;
  cursor: default;
}

@media (max-width: 940px) {
  .cd.cd-auth {
    grid-template-columns: minmax(0, 1fr);
  }

  .cd-auth-aside {
    display: none;
  }

  .cd-auth-pane {
    min-height: 100dvh;
  }

  .cd-auth-mark {
    display: block;
  }
}

/* ---------- Enquiries ---------- */

.cd .ibwrap {
  background: var(--surface);
  border-color: var(--line);
  border-radius: var(--r-lg);
  box-shadow: none;
}

.cd-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Content ---------- */

.cd-post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.cd-post-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 6px;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  cursor: pointer;
}

.cd-post-list li:last-child .cd-post-row {
  border-bottom: 0;
}

.cd-post-row:hover {
  background: var(--surface-2);
}

.cd-post-date {
  display: flex;
  flex-shrink: 0;
  flex-direction: column;
  align-items: center;
  width: 52px;
  padding: 6px 0;
  line-height: 1.1;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.cd-post-date b {
  font-size: 18px;
  font-weight: 700;
}

.cd-post-date span {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--ink-3);
}

.cd-post-text {
  flex: 1;
  min-width: 0;
}

.cd-post-text b,
.cd-post-text span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cd-post-text b {
  font-size: 14.5px;
  font-weight: 600;
}

.cd-post-text span {
  font-size: 12.5px;
  color: var(--ink-3);
}

.cd-status-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  background: var(--ink-3);
  border-radius: 50%;
}

.cd-status-dot.scheduled {
  background: var(--accent);
}

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

.cd-status-dot.published {
  background: var(--good);
}

.cd-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}

.cd-filter-chip[aria-pressed="false"] {
  color: var(--ink-3);
  background: none;
}

.cd-filter-chip[aria-pressed="false"] .cd-status-dot {
  opacity: 0.4;
}

.cd-month-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cd-month-nav b {
  min-width: 140px;
  font-size: 15px;
  text-align: center;
}

.cd-side-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cd-side-list button {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 8px 6px;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.cd-side-list button:hover {
  background: var(--surface-2);
}

.cd-side-list .cd-status-dot {
  margin-top: 7px;
}

.cd-side-list-text {
  min-width: 0;
}

.cd-side-list-text b,
.cd-side-list-text span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cd-side-list-text b {
  font-size: 14px;
  font-weight: 600;
}

.cd-side-list-text span {
  font-size: 12.5px;
  color: var(--ink-3);
}

.cd-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(16, 20, 31, 0.5);
}

.cd-modal {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 32px);
  padding: 24px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px rgba(16, 20, 31, 0.3);
}

.cd-modal h2 {
  margin: 0 36px 4px 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.cd-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
}

.cd-modal-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  margin: 16px 0;
  font-size: 14px;
}

.cd-modal-meta dt,
.cd-modal-meta dd {
  margin: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.cd-modal-meta dt {
  color: var(--ink-3);
}

.cd-modal-meta dd {
  padding-left: 16px;
  font-weight: 600;
  text-align: right;
}

.cd-modal-excerpt {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.cd-modal-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1180px) {
  .cd-info-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .cd {
    grid-template-columns: minmax(0, 1fr);
    background: var(--bg);
  }

  .cd-mbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .cd-burger {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 40px;
    height: 40px;
    background: none;
    border: 1px solid var(--line);
    border-radius: 10px;
    cursor: pointer;
  }

  .cd-burger svg,
  .cd-drawer-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--ink);
    stroke-width: 2;
    stroke-linecap: round;
  }

  .cd-mbar-txt {
    min-width: 0;
  }

  .cd-mbar-site,
  .cd-mbar-view {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .cd-mbar-site {
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.2;
  }

  .cd-mbar-view {
    font-size: 12.5px;
    color: var(--ink-3);
  }

  .cd-side {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 40;
    width: min(300px, 86vw);
    height: 100dvh;
    visibility: hidden;
    box-shadow: 0 0 40px rgba(16, 20, 31, 0.18);
    transform: translateX(-102%);
    transition:
      transform 0.25s ease,
      visibility 0s linear 0.25s;
  }

  .cd-drawer-open .cd-side {
    visibility: visible;
    transform: none;
    transition:
      transform 0.25s ease,
      visibility 0s;
  }

  .cd-drawer-close {
    display: grid;
    flex-shrink: 0;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-left: auto;
    background: none;
    border: 0;
    border-radius: 9px;
    cursor: pointer;
  }

  .cd-drawer-close:hover {
    background: var(--surface-2);
  }

  .cd-scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    background: rgba(16, 20, 31, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }

  .cd-drawer-open .cd-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .cd-main {
    /* Below the 61px mobile bar, so the page isn't scrollable when it doesn't need to be. */
    min-height: calc(100dvh - 61px);
    padding: 22px 18px 20px;
  }

  .cd-g-2-1,
  .cd-g-1-1 {
    grid-template-columns: minmax(0, 1fr);
  }

  .cd-info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cd-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .cd-split-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cd-stat:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .cd .ibwrap,
  .cd-sk-inbox {
    flex-direction: column;
  }

  .cd-sk-inbox-list {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .cd .iblist {
    width: 100%;
    max-height: 320px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  /* Five tabs don't fit a phone: the strip scrolls sideways instead of wrapping onto several rows. */
  .cd-toolbar {
    min-width: 0;
  }

  .cd-seg[role="tablist"] {
    flex-wrap: nowrap;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .cd-seg[role="tablist"]::-webkit-scrollbar {
    display: none;
  }

  .cd-seg[role="tablist"] button {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .cd-score-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .cd-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .cd-stat {
    padding: 14px 16px;
  }

  .cd-stat-v {
    font-size: 24px;
  }

  .cd-info-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .cd-info {
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
  }

  .cd-info-ic {
    margin-bottom: 0;
  }

  .cd-info-v {
    font-size: 17px;
  }

  .cd-digest {
    padding: 20px;
  }

  .cd-topbar h1 {
    font-size: 22px;
  }

  .cd-input {
    width: 100%;
  }

  .cd-post-date {
    display: none;
  }

  .cd-panel {
    padding: 16px;
  }

  .cd-tbl-wrap {
    margin: 0 -16px;
    padding: 0 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cd *,
  .cd *::before,
  .cd *::after {
    transition: none !important;
    animation: none !important;
  }
}
