/* Author: TDULinks — Apple-inspired design system */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --accent: #c8102e;
  --accent-hover: #a30d25;
  --accent-soft: rgba(200, 16, 46, 0.1);
  --accent-ring: rgba(200, 16, 46, 0.28);
  --blue: #0071e3;
  --green: #34c759;
  --green-soft: rgba(52, 199, 89, 0.12);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.12);
  --blur: saturate(180%) blur(20px);
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --page-width: 1180px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.47059;
  letter-spacing: -0.022em;
}

/* ── Login ── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(200, 16, 46, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 80% 90%, rgba(0, 113, 227, 0.14), transparent 50%),
    linear-gradient(160deg, #1d1d1f 0%, #2c2c2e 45%, #1d1d1f 100%);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-xl);
  padding: 44px 40px 40px;
  box-shadow: var(--shadow-lg);
}

.login-header { text-align: center; margin-bottom: 36px; }

.logo-circle {
  width: 60px; height: 60px; border-radius: 16px;
  background: linear-gradient(145deg, #e8354a 0%, var(--accent) 100%);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(200, 16, 46, 0.35);
}

.login-header h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.03em; margin-bottom: 6px; }
.login-header p { color: var(--text-tertiary); font-size: 13px; }

/* ── Top bar ── */
.top-bar {
  position: sticky; top: 0; z-index: 200;
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--border);
}

.top-bar-inner {
  max-width: var(--page-width); margin: 0 auto; padding: 0 28px;
  height: 52px; display: flex; align-items: center; justify-content: space-between;
}

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

.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 15px; letter-spacing: -0.02em;
  color: var(--text);
}

.logo-mini {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(145deg, #e8354a, var(--accent));
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
}

.main-nav {
  display: flex; align-items: center; gap: 2px;
  padding: 3px; background: rgba(0, 0, 0, 0.05);
  border-radius: 10px;
}

.nav-link {
  padding: 6px 14px; border-radius: 8px;
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary); text-decoration: none;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.6); }

.nav-link.active {
  color: var(--text); background: var(--surface-solid);
  box-shadow: var(--shadow-sm); font-weight: 600;
}

.user-area {
  display: flex; align-items: center; gap: 12px;
  font-size: 13px; color: var(--text-secondary);
}

.user-area #currentUser {
  padding: 4px 12px; border-radius: 20px;
  background: rgba(0, 0, 0, 0.04); font-weight: 500; color: var(--text);
}

/* ── Page shell ── */
.app-page { max-width: var(--page-width); margin: 0 auto; padding: 28px 28px 48px; }

.page-hero {
  margin-bottom: 24px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  flex-wrap: wrap;
}

.page-hero-text h1 {
  font-size: 32px; font-weight: 700; letter-spacing: -0.04em;
  line-height: 1.1; margin-bottom: 8px;
}

.page-hero-tag {
  display: inline-block; font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 20px; margin-bottom: 10px;
  letter-spacing: 0.02em;
}

.page-hero-desc { font-size: 15px; color: var(--text-secondary); max-width: 520px; line-height: 1.5; }

.page-hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }

.stat-pill {
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 18px; text-align: center;
  min-width: 72px; box-shadow: var(--shadow-sm);
}

.stat-pill strong { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.stat-pill span { font-size: 11px; color: var(--text-tertiary); font-weight: 500; }

/* ── Layout ── */
.main-layout {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start;
}

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

.panel-head {
  margin-bottom: 20px; padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.panel-head p { font-size: 13px; color: var(--text-secondary); }

.panel > h2 {
  font-size: 17px; font-weight: 600; letter-spacing: -0.02em;
  margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* ── Forms ── */
label {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--text-secondary); margin-bottom: 6px; margin-top: 14px;
}

.form-group { margin-bottom: 2px; }

.form-group:first-child label { margin-top: 0; }

input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: #f5f5f7; font-size: 15px; font-family: inherit;
  color: var(--text); outline: none;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s var(--ease);
}

input:hover, select:hover { background: #ebebed; }

input:focus, select:focus {
  background: var(--surface-solid);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

input::placeholder { color: var(--text-tertiary); }

input[type=range] { width: 100%; accent-color: var(--accent); height: 4px; }

.checkbox-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text); margin-top: 0; cursor: pointer;
  font-weight: 400;
}

.checkbox-label input[type=checkbox] {
  width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer;
}

.label-optional { font-weight: 400; color: var(--text-tertiary); font-size: 12px; }

.field-note { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 4px; }

/* ── Buttons ── */
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  border-radius: var(--radius-sm); padding: 12px 22px;
  font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background 0.2s var(--ease), transform 0.1s var(--ease), box-shadow 0.2s;
  letter-spacing: -0.01em;
}

