:root {
  color-scheme: light;
  --bg: #f3f5f8;
  --card: #ffffff;
  --ink: #18202a;
  --muted: #6c7887;
  --line: #dfe4ea;
  --line-strong: #cad2dc;
  --primary: #1d63ed;
  --primary-dark: #154fc2;
  --primary-soft: #eaf1ff;
  --success: #168557;
  --danger: #cc3545;
  --warning: #b76c00;
  --navy: #111b2d;
  --shadow: 0 12px 36px rgba(26, 39, 57, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 28px clamp(22px, 4vw, 64px);
  background: var(--navy);
  color: #fff;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar h1 {
  margin: 3px 0 5px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.topbar p {
  max-width: 850px;
  margin: 0;
  color: #abb8cb;
  line-height: 1.6;
}

.eyebrow {
  color: #76a5ff;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
}

.state {
  flex: 0 0 auto;
  padding: 9px 16px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  font-weight: 750;
  white-space: nowrap;
}

.state.running,
.state.cancelling {
  background: #6b4b00;
}

.state.completed {
  background: #0b6b45;
}

.state.failed {
  background: #8c2230;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 24px;
  width: min(1680px, 100%);
  margin: 0 auto;
  padding: 24px clamp(18px, 3vw, 46px) 50px;
}

.workspace,
.sidebar {
  min-width: 0;
}

.workspace,
.status-card,
.progress-card,
.files-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.workspace {
  overflow: hidden;
}


.quick-start-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #ffffff, #f5f8ff);
}

.quick-start-card h2 {
  margin: 4px 0 5px;
  font-size: 20px;
  line-height: 1.35;
}

.quick-start-card p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.quick-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
}

.help-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid #d9e4f8;
  border-radius: 10px;
  background: #f5f8ff;
  color: #3e516d;
}

.help-box b {
  color: #1d4ed8;
}

.help-box span {
  color: #56657a;
  font-size: 12px;
  line-height: 1.55;
}

.database-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 16px;
  margin-top: 22px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
}

