@font-face {
  font-family: "DF Sans";
  src: url("./fonts/SourceHanSansCN-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "DF DIN";
  src: url("./fonts/DIN-Medium.otf") format("opentype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: oklch(0.145 0.008 285);
  --bg-raised: oklch(0.18 0.009 285);
  --surface: oklch(0.205 0.009 285);
  --surface-strong: oklch(0.245 0.011 285);
  --surface-soft: oklch(0.175 0.008 285);
  --text: oklch(0.965 0.004 285);
  --text-soft: oklch(0.72 0.012 285);
  --text-faint: oklch(0.67 0.014 285);
  --border: oklch(1 0 0 / 11%);
  --border-strong: oklch(1 0 0 / 19%);
  --brand-cyan: oklch(0.71 0.17 294);
  --brand-purple: oklch(0.74 0.17 3);
  --gradient: linear-gradient(90deg in oklch, var(--brand-purple), var(--brand-cyan));
  --on-brand: oklch(0.14 0.01 285);
  --focus-ring: oklch(0.8 0.17 294);
  --success: oklch(0.72 0.18 150);
  --success-soft: oklch(0.72 0.18 150 / 13%);
  --warning: oklch(0.78 0.16 74);
  --warning-soft: oklch(0.78 0.16 74 / 13%);
  --danger: oklch(0.66 0.22 25);
  --danger-soft: oklch(0.66 0.22 25 / 13%);
  --info: oklch(0.69 0.15 246);
  --info-soft: oklch(0.69 0.15 246 / 13%);
  --shadow-sm: 0 1px 2px oklch(0.05 0.01 285 / 26%);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 10px;
  --sidebar-width: 232px;
  --topbar-height: 64px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: oklch(0.975 0.003 285);
  --bg-raised: oklch(0.995 0.002 285);
  --surface: oklch(1 0 0);
  --surface-strong: oklch(0.955 0.006 285);
  --surface-soft: oklch(0.965 0.005 285);
  --text: oklch(0.19 0.012 285);
  --text-soft: oklch(0.48 0.018 285);
  --text-faint: oklch(0.47 0.014 285);
  --border: oklch(0.89 0.01 285);
  --border-strong: oklch(0.8 0.018 285);
  --success: oklch(0.46 0.15 150);
  --success-soft: oklch(0.46 0.15 150 / 10%);
  --warning: oklch(0.47 0.14 74);
  --warning-soft: oklch(0.47 0.14 74 / 10%);
  --danger: oklch(0.48 0.19 25);
  --danger-soft: oklch(0.48 0.19 25 / 9%);
  --info: oklch(0.46 0.15 246);
  --info-soft: oklch(0.46 0.15 246 / 9%);
  --focus-ring: oklch(0.45 0.18 294);
  --shadow-sm: 0 1px 2px oklch(0.3 0.01 285 / 8%);
}

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

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: "DF Sans", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select,
label[for],
summary,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
}

svg {
  flex: 0 0 auto;
}

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

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

table {
  width: 100%;
  border-collapse: collapse;
}

::selection {
  color: var(--on-brand);
  background: color-mix(in oklch, var(--brand-cyan) 65%, var(--brand-purple));
}

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

.skip-link {
  position: fixed;
  z-index: 100;
  top: 8px;
  left: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: var(--on-brand);
  background: var(--brand-cyan);
  transform: translateY(-160%);
  transition: transform 160ms var(--ease);
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

.icon-sm {
  width: 15px;
  height: 15px;
}

.numeric {
  font-family: "DF DIN", "DF Sans", sans-serif;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-soft);
}

.faint {
  color: var(--text-faint);
}

.app-shell {
  min-height: 100dvh;
}

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 82%, var(--brand-cyan) 3%);
  transition: transform 220ms var(--ease);
}

.brand {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: var(--radius);
  color: var(--on-brand);
  background: var(--gradient);
  box-shadow: var(--shadow-sm);
  font-family: "DF DIN", sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-meta {
  display: block;
  color: var(--text-faint);
  font-size: 11px;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  padding: 18px 10px;
}

.nav-label {
  margin: 14px 10px 7px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 500;
}

.nav-link {
  position: relative;
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  overflow: hidden;
  border-radius: var(--radius);
  color: var(--text-soft);
  transition: color 160ms var(--ease), background 160ms var(--ease);
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.nav-link[aria-current="page"] {
  color: var(--text);
  background: color-mix(in oklch, var(--surface) 78%, var(--brand-cyan) 10%);
}

.nav-link[aria-current="page"]::before {
  position: absolute;
  inset: 7px auto 7px 0;
  width: 2px;
  border-radius: 2px;
  background: var(--gradient);
  content: "";
}

.nav-link[aria-current="page"] .icon {
  color: var(--brand-cyan);
}

.nav-count {
  display: inline-grid;
  min-width: 20px;
  min-height: 20px;
  margin-left: auto;
  place-items: center;
  padding: 0 6px;
  border-radius: 999px;
  color: var(--on-brand);
  background: var(--gradient);
  font-family: "DF DIN", sans-serif;
  font-size: 10px;
}

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--border);
}

