:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --bg: oklch(0.975 0.006 255);
  --surface: #ffffff;
  --surface: oklch(1 0 0);
  --surface-alt: #edf1f7;
  --surface-alt: oklch(0.955 0.009 255);
  --surface-strong: #e3e9f2;
  --ink: #151b28;
  --ink: oklch(0.2 0.012 255);
  --muted: #526178;
  --muted: oklch(0.45 0.02 255);
  --line: #d9e0ea;
  --line: oklch(0.89 0.012 255);
  --accent: #2764e8;
  --accent: oklch(0.55 0.2 255);
  --accent-hover: #1f50c5;
  --accent-soft: #e8efff;
  --accent-soft: oklch(0.94 0.03 255);
  --green: #187c43;
  --green: oklch(0.52 0.13 145);
  --green-soft: #e4f6ea;
  --green-soft: oklch(0.95 0.035 145);
  --amber: #976400;
  --amber-soft: #fff2cc;
  --red: #c33232;
  --red-hover: #a72828;
  --red-soft: #fce9e9;
  --focus-ring: 0 0 0 3px rgba(39, 100, 232, 0.24);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --sidebar-width: 228px;
  --z-sticky: 20;
  --z-backdrop: 40;
  --z-modal: 50;
  --z-toast: 70;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080b10;
  --bg: oklch(0.1 0.008 255);
  --surface: #111823;
  --surface: oklch(0.18 0.025 255);
  --surface-alt: #182336;
  --surface-alt: oklch(0.23 0.03 255);
  --surface-strong: #223149;
  --ink: #f7f8fa;
  --ink: oklch(0.97 0 0);
  --muted: #a9b6c9;
  --muted: oklch(0.72 0.018 255);
  --line: #2b3a50;
  --line: oklch(0.33 0.03 255);
  --accent: #4d7ff0;
  --accent: oklch(0.64 0.17 255);
  --accent-hover: #6e96f3;
  --accent-soft: #1b315f;
  --accent-soft: oklch(0.29 0.08 255);
  --green: #42b46f;
  --green: oklch(0.68 0.15 145);
  --green-soft: #173c28;
  --green-soft: oklch(0.3 0.06 145);
  --amber: #f0c15c;
  --amber-soft: #493718;
  --red: #f07575;
  --red-hover: #ff8b8b;
  --red-soft: #4a2528;
  --focus-ring: 0 0 0 3px rgba(77, 127, 240, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

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

button,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

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

button,
a,
input,
select,
textarea,
summary {
  outline: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  box-shadow: var(--focus-ring);
}

[hidden] {
  display: none !important;
}

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

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

h1,
h2,
h3 {
  color: var(--ink);
  line-height: 1.25;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  margin-bottom: 0;
  font-size: 1.5rem;
}

h2 {
  margin-bottom: 0.35rem;
  font-size: 1.35rem;
}

h3 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 750;
  line-height: 1;
}

.brand-mark.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 1rem;
}

.login-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(100%, 420px);
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.login-panel .brand-mark {
  margin-bottom: 18px;
}

.product-name {
  margin-bottom: 4px;
  color: var(--accent);
  font-weight: 700;
}

.login-panel h1 {
  margin-bottom: 12px;
  font-size: 1.65rem;
}

.login-copy {
  max-width: 38ch;
  margin-bottom: 28px;
  color: var(--muted);
}

.privacy-note {
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sticky);
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 22px 14px 18px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 7px 26px;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 750;
  text-decoration: none;
}

