:root {
  --ui-scale: 1;
  --page-max-width: 1460px;
  --page-max-width-wide: 1520px;
  --page-padding-x: 24px;
  --page-padding-y: 16px;
  --layout-gap: 16px;
  --section-gap: 12px;
  --block-gap: 8px;
  --sidebar-width: 332px;
  --sidebar-width-sm: 320px;
  --target-panel-width: 360px;

  --bg-page: #f6f8fb;
  --bg-card: #ffffff;
  --bg-soft: #f8fafc;
  --bg-soft-blue: #eff6ff;
  --bg-hover: #f9fbff;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-border: #bfdbfe;

  --success: #16a34a;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;

  --radius-card: 16px;
  --radius-card-sm: 13px;
  --radius-control: 9px;
  --radius-pill: 999px;

  --shadow-card: 0 6px 24px rgba(15, 23, 42, 0.04);
  --shadow-soft: 0 2px 10px rgba(15, 23, 42, 0.04);
  --shadow-dock: 0 -12px 32px rgba(15, 23, 42, 0.08);

  --input-height: 38px;
  --button-height: 36px;
  --button-height-lg: 40px;
  --switch-row-height: 56px;

  /* legacy aliases */
  --page-gap: var(--layout-gap);
  --side-width: var(--sidebar-width);
  --bg: var(--bg-page);
  --card: var(--bg-card);
  --card-soft: #fbfdff;
  --text: var(--text-main);
  --muted: var(--text-muted);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --blue: var(--primary);
  --blue-hover: var(--primary-hover);
  --code-bg: var(--bg-soft);
  --shadow: var(--shadow-card);
  --shadow-strong: 0 18px 48px rgba(15, 23, 42, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-main);
  font-family: "PingFang SC", "Microsoft YaHei", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  padding-bottom: 96px;
}

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

button {
  border: 0;
  background: transparent;
}

.hidden {
  display: none !important;
}

.app-shell,
.page-shell {
  width: 100%;
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: var(--page-padding-y) var(--page-padding-x) 96px;
  box-sizing: border-box;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
  overflow: hidden;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  display: block;
}

.brand h1 {
  margin: 0;
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-badge,
.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 0.85rem;
}

.status-badge.online {
  color: var(--success);
}

.status-badge.offline {
  color: var(--danger);
}

.dot,
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.github-link:hover {
  color: var(--text-main);
  border-color: var(--border-strong);
}

.workspace-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow: visible;
  padding: 2px 0;
}

.app-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow: visible;
}

.workspace-tab {
  box-sizing: border-box;
  min-height: 36px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transform: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background-color 0.2s ease,
    color 0.2s ease;
}

.workspace-tab:hover {
  border-color: #bfdbfe;
  background: #fff;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.12);
  transform: none;
}

.workspace-tab.active {
  color: var(--primary);
  border-color: #93c5fd;
  background: var(--primary-soft);
}

.workspace-panel {
  display: block;
}

.config-grid,
.content-grid,
.page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-width);
  gap: var(--layout-gap);
  align-items: start;
  width: 100%;
}

.config-main,
.config-side,
.main-column,
.diagnostic-grid {
  display: grid;
  gap: var(--section-gap);
  align-content: start;
}

.main-column,
.side-column {
  min-width: 0;
}

.main-column {
  width: 100%;
}

.side-column,
.config-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.side-column {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  position: sticky;
  top: 96px;
  align-self: start;
  height: auto;
  max-height: none;
  overflow: visible;
  padding-bottom: 0;
}

.diagnostic-grid {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
}

.panel,
.card,
.side-card {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 16px;
}

.side-card {
  padding: 14px;
}

.card + .card {
  margin-top: var(--section-gap);
}