.workspace-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-soft);
}

.workspace-avatar,
.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--on-brand);
  background: color-mix(in oklch, var(--brand-purple) 70%, var(--brand-cyan));
  font-family: "DF DIN", sans-serif;
}

.workspace-avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.workspace-info {
  min-width: 0;
  flex: 1;
}

.workspace-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-plan {
  color: var(--text-faint);
  font-size: 10px;
}

.app-frame {
  min-height: 100dvh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  height: var(--topbar-height);
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
}

.topbar::after {
  position: absolute;
  inset: auto 0 -1px;
  height: 1px;
  opacity: 0.48;
  background: var(--gradient);
  content: "";
}

.topbar .mobile-menu-button {
  display: none;
}

.breadcrumbs {
  min-width: 0;
  flex: 1;
  color: var(--text-soft);
  font-size: 12px;
}

.breadcrumbs strong {
  color: var(--text);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-indicator {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 11px;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.page {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 26px 28px 48px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-title {
  margin-bottom: 5px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.25;
}

.page-description {
  max-width: 72ch;
  margin-bottom: 0;
  color: var(--text-soft);
  font-size: 13px;
}

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

.btn,
.icon-btn {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 500;
  transition: transform 140ms var(--ease), color 160ms var(--ease), background 160ms var(--ease), border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}

.btn {
  padding: 0 14px;
}

.icon-btn {
  width: 36px;
  padding: 0;
}

.btn:hover,
.icon-btn:hover {
  box-shadow: var(--shadow-sm);
}

.btn:active,
.icon-btn:active {
  transform: scale(0.98);
}

.btn-primary {
  color: var(--on-brand);
  background: var(--gradient);
  box-shadow: var(--shadow-sm);
}

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

.btn-secondary {
  color: var(--text);
  border-color: var(--border);
  background: var(--surface-strong);
}

.btn-ghost,
.icon-btn {
  color: var(--text-soft);
  border-color: var(--border);
  background: transparent;
}

.btn-ghost:hover,
.icon-btn:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.btn-danger {
  color: var(--danger);
  border-color: color-mix(in oklch, var(--danger) 35%, var(--border));
  background: var(--danger-soft);
}

.btn-sm {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.btn:disabled,
.icon-btn:disabled {
  opacity: 0.45;
  filter: grayscale(0.3);
  transform: none;
}

.control,
.search-control,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-soft);
  box-shadow: var(--shadow-sm);
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}

.control,
.search-control {
  min-height: 36px;
  padding: 0 11px;
}

.control:hover,
.search-control:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.control:focus,
.search-control:focus,
.textarea:focus {
  border-color: var(--brand-cyan);
  background: var(--surface);
  outline: none;
}

.control:focus-visible,
.search-control:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.textarea {
  min-height: 112px;
  resize: vertical;
  padding: 10px 11px;
}

.control::placeholder,
.search-control::placeholder,
.textarea::placeholder {
  color: var(--text-faint);
}

.field {
  display: grid;
  gap: 7px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 500;
}

.field-hint {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 400;
}

.field-error {
  color: var(--danger);
  font-size: 11px;
}

.date-range-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.date-field {
  width: 148px;
}

.input-group {
  position: relative;
}

.input-group .icon {
  position: absolute;
  top: 50%;
  left: 11px;
  color: var(--text-faint);
  transform: translateY(-50%);
}

.input-group .control,
.input-group .search-control {
  padding-left: 36px;
}

.checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--brand-cyan);
}

.switch {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 20px;
  flex: 0 0 auto;
  align-items: center;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-strong);
  transition: background 160ms var(--ease), border-color 160ms var(--ease);
}

.switch-track::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text-soft);
  content: "";
  transition: transform 180ms var(--ease), background 180ms var(--ease);
}

.switch input:checked + .switch-track {
  border-color: transparent;
  background: var(--gradient);
}

.switch input:checked + .switch-track::after {
  background: var(--on-brand);
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--brand-cyan);
  outline-offset: 2px;
}