.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: #d1d1d6; cursor: not-allowed; transform: none; }

.btn-block { width: 100%; margin-top: 20px; }

.btn-text {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 13px; font-weight: 500; font-family: inherit;
  padding: 6px 10px; border-radius: 8px;
  transition: background 0.15s;
}

.btn-text:hover { background: var(--accent-soft); }

.btn-secondary {
  background: #e8e8ed; color: var(--text); border: none;
  border-radius: var(--radius-sm); padding: 12px 22px;
  font-size: 15px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover { background: #dcdce1; }

.btn-outline {
  background: transparent; color: var(--accent);
  border: 1.5px solid var(--accent); border-radius: var(--radius-sm);
  padding: 10px 18px; font-size: 14px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background 0.2s;
}

.btn-outline:hover { background: var(--accent-soft); }

.btn-preset {
  border: 1px solid var(--border-strong); background: var(--surface-solid);
  color: var(--text); border-radius: 8px; padding: 8px 14px;
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background 0.15s;
}

.btn-preset:hover { background: #f5f5f7; }

.error-msg { color: var(--accent); font-size: 13px; margin-top: 14px; text-align: center; }

.hint, .param-hint { font-size: 12px; color: var(--text-tertiary); margin: 10px 0; line-height: 1.55; }

/* ── Advanced panel ── */
.advanced-panel {
  margin: 18px 0 10px; padding: 16px 18px;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: #fafafa;
}

.advanced-panel summary {
  cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text);
  list-style: none; display: flex; align-items: center; gap: 8px;
  user-select: none;
}

.advanced-panel summary::before {
  content: '›'; font-size: 16px; color: var(--text-tertiary);
  transition: transform 0.2s; display: inline-block;
}

.advanced-panel[open] summary::before { transform: rotate(90deg); }

.advanced-panel summary::-webkit-details-marker { display: none; }

.param-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 20px; margin-top: 12px; }
.param-grid .form-group label { margin-top: 6px; font-size: 12px; }

.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { flex: 1; height: 40px; padding: 4px; border-radius: 8px; border: none; background: #f5f5f7; }

.unit { font-weight: 500; color: var(--accent); font-size: 12px; margin-left: 4px; }
.fixed-color-row { margin: 14px 0 8px; }
.serial-row { display: flex; gap: 12px; align-items: center; }
.serial-row input { flex: 1; }

/* ── Preview ── */
.preview-box {
  min-height: 380px;
  background: repeating-conic-gradient(#ebebed 0% 25%, #f5f5f7 0% 50%) 50% / 18px 18px;
  border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); overflow: hidden;
}

.preview-placeholder { text-align: center; color: var(--text-tertiary); padding: 24px; }
.preview-placeholder span { font-size: 40px; display: block; margin-bottom: 12px; opacity: 0.5; }
.preview-placeholder p { font-size: 14px; line-height: 1.5; max-width: 240px; margin: 0 auto; }

.preview-box img { max-width: 100%; max-height: 400px; object-fit: contain; }

.preview-meta {
  margin-top: 18px; display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 12px;
}

.preview-meta p { font-size: 14px; color: var(--text-secondary); }

/* ── Tables ── */
table { width: 100%; border-collapse: collapse; }

th, td {
  text-align: center; vertical-align: middle;
  padding: 11px 10px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}

th {
  background: #fafafa; font-weight: 600; color: var(--text-secondary);
  font-size: 12px; letter-spacing: 0.01em;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(0, 0, 0, 0.02); }

.empty-row td { color: var(--text-tertiary); padding: 28px; }

.table-scroll, .history-table-wrap {
  max-height: 240px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--surface-solid);
}

.table-scroll thead th, .history-table-wrap thead th {
  position: sticky; top: 0; z-index: 2;
  background: #fafafa;
  box-shadow: 0 1px 0 var(--border);
}

.link-action, .ops-cell a {
  color: var(--accent); text-decoration: none; font-weight: 500; font-size: 13px;
  padding: 4px 10px; border-radius: 6px; transition: background 0.15s;
}

.link-action:hover, .ops-cell a:hover { background: var(--accent-soft); text-decoration: none; }

/* ── Contract page ── */
.contract-layout { align-items: stretch; }

.contract-form-panel {
  display: flex; flex-direction: column;
  max-height: calc(100vh - 108px); overflow: hidden;
}

.contract-form-header { flex-shrink: 0; }
.contract-form-header h2 { border: none; padding: 0; margin-bottom: 8px; }

.contract-form-scroll {
  flex: 1; overflow-y: auto; padding-right: 6px; margin-top: 4px;
  scrollbar-width: thin; scrollbar-color: #d1d1d6 transparent;
}

.field-group {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px 8px; margin-bottom: 16px; background: #fafafa;
}

.field-group legend {
  font-size: 12px; font-weight: 600; color: var(--accent);
  padding: 0 8px; letter-spacing: 0.02em;
}

.contract-preview-wrap {
  min-height: 500px; background: #e8e8ed; border-radius: var(--radius-md);
  border: 1px solid var(--border); overflow: hidden; position: relative;
}

.contract-preview-wrap iframe {
  width: 100%; height: 580px; border: none; background: #fff; display: block;
}

.contract-preview-wrap .preview-placeholder {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}

.stamp-party-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 10px; flex-wrap: wrap;
}