.full-panel {
  min-height: calc(100vh - 190px);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-head.simple-head {
  justify-content: space-between;
}

.panel-head h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.panel-subtitle,
.field-help,
.meta-text {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.session-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 8px 12px;
  margin-bottom: 10px;
}

.session-banner-main {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 6px 10px;
}

.session-banner-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.session-banner-text,
.session-banner-meta {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text-muted);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-banner-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.session-banner.mode-draft-detected {
  border-color: #fcd34d;
  background: #fffbeb;
  box-shadow: none;
}

.session-banner.mode-draft-detected .session-banner-title,
.session-banner.mode-draft-detected .session-banner-text,
.session-banner.mode-draft-detected .session-banner-meta {
  color: #92400e;
}

.session-banner.mode-local-draft {
  border-color: #bfdbfe;
  background: #eff6ff;
  box-shadow: none;
}

.session-banner.mode-local-draft .session-banner-title,
.session-banner.mode-local-draft .session-banner-text,
.session-banner.mode-local-draft .session-banner-meta {
  color: #1d4ed8;
}

.icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: currentColor;
  flex-shrink: 0;
}

.icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.section-badge {
  width: 30px;
  height: 30px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  flex: 0 0 auto;
}

.section-badge .icon {
  width: 16px;
  height: 16px;
}

.card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

.required::after {
  content: " *";
  color: var(--danger);
}

.field-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: #fff;
  color: var(--text-main);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  box-sizing: border-box;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input,
select {
  height: var(--input-height);
}

textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.55;
}

.basic-layout,
.base-settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
  width: 100%;
}

.basic-sources,
.base-main-column,
.target-panel,
.filter-panel,
.manual-section {
  min-width: 0;
}

.basic-sources,
.base-main-column {
  max-width: 100%;
  overflow: hidden;
}

.filter-panel {
  grid-column: 1 / -1;
}

.manual-section {
  grid-column: 1 / -1;
}

.source-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.source-manager-headline,
.sub-section-head {
  align-items: flex-start;
}

.sub-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sub-section-copy {
  min-width: 0;
}

.sub-section-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
  font-size: 0.92rem;
  font-weight: 650;
}

.target-panel {
  width: 360px;
  min-width: 0;
  max-width: 360px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-soft);
  display: grid;
  gap: var(--block-gap);
  align-content: start;
}

.filter-panel,
.filter-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 18px;
  margin-top: 12px;
}

.subscription-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  container-type: inline-size;
}

.source-row {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #e2e8f0;
  border-radius: 13px;
  background: #f8fafc;
  overflow: hidden;
  box-sizing: border-box;
}

.source-row:hover {
  border-color: #bfdbfe;
  background: #f9fbff;
}

.source-row-main {
  display: grid;
  grid-template-columns: 64px minmax(180px, 260px) minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.source-enable,
.source-name-combo,
.source-name-input,
.source-url-input {
  min-width: 0;
}

.source-toggle {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
  align-items: flex-start;
}

.source-name-inline {
  height: 42px;
  font-weight: 600;
}

.manual-row-top {
  grid-template-columns: minmax(0, 240px);
}

.source-name {
  width: 100%;
}

.source-enable-label {
  font-size: 0.76rem;
  color: var(--muted);
}

.source-name-combo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px;
  align-items: center;
  height: 42px;
  min-width: 0;
  max-width: 260px;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.source-name-combo:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.source-name-combo.is-emoji-open {
  border-color: #93c5fd;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.08);
}

.source-name-combo input {
  height: 40px;
  border: 0;
  box-shadow: none;
  min-width: 0;
  width: 100%;
  padding: 0 12px;
}

.source-name-combo input:focus {
  outline: none;
  box-shadow: none;
}

.source-emoji-suffix {
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-left: 1px solid #e2e8f0;
  background: #f8fafc;
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.source-emoji-suffix:hover {
  background: #eff6ff;
}

.source-url-input {
  min-width: 0;
  max-width: 100%;
  width: 100%;
}

.source-delete-btn {
  width: 72px;
  min-width: 72px;
}

.emoji-popover {
  position: fixed;
  z-index: 3000;
  width: 196px;
  max-width: calc(100vw - 24px);
  padding: 10px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.18);
  box-sizing: border-box;
}

.emoji-popover-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 27px);
  gap: 5px;
  justify-content: center;
}