.segmented {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.segment {
  position: relative;
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: transparent;
  font-size: 11px;
}

.segment:hover {
  color: var(--text);
}

.segment[aria-pressed="true"],
.segment[aria-selected="true"] {
  color: var(--text);
  background: var(--surface-strong);
  box-shadow: var(--shadow-sm);
}

.segment[aria-pressed="true"]::after,
.segment[aria-selected="true"]::after {
  position: absolute;
  inset: auto 7px -3px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient);
  content: "";
}

.tabs {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 42px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  position: relative;
  flex: 0 0 auto;
  align-self: stretch;
  padding: 0 2px;
  border: 0;
  color: var(--text-soft);
  background: transparent;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  color: var(--text);
}

.tab[aria-selected="true"]::after {
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--gradient);
  content: "";
}

[role="tabpanel"][hidden] {
  display: none;
}

.badge,
.status-badge,
.source-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

.status-badge::before {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.status-success {
  color: var(--success);
  border-color: color-mix(in oklch, var(--success) 28%, transparent);
  background: var(--success-soft);
}

.status-warning,
.status-pending,
.status-scheduled {
  color: var(--warning);
  border-color: color-mix(in oklch, var(--warning) 28%, transparent);
  background: var(--warning-soft);
}

.status-danger,
.status-failed {
  color: var(--danger);
  border-color: color-mix(in oklch, var(--danger) 28%, transparent);
  background: var(--danger-soft);
}

.status-info,
.status-publishing,
.status-queued {
  color: var(--info);
  border-color: color-mix(in oklch, var(--info) 28%, transparent);
  background: var(--info-soft);
}

.panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.panel-title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.panel-subtitle {
  margin: 2px 0 0;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 400;
}

.panel-body {
  padding: 18px;
}

.panel-flush {
  overflow: hidden;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric {
  min-width: 0;
  padding: 17px 18px;
  border-right: 1px solid var(--border);
}

.metric:last-child {
  border-right: 0;
}

.metric-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--text-soft);
  font-size: 11px;
}

.metric-value {
  margin-bottom: 5px;
  font-family: "DF DIN", "DF Sans", sans-serif;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-faint);
  font-size: 10px;
}

.metric-delta.positive {
  color: var(--success);
}

.metric-delta.negative {
  color: var(--danger);
}

.grid-two {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 16px;
}

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

.section-gap {
  margin-top: 16px;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

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

.toolbar .search-wrap {
  width: min(320px, 100%);
}

.table-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  contain: layout paint;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.data-table {
  min-width: 780px;
}

.data-table th {
  height: 38px;
  padding: 0 14px;
  color: var(--text-faint);
  background: var(--surface-soft);
  font-size: 10px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.data-table td {
  min-height: 54px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 11px;
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 150ms var(--ease);
}

.data-table tbody tr:hover {
  background: var(--surface-soft);
}

.data-table tbody tr.is-selected {
  background: color-mix(in oklch, var(--surface) 88%, var(--brand-cyan) 8%);
}

.data-table .cell-primary {
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
}

.data-table .cell-secondary {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 10px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.platform-stack {
  display: flex;
  align-items: center;
}

.platform-icon {
  width: 23px;
  height: 23px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: oklch(0.98 0 0);
  object-fit: contain;
}

.platform-stack .platform-icon + .platform-icon {
  margin-left: -5px;
}

.platform-more {
  display: inline-grid;
  width: 23px;
  height: 23px;
  margin-left: -5px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-soft);
  background: var(--surface-strong);
  font-family: "DF DIN", sans-serif;
  font-size: 9px;
}

.content-cell {
  display: flex;
  min-width: 250px;
  align-items: center;
  gap: 10px;
}

.content-thumb {
  position: relative;
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: color-mix(in oklch, var(--surface-strong) 78%, var(--brand-cyan) 8%);
  font-family: "DF DIN", sans-serif;
  font-size: 10px;
}

.content-thumb::after {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--gradient);
  content: "";
}

.batch-bar {
  position: sticky;
  z-index: 20;
  bottom: 16px;
  display: none;
  width: fit-content;
  max-width: 100%;
  min-height: 48px;
  margin: 16px auto 0;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-raised);
  box-shadow: 0 8px 20px oklch(0.05 0.01 285 / 18%);
}

.batch-bar.is-visible {
  display: flex;
}

.batch-count {
  color: var(--text-soft);
  font-size: 11px;
}

.overview-main {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(310px, 0.72fr);
  gap: 16px;
  margin-top: 16px;
}

.agenda-list,
.activity-list,
.queue-list,
.ranking-list {
  display: grid;
}

.agenda-item,
.activity-item,
.queue-item,
.ranking-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.agenda-item:last-child,
.activity-item:last-child,
.queue-item:last-child,
.ranking-item:last-child {
  border-bottom: 0;
}