.seal-type-select {
  flex: 1; min-width: 120px; max-width: 160px;
  padding: 8px 10px; font-size: 13px;
}

.edge-seal-row { margin-top: 6px; padding-top: 12px; border-top: 1px dashed var(--border); flex-wrap: wrap; }
.edge-seal-hint { flex: 1 1 100%; margin: 4px 0 0 26px; }

.workflow-steps {
  display: flex; justify-content: center; gap: 6px; flex-wrap: wrap;
  margin: 16px 0 12px;
}

.workflow-step {
  padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500;
  background: #e8e8ed; color: var(--text-tertiary);
  transition: background 0.2s, color 0.2s;
}

.workflow-step.active { background: var(--accent); color: #fff; }
.workflow-step.done { background: var(--green-soft); color: #248a3d; }

.seal-preview-panel { padding: 20px; text-align: center; min-height: 480px; }
.seal-preview-panel h3 { font-size: 15px; margin-bottom: 16px; color: var(--text); font-weight: 600; }

.seal-preview-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; }

.seal-preview-card {
  flex: 0 1 200px; padding: 18px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: #fafafa;
}

.seal-preview-card p { font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; }
.seal-preview-card img { width: 140px; height: 140px; object-fit: contain; mix-blend-mode: multiply; opacity: 0.92; }

.seal-preview-hint { margin-top: 20px; font-size: 13px; color: var(--text-tertiary); }

.edge-slice-preview { display: flex; align-items: center; justify-content: center; gap: 8px; }
.edge-slice-preview img { width: 36px; height: 120px; object-fit: contain; mix-blend-mode: multiply; }
.edge-slice-preview span { color: var(--text-tertiary); font-size: 12px; }

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

.history-section {
  margin-top: 20px; flex-shrink: 0;
  border-top: 1px solid var(--border); padding-top: 18px;
}

.history-section h3 {
  font-size: 14px; font-weight: 600; margin-bottom: 12px; text-align: center;
  color: var(--text);
}

.block-check { display: flex; margin-bottom: 8px; }

/* ── Contract chain ── */
.chain-page { max-width: var(--page-width); margin: 0 auto; padding: 28px 28px 48px; }

.chain-hero {
  margin-bottom: 24px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}

.chain-hero-text h1 { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; line-height: 1.1; margin-bottom: 8px; }

.chain-hero-tag {
  display: inline-block; font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft);
  padding: 4px 10px; border-radius: 20px; margin-bottom: 10px;
}

.chain-hero-desc { font-size: 15px; color: var(--text-secondary); max-width: 520px; line-height: 1.5; }

.chain-hero-stats { display: flex; gap: 10px; }

.chain-stat-card, .stat-pill {
  background: var(--surface-solid); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 18px; text-align: center;
  min-width: 72px; box-shadow: var(--shadow-sm);
}

.chain-stat-value, .stat-pill strong { display: block; font-size: 20px; font-weight: 700; letter-spacing: -0.03em; }
.chain-stat-label, .stat-pill span { font-size: 11px; color: var(--text-tertiary); font-weight: 500; }

.chain-layout { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 20px; align-items: start; }

.chain-panel { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-sm); }

.chain-panel-head { margin-bottom: 18px; }
.chain-panel-head h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.chain-panel-sub { font-size: 13px; color: var(--text-secondary); }

.chain-flow-preview {
  margin-bottom: 20px; padding: 16px 18px;
  background: linear-gradient(135deg, #fafafa 0%, #f5f5f7 100%);
  border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow-x: auto;
}

.chain-flow-empty { text-align: center; }
.chain-flow-placeholder { font-size: 13px; color: var(--text-tertiary); padding: 8px 0; }

.chain-flow-nodes {
  display: flex; align-items: center; gap: 0; min-width: min-content;
  padding: 4px 0;
}

.chain-flow-node {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  flex-shrink: 0; max-width: 120px;
}

.chain-node-dot {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-solid); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-soft);
}