.emoji-option {
  width: 27px;
  height: 27px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  font-size: 18px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.emoji-option:hover,
.emoji-option.active {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.emoji-divider {
  margin: 8px 0;
  height: 1px;
  background: #e2e8f0;
}

.custom-emoji-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 6px;
}

.custom-emoji-row input {
  width: 56px;
  min-width: 0;
  height: 32px;
  text-align: center;
  padding: 0 8px;
}

.custom-emoji-row button {
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  min-width: 0;
}

.source-row-meta {
  margin-left: 74px;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  font-size: 12px;
  color: #64748b;
  flex-wrap: nowrap;
}

.source-row-meta > * {
  min-width: 0;
}

.source-domain,
.source-preview,
.source-warning-inline {
  min-width: 0;
  font-size: 12px;
}

.source-preview,
.source-warning-inline {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-meta-separator {
  flex: 0 0 auto;
}

.source-warning-inline {
  color: var(--warning);
}

.source-meta-link {
  flex: 0 0 auto;
}

.danger-ghost {
  border-color: #fecaca;
  color: var(--danger);
  background: #fff;
}

.source-url,
.source-main textarea {
  overflow-x: auto;
}

.source-info-stack {
  display: grid;
  gap: 4px;
}

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

.manual-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.manual-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.manual-section-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
}

.manual-section-title-wrap h3 {
  margin: 0;
  color: var(--text-main);
  font-size: 18px;
  font-weight: 700;
}

.manual-section-title-wrap p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.manual-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.manual-enable-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.manual-disabled-note {
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.manual-section-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.manual-section-body.is-disabled {
  opacity: 0.65;
}

.manual-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 28px 20px;
  border: 1px dashed #bfdbfe;
  border-radius: 16px;
  background: #f8fafc;
  text-align: center;
}

.manual-empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #eff6ff;
  color: #2563eb;
}

.manual-empty-icon svg {
  width: 22px;
  height: 22px;
}

.manual-empty-title {
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.manual-empty-desc {
  max-width: 560px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

.inline-advanced summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
}

.manual-node-list {
  display: grid;
  gap: 14px;
  width: 100%;
}

.manual-node-card {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  padding: 16px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fafc;
  box-sizing: border-box;
}

.manual-node-card.disabled {
  opacity: 1;
}

.manual-node-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manual-node-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.manual-node-title-wrap strong {
  min-width: 0;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.manual-node-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.manual-node-status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #f1f5f9;
  color: #64748b;
}

.manual-node-status.success {
  background: #ecfdf5;
  color: #059669;
}

.manual-node-status.error {
  background: #fef2f2;
  color: #dc2626;
}

.manual-node-status.disabled {
  background: #f8fafc;
  color: #94a3b8;
}

.manual-node-field {
  display: grid;
  gap: 6px;
}

.manual-node-field label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
}

.manual-node-input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
}

.manual-node-textarea {
  width: 100%;
  min-height: 120px;
  max-height: 320px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  background: #fff;
  line-height: 1.5;
  resize: vertical;
}

.manual-node-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.manual-node-result {
  color: #64748b;
  font-size: 13px;
  line-height: 1.45;
}

.manual-node-result.success {
  color: #047857;
}

.manual-node-result.error {
  color: #dc2626;
}

.manual-node-result.disabled {
  color: #94a3b8;
}

.manual-node-delete {
  height: 34px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #fecaca;
  border-radius: 10px;
  background: #fff;
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.manual-node-delete:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.source-advanced {
  margin-left: 74px;
  margin-top: 6px;
  min-width: 0;
}

.source-advanced summary,
.inline-advanced summary {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.source-advanced input {
  margin-top: 8px;
  width: 100%;
  min-width: 0;
}

.source-prefix-mode-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.source-prefix-mode-control label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}

.source-prefix-mode-control select {
  height: 38px;
  font-size: 13px;
}

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

.option-group-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.option-group-head {
  margin-bottom: 12px;
}

.option-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
}