.agenda-time {
  width: 48px;
  flex: 0 0 auto;
  color: var(--text);
  font-family: "DF DIN", sans-serif;
  font-size: 12px;
}

.agenda-content,
.activity-content,
.queue-content {
  min-width: 0;
  flex: 1;
}

.agenda-title,
.activity-title,
.queue-title {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agenda-meta,
.activity-meta,
.queue-meta {
  margin-top: 3px;
  color: var(--text-faint);
  font-size: 10px;
}

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

.quick-action {
  display: flex;
  min-height: 76px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--surface-soft);
  transition: color 160ms var(--ease), border-color 160ms var(--ease), transform 160ms var(--ease);
}

.quick-action:hover {
  color: var(--text);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.quick-action strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}

.health-row {
  display: grid;
  grid-template-columns: 105px minmax(0, 1fr) 38px;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
}

.health-label {
  color: var(--text-soft);
  font-size: 10px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.progress-fill {
  width: var(--progress, 0%);
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
}

.health-value {
  color: var(--text);
  font-family: "DF DIN", sans-serif;
  font-size: 10px;
  text-align: right;
}

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

.source-card {
  display: flex;
  min-height: 172px;
  flex-direction: column;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.source-card:hover {
  border-color: var(--border-strong);
}

.source-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.source-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--brand-cyan);
  background: var(--surface-soft);
}

.source-card-title {
  margin: 13px 0 3px;
  font-size: 13px;
  font-weight: 600;
}

.source-card-description {
  min-height: 36px;
  margin: 0 0 12px;
  color: var(--text-soft);
  font-size: 10px;
}

.source-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  color: var(--text-faint);
  font-size: 10px;
}

.automation-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.65fr);
  gap: 16px;
}

.rule-list {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
}

.rule-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  background: var(--surface-soft);
}

.rule-info {
  min-width: 0;
  flex: 1;
}

.rule-name {
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}

.rule-meta {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 9px;
}