.nav-list {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 590;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.nav-item:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-icon {
  display: inline-grid;
  width: 22px;
  place-items: center;
  font-size: 1.15rem;
  line-height: 1;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 8px 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.workspace {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.page-kicker {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 0.77rem;
}

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

.content {
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 34px 38px 64px;
}

.content:focus {
  outline: none;
}

.page {
  animation: page-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.narrow-page {
  max-width: 980px;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-heading {
  margin-bottom: 24px;
}

.section-heading > p,
.panel-title-row p {
  max-width: 70ch;
  margin-bottom: 0;
  color: var(--muted);
}

.section-heading.split,
.panel-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.compact-heading {
  margin-bottom: 14px;
}

.button,
.icon-button {
  min-height: 40px;
  border: 0;
  border-radius: 10px;
  font-weight: 650;
  transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease, transform 100ms ease;
}

.button:active:not(:disabled),
.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.button.secondary {
  background: var(--surface-strong);
  color: var(--ink);
}

.button.secondary:hover:not(:disabled),
.button.quiet:hover:not(:disabled) {
  background: var(--surface-alt);
}

.button.quiet {
  background: transparent;
  color: var(--muted);
}

.button.danger {
  background: var(--red);
  color: #fff;
}

.button.danger:hover:not(:disabled) {
  background: var(--red-hover);
}

.button.danger-quiet {
  background: var(--red-soft);
  color: var(--red);
}

.button.compact {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.button.wide {
  width: 100%;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  padding: 0;
  place-items: center;
  background: transparent;
  color: var(--muted);
  font-size: 1.25rem;
}

.icon-button:hover {
  background: var(--surface-alt);
  color: var(--ink);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-strip > div {
  display: flex;
  min-width: 0;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
}

.metric-strip > div + div {
  border-left: 1px solid var(--line);
}

.metric-strip span {
  color: var(--muted);
  font-size: 0.86rem;
}

.metric-strip strong {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.overview-columns {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
  gap: 18px;
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.panel-title-row {
  margin-bottom: 18px;
}

.detail-list {
  margin: 0;
}

.detail-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  font-weight: 620;
  text-align: right;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.green,
.badge.healthy {
  background: var(--green-soft);
  color: var(--green);
}

.badge.blue {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge.amber,
.badge.degraded,
.badge.unknown {
  background: var(--amber-soft);
  color: var(--amber);
}

.badge.red,
.badge.unhealthy {
  background: var(--red-soft);
  color: var(--red);
}

.badge.neutral,
.badge.disabled {
  background: var(--surface-alt);
  color: var(--muted);
}

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

.status-dot.healthy {
  background: var(--green);
}

.status-dot.degraded,
.status-dot.unknown {
  background: var(--amber);
}

.status-dot.unhealthy {
  background: var(--red);
}

.attention-list {
  display: flex;
  flex-direction: column;
}

.attention-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
}

.attention-item:first-child {
  border-top: 0;
}

.attention-item p {
  flex: 1;
  margin: 0;
}

.attention-item small {
  display: block;
  color: var(--muted);
}

.text-link {
  font-weight: 650;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

.guide-row {
  display: flex;
  gap: 0;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-alt);
}

.guide-row > div {
  display: flex;
  flex: 1;
  gap: 12px;
  padding: 18px;
}

.guide-row > div + div {
  border-left: 1px solid var(--line);
}

.guide-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.guide-row strong {
  color: var(--ink);
}

.step-number {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 750;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.search-field {
  display: flex;
  min-width: 220px;
  flex: 1;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.search-field:focus-within {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.search-field input {
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
  outline: 0;
}

.toolbar-count {
  min-width: 58px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: right;
}

.compact-select select {
  min-width: 124px;
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.channel-item {
  overflow: clip;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.channel-summary {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(190px, 0.7fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 84px;
  padding: 14px 16px;
}

.channel-identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.min-width-zero {
  min-width: 0;
}

.channel-identity-logo {
  position: relative;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
}

.channel-logo,
.channel-logo-fallback {
  position: absolute;
  inset: 0;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--surface-alt);
  object-fit: contain;
}

.channel-logo {
  padding: 4px;
}

.channel-logo-fallback {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 750;
}

.channel-name {
  margin: 0 0 2px;
  overflow: hidden;
  font-size: 1rem;
  font-weight: 720;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-subtitle {
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.channel-health-copy {
  min-width: 0;
}

.channel-health-copy strong,
.channel-health-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-health-copy small {
  color: var(--muted);
}

.channel-actions,
.source-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.channel-toggle {
  border-top: 1px solid var(--line);
}

.channel-toggle-button {
  width: 100%;
  min-height: 36px;
  border: 0;
  background: var(--surface-alt);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.channel-toggle-button:hover {
  color: var(--ink);
}

.source-region {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}

.source-region-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}

.source-region-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.source-list {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.source-row {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(220px, 0.75fr) auto;
  align-items: center;
  gap: 14px;
  padding: 13px;
}

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

.source-main {
  min-width: 0;
}

.source-main-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.source-url {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.77rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 14px;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.source-error {
  grid-column: 1 / -1;
  margin: -5px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.empty-state {
  padding: 42px 22px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 1rem;
}

.empty-state .button {
  margin-top: 14px;
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice.info {
  border-color: var(--accent);
}

.notice.warning {
  background: var(--amber-soft);
}

.notice h3,
.notice p {
  margin-bottom: 5px;
}

.notice p {
  max-width: 75ch;
  color: var(--muted);
}

.notice-symbol {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
}

.warning .notice-symbol {
  background: var(--amber);
}

.catalog-list {
  display: flex;
  flex-direction: column;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.catalog-list > div {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px 0;
}

.catalog-list > div + div {
  border-top: 1px solid var(--line);
}

.catalog-list strong {
  margin-right: 8px;
}

.catalog-list a {
  font-size: 0.82rem;
}

.form-panel,
.settings-section {
  margin-bottom: 18px;
}

.import-mode-field {
  max-width: 420px;
  margin-top: 16px;
}

.form-stack,
.dialog-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

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

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

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 620;
}

.field small,
.form-actions > span {
  color: var(--muted);
  font-size: 0.77rem;
  font-weight: 400;
}

.field input,
.field select,
.field textarea,
.select-field select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  caret-color: var(--accent);
}

.field textarea {
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.search-field input::placeholder {
  color: var(--muted);
  opacity: 0.92;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.select-field select:focus {
  border-color: var(--accent);
  box-shadow: var(--focus-ring);
}

.field input:read-only {
  background: var(--surface-alt);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 560;
}

.check-row input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 0.84rem;
}

.segmented-fieldset {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

.segmented-fieldset legend {
  margin-bottom: 7px;
  font-size: 0.88rem;
  font-weight: 620;
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-alt);
}

.segmented-control label {
  position: relative;
}

.segmented-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control span {
  display: block;
  min-width: 100px;
  padding: 7px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 650;
  text-align: center;
}

.segmented-control input:checked + span {
  background: var(--surface);
  color: var(--ink);
}

.segmented-control input:focus-visible + span {
  box-shadow: var(--focus-ring);
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.form-actions.separated {
  justify-content: space-between;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.preview-section {
  margin-top: 26px;
}

.preview-list {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.preview-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(100px, 0.5fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 15px;
}

.preview-item + .preview-item {
  border-top: 1px solid var(--line);
}

.preview-item strong,
.preview-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.confirm-box {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: end;
  gap: 18px;
  margin-top: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.important-check {
  align-self: center;
}

.token-field + .token-field {
  margin-top: 16px;
}

.input-actions {
  display: flex;
  gap: 7px;
}

.input-actions input {
  min-width: 0;
  flex: 1;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.8rem;
}

.compact-notice {
  margin: 18px 0 0;
  padding: 12px;
}

.compact-notice p {
  margin: 1px 0 0;
  font-size: 0.82rem;
}

.password-form {
  max-width: 700px;
}

.advanced-fields {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.advanced-fields summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 650;
}

.advanced-fields[open] summary {
  margin-bottom: 14px;
  color: var(--ink);
}

dialog {
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(5, 10, 20, 0.52);
}

.sheet-dialog {
  width: min(100% - 28px, 570px);
  max-height: min(88vh, 780px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
}

.dialog-form {
  display: flex;
  max-height: min(88vh, 780px);
  flex-direction: column;
}

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

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

.dialog-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.dialog-header .icon-button {
  flex: 0 0 auto;
}

.dialog-body {
  overflow-y: auto;
  padding: 20px;
}

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

.confirm-dialog {
  width: min(100% - 28px, 430px);
  padding: 23px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.18);
}

.confirm-dialog p {
  margin-bottom: 20px;
  color: var(--muted);
}

.confirm-dialog .dialog-actions {
  padding: 0;
  border: 0;
}

.job-progress {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: var(--z-toast);
  width: min(calc(100% - 44px), 340px);
  padding: 14px;
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.job-progress > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.83rem;
}

.job-progress progress {
  display: block;
  width: 100%;
  height: 7px;
  accent-color: var(--accent);
}

.toast-region {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: var(--z-toast);
  display: flex;
  width: min(calc(100% - 36px), 380px);
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 3px 7px rgba(0, 0, 0, 0.18);
  font-size: 0.86rem;
  animation: toast-in 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast.error {
  background: var(--red);
  color: #fff;
}

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

.skeleton {
  background: var(--surface-alt);
  animation: skeleton 1.2s ease-in-out infinite alternate;
}

.skeleton::after {
  content: none;
}

@keyframes skeleton {
  to { opacity: 0.58; }
}

.skeleton.line {
  width: 100%;
  height: 15px;
  margin: 13px 0;
  border-radius: 6px;
}

.skeleton.line.short {
  width: 72%;
}

.channel-skeleton {
  height: 86px;
  border-radius: var(--radius);
}

@media (max-width: 1050px) {
  .channel-summary,
  .source-row {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .channel-health,
  .source-stats {
    grid-column: 1;
  }

  .channel-actions,
  .source-actions {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .confirm-box {
    grid-template-columns: 1fr 1fr;
  }

  .confirm-box .button.primary {
    grid-column: 2;
  }
}

@media (max-width: 800px) {
  :root {
    --sidebar-width: 0px;
  }

  .sidebar {
    inset: auto 0 0 0;
    width: auto;
    height: 68px;
    flex-direction: row;
    align-items: center;
    padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .brand,
  .sidebar-foot {
    display: none;
  }

  .nav-list {
    flex-direction: row;
    justify-content: space-around;
    gap: 2px;
  }

  .nav-item {
    min-width: 0;
    min-height: 52px;
    flex: 1;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 4px;
    font-size: 0.68rem;
  }

  .nav-icon {
    font-size: 1rem;
  }

  .workspace {
    margin-left: 0;
  }

  .topbar {
    min-height: 68px;
    padding: 10px 18px;
  }

  .topbar .page-kicker,
  #logout-button {
    display: none;
  }

  .content {
    padding: 25px 18px 100px;
  }

  .metric-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric-strip > div:nth-child(3) {
    border-left: 0;
  }

  .metric-strip > div:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

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

  .guide-row {
    flex-direction: column;
  }

  .guide-row > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .catalog-list > div {
    grid-template-columns: 1fr auto;
  }

  .catalog-list > div > div {
    grid-column: 1 / -1;
  }

  .form-grid.two,
  .confirm-box {
    grid-template-columns: 1fr;
  }

  .confirm-box .button.primary {
    grid-column: auto;
  }

  .job-progress {
    bottom: 82px;
  }
}

@media (max-width: 620px) {
  .login-view {
    padding: 0;
    background: var(--surface);
  }

  .login-panel {
    padding: 28px 24px;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    gap: 8px;
    padding-right: 12px;
  }

  .topbar h1 {
    font-size: 1.2rem;
  }

  .section-heading.split {
    flex-direction: column;
    gap: 14px;
  }

  .section-heading.split .button-row,
  .section-heading.split .button-row .button {
    width: 100%;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .search-field {
    flex-basis: 100%;
  }

  .toolbar-count {
    margin-left: auto;
  }

  .channel-summary,
  .source-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .channel-health,
  .channel-actions,
  .source-stats,
  .source-actions {
    grid-column: 1;
    grid-row: auto;
  }

  .channel-actions,
  .source-actions {
    justify-content: flex-start;
  }

  .source-row {
    padding: 14px;
  }

  .preview-item {
    grid-template-columns: 1fr auto;
  }

  .preview-item .preview-group {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .input-actions {
    flex-wrap: wrap;
  }

  .input-actions input {
    flex-basis: 100%;
  }

  .form-actions.separated {
    align-items: stretch;
    flex-direction: column;
  }

  .form-actions.separated .button {
    width: 100%;
  }

  .dialog-header,
  .dialog-actions,
  .dialog-body {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@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;
  }
}