.option-group-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.option-group-list {
  display: flex;
  flex-direction: column;
}

.option-group-list .option-item + .option-item {
  border-top: 1px solid var(--border);
}

.option-tile,
.option-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: var(--switch-row-height);
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  background: #fff;
}

.option-tile[title],
.option-item[title] {
  cursor: help;
}

.option-item:hover {
  background: transparent;
}

.setting-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.setting-icon .icon {
  width: 18px;
  height: 18px;
}

.setting-body {
  min-width: 0;
}

.option-title {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.option-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.option-desc {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.switch {
  position: relative;
  display: inline-flex;
}

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

.switch-track {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  position: relative;
  transition: background 0.18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.14);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch-track {
  background: var(--success);
}

.switch input:checked + .switch-track::after {
  transform: translateX(18px);
}

.info-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #f8fbff;
  color: var(--muted);
  font-size: 0.8rem;
}

.source-tabs,
.dialog-tabbar {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f5f9;
}

.source-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(116px, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
}

.tab-button,
.dialog-tab {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  transition:
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.tab-button.active,
.dialog-tab.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
}

.source-tabs .tab-button {
  min-height: 36px;
}

.source-tabs .tab-button.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.source-tabs .tab-button:not(.active):hover {
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-main);
}

.source-panel {
  display: block;
}

.rule-mode-subtabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f5f9;
  margin-bottom: 14px;
}

.rule-subpanel {
  display: block;
}

.preset-row {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.preset-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.preset-control {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.preset-chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
}

.preset-chip.active {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--blue);
}

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

.rule-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}

.rule-chip:hover {
  border-color: #93c5fd;
}