.chain-node-dot.is-source { background: var(--accent); color: #fff; }
.chain-node-dot.is-terminal { background: var(--text); border-color: var(--text); color: #fff; }

.chain-node-label {
  font-size: 11px; color: var(--text-secondary); text-align: center;
  line-height: 1.35; max-width: 110px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

.chain-flow-arrow {
  flex-shrink: 0; width: 32px; height: 2px;
  background: linear-gradient(90deg, var(--accent), #d1d1d6);
  position: relative; margin: 0 4px; margin-bottom: 22px;
}

.chain-flow-arrow::after {
  content: ''; position: absolute; right: -1px; top: -4px;
  border: 5px solid transparent; border-left-color: #d1d1d6;
}

.chain-form-section {
  margin-bottom: 20px; padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.chain-form-section:last-of-type { border-bottom: none; padding-bottom: 0; }

.chain-section-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}

.chain-section-icon {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.chain-date-hint { margin-top: 0; margin-bottom: 10px; }

.intermediate-list { margin-bottom: 8px; }

.intermediate-row {
  display: flex; gap: 8px; margin-bottom: 8px; align-items: center;
}

.intermediate-row input { flex: 1; }

.intermediate-row .btn-text { flex-shrink: 0; color: var(--text-tertiary); font-size: 12px; }
.intermediate-row .btn-text:hover { color: var(--accent); }

.btn-add-node {
  width: 100%; margin-top: 6px; display: flex; align-items: center;
  justify-content: center; gap: 6px;
}

.chain-submit-btn { margin-top: 8px; padding: 14px; font-size: 16px; border-radius: var(--radius-md); }

.chain-history-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }

.chain-history-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}

.chain-history-head h3 { font-size: 14px; font-weight: 600; }

.chain-history-badge {
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  background: #e8e8ed; padding: 3px 10px; border-radius: 20px;
}

.chain-feature-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }

.chain-feature-item {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 14px 16px; background: #fafafa;
  border: 1px solid var(--border); border-radius: var(--radius-md);
  transition: background 0.15s;
}

.chain-feature-item:hover { background: #f5f5f7; }

.chain-feature-icon { font-size: 22px; line-height: 1; flex-shrink: 0; margin-top: 2px; }

.chain-feature-item strong { display: block; font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.chain-feature-item p { font-size: 12px; color: var(--text-secondary); line-height: 1.45; }
.chain-feature-item code { font-size: 11px; background: #e8e8ed; padding: 1px 6px; border-radius: 4px; }

.chain-result-card {
  margin-top: 20px; padding: 18px;
  background: var(--green-soft); border: 1px solid rgba(52, 199, 89, 0.25);
  border-radius: var(--radius-md);
}

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

.chain-result-icon {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}

.chain-result-head h3 { font-size: 15px; font-weight: 600; color: #248a3d; }

.chain-result-links { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }

.chain-result-links li {
  font-size: 13px; color: var(--text); padding: 8px 12px;
  background: rgba(255, 255, 255, 0.7); border-radius: 8px;
  text-align: center;
}

.chain-result-download { display: block; text-align: center; text-decoration: none; }

.chain-result-placeholder {
  margin-top: 20px; padding: 32px 20px; text-align: center;
  border: 1.5px dashed var(--border); border-radius: var(--radius-md);
  color: var(--text-tertiary);
}

.chain-result-placeholder-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.4; }
.chain-result-placeholder p { font-size: 13px; line-height: 1.5; }

.link-dates-panel { display: flex; flex-direction: column; gap: 10px; }

.link-date-block {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; background: #fafafa;
}

.link-date-title {
  font-size: 12px; font-weight: 600; color: var(--text);
  margin-bottom: 10px; text-align: center;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}

.link-date-badge {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; margin-right: 6px;
}

.link-date-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }

.link-date-row label {
  display: flex; flex-direction: column; font-size: 11px; gap: 5px;
  text-align: center; margin-top: 0; flex: 1; min-width: 120px;
  color: var(--text-tertiary); font-weight: 500;
}

.link-date-row input[type=date] { font-size: 13px; padding: 9px 10px; }

.success-msg { color: #248a3d; font-weight: 600; margin-bottom: 8px; font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .main-layout, .chain-layout { grid-template-columns: 1fr; }
  .contract-form-panel { max-height: none; }
  .contract-preview-wrap iframe { height: 420px; }
  .param-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .app-page, .chain-page { padding: 16px 16px 40px; }
  .top-bar-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 12px; }
  .brand-area { flex-direction: column; align-items: flex-start; gap: 10px; width: 100%; }
  .main-nav { width: 100%; justify-content: space-between; }
  .nav-link { flex: 1; text-align: center; padding: 8px 6px; font-size: 12px; }
  .page-hero-text h1, .chain-hero-text h1 { font-size: 26px; }
  .login-card { padding: 32px 24px; }
}