.rule-target-list {
  display: grid;
  max-height: min(320px, 42dvh);
  gap: 1px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.rule-target-item {
  display: flex;
  min-width: 0;
  min-height: 46px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  color: var(--text-soft);
  background: var(--surface-soft);
  cursor: pointer;
  transition: color 160ms var(--ease), background 160ms var(--ease);
}

.rule-target-item:hover {
  color: var(--text);
  background: var(--surface-strong);
}

.rule-target-item:has(.checkbox:checked),
.rule-target-item:has(.checkbox:indeterminate) {
  color: var(--text);
  background: color-mix(in oklch, var(--surface-soft) 90%, var(--brand-cyan) 8%);
}

.rule-target-item:has(.checkbox:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.rule-target-copy {
  min-width: 0;
  flex: 1;
}

.rule-target-title,
.rule-target-meta {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rule-target-title {
  color: var(--text);
  font-size: 10px;
  font-weight: 500;
}

.rule-target-meta {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 9px;
}

.rule-target-item > .badge,
.rule-target-item > .status-badge {
  flex: 0 0 auto;
  margin-left: auto;
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(340px, 0.7fr);
  gap: 16px;
}

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.week-grid {
  display: grid;
  grid-template-columns: 52px repeat(7, minmax(105px, 1fr));
  min-width: 820px;
}

.week-head,
.week-time,
.week-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.week-head {
  min-height: 48px;
  padding: 8px;
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 10px;
  text-align: center;
}

.week-head strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-family: "DF DIN", sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.week-head.is-today strong {
  color: var(--brand-cyan);
}

.week-time {
  min-height: 74px;
  padding: 8px 6px;
  color: var(--text-faint);
  background: var(--surface-soft);
  font-family: "DF DIN", sans-serif;
  font-size: 9px;
  text-align: center;
}

.week-cell {
  position: relative;
  min-width: 0;
  min-height: 74px;
  padding: 5px;
  overflow: hidden;
  background: var(--surface);
}

.calendar-event {
  display: grid;
  width: 100%;
  min-width: 0;
  gap: 3px;
  min-height: 52px;
  padding: 7px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: inherit;
  background: var(--surface-strong);
  text-align: left;
}

.calendar-event:hover {
  border-color: var(--border-strong);
}

.calendar-event-time {
  color: var(--brand-cyan);
  font-family: "DF DIN", sans-serif;
  font-size: 9px;
}

.calendar-event-title {
  overflow: hidden;
  color: var(--text);
  font-size: 9px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-stack {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.calendar-event-stack .calendar-event {
  min-height: 0;
  padding: 6px;
}

.calendar-event-meta,
.calendar-event-account {
  display: block;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-more {
  display: inline-flex;
  width: 100%;
  min-height: 23px;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  overflow: hidden;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button.calendar-event-more:hover {
  color: var(--text);
  border-color: var(--brand-cyan);
}

.rule-panel {
  position: sticky;
  top: calc(var(--topbar-height) + 16px);
  align-self: start;
}

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

.form-stack {
  display: grid;
  gap: 13px;
}

.selection-list {
  display: grid;
  max-height: 170px;
  gap: 1px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
}

.selection-platform-group {
  min-width: 0;
  background: var(--surface-soft);
}

.selection-platform-header {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  color: var(--text-soft);
  background: var(--surface-soft);
}

.selection-platform-toggle {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.selection-platform-toggle:has(.checkbox:checked),
.selection-platform-toggle:has(.checkbox:indeterminate) {
  color: var(--text);
}

.selection-platform-toggle:has(.checkbox:indeterminate)::after {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand-cyan);
  content: "";
}

.selection-platform-toggle .platform-icon {
  flex: 0 0 auto;
}

.selection-platform-count {
  flex: 0 0 auto;
  margin-left: auto;
  color: var(--text-faint);
  font-family: "DF DIN", "DF Sans", sans-serif;
  font-size: 9px;
}

.selection-platform-list {
  display: grid;
  min-width: 0;
  gap: 1px;
  border-top: 1px solid var(--border);
  background: var(--border);
}

.selection-platform-list .selection-item {
  padding-left: 18px;
  background: var(--surface);
}

.selection-platform-list .selection-item:has(.checkbox:checked) {
  background: color-mix(in oklch, var(--surface) 92%, var(--brand-cyan) 6%);
}

.selection-item:has(.checkbox:disabled) {
  cursor: not-allowed;
  opacity: 0.52;
}

.selection-item {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  background: var(--surface-soft);
}

.selection-copy {
  min-width: 0;
  flex: 1;
}

.selection-title {
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-meta {
  color: var(--text-faint);
  font-size: 9px;
}

.schedule-preview {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
}

.preview-row {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 74px;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  background: var(--surface-soft);
  font-size: 9px;
}

.preview-index {
  color: var(--text-faint);
  font-family: "DF DIN", sans-serif;
}

.preview-title {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-time {
  color: var(--brand-cyan);
  font-family: "DF DIN", sans-serif;
  text-align: right;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 10px;
}

.notice-warning {
  border-color: color-mix(in oklch, var(--warning) 26%, var(--border));
  background: var(--warning-soft);
}

.notice-danger {
  border-color: color-mix(in oklch, var(--danger) 26%, var(--border));
  background: var(--danger-soft);
}

.notice-success {
  border-color: color-mix(in oklch, var(--success) 26%, var(--border));
  background: var(--success-soft);
}

.callback-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.callback-url {
  overflow: hidden;
  color: var(--text);
  font-family: "DF DIN", monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-layout {
  display: grid;
  gap: 16px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
}

.detail-item {
  min-height: 58px;
  padding: 10px;
  background: var(--surface-soft);
}

.detail-label {
  margin-bottom: 5px;
  color: var(--text-faint);
  font-size: 9px;
}

.detail-value {
  color: var(--text);
  font-size: 11px;
}

.analytics-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.55fr);
  gap: 16px;
}

.chart-wrap {
  position: relative;
  min-height: 292px;
  padding: 10px 0 0;
}

.chart-svg {
  width: 100%;
  height: 270px;
  overflow: visible;
}

.chart-grid-line {
  stroke: var(--border);
  stroke-width: 1;
}

.chart-axis-label {
  fill: var(--text-faint);
  font-family: "DF DIN", sans-serif;
  font-size: 9px;
}

.chart-line {
  fill: none;
  stroke: var(--brand-cyan);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: color-mix(in oklch, var(--brand-cyan) 16%, transparent);
}

.chart-point {
  fill: var(--surface);
  stroke: var(--brand-cyan);
  stroke-width: 2;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 6px;
  color: var(--text-soft);
  font-size: 10px;
}

.legend-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--brand-cyan);
}

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 30px;
  height: 30px;
  font-size: 9px;
}

.account-copy {
  min-width: 0;
}

.account-name {
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-platform {
  color: var(--text-faint);
  font-size: 9px;
}

.account-groups {
  min-width: 0;
  border-top: 1px solid var(--border);
}

.account-platform-group {
  min-width: 0;
  background: var(--surface);
}

.account-platform-group + .account-platform-group {
  border-top: 1px solid var(--border);
}

.account-platform-header {
  display: flex;
  min-width: 0;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.account-platform-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.account-platform-title .platform-icon {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 4px;
}

.account-platform-heading,
.account-platform-name {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-platform-summary {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  color: var(--text-faint);
  font-size: 9px;
}

.account-list {
  display: grid;
  min-width: 0;
}

.account-list-row {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(210px, 1.2fr) minmax(260px, 1.35fr) minmax(110px, 0.55fr) minmax(170px, auto);
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  color: var(--text-soft);
  background: var(--surface);
  transition: background 160ms var(--ease), opacity 160ms var(--ease);
}

.account-list-row + .account-list-row {
  border-top: 1px solid var(--border);
}

.account-list-row:hover,
.account-list-row.is-focused {
  background: color-mix(in oklch, var(--surface) 94%, var(--brand-cyan) 4%);
}

.account-list-row.is-focused {
  box-shadow: inset 2px 0 0 var(--brand-cyan);
}

.account-list-row.is-disabled,
.account-list-row.is-unbound {
  background: color-mix(in oklch, var(--surface) 86%, var(--surface-soft));
}

.account-list-row.is-unbound .account-main,
.account-list-row.is-unbound .account-meta,
.account-list-row.is-disabled .account-main,
.account-list-row.is-disabled .account-meta {
  opacity: 0.62;
}

.account-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.account-main .avatar {
  width: 38px;
  height: 38px;
  font-size: 10px;
}

.account-main .account-copy {
  min-width: 0;
  flex: 1;
}

.account-main .account-name {
  font-size: 12px;
}

.account-handle,
.account-id {
  display: block;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-handle + .account-id {
  margin-top: 1px;
}

.account-meta {
  display: grid;
  min-width: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.account-meta-item {
  min-width: 0;
}

.account-meta-label,
.account-meta-value {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-meta-label {
  margin-bottom: 3px;
  color: var(--text-faint);
  font-size: 9px;
}

.account-meta-value {
  color: var(--text-soft);
  font-family: "DF DIN", "DF Sans", sans-serif;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.account-status {
  display: grid;
  min-width: 0;
  justify-items: start;
  gap: 4px;
}

.account-status-note {
  max-width: 100%;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-actions {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.account-actions .btn {
  min-width: 0;
}

.account-groups-loading,
.account-group-loading {
  min-width: 0;
}

.account-group-loading-title {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-soft);
}

.account-loading-row {
  display: flex;
  min-width: 0;
  min-height: 64px;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
}

.account-loading-row + .account-loading-row {
  border-top: 1px solid var(--border);
}

.account-loading-row .account-copy {
  min-width: 0;
  flex: 1;
}

.ranking-number {
  width: 24px;
  color: var(--text-faint);
  font-family: "DF DIN", sans-serif;
  text-align: center;
}

.ranking-number.top {
  color: var(--brand-cyan);
}

.ranking-content {
  min-width: 0;
  flex: 1;
}

.ranking-title {
  overflow: hidden;
  color: var(--text);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ranking-meta {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 9px;
}

.ranking-value {
  color: var(--text);
  font-family: "DF DIN", sans-serif;
  font-size: 11px;
}

.dropzone {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-soft);
  background: var(--surface-soft);
  text-align: center;
  transition: border-color 160ms var(--ease), background 160ms var(--ease);
}

.dropzone:hover,
.dropzone.is-dragging,
.dropzone:focus-within {
  border-color: var(--brand-cyan);
  background: color-mix(in oklch, var(--surface-soft) 90%, var(--brand-cyan) 6%);
}

.dropzone:focus-within {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.dropzone .icon {
  width: 26px;
  height: 26px;
  margin: 0 auto 10px;
  color: var(--brand-cyan);
}

.dropzone strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 12px;
}

.dropzone p {
  margin: 0;
  color: var(--text-faint);
  font-size: 10px;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 16px;
}

.import-layout > section {
  min-width: 0;
}

.import-preview-table {
  min-width: 460px;
}

.resource-pool-heading,
.resource-pool-summary,
.resource-pool-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.resource-pool-heading .notice {
  min-width: 0;
  flex: 1;
}

.resource-pool-sync-meta {
  margin-top: 6px;
  color: var(--text-faint);
  font-size: 9px;
}

.resource-pool-controls {
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) repeat(2, minmax(92px, 0.8fr));
  gap: 8px;
}

.resource-pool-controls .search-wrap,
.resource-pool-controls .field,
.resource-pool-controls .control {
  width: 100%;
  min-width: 0;
}

.resource-pool-summary {
  margin: 10px 0 7px;
}

.resource-pool-select-all {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-soft);
  font-size: 10px;
  cursor: pointer;
}

.resource-pool-select-all:has(.checkbox:disabled) {
  cursor: not-allowed;
  opacity: 0.55;
}

.resource-pool-list {
  max-height: min(300px, 38dvh);
}

.resource-pool-item {
  min-height: 74px;
  align-items: flex-start;
}

.resource-pool-item > .checkbox {
  margin-top: 2px;
}

.resource-pool-copy {
  display: grid;
  gap: 3px;
}

.resource-pool-title-row {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 7px;
}

.resource-pool-title-row .rule-target-title {
  min-width: 0;
  flex: 1;
}

.resource-pool-id {
  flex: 0 0 auto;
  color: var(--text-faint);
  font-size: 9px;
}

.resource-pool-excerpt {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.resource-pool-aside {
  display: grid;
  flex: 0 0 auto;
  justify-items: end;
  gap: 8px;
}

.resource-pool-aside .platform-stack {
  justify-content: flex-end;
}

.resource-pool-actions {
  margin-top: 9px;
}

.resource-pool-empty,
.resource-pool-loading {
  display: grid;
  min-height: 132px;
  place-items: center;
  padding: 18px;
  color: var(--text-faint);
  background: var(--surface-soft);
  font-size: 10px;
  text-align: center;
}

.resource-pool-empty {
  align-content: center;
  gap: 4px;
}

.resource-pool-empty .empty-icon {
  width: 38px;
  height: 38px;
  margin-bottom: 4px;
}

.resource-pool-empty strong {
  color: var(--text);
  font-size: 11px;
  font-weight: 500;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 16px;
}

.step {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-faint);
  font-size: 10px;
}

.step-number {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  font-family: "DF DIN", sans-serif;
}

.step.is-active,
.step.is-complete {
  color: var(--text);
}

.step.is-active .step-number,
.step.is-complete .step-number {
  color: var(--on-brand);
  border-color: transparent;
  background: var(--gradient);
}

.step-line {
  width: 28px;
  height: 1px;
  background: var(--border);
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  padding: 28px;
  color: var(--text-soft);
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 46px;
  height: 46px;
  margin: 0 auto 12px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  color: var(--brand-cyan);
  background: linear-gradient(var(--surface), var(--surface)) padding-box, var(--gradient) border-box;
}

.empty-state h3 {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.empty-state p {
  max-width: 42ch;
  margin-bottom: 14px;
  font-size: 10px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
}

.skeleton::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in oklch, var(--text) 8%, transparent), transparent);
  content: "";
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(84dvh, 820px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text);
  background: var(--bg-raised);
  box-shadow: 0 18px 44px oklch(0.03 0.01 285 / 38%);
}

dialog::backdrop {
  background: oklch(0.06 0.01 285 / 72%);
  backdrop-filter: blur(3px);
}

.dialog-wide {
  width: min(940px, calc(100vw - 32px));
}

.dialog-narrow {
  width: min(520px, calc(100vw - 32px));
}

.dialog-header,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
}

.dialog-header {
  border-bottom: 1px solid var(--border);
}

.dialog-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
}

.dialog-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.dialog-description {
  margin: 2px 0 0;
  color: var(--text-faint);
  font-size: 10px;
}

.dialog-body {
  max-height: calc(84dvh - 124px);
  overflow: auto;
  padding: 18px;
}

.toast-region {
  position: fixed;
  z-index: 80;
  right: 18px;
  bottom: 18px;
  display: grid;
  width: min(340px, calc(100vw - 36px));
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--bg-raised);
  box-shadow: 0 8px 20px oklch(0.04 0.01 285 / 22%);
  animation: toast-in 180ms var(--ease);
}

.toast-success .icon {
  margin-top: 1px;
  color: var(--success);
}

.toast-danger .icon {
  margin-top: 1px;
  color: var(--danger);
}

.toast-info .icon {
  margin-top: 1px;
  color: var(--info);
}

.toast-copy {
  min-width: 0;
}

.toast-title {
  font-size: 11px;
  font-weight: 600;
}

.toast-message {
  margin-top: 2px;
  color: var(--text-soft);
  font-size: 10px;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.mobile-overlay {
  position: fixed;
  z-index: 35;
  inset: 0;
  display: none;
  border: 0;
  background: oklch(0.06 0.01 285 / 62%);
}

.mobile-overlay.is-open {
  display: block;
}

.loading-label {
  position: relative;
  padding-left: 18px;
}

.loading-label::before {
  position: absolute;
  top: 50%;
  left: 0;
  width: 11px;
  height: 11px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  transform: translateY(-50%);
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

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

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--border);
  }

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

  .schedule-layout,
  .automation-layout,
  .analytics-layout {
    grid-template-columns: 1fr;
  }

  .rule-panel {
    position: static;
  }

  .account-list-row {
    grid-template-columns: minmax(210px, 1fr) minmax(260px, 1.2fr);
  }

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

@media (max-width: 940px) {
  .import-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .sidebar {
    visibility: hidden;
    box-shadow: 12px 0 30px oklch(0.04 0.01 285 / 28%);
    transform: translateX(-105%);
    transition: transform 220ms var(--ease), visibility 0s linear 220ms;
  }

  .sidebar.is-open {
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0s;
  }

  .app-frame {
    margin-left: 0;
  }

  .topbar .mobile-menu-button {
    display: inline-flex;
  }

  .page {
    padding: 22px 20px 42px;
  }

  .grid-two,
  .overview-main {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar {
    padding: 0 12px;
  }

  .live-indicator,
  .topbar .btn-label {
    display: none;
  }

  .page {
    padding: 18px 12px 36px;
  }

  .page-header {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .page-title {
    font-size: 21px;
  }

  .page-actions .btn {
    flex: 1;
  }

  .metric-strip,
  .grid-equal,
  .source-grid,
  .form-grid,
  .import-layout {
    grid-template-columns: 1fr;
  }

  .resource-pool-controls {
    grid-template-columns: 1fr;
  }

  .resource-pool-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-pool-heading .btn {
    width: 100%;
  }

  .resource-pool-list {
    max-height: min(240px, 34dvh);
  }

  .resource-pool-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .resource-pool-actions .btn {
    width: 100%;
  }

  .metric,
  .metric:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .metric:last-child {
    border-bottom: 0;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-group,
  .toolbar-actions {
    width: 100%;
  }

  .toolbar .search-wrap {
    width: 100%;
  }

  .date-range-controls {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .date-field {
    width: auto;
  }

  .toolbar select.control {
    min-width: 0;
    flex: 1;
  }

  .account-platform-header {
    align-items: flex-start;
    padding: 10px 12px;
  }

  .account-platform-summary {
    max-width: 46%;
  }

  .account-list-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    padding: 13px 12px;
  }

  .account-meta {
    padding: 10px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
  }

  .account-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
  }

  .account-actions {
    justify-content: flex-start;
  }

  .account-group-loading-title,
  .account-loading-row {
    padding-right: 12px;
    padding-left: 12px;
  }

  .rule-target-list {
    max-height: min(300px, 40dvh);
  }

  .selection-list {
    max-height: 220px;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }

  .quick-action {
    min-height: 60px;
    flex-direction: row;
    align-items: center;
  }

  .batch-bar {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    padding: 10px;
  }

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

  .batch-bar .btn {
    width: 100%;
  }

  .callback-card {
    grid-template-columns: 1fr;
  }

  .detail-list {
    grid-template-columns: 1fr;
  }

  .dialog-header,
  .dialog-footer,
  .dialog-body {
    padding-right: 14px;
    padding-left: 14px;
  }

  dialog {
    width: calc(100vw - 20px);
    max-height: 90dvh;
  }

  .dialog-body {
    max-height: calc(90dvh - 124px);
  }

  .toast-region {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
  }
}

@media (max-width: 420px) {
  .panel-header {
    min-width: 0;
    flex-wrap: wrap;
    padding-right: 12px;
    padding-left: 12px;
  }

  .account-platform-header {
    flex-wrap: wrap;
  }

  .account-platform-title,
  .account-platform-summary {
    width: 100%;
    max-width: none;
  }

  .account-platform-summary {
    justify-content: flex-start;
    padding-left: 40px;
  }

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

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

  .account-actions .btn {
    width: 100%;
    padding-right: 8px;
    padding-left: 8px;
  }

  .selection-platform-header,
  .rule-target-item {
    padding-right: 8px;
    padding-left: 8px;
  }

  .resource-pool-item {
    flex-wrap: wrap;
  }

  .resource-pool-aside {
    width: 100%;
    flex-basis: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding-left: 25px;
  }

  .resource-pool-aside .platform-stack {
    justify-content: flex-start;
  }

  .selection-platform-list .selection-item {
    padding-left: 14px;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding-right: 10px;
    padding-left: 10px;
  }

  .calendar-toolbar .toolbar-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .calendar-toolbar .segmented,
  .calendar-toolbar .field,
  .calendar-toolbar .control {
    width: 100%;
    min-width: 0;
  }

  .calendar-toolbar .segment {
    min-width: 0;
    flex: 1;
  }

  .schedule-preview {
    min-width: 0;
  }

  .preview-row {
    grid-template-columns: 34px minmax(0, 1fr) 68px;
    gap: 6px;
    padding-right: 7px;
    padding-left: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  dialog::backdrop {
    backdrop-filter: none;
  }
}