.rule-chip.selected {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.rule-chip-main {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.rule-chip-check {
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rule-icon {
  width: 22px;
  height: 22px;
  color: #2563eb;
}

.chip-check-icon {
  color: #2563eb;
}

.disabled-panel {
  opacity: 0.48;
  pointer-events: none;
}

.rule-extra-wrap {
  margin-top: 10px;
}

.rule-actions-row,
.panel-actions,
.result-actions,
.inline-toolbar,
.toolbar-group,
.bulk-action-buttons,
.node-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.rule-actions-row {
  margin-top: 12px;
  justify-content: space-between;
}

.template-detail-card,
.status-summary-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.custom-rule-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.inline-custom-rule-layout {
  margin-top: 6px;
}

.custom-rule-list-panel,
.custom-rule-editor-panel {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-soft);
}

.custom-rule-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.custom-rule-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.custom-rule-item-main {
  min-width: 0;
}

.custom-rule-item-title {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.3;
}

.custom-rule-item-actions {
  display: flex;
  gap: 6px;
}

.custom-rule-preview {
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 0.82rem;
}

.compact-empty-state {
  padding: 16px 0;
  text-align: center;
}

.template-detail-title {
  font-size: 0.86rem;
  font-weight: 600;
}

.template-detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.template-detail-pill {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.template-detail-pill-label {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  margin-bottom: 4px;
}

.template-detail-desc,
.template-detail-note {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.45;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-solid-button,
.danger-ghost-button,
.tiny-button {
  min-height: var(--button-height);
  padding: 0 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.danger-solid-button:hover,
.danger-ghost-button:hover,
.tiny-button:hover,
.icon-button:hover,
.preset-chip:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none !important;
}

.primary-button {
  min-height: var(--button-height-lg);
  background: var(--primary);
  color: #fff;
}

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

.secondary-button {
  min-height: var(--button-height);
  border: 1px solid var(--primary-border);
  background: #fff;
  color: var(--primary);
}

.ghost-button,
.danger-ghost-button,
.tiny-button {
  min-height: var(--button-height);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-main);
}

.danger-solid-button {
  min-height: var(--button-height);
  background: var(--danger);
  color: #fff;
}

.danger-solid-button:hover {
  background: #b91c1c;
}

.danger-ghost-button {
  border-color: #fecaca;
  background: var(--danger-soft);
  color: var(--danger);
}

.danger-ghost-button:hover {
  background: #fee2e2;
}

.small-button,
.tiny-button {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.sticky-action-wrap,
.result-dock-wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  pointer-events: none;
}

.sticky-action-inner,
.result-dock-inner {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding-left: var(--page-padding-x);
  padding-right: var(--page-padding-x);
  box-sizing: border-box;
}

.sticky-action-bar,
.result-dock {
  pointer-events: auto;
  width: 100%;
  box-sizing: border-box;
  min-height: 64px;
  max-height: 72px;
  display: grid;
  grid-template-columns: minmax(120px, 210px) minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-dock);
}

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

.summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  padding: 0;
  border-bottom: 1px dashed var(--border);
}

.summary-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.summary-key {
  color: var(--text-muted);
  font-size: 12px;
}

.summary-value {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.result-panel.success-panel {
  border-color: rgba(22, 163, 74, 0.26);
  box-shadow: 0 10px 32px rgba(22, 163, 74, 0.08);
}

.result-panel.error-panel {
  border-color: rgba(239, 68, 68, 0.22);
  box-shadow: 0 10px 32px rgba(239, 68, 68, 0.08);
}

.empty-state {
  padding: 18px 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.result-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--success);
  font-size: 13px;
  font-weight: 700;
  min-height: 20px;
  line-height: 1.2;
  margin-bottom: 0;
  min-width: 0;
}

.action-result-row {
  display: contents;
  min-width: 0;
  padding-bottom: 0;
}

.result-time {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  display: none;
}

.result-link-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto auto;
  gap: 6px;
  align-items: center;
}

.result-link-row input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  height: 36px;
  border-radius: 10px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.result-link-row input[disabled] {
  background: var(--bg-soft);
  color: var(--text-muted);
}

.result-link-row .small-button {
  height: 32px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
}

.action-buttons-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 6px;
  min-width: 0;
}

.result-divider {
  display: none;
}

.result-empty {
  color: var(--muted);
}

.result-warning {
  color: var(--warning);
}

.result-error {
  color: var(--danger);
}

.result-actions .primary-button,
.result-actions .secondary-button,
.result-actions .ghost-button,
.result-actions .danger-solid-button,
.result-actions .danger-ghost-button {
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border-radius: 10px;
  font-size: 13px;
  white-space: nowrap;
}

.result-actions .primary-button {
  padding: 0 14px;
}

.result-highlight {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

.status-dot.success {
  color: var(--success);
}

.status-dot.warning {
  color: var(--warning);
}

.status-dot.error {
  color: var(--danger);
}

.status-icon.success {
  color: #16a34a;
}

.status-icon.warning {
  color: #f59e0b;
}

.status-icon.danger {
  color: #ef4444;
}

.success-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--success);
}

.subscription-meta-overview {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  background: var(--bg-soft);
}

.subscription-meta-title {
  font-size: 0.84rem;
  font-weight: 700;
}

.subscription-meta-line {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

.subscription-meta-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.subscription-meta-item {
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--bg-soft);
}

.subscription-meta-item.warning {
  border-color: #fcd34d;
  background: #fffbeb;
}

.subscription-meta-item.danger {
  border-color: #fca5a5;
  background: #fef2f2;
}

.subscription-meta-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.subscription-meta-item-title {
  font-size: 0.84rem;
  font-weight: 700;
}

.subscription-meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.stats-strip,
.diagnostic-counters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.stat-pill strong {
  color: var(--text-main);
}

.node-editor-page,
.node-page {
  width: 100%;
}

.shell-toolbar,
.node-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px 160px 160px auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar-group-left {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1 1 680px;
}

.toolbar-group-right {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
}

.toolbar-group-left input[type="text"] {
  width: 100%;
}

.node-toolbar .toolbar-group-left,
.node-toolbar .toolbar-group-right {
  display: contents;
}

.bulk-action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #f8fbff;
}

.node-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: #fff;
}

.tall-table {
  max-height: calc(100vh - 260px);
}

.node-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 980px;
}

.node-table th,
.node-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.78rem;
}

.node-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
}

.node-table tbody tr {
  height: 68px;
}

.node-table tbody tr:hover {
  background: #f8fafc;
}

.table-empty {
  text-align: center !important;
  color: var(--muted);
}

.node-cell {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 10px;
}

.node-cell-copy {
  min-width: 0;
}

.node-title {
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.3;
}

.node-submeta,
.node-feature-list,
.node-badge-list {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.status-dot.enabled {
  color: var(--success);
}

.status-dot.disabled {
  color: #94a3b8;
}

.mini-badge {
  height: 22px;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
}

.badge {
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
}

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

.badge-green {
  background: var(--success-soft);
  border-color: #bbf7d0;
  color: var(--success);
}

.badge-yellow {
  background: var(--warning-soft);
  border-color: #fde68a;
  color: #b45309;
}

.badge-red {
  background: var(--danger-soft);
  border-color: #fecaca;
  color: var(--danger);
}

.mini-badge.modified {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.mini-badge.warning {
  border-color: #fde68a;
  background: var(--warning-soft);
  color: #b45309;
}

.mini-badge.disabled {
  border-color: var(--border-strong);
  background: var(--bg-soft);
  color: var(--text-muted);
}

.type-badge {
  color: #fff;
  border: 0;
}

.type-ss { background: #475569; }
.type-vmess { background: #06b6d4; }
.type-vless { background: #2563eb; }
.type-trojan { background: #f97316; }
.type-hysteria2 { background: #16a34a; }
.type-tuic { background: #4f46e5; }
.type-anytls { background: #7c3aed; }
.type-wireguard { background: #64748b; }
.type-http { background: #0f766e; }
.type-socks5 { background: #52525b; }

.region-badge {
  border-color: var(--primary-border);
  background: var(--primary-soft);
  color: var(--primary);
}

.address-ellipsis {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.tiny-button.primary-text {
  color: var(--blue);
  border-color: #bfdbfe;
}

.tiny-button.warn-text {
  color: #b45309;
  border-color: #fcd34d;
}

.node-delete-wrap {
  position: relative;
}

.node-popconfirm {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 260px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12);
  z-index: 8;
}

.node-popconfirm-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.node-popconfirm-desc {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.node-popconfirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 12px;
}

.row-menu {
  position: relative;
}

.row-menu summary {
  list-style: none;
  min-width: 34px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.row-menu summary::-webkit-details-marker {
  display: none;
}

.row-menu[open] .row-menu-list {
  display: grid;
}

.row-menu-list {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 150px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-strong);
  z-index: 6;
}

.row-menu-list button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.row-menu-list button:hover {
  background: #f8fafc;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.table-footer-left,
.table-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.node-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border: 1px solid #e2e8f0;
  border-top: 1px solid #e2e8f0;
  border-radius: 0 0 14px 14px;
  background: #fff;
}

.node-table-footer-left {
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
}

.node-table-footer-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.page-size-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
  white-space: nowrap;
}

.page-size-control select {
  height: 34px;
  min-width: 86px;
}

.pagination-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pagination-info {
  min-width: 72px;
  text-align: center;
  font-size: 13px;
  color: #64748b;
}

.yaml-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.yaml-preview-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.yaml-preview-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.yaml-search-input {
  width: 280px;
  min-width: 0;
}

.wrap-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
}

.yaml-preview-meta {
  margin-top: 14px;
  margin-bottom: 10px;
  font-size: 12px;
  color: #64748b;
}

.yaml-viewer {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  height: calc(100vh - 330px);
  min-height: 520px;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--code-bg);
}

.yaml-viewer.wrapped .yaml-code-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.yaml-viewer:not(.wrapped) .yaml-code-content {
  white-space: pre;
}

.yaml-gutter,
.yaml-code-content,
.diagnostic-logs-output,
.mini-pre,
.code-textarea {
  margin: 0;
  padding: 14px 16px;
  color: #243041;
  font-family: "SFMono-Regular", "Menlo", "Monaco", "Consolas", monospace;
  font-size: 0.76rem;
  line-height: 1.58;
}

.yaml-gutter {
  border-right: 1px solid var(--line);
  color: #94a3b8;
  text-align: right;
  user-select: none;
}

.yaml-code-content {
  overflow: visible;
}

.yaml-key {
  color: #2563eb;
}

.yaml-string {
  color: #047857;
}

.yaml-number {
  color: #b45309;
}

.yaml-bool {
  color: #0f766e;
  font-weight: 600;
}

.yaml-punc {
  color: #64748b;
}

.yaml-comment {
  color: #94a3b8;
  font-style: italic;
}

.yaml-code-content mark {
  background: #fef08a;
  color: inherit;
}

.diagnostic-list {
  display: grid;
  gap: 10px;
}

.diagnostic-item {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  background: #fff;
}

.diagnostic-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.diagnostic-logs-output {
  min-height: calc(100vh - 330px);
  max-height: calc(100vh - 330px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-card-sm);
  background: var(--code-bg);
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  border: 0;
  border-radius: var(--radius-card);
  padding: 0;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.24);
}

.narrow-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: 85vh;
}

.modal-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
}

.modal-shell {
  display: grid;
  gap: 16px;
  padding: 20px;
  max-height: inherit;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.dialog-tab-panels {
  overflow: auto;
}

.dialog-tab-panel {
  padding-top: 6px;
}

.dialog-grid {
  display: grid;
  gap: 12px 14px;
}

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

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  font-size: 0.82rem;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
}

.compact-check {
  min-height: 36px;
}

.secret-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.code-textarea,
.mini-pre {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--code-bg);
}

.code-textarea {
  min-height: 280px;
  resize: vertical;
}

.mini-pre {
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.split-actions {
  justify-content: space-between;
  align-items: center;
}

.modal-actions-danger,
.modal-actions-primary {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.danger-dialog-head {
  align-items: center;
}

.danger-dialog-copy {
  display: flex;
  align-items: center;
  gap: 14px;
}

.danger-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: #fef2f2;
  color: #dc2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #fecaca;
  flex: 0 0 auto;
}

.danger-icon {
  width: 20px;
  height: 20px;
}

.danger-dialog-details {
  display: grid;
  gap: 12px;
}

.danger-dialog-info {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.danger-dialog-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8rem;
}

.danger-dialog-row span {
  color: var(--muted);
}

.danger-dialog-row strong {
  color: var(--text);
  font-weight: 650;
}

.danger-dialog-note {
  padding: 12px 14px;
  border: 1px solid #fecaca;
  border-radius: 14px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.78rem;
  line-height: 1.5;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
  border: 1px solid rgba(37, 99, 235, 0.18);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
  font-size: 0.82rem;
}

.toast.error {
  background: rgba(239, 68, 68, 0.08);
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.18);
}

@media (min-width: 1800px) {
  :root {
    --page-max-width: 1520px;
    --sidebar-width: 350px;
  }
}

@media (max-width: 1439px) {
  :root {
    --page-max-width: 1320px;
    --sidebar-width: 320px;
  }

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

@media (max-width: 1199px) {
  .config-grid,
  .content-grid,
  .diagnostic-grid {
    grid-template-columns: 1fr;
  }

  .side-column,
  .config-side {
    order: 2;
    position: static;
    width: 100%;
    min-width: 0;
    max-height: none;
    overflow: visible;
    padding-bottom: 0;
  }

  .base-settings-grid {
    grid-template-columns: 1fr;
  }

  .target-panel {
    width: 100%;
    max-width: 100%;
  }

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

@media (max-width: 900px) {
  .sticky-action-bar,
  .result-dock {
    max-height: none;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .action-result-row {
    display: grid;
    gap: 8px;
  }

  .result-time {
    display: inline;
  }

  .action-buttons-row {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

@container (max-width: 820px) {
  .source-row-main {
    grid-template-columns: 64px minmax(0, 1fr) 72px;
  }

  .source-name-combo {
    grid-column: 2 / 3;
    max-width: none;
  }

  .source-url-input {
    grid-column: 2 / 4;
    min-width: 0;
  }

  .source-delete-btn {
    grid-column: 3 / 4;
    grid-row: 1;
  }
}

@media (max-width: 768px) {
  :root {
    --page-padding-x: 14px;
  }

  body {
    padding-bottom: 220px;
  }

  .app-shell,
  .page-shell {
    padding: var(--page-padding-y) var(--page-padding-x) 220px;
  }

  .app-header,
  .brand,
  .source-foot,
  .table-footer,
  .bulk-action-bar {
    flex-direction: column;
    align-items: stretch;
  }

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

  .yaml-preview-actions,
  .yaml-preview-tools {
    width: 100%;
  }

  .yaml-preview-tools {
    justify-content: space-between;
  }

  .yaml-search-input {
    width: 100%;
  }

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

  .session-banner,
  .session-banner-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .node-table-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .node-table-footer-right {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .session-banner-main {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }

  .session-banner-text,
  .session-banner-meta {
    white-space: normal;
  }

  .compact-base-grid,
  .options-grid,
  .chip-grid,
  .dialog-grid.two-col,
  .template-detail-meta {
    grid-template-columns: 1fr;
  }

  .custom-rule-layout {
    grid-template-columns: 1fr;
  }

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

  .source-row-main {
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }

  .source-url-input {
    grid-column: 1 / -1;
  }

  .source-delete-btn {
    grid-column: 3;
    grid-row: 1;
    width: auto;
  }

  .source-row-meta,
  .source-advanced {
    margin-left: 0;
  }

  .source-row-meta {
    flex-wrap: wrap;
  }

  .manual-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .manual-header-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .toolbar-group-left,
  .toolbar-group-right {
    width: 100%;
    justify-content: stretch;
  }

  .toolbar-group-left input[type="text"] {
    width: 100%;
  }

  .result-link-row {
    grid-template-columns: 1fr 1fr;
  }

  .result-link-row input {
    grid-column: 1 / -1;
  }

  .result-link-row .secondary-button,
  .result-link-row .ghost-button {
    width: 100%;
  }

  .sticky-action-inner,
  .result-dock-inner {
    padding-left: var(--page-padding-x);
    padding-right: var(--page-padding-x);
  }

  .action-buttons-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .action-buttons-row button {
    width: 100%;
  }

  .yaml-viewer {
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .node-table,
  .node-table thead,
  .node-table tbody,
  .node-table tr,
  .node-table td {
    display: block;
  }

  .node-table {
    min-width: 0;
  }

  .node-table thead {
    display: none;
  }

  .node-table tbody {
    display: grid;
    gap: 12px;
    padding: 12px;
  }

  .node-table tr {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: #fff;
    height: auto;
  }

  .node-table td {
    border: 0;
    padding: 4px 0;
  }

  .tall-table {
    max-height: none;
  }

  .shell-toolbar,
  .node-toolbar {
    grid-template-columns: 1fr;
  }

  .modal-dialog,
  .narrow-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
  }
}

.status-badge .icon {
  width: 16px;
  height: 16px;
}