.database-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.database-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.database-status {
  align-self: center;
  padding: 12px;
  border-radius: 10px;
  background: #eef2f7;
  color: #49586b;
  font-size: 12px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.output-links {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.output-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8faff;
  color: #26354c;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.output-link:hover {
  color: var(--primary);
  border-color: #a9c1f3;
}

.sidebar-separator {
  margin: 13px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.tabs {
  display: flex;
  gap: 4px;
  max-width: 100%;
  padding: 10px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.tab {
  flex: 0 0 auto;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover {
  background: #f1f4f8;
  color: #334155;
}

.tab.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.panel {
  display: none;
  padding: 28px;
}

.panel.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.panel-head h2 {
  margin: 0 0 5px;
  font-size: 21px;
  line-height: 1.35;
}

.panel-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.grid {
  display: grid;
  gap: 17px;
  min-width: 0;
}

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

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

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

label {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 7px;
  color: #3f4b59;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input,
select {
  min-height: 44px;
  padding: 10px 12px;
}

textarea {
  min-height: 88px;
  padding: 11px 12px;
  resize: vertical;
  line-height: 1.55;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #6d99f4;
  box-shadow: 0 0 0 3px rgba(29, 99, 237, 0.1);
}

input[type="checkbox"] {
  min-height: 0;
}

.inline-check {
  align-self: end;
  min-height: 44px;
  flex-direction: row;
  align-items: center;
  gap: 9px;
}

.inline-check input,
.switch-card input,
.preview-auto input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--primary);
}

.secret-storage-row {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 13px;
  border: 1px dashed #e2a53a;
  border-radius: 10px;
  background: #fff8e8;
}

.secret-storage-row[hidden] {
  display: none;
}

.secret-storage-label {
  min-height: 0;
  align-self: auto;
  color: #78500a;
  font-weight: 700;
}

.secret-storage-status {
  color: #8b641d;
  font-size: 12px;
  line-height: 1.45;
  text-align: right;
}

.secret-storage-status.saved {
  color: #24713b;
}

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

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

.switch-card {
  min-height: 82px;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.switch-card:hover {
  border-color: #aac0e8;
  background: #f7f9fd;
  transform: translateY(-1px);
}

.switch-card.featured {
  border-color: #8cb0f8;
  background: #f1f6ff;
}

.switch-card span {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.switch-card b {
  color: var(--ink);
}

.switch-card small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
}

.route-target-card {
  margin-bottom: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8faff;
}

.route-target-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.route-target-head h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 16px;
}

.route-target-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.route-target-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.route-target-columns,
.route-target-row {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(190px, 1fr) 58px;
  align-items: center;
  gap: 10px;
}

.route-target-columns {
  padding: 0 2px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.route-target-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.route-target-row label {
  min-width: 0;
}

.route-target-row input {
  width: 100%;
}

.route-target-remove {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
}

.route-target-remove:disabled {
  color: #aeb6c2;
  cursor: not-allowed;
}

.mobile-field-label {
  display: none;
}

.compact {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.command-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--navy);
  color: #dce7fa;
}

.command-box code {
  overflow-wrap: anywhere;
  color: #7fafff;
  white-space: normal;
}

.command-box span {
  color: #aab8cd;
  font-size: 12px;
  line-height: 1.55;
}

.actionbar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  background: #fafbfc;
}

.button {
  min-height: 42px;
  padding: 10px 18px;
  border: 0;
  border-radius: 9px;
  font-weight: 750;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s, transform 0.15s;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

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

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

.secondary {
  background: #26354c;
  color: #fff;
}

.ghost {
  background: #e8edf4;
  color: #27374d;
}

.danger {
  background: #fae7ea;
  color: var(--danger);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.status-card,
.progress-card,
.files-card {
  padding: 18px;
}

.status-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.status-top > div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.status-top strong {
  overflow-wrap: anywhere;
  font-size: 15px;
}

.muted,
.status-meta {
  color: var(--muted);
  font-size: 12px;
}

.progress {
  height: 8px;
  margin: 15px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.progress div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.25s;
}

.status-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.card-title h3 {
  margin: 0;
  font-size: 15px;
}

.text-button {
  padding: 3px 0;
  border: 0;
  background: none;
  color: var(--primary);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}

.progress-summary {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #5d6b7a;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.progress-summary.has-failure {
  background: #fae7ea;
  color: var(--danger);
}

.progress-table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.progress-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.progress-table th {
  position: sticky;
  z-index: 1;
  top: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fc;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}

.progress-table th:nth-child(2),
.progress-table td:nth-child(2) {
  width: 72px;
  text-align: center;
}

.progress-table th:nth-child(3),
.progress-table td:nth-child(3) {
  width: 66px;
  text-align: right;
}

.progress-table td {
  padding: 10px;
  border-bottom: 1px solid #edf0f4;
  vertical-align: top;
}

.progress-table tr:last-child td {
  border-bottom: 0;
}

.progress-table tr[data-status="running"] td {
  background: #f5f8ff;
}

.progress-table tr[data-status="failed"] td {
  background: #fff8f8;
}

.progress-name {
  overflow-wrap: anywhere;
  color: #26354c;
  font-weight: 750;
  line-height: 1.35;
}

.progress-note {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-progress {
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf3;
}

.step-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.25s ease;
}

tr[data-status="completed"] .step-progress span {
  background: var(--success);
}

tr[data-status="failed"] .step-progress span {
  background: var(--danger);
}

tr[data-status="cancelled"] .step-progress span,
tr[data-status="skipped"] .step-progress span {
  background: #8793a2;
}

.step-status {
  display: inline-block;
  min-width: 50px;
  padding: 4px 6px;
  border-radius: 999px;
  background: #eef2f7;
  color: #657384;
  font-size: 10px;
  font-weight: 750;
  text-align: center;
  white-space: nowrap;
}

.step-status.running {
  background: #eaf1ff;
  color: var(--primary);
}

.step-status.completed {
  background: #e6f5ee;
  color: var(--success);
}

.step-status.failed {
  background: #fae7ea;
  color: var(--danger);
}

.step-status.cancelled,
.step-status.skipped {
  background: #eef0f3;
  color: #687585;
}

.progress-time {
  display: block;
  color: #3d4b5c;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-table td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.progress-empty {
  padding: 28px !important;
  color: var(--muted);
  text-align: center !important;
}

.file-list {
  display: flex;
  max-height: 430px;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.file-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.file-item > div {
  min-width: 0;
}

.file-item a {
  display: block;
  color: #26354c;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.file-item a:hover {
  color: var(--primary);
}

.file-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.4;
}

.file-size {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.empty {
  padding: 25px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.import-card {
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid #b9cdf5;
  border-radius: 13px;
  background: #f5f8ff;
}

.import-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.import-main .button {
  height: 44px;
  white-space: nowrap;
}

.import-options {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #d9e4f8;
}

.import-status {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 9px;
  overflow-wrap: anywhere;
  background: #e9eef6;
  color: #4d5b6c;
  font-size: 12px;
  line-height: 1.65;
}

.import-status.success {
  background: #e6f5ee;
  color: #116b48;
}

.import-status.warning {
  background: #fff4dd;
  color: #895500;
}

.import-status.error {
  background: #fae7ea;
  color: #9d2937;
}

.import-status b {
  color: inherit;
}

.import-field-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: 5px;
}

.import-field-list span {
  padding: 2px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.65);
}

.preview-panel {
  padding: 0;
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.preview-heading {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
}

.preview-heading h2 {
  margin: 2px 0 0;
  font-size: 18px;
  line-height: 1.3;
}

.preview-eyebrow {
  color: var(--primary);
}

.preview-status {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f7;
  color: #5f6d7d;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.preview-status.ready {
  background: #e6f5ee;
  color: #116b48;
}

.preview-status.loading {
  background: #fff4dd;
  color: #895500;
}

.preview-status.error {
  background: #fae7ea;
  color: #9d2937;
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.preview-auto {
  min-height: 38px;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  padding: 0 3px;
  font-size: 12px;
  white-space: nowrap;
}

.preview-size-group {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f5f7fa;
}

.preview-size {
  min-height: 30px;
  padding: 5px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.preview-size.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(25, 42, 68, 0.12);
}

.compact-button {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}

.preview-viewport {
  min-height: 640px;
  padding: 20px;
  overflow: auto;
  background:
    linear-gradient(45deg, #eef1f5 25%, transparent 25%),
    linear-gradient(-45deg, #eef1f5 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef1f5 75%),
    linear-gradient(-45deg, transparent 75%, #eef1f5 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

#articlePreview {
  display: block;
  width: 100%;
  height: 760px;
  margin: 0 auto;
  border: 1px solid #cfd6df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(20, 34, 53, 0.14);
  transition: width 0.2s ease;
}

.toast {
  position: fixed;
  z-index: 1000;
  right: 25px;
  bottom: 25px;
  max-width: min(430px, calc(100vw - 32px));
  padding: 13px 17px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(30px);
  background: #172236;
  color: #fff;
  box-shadow: var(--shadow);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.error {
  background: #8c2230;
}



.tab-count {
  display: inline-flex;
  min-width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
  margin-left: 5px;
  padding: 0 6px;
  border-radius: 999px;
  background: #dce5f1;
  color: #58677b;
  font-size: 11px;
  line-height: 1;
}

.tab.active .tab-count {
  background: #c9d9fa;
  color: var(--primary);
}

.ssh-panel {
  min-width: 0;
}

.ssh-panel-head {
  align-items: center;
}

.ssh-monitor-state {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 999px;
  background: #e8edf3;
  color: #5e6c80;
  font-size: 12px;
  font-weight: 750;
}

.ssh-monitor-state.running {
  background: #e7f3ff;
  color: #1261a6;
}

.ssh-monitor-state.completed {
  background: #e4f5ea;
  color: #237044;
}

.ssh-monitor-state.failed {
  background: #fae7ea;
  color: #a32c3d;
}

.ssh-monitor-state.cancelled {
  background: #fff2d8;
  color: #8a5b00;
}

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

.ssh-auto-scroll {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #56657a;
  font-size: 13px;
  font-weight: 650;
}

.ssh-auto-scroll input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.ssh-toolbar-actions {
  display: flex;
  gap: 8px;
}

.ssh-subtabs {
  display: flex;
  max-width: 100%;
  gap: 6px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid #263347;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #111927;
  scrollbar-width: thin;
}

.ssh-subtab {
  position: relative;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 12px 7px 27px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #9fb0c7;
  font: 700 12px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  cursor: pointer;
  white-space: nowrap;
}

.ssh-subtab::before {
  position: absolute;
  top: 50%;
  left: 11px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  content: "";
  transform: translateY(-50%);
}

.ssh-subtab[data-status="running"]::before {
  background: #38bdf8;
  box-shadow: 0 0 0 4px rgb(56 189 248 / 14%);
  animation: ssh-pulse 1.4s ease-in-out infinite;
}

.ssh-subtab[data-status="completed"]::before {
  background: #4ade80;
}

.ssh-subtab[data-status="failed"]::before {
  background: #fb7185;
}

.ssh-subtab[data-status="cancelled"]::before {
  background: #fbbf24;
}

.ssh-subtab:hover {
  background: #1a2638;
  color: #e5edf7;
}

.ssh-subtab.active {
  border-color: #334a67;
  background: #24354c;
  color: #fff;
}

.ssh-terminal-panels {
  position: relative;
  min-width: 0;
  height: 570px;
  overflow: hidden;
  border: 1px solid #263347;
  border-radius: 0 0 12px 12px;
  background: #000;
}

.ssh-terminal-empty {
  display: grid;
  height: 100%;
  padding: 30px;
  place-items: center;
  color: #75849a;
  font-size: 13px;
  text-align: center;
}

.ssh-terminal-panel {
  display: none;
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background: #000;
}

.ssh-terminal-panel.active {
  display: block;
}

.ssh-terminal-host,
.ssh-terminal-host .terminal,
.ssh-terminal-host .xterm,
.ssh-terminal-host .xterm-viewport {
  width: 100% !important;
  max-width: 100% !important;
}

.ssh-terminal-host {
  height: 100%;
  min-width: 0;
  overflow: hidden;
  background: #000;
}

.ssh-terminal-host .terminal,
.ssh-terminal-host .xterm {
  height: 100% !important;
}

.ssh-terminal-host .xterm-viewport {
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.ssh-terminal-host .xterm-screen {
  max-width: 100%;
}

@keyframes ssh-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

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

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

  .status-card {
    grid-column: 1 / -1;
  }

  .files-card,
  .progress-card {
    min-width: 0;
  }
}

@media (max-width: 900px) {
  .cols-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .preview-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    gap: 15px;
    padding: 20px 18px;
  }

  .topbar p {
    display: none;
  }

  .layout {
    gap: 14px;
    padding: 14px 12px 32px;
  }

  .panel {
    padding: 20px 16px;
  }

  .cols-3,
  .cols-4,
  .test-grid,
  .sidebar,
  .import-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .span-2,
  .span-3,
  .status-card {
    grid-column: span 1;
  }

  .import-main .button {
    width: 100%;
  }

  .route-target-head {
    flex-direction: column;
  }

  .route-target-actions {
    width: 100%;
  }

  .route-target-actions .button {
    flex: 1 1 0;
  }

  .route-target-columns {
    display: none;
  }

  .route-target-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
  }

  .mobile-field-label {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  .route-target-remove {
    justify-self: end;
    min-height: 28px;
  }

  .actionbar {
    flex-wrap: wrap;
    padding: 14px 16px;
  }

  .actionbar .button {
    flex: 1 1 calc(50% - 10px);
  }

  .preview-heading {
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
  }

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

  .preview-auto,
  .preview-size-group {
    grid-column: 1 / -1;
  }

  .preview-size-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .preview-viewport {
    min-height: 520px;
    padding: 10px;
  }

  #articlePreview {
    height: 650px;
  }

  .ssh-panel-head,
  .ssh-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .ssh-toolbar-actions {
    width: 100%;
  }

  .ssh-toolbar-actions .button {
    flex: 1 1 50%;
  }

  .ssh-terminal-panels {
    height: 480px;
  }
}

@media (max-width: 460px) {
  .topbar {
    flex-direction: column;
  }

  .state {
    align-self: flex-start;
  }

  .actionbar .button,
  .preview-actions .button {
    flex-basis: 100%;
  }

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

  .preview-auto,
  .preview-size-group {
    grid-column: span 1;
  }
}

.system-test-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.system-test-actions .button {
  flex: 0 0 auto;
}

/* Bootstrap modal based live execution monitor */
.job-monitor-modal {
  --bs-modal-bg: #f7f9fc;
  --bs-modal-border-color: var(--line);
  --bs-modal-header-border-color: var(--line);
  --bs-modal-footer-border-color: var(--line);
}

.job-monitor-modal .modal-dialog {
  max-width: min(1440px, calc(100vw - 28px));
}

.job-monitor-modal .modal-content {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.job-monitor-modal .modal-header {
  align-items: flex-start;
  gap: 16px;
  background: #fff;
}

.job-monitor-modal .modal-title {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.job-monitor-modal .modal-body {
  padding: 18px;
}

.job-monitor-modal .modal-dialog {
  max-width: min(1680px, 96vw);
}

.job-monitor-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "ssh status"
    "ssh progress";
  gap: 16px;
  min-width: 0;
  min-height: min(72vh, 760px);
}

.modal-status-card,
.modal-progress-card,
.modal-ssh-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}

.modal-status-card {
  grid-area: status;
}

.modal-progress-card {
  grid-area: progress;
  min-height: 0;
}

.modal-ssh-panel {
  grid-area: ssh;
  min-width: 0;
  min-height: 0;
  padding: 18px;
}

.job-monitor-modal .panel-head {
  margin-bottom: 14px;
}

.job-monitor-modal .panel-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.job-monitor-modal .panel-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.job-monitor-modal .ssh-terminal-panels {
  height: calc(min(72vh, 760px) - 156px);
  min-height: 520px;
}

.job-monitor-modal .progress-table-wrap {
  max-height: calc(min(72vh, 760px) - 150px);
  overflow: auto;
}

.job-monitor-modal .modal-footer {
  background: #fff;
}

#openMonitorBtn[hidden] {
  display: none !important;
}

@media (max-width: 900px) {
  .job-monitor-modal .modal-dialog {
    max-width: none;
  }

  .job-monitor-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas:
      "status"
      "progress"
      "ssh";
    min-height: 0;
  }

  .job-monitor-modal .modal-body {
    padding: 14px;
  }

  .job-monitor-modal .ssh-terminal-panels {
    height: 520px;
    min-height: 420px;
  }

  .job-monitor-modal .progress-table-wrap {
    max-height: none;
  }
}

/* Minimal fallback when Bootstrap assets are unavailable. */
.job-monitor-modal:not(.show) {
  display: none;
}

.job-monitor-modal.show {
  display: block;
}

.job-monitor-modal {
  position: fixed;
  inset: 0;
  z-index: 1055;
  overflow-x: hidden;
  overflow-y: auto;
  background: rgba(15, 23, 42, 0.46);
}

.job-monitor-modal .modal-dialog {
  width: auto;
  margin: 18px auto;
}

.job-monitor-modal .modal-content {
  background: #f7f9fc;
}

.modal-open {
  overflow: hidden;
}

/* System settings cards */
.settings-stack {
  display: grid;
  gap: 18px;
}

.setting-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(26, 39, 57, 0.05);
  padding: 18px;
}

.setting-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 15px;
  padding-bottom: 13px;
  border-bottom: 1px solid #edf1f6;
}

.setting-card-head h3 {
  margin: 0 0 5px;
  color: #243145;
  font-size: 16px;
  line-height: 1.35;
}

.setting-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.html-source-output {
  margin-top: 12px;
  border: 1px solid rgba(17, 24, 39, 0.12);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.7);
}

.html-source-output summary {
  padding: 9px 11px;
  cursor: pointer;
  color: #26354c;
  font-weight: 800;
}

.html-source-output pre {
  max-height: 420px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-top: 1px solid rgba(17, 24, 39, 0.10);
  background: #101828;
  color: #eef4ff;
  font: 12px/1.55 Consolas, "Cascadia Mono", "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 760px) {
  .setting-card {
    padding: 15px;
  }
}

/* Live browser screenshots in execution process modal */
.ssh-terminal-panel {
  flex-direction: column;
}

.ssh-terminal-panel.active {
  display: flex;
}

.process-screenshot-list {
  display: flex;
  flex: 0 0 auto;
  max-height: 230px;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid #263347;
  background: #0b1220;
  scrollbar-width: thin;
}

.process-screenshot-list:empty {
  display: none;
}

.process-screenshot-card {
  flex: 0 0 260px;
  margin: 0;
  overflow: hidden;
  border: 1px solid #263347;
  border-radius: 10px;
  background: #111927;
}

.process-screenshot-card figcaption {
  padding: 7px 9px;
  overflow: hidden;
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-screenshot-button {
  display: block;
  width: 100%;
  padding: 0 8px 8px;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.process-screenshot-card img {
  display: block;
  width: 100%;
  max-height: 170px;
  object-fit: contain;
  border-radius: 7px;
  background: #fff;
}

.ssh-terminal-host {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}


/* Large live screenshot preview modal */
.screenshot-preview-modal .modal-content {
  overflow: hidden;
  border: 0;
  border-radius: 16px;
}

.screenshot-preview-header {
  gap: 12px;
}

.screenshot-preview-header .modal-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.screenshot-preview-actions {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
  white-space: nowrap;
}

.screenshot-preview-modal .modal-body {
  min-height: min(78vh, 780px);
  padding: 0;
  background: #0b1220;
}

.screenshot-preview-viewport {
  width: 100%;
  height: min(78vh, 780px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: zoom-in;
  user-select: none;
  touch-action: none;
}

.screenshot-preview-viewport.is-zoomed {
  cursor: grab;
}

.screenshot-preview-viewport.is-dragging {
  cursor: grabbing;
}

.screenshot-preview-image {
  display: block;
  max-width: 100%;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  transform-origin: center center;
  transition: transform .08s ease-out;
  will-change: transform;
  pointer-events: none;
}

.screenshot-preview-modal:not(.show) {
  display: none;
}

.screenshot-preview-modal.show {
  display: block;
  background: rgba(15, 23, 42, 0.72);
}

@media (max-width: 640px) {
  .screenshot-preview-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .screenshot-preview-actions {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .screenshot-preview-actions .btn {
    flex: 1 1 0;
  }
}

.switch-card .test-card-body {
  flex: 1 1 auto;
}

.retest-button {
  align-self: flex-start;
  margin-top: 8px;
  padding: 5px 10px;
  border: 1px solid #c9d6ee;
  border-radius: 999px;
  background: #fff;
  color: #2d5ca8;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.retest-button:hover:not(:disabled) {
  background: #edf4ff;
  border-color: #8fb1ed;
}

.retest-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

@media (max-width: 900px) {
  .quick-start-card,
  .database-card {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .quick-actions {
    justify-content: stretch;
  }

  .quick-actions .button {
    flex: 1 1 160px;
  }
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, rgba(37, 99, 235, .18), transparent 34%), rgba(12, 18, 31, .74);
  backdrop-filter: blur(8px);
}
.login-card {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(0,0,0,.28);
}
.login-card h1 { margin: 6px 0 10px; font-size: 28px; color: #111827; }
.login-card p { margin: 0 0 18px; color: #64748b; line-height: 1.7; }
.login-card label { display: block; margin-bottom: 14px; }
.login-card label span { display: block; margin-bottom: 7px; color: #334155; font-weight: 700; }
.turnstile-box { min-height: 0; margin: 10px 0 16px; }
.login-status { min-height: 22px; margin-top: 12px; color: #64748b; font-size: 14px; }
.login-status.error { color: #b42318; }
.login-status.success { color: #027a48; }
.panel-separator { margin: 26px 0; border: 0; border-top: 1px solid #e5e7eb; }
.article-list { display: grid; gap: 14px; }
.article-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}
.article-list-item.active { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .10); }
.article-list-main { display: grid; gap: 6px; min-width: 0; }
.article-list-main strong { color: #111827; font-size: 16px; overflow-wrap: anywhere; }
.article-list-main small { color: #64748b; }
.article-list-main code { width: fit-content; max-width: 100%; padding: 3px 7px; border-radius: 7px; background: #f1f5f9; color: #334155; overflow-wrap: anywhere; }
.article-list-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.compact-select { min-height: 34px; padding: 0 10px; border: 1px solid #cbd5e1; border-radius: 9px; background: #fff; color: #334155; }
@media (max-width: 900px) {
  .article-list-item { grid-template-columns: 1fr; }
  .article-list-actions { justify-content: flex-start; }
}


.public-article-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0, rgba(52, 211, 153, .14), transparent 32rem),
    radial-gradient(circle at 86% 6%, rgba(37, 99, 235, .15), transparent 28rem),
    linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
  color: #172033;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

.article-site-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 22px;
  border-bottom: 1px solid rgba(226, 232, 240, .84);
  background: rgba(255, 255, 255, .86);
  backdrop-filter: blur(16px);
}

.article-site-logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #111827;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -.02em;
  text-decoration: none;
}

.article-site-logo::before {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1d4ed8, #0f766e);
  box-shadow: 0 10px 24px rgba(29, 78, 216, .28);
  content: "";
}

.article-site-logo strong {
  color: #0f766e;
}

.article-site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.article-site-nav a {
  padding: 8px 11px;
  border-radius: 999px;
  color: #475569;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.article-site-nav a:hover {
  background: #e8f2ff;
  color: #1d4ed8;
}

.article-theme-toggle {
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
}

.article-theme-toggle:hover {
  background: #1d4ed8;
}

.article-index-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: clamp(18px, 4vw, 42px);
  align-items: end;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(42px, 7vw, 78px) 22px 26px;
}

.article-index-hero-copy {
  min-width: 0;
}

.article-index-hero h1 {
  max-width: 920px;
  margin: 10px 0 14px;
  color: #0f172a;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.article-index-hero p {
  max-width: 820px;
  margin: 0;
  color: #536172;
  font-size: 17px;
  line-height: 1.9;
}

.article-index-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.article-index-tags span {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid rgba(20, 184, 166, .26);
  border-radius: 999px;
  background: rgba(255, 255, 255, .75);
  color: #0f766e;
  font-size: 13px;
  font-weight: 800;
}

.article-index-summary-card {
  min-height: 190px;
  padding: 22px;
  border: 1px solid rgba(203, 213, 225, .86);
  border-radius: 28px;
  background: linear-gradient(145deg, #0f172a, #123c57 58%, #0f766e);
  color: #fff;
  box-shadow: 0 24px 55px rgba(15, 23, 42, .22);
}

.article-index-summary-card span,
.article-index-summary-card em {
  display: block;
  color: rgba(255, 255, 255, .76);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.article-index-summary-card strong {
  display: block;
  margin: 18px 0 10px;
  font-size: 58px;
  line-height: 1;
  letter-spacing: -.04em;
}

.article-index-main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 22px 64px;
}

.article-index-seo {
  position: relative;
  margin: 0 0 18px;
  padding: 22px 24px;
  border: 1px solid rgba(226, 232, 240, .98);
  border-radius: 24px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .06);
}

.article-index-intro::before {
  position: absolute;
  top: 22px;
  left: 0;
  width: 4px;
  height: 38px;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(180deg, #1d4ed8, #0f766e);
  content: "";
}

.article-index-seo h2 {
  margin: 0 0 9px;
  color: #0f172a;
  font-size: 21px;
  letter-spacing: -.02em;
}

.article-index-seo p {
  margin: 0;
  color: #64748b;
  line-height: 1.85;
}

.article-index-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin: 0 0 20px;
  padding: 16px;
  border: 1px solid rgba(226, 232, 240, .98);
  border-radius: 24px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 16px 44px rgba(15, 23, 42, .06);
}

.article-index-toolbar label {
  flex: 1;
  margin: 0;
}

.article-index-toolbar label span {
  color: #334155;
  font-weight: 900;
}

.article-index-toolbar input[type="search"] {
  min-height: 46px;
  border-radius: 16px;
  border-color: #dbe3ee;
  background: #f8fafc;
  font-weight: 700;
}

.article-index-toolbar input[type="search"]:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.article-index-count {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1e40af;
  font-size: 14px;
  font-weight: 900;
  white-space: nowrap;
}

.public-article-list {
  display: grid;
  gap: 18px;
}

.public-article-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 28px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 18px 48px rgba(15, 23, 42, .07);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.public-article-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 99, 235, .35);
  box-shadow: 0 26px 60px rgba(15, 23, 42, .10);
}

.public-article-card-date {
  display: grid;
  place-items: center;
  min-height: 82px;
  padding: 10px;
  border: 1px solid #dbeafe;
  border-radius: 22px;
  background: linear-gradient(180deg, #eff6ff, #ecfdf5);
  text-align: center;
}

.public-article-card-date span {
  color: #0f172a;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.25;
}

.public-article-card-date em {
  color: #0f766e;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.public-article-card-body {
  min-width: 0;
}

.public-article-card h2 {
  margin: 8px 0 10px;
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.35;
  letter-spacing: -.025em;
}

.public-article-card h2 a {
  color: #0f172a;
  text-decoration: none;
}

.public-article-card h2 a:hover {
  color: #1d4ed8;
}

.public-article-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #526072;
  line-height: 1.8;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.public-article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.public-article-meta span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  background: #f1f5f9;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .02em;
}

.public-article-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.article-read-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
}

.article-read-more span {
  transition: transform .18s ease;
}

.article-read-more:hover {
  background: #1d4ed8;
  color: #fff;
}

.article-read-more:hover span {
  transform: translateX(2px);
}


body.public-article-page.article-theme-dark {
  background:
    radial-gradient(circle at 15% 0, rgba(45, 212, 191, .10), transparent 32rem),
    radial-gradient(circle at 86% 6%, rgba(59, 130, 246, .13), transparent 28rem),
    linear-gradient(180deg, #020617 0%, #0f172a 100%);
  color: #e5e7eb;
  color-scheme: dark;
}

body.public-article-page.article-theme-dark .article-site-topbar {
  border-color: rgba(51, 65, 85, .86);
  background: rgba(15, 23, 42, .82);
}

body.public-article-page.article-theme-dark .article-site-logo,
body.public-article-page.article-theme-dark .article-index-hero h1,
body.public-article-page.article-theme-dark .article-index-seo h2,
body.public-article-page.article-theme-dark .public-article-card h2 a,
body.public-article-page.article-theme-dark .public-article-card-date span {
  color: #f8fafc;
}

body.public-article-page.article-theme-dark .article-site-logo strong,
body.public-article-page.article-theme-dark .public-article-card-date em {
  color: #5eead4;
}

body.public-article-page.article-theme-dark .article-site-nav a {
  color: #cbd5e1;
}

body.public-article-page.article-theme-dark .article-site-nav a:hover {
  background: rgba(30, 41, 59, .9);
  color: #93c5fd;
}

body.public-article-page.article-theme-dark .article-theme-toggle {
  background: #e2e8f0;
  color: #0f172a;
}

body.public-article-page.article-theme-dark .article-index-hero p,
body.public-article-page.article-theme-dark .article-index-seo p,
body.public-article-page.article-theme-dark .public-article-description {
  color: #cbd5e1;
}

body.public-article-page.article-theme-dark .article-index-tags span {
  border-color: rgba(94, 234, 212, .30);
  background: rgba(15, 118, 110, .16);
  color: #99f6e4;
}

body.public-article-page.article-theme-dark .article-index-summary-card {
  border-color: rgba(71, 85, 105, .88);
  background: linear-gradient(145deg, #0b1120, #172554 58%, #134e4a);
  box-shadow: 0 24px 55px rgba(0, 0, 0, .32);
}

body.public-article-page.article-theme-dark .article-index-seo,
body.public-article-page.article-theme-dark .article-index-toolbar,
body.public-article-page.article-theme-dark .public-article-card {
  border-color: rgba(51, 65, 85, .92);
  background: rgba(15, 23, 42, .90);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
}

body.public-article-page.article-theme-dark .article-index-toolbar label span {
  color: #e2e8f0;
}

body.public-article-page.article-theme-dark .article-index-toolbar input[type="search"] {
  border-color: #334155;
  background: #020617;
  color: #f8fafc;
}

body.public-article-page.article-theme-dark .article-index-toolbar input[type="search"]::placeholder {
  color: #64748b;
}

body.public-article-page.article-theme-dark .article-index-count {
  background: rgba(30, 64, 175, .28);
  color: #bfdbfe;
}

body.public-article-page.article-theme-dark .public-article-card:hover {
  border-color: rgba(96, 165, 250, .55);
  box-shadow: 0 26px 60px rgba(0, 0, 0, .32);
}

body.public-article-page.article-theme-dark .public-article-card-date {
  border-color: rgba(59, 130, 246, .35);
  background: linear-gradient(180deg, rgba(30, 64, 175, .35), rgba(15, 118, 110, .24));
}

body.public-article-page.article-theme-dark .public-article-meta span {
  background: rgba(30, 41, 59, .92);
  color: #cbd5e1;
}

body.public-article-page.article-theme-dark .article-read-more {
  background: #2563eb;
  box-shadow: 0 12px 28px rgba(37, 99, 235, .24);
}

body.public-article-page.article-theme-dark .article-read-more:hover {
  background: #1d4ed8;
}

body.public-article-page.article-theme-dark .empty {
  border-color: rgba(51, 65, 85, .92);
  background: rgba(15, 23, 42, .90);
  color: #cbd5e1;
}

@media (prefers-color-scheme: dark) {
  body.public-article-page:not(.article-theme-light) {
    background:
      radial-gradient(circle at 15% 0, rgba(45, 212, 191, .10), transparent 32rem),
      radial-gradient(circle at 86% 6%, rgba(59, 130, 246, .13), transparent 28rem),
      linear-gradient(180deg, #020617 0%, #0f172a 100%);
    color: #e5e7eb;
    color-scheme: dark;
  }

  body.public-article-page:not(.article-theme-light) .article-site-topbar {
    border-color: rgba(51, 65, 85, .86);
    background: rgba(15, 23, 42, .82);
  }

  body.public-article-page:not(.article-theme-light) .article-site-logo,
  body.public-article-page:not(.article-theme-light) .article-index-hero h1,
  body.public-article-page:not(.article-theme-light) .article-index-seo h2,
  body.public-article-page:not(.article-theme-light) .public-article-card h2 a,
  body.public-article-page:not(.article-theme-light) .public-article-card-date span {
    color: #f8fafc;
  }

  body.public-article-page:not(.article-theme-light) .article-site-logo strong,
  body.public-article-page:not(.article-theme-light) .public-article-card-date em {
    color: #5eead4;
  }

  body.public-article-page:not(.article-theme-light) .article-site-nav a {
    color: #cbd5e1;
  }

  body.public-article-page:not(.article-theme-light) .article-site-nav a:hover {
    background: rgba(30, 41, 59, .9);
    color: #93c5fd;
  }

  body.public-article-page:not(.article-theme-light) .article-theme-toggle {
    background: #e2e8f0;
    color: #0f172a;
  }

  body.public-article-page:not(.article-theme-light) .article-index-hero p,
  body.public-article-page:not(.article-theme-light) .article-index-seo p,
  body.public-article-page:not(.article-theme-light) .public-article-description {
    color: #cbd5e1;
  }

  body.public-article-page:not(.article-theme-light) .article-index-tags span {
    border-color: rgba(94, 234, 212, .30);
    background: rgba(15, 118, 110, .16);
    color: #99f6e4;
  }

  body.public-article-page:not(.article-theme-light) .article-index-summary-card {
    border-color: rgba(71, 85, 105, .88);
    background: linear-gradient(145deg, #0b1120, #172554 58%, #134e4a);
    box-shadow: 0 24px 55px rgba(0, 0, 0, .32);
  }

  body.public-article-page:not(.article-theme-light) .article-index-seo,
  body.public-article-page:not(.article-theme-light) .article-index-toolbar,
  body.public-article-page:not(.article-theme-light) .public-article-card {
    border-color: rgba(51, 65, 85, .92);
    background: rgba(15, 23, 42, .90);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .24);
  }

  body.public-article-page:not(.article-theme-light) .article-index-toolbar label span {
    color: #e2e8f0;
  }

  body.public-article-page:not(.article-theme-light) .article-index-toolbar input[type="search"] {
    border-color: #334155;
    background: #020617;
    color: #f8fafc;
  }

  body.public-article-page:not(.article-theme-light) .article-index-toolbar input[type="search"]::placeholder {
    color: #64748b;
  }

  body.public-article-page:not(.article-theme-light) .article-index-count {
    background: rgba(30, 64, 175, .28);
    color: #bfdbfe;
  }

  body.public-article-page:not(.article-theme-light) .public-article-card:hover {
    border-color: rgba(96, 165, 250, .55);
    box-shadow: 0 26px 60px rgba(0, 0, 0, .32);
  }

  body.public-article-page:not(.article-theme-light) .public-article-card-date {
    border-color: rgba(59, 130, 246, .35);
    background: linear-gradient(180deg, rgba(30, 64, 175, .35), rgba(15, 118, 110, .24));
  }

  body.public-article-page:not(.article-theme-light) .public-article-meta span {
    background: rgba(30, 41, 59, .92);
    color: #cbd5e1;
  }

  body.public-article-page:not(.article-theme-light) .article-read-more {
    background: #2563eb;
    box-shadow: 0 12px 28px rgba(37, 99, 235, .24);
  }

  body.public-article-page:not(.article-theme-light) .article-read-more:hover {
    background: #1d4ed8;
  }

  body.public-article-page:not(.article-theme-light) .empty {
    border-color: rgba(51, 65, 85, .92);
    background: rgba(15, 23, 42, .90);
    color: #cbd5e1;
  }
}

@media (max-width: 820px) {
  .article-site-topbar,
  .article-index-hero,
  .article-index-toolbar,
  .public-article-card {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .article-site-topbar {
    position: static;
  }

  .article-site-nav {
    justify-content: flex-start;
  }

  .article-index-summary-card {
    min-height: 0;
  }

  .article-index-count,
  .public-article-actions {
    justify-content: flex-start;
  }

  .public-article-card-date {
    display: inline-grid;
    width: fit-content;
    min-height: 0;
    grid-template-columns: auto auto;
    gap: 8px;
    padding: 8px 12px;
  }
}

@media (max-width: 520px) {
  .article-site-logo span { display: none; }
  .article-index-hero { padding-top: 28px; }
  .article-index-hero h1 { font-size: 32px; }
  .article-index-main { padding-inline: 14px; }
  .article-index-hero { padding-inline: 14px; }
  .article-index-seo,
  .article-index-toolbar,
  .public-article-card { border-radius: 20px; }
}

.article-editor {
  display: grid;
  gap: 14px;
  margin: 16px 0 18px;
  padding: 16px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8fbff;
}

.article-editor[hidden] { display: none; }

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

.article-editor input[readonly] {
  background: #f1f5f9;
  color: #475569;
}

.article-create-card {
  display: grid;
  gap: 14px;
  margin: 16px 0 18px;
  padding: 16px;
  border: 1px solid #dcfce7;
  border-radius: 16px;
  background: #f7fef9;
}

.article-state {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  vertical-align: middle;
}

.article-state.draft {
  background: #fff7ed;
  color: #c2410c;
}

.article-state.ready {
  background: #ecfdf5;
  color: #047857;
}

.article-list-item.draft {
  border-style: dashed;
  background: #fffaf3;
}

.muted-hint {
  align-self: center;
  color: #64748b;
  font-size: 13px;
  line-height: 1.5;
}

/* Article management modal */
.article-admin-head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.article-edit-modal {
  --bs-modal-bg: #f7f9fc;
  --bs-modal-border-color: var(--line);
  --bs-modal-header-border-color: var(--line);
  --bs-modal-footer-border-color: var(--line);
}

.article-edit-modal .modal-dialog {
  max-width: min(1180px, calc(100vw - 32px));
}

.article-edit-modal .modal-content {
  border: 1px solid var(--line);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .18);
}

.article-edit-modal .modal-header,
.article-edit-modal .modal-footer {
  background: #fff;
}

.article-edit-modal .modal-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.modal-setting-card {
  margin: 0;
}

.modal-test-grid {
  margin-top: 10px;
}

.modal-test-options {
  margin-top: 16px;
}

@media (max-width: 760px) {
  .article-admin-head-actions {
    width: 100%;
    justify-content: stretch;
  }

  .article-admin-head-actions .button {
    flex: 1;
  }
}

.modal-config-tabs {
  gap: 0.5rem;
  margin: 1rem 0 1.25rem;
}

.modal-config-tabs .nav-link {
  border-radius: 999px;
  color: #475569;
  font-weight: 700;
  padding: 0.45rem 0.9rem;
}

.modal-config-tabs .nav-link.active {
  background: #0f172a;
  color: #fff;
}

.modal-config-tab-content > .tab-pane {
  min-height: 320px;
}

/* Public article/table dark theme fixes */
body.public-article-page.article-theme-dark table th,
body.public-article-page.article-theme-dark .wp-block-table th,
body.public-article-page.article-theme-dark .article-content th {
  color: #f8fafc;
}

@media (prefers-color-scheme: dark) {
  body.public-article-page:not(.article-theme-light) table th,
  body.public-article-page:not(.article-theme-light) .wp-block-table th,
  body.public-article-page:not(.article-theme-light) .article-content th {
    color: #f8fafc;
  }
}

/* Friend links management */
.friend-link-editor {
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid #dbe4f0;
  border-radius: 14px;
  background: #f8fbff;
}

.friend-link-editor-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.friend-link-list {
  display: grid;
  gap: 12px;
}

.friend-link-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
}

.friend-link-list-item.disabled {
  border-style: dashed;
  background: #f8fafc;
  opacity: .78;
}

.friend-link-list-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.friend-link-list-main strong {
  color: #111827;
  font-size: 16px;
  overflow-wrap: anywhere;
}

.friend-link-list-main small,
.friend-link-list-main a {
  color: #64748b;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.friend-link-list-main a:hover {
  color: #2563eb;
}

.friend-link-list-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.article-friend-links h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.article-friend-links h2::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, rgba(37, 99, 235, .28), transparent);
}

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

.friend-link-card {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff, #f8fbff);
  color: inherit;
  text-decoration: none;
  transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.friend-link-card:hover {
  border-color: #60a5fa;
  box-shadow: 0 14px 32px rgba(37, 99, 235, .12);
  transform: translateY(-1px);
}

.friend-link-card strong {
  color: #1d4ed8;
  font-size: 15px;
  overflow-wrap: anywhere;
}

.friend-link-card span {
  color: #64748b;
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

body.public-article-page.article-theme-dark .friend-link-card {
  border-color: rgba(51, 65, 85, .92);
  background: rgba(15, 23, 42, .84);
}

body.public-article-page.article-theme-dark .friend-link-card:hover {
  border-color: rgba(96, 165, 250, .55);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
}

body.public-article-page.article-theme-dark .friend-link-card strong {
  color: #93c5fd;
}

body.public-article-page.article-theme-dark .friend-link-card span {
  color: #cbd5e1;
}

@media (prefers-color-scheme: dark) {
  body.public-article-page:not(.article-theme-light) .friend-link-card {
    border-color: rgba(51, 65, 85, .92);
    background: rgba(15, 23, 42, .84);
  }

  body.public-article-page:not(.article-theme-light) .friend-link-card:hover {
    border-color: rgba(96, 165, 250, .55);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .28);
  }

  body.public-article-page:not(.article-theme-light) .friend-link-card strong {
    color: #93c5fd;
  }

  body.public-article-page:not(.article-theme-light) .friend-link-card span {
    color: #cbd5e1;
  }
}

@media (max-width: 900px) {
  .friend-link-list-item {
    grid-template-columns: 1fr;
  }

  .friend-link-list-actions {
    justify-content: flex-start;
  }

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