:root {
  --bg: #f7fbfb;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-soft: #eef8f8;
  --line: #d5e7e8;
  --line-strong: #b6d7d9;
  --text: #183234;
  --muted: #5d797d;
  --accent: #0fa7a4;
  --accent-deep: #0c7c7a;
  --accent-soft: #dff6f5;
  --warning: #cf4d4d;
  --success: #1b8a65;
  --shadow: 0 24px 60px rgba(34, 79, 82, 0.12);
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --max-width: 1380px;
  --font-sans: "Avenir Next", "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 167, 164, 0.12), transparent 28%),
    linear-gradient(180deg, #fbfefe 0%, var(--bg) 42%, #eef7f7 100%);
}

body[data-page="home"] {
  color: var(--text);
  background:
    radial-gradient(circle at 18% 22%, rgba(15, 167, 164, 0.12), transparent 22%),
    radial-gradient(circle at 82% 18%, rgba(98, 214, 255, 0.12), transparent 20%),
    linear-gradient(180deg, #fbfefe 0%, var(--bg) 42%, #eef7f7 100%);
  overflow-x: hidden;
}

body.accounts-drawer-open {
  overflow: hidden;
}

body[data-page="feishu-auth"] {
  color: #2a313d;
  background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
}

img {
  max-width: 100%;
  display: block;
}

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

button {
  cursor: pointer;
}

.page-shell {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.login-scene {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
}

.login-shell {
  position: relative;
  z-index: 2;
  width: min(calc(100% - 52px), 1440px);
  margin: 0 auto;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px 0 22px;
}

.login-noise,
.login-grid,
.login-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.login-grid {
  background-image:
    linear-gradient(rgba(120, 191, 194, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 191, 194, 0.08) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.14) 20%, rgba(0, 0, 0, 0.52) 100%);
}

.login-noise {
  background-image: radial-gradient(rgba(117, 167, 171, 0.24) 0.8px, transparent 0.8px);
  background-size: 96px 96px;
  opacity: 0.4;
}

.login-orbit {
  border-radius: 999px;
  border: 1px solid rgba(120, 191, 194, 0.18);
}

.orbit-one {
  inset: -8% 22% 12% -18%;
  transform: rotate(8deg);
}

.orbit-two {
  inset: 14% -10% -14% 30%;
  border-color: rgba(103, 203, 226, 0.18);
  transform: rotate(-18deg);
}

.orbit-three {
  inset: 34% 36% -28% -6%;
  border-color: rgba(15, 167, 164, 0.14);
  transform: rotate(19deg);
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 24px;
}

.login-brandline,
.login-panel-tag,
.login-footer span,
.login-method-text small {
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.login-brandline {
  color: var(--accent-deep);
  font-size: 0.92rem;
  font-weight: 700;
}

.login-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-nav a {
  color: var(--text);
  text-decoration: none;
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.login-main {
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(320px, 420px);
  gap: 42px;
  align-items: center;
  justify-content: center;
}

.login-copy {
  align-self: start;
  padding-top: 88px;
}

.login-copy-top {
  padding-top: 0;
}

.login-kicker {
  margin: 0 0 16px;
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.login-copy h1 {
  margin: 0;
  font-size: clamp(3.5rem, 6vw, 6rem);
  line-height: 0.9;
  letter-spacing: -0.06em;
  color: #163235;
  text-shadow: 0 10px 28px rgba(111, 189, 192, 0.14);
}

.login-stage {
  position: relative;
  min-height: 640px;
  width: 100%;
}

.stage-core {
  position: absolute;
  inset: 6% 0 10% 0;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.core-glow {
  position: absolute;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(104, 217, 220, 0.38), rgba(15, 167, 164, 0.08) 54%, transparent 72%);
  filter: blur(22px);
  animation: coreGlowPulse 6.4s ease-in-out infinite;
}

.core-ring {
  position: absolute;
  border-radius: 999px;
  border: 2px solid rgba(129, 213, 216, 0.74);
  box-shadow: 0 0 18px rgba(86, 193, 196, 0.14);
  transform-origin: center;
}

.ring-a {
  width: 330px;
  height: 168px;
  animation: ringFloatA 8s ease-in-out infinite;
}

.ring-b {
  width: 410px;
  height: 410px;
  border-color: rgba(115, 196, 198, 0.28);
  animation: ringFloatB 12s ease-in-out infinite;
}

.ring-c {
  width: 520px;
  height: 220px;
  border-color: rgba(88, 179, 181, 0.16);
  transform: rotate(-12deg);
  animation: ringFloatC 10s ease-in-out infinite;
}

.core-runner {
  position: absolute;
  inset: 50% auto auto 50%;
  pointer-events: none;
}

.runner-a {
  width: 330px;
  height: 168px;
  margin-left: -165px;
  margin-top: -84px;
  animation: runnerAFloat 8s ease-in-out infinite;
}

.runner-a .runner-dot {
  offset-path: path("M 42 0 H 288 C 311 0 330 19 330 42 V 126 C 330 149 311 168 288 168 H 42 C 19 168 0 149 0 126 V 42 C 0 19 19 0 42 0 Z");
  animation: runnerTravel 7.2s linear infinite;
}

.runner-b {
  width: 520px;
  height: 220px;
  margin-left: -260px;
  margin-top: -110px;
  transform: rotate(-12deg);
  opacity: 0.7;
  animation: runnerBFloat 10s ease-in-out infinite;
}

.runner-b .runner-dot {
  width: 10px;
  height: 10px;
  background: rgba(192, 247, 255, 0.88);
  box-shadow:
    0 0 18px rgba(126, 231, 250, 0.46),
    0 0 34px rgba(88, 179, 181, 0.16);
  offset-path: path("M 60 0 H 460 C 493 0 520 27 520 60 V 160 C 520 193 493 220 460 220 H 60 C 27 220 0 193 0 160 V 60 C 0 27 27 0 60 0 Z");
  animation: runnerTravel 11s linear infinite reverse;
}

.core-node {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cafcff;
  box-shadow:
    0 0 20px rgba(113, 230, 255, 0.6),
    0 0 50px rgba(73, 182, 184, 0.28);
  animation: coreNodePulse 4.2s ease-in-out infinite;
}

.runner-dot {
  position: absolute;
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #d9feff;
  box-shadow:
    0 0 16px rgba(133, 239, 255, 0.7),
    0 0 30px rgba(85, 187, 190, 0.24);
  offset-rotate: 0deg;
}

@keyframes runnerTravel {
  from {
    offset-distance: 0%;
  }

  to {
    offset-distance: 100%;
  }
}

@keyframes ringFloatA {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  50% {
    transform: translate3d(0, -8px, 0) scale(1.015);
  }
}

@keyframes ringFloatB {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(0deg);
  }

  50% {
    transform: translate3d(10px, 6px, 0) rotate(5deg);
  }
}

@keyframes ringFloatC {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-12deg);
  }

  50% {
    transform: translate3d(-10px, 8px, 0) rotate(-9deg);
  }
}

@keyframes runnerAFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }

  50% {
    transform: translate3d(0, -8px, 0);
  }
}

@keyframes runnerBFloat {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-12deg);
  }

  50% {
    transform: translate3d(-10px, 8px, 0) rotate(-9deg);
  }
}

@keyframes coreGlowPulse {
  0%,
  100% {
    transform: scale(0.96);
    opacity: 0.68;
  }

  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes coreNodePulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.72;
  }

  50% {
    transform: scale(1.14);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .core-glow,
  .core-ring,
  .core-runner,
  .runner-dot,
  .core-node {
    animation: none !important;
  }
}

.login-panel {
  position: relative;
  align-self: center;
  padding: 28px;
  border-radius: 26px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(242, 250, 250, 0.82)),
    rgba(255, 255, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 24px 80px rgba(40, 92, 95, 0.18);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(133, 226, 228, 0.22), transparent 35%, rgba(148, 216, 219, 0.18));
  z-index: -1;
  opacity: 0.9;
}

.login-panel-header h2 {
  margin: 10px 0 0;
  font-size: 1.65rem;
  line-height: 1.08;
  color: #163235;
}

.login-panel-tag {
  color: var(--accent-deep);
  font-size: 0.76rem;
  font-weight: 700;
}

.login-methods {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.login-method-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 18px;
  border-radius: 22px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: rgba(255, 255, 255, 0.8);
  color: #183234;
  text-decoration: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.26);
}

.login-method-card.is-disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.login-method-icon {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 1px solid rgba(139, 205, 208, 0.4);
  background: radial-gradient(circle at 30% 30%, rgba(156, 227, 255, 0.28), rgba(110, 206, 208, 0.12));
  color: var(--accent-deep);
  font-size: 1.35rem;
  box-shadow: 0 0 24px rgba(76, 186, 255, 0.12);
}

.login-method-text {
  display: grid;
  gap: 6px;
}

.login-method-text strong {
  font-size: 1.25rem;
}

.login-method-text small {
  color: rgba(12, 124, 122, 0.68);
  font-size: 0.76rem;
  font-weight: 700;
}

.login-auth-feedback {
  min-height: 22px;
  margin: 16px 0 0;
  color: var(--warning);
  font-size: 0.9rem;
  line-height: 1.5;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  color: rgba(76, 112, 116, 0.66);
  font-size: 0.76rem;
}

.feishu-auth-page {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.feishu-auth-card {
  width: min(100%, 1080px);
  padding: 48px 48px 38px;
  border-radius: 22px;
  border: 1px solid #d9dee8;
  background: #ffffff;
  box-shadow: 0 20px 60px rgba(35, 55, 88, 0.08);
}

.feishu-auth-app {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 12px;
}

.feishu-auth-app-icon {
  width: 94px;
  height: 94px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(180deg, #6675ff 0%, #4c5deb 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
}

.feishu-auth-app-icon span {
  color: #ffffff;
  font-size: 2.6rem;
  font-weight: 700;
  letter-spacing: -0.08em;
}

.feishu-auth-app h1 {
  margin: 4px 0 0;
  font-size: clamp(2.1rem, 4vw, 3rem);
  line-height: 1.06;
  color: #232834;
}

.feishu-auth-app p {
  margin: 0;
  font-size: clamp(1.2rem, 2.3vw, 1.5rem);
  color: #6b7280;
}

.feishu-auth-panel {
  margin-top: 34px;
  padding: 30px 32px;
  border-radius: 20px;
  background: #f7f8fb;
}

.feishu-auth-account,
.feishu-auth-panel-head,
.feishu-auth-actions,
.feishu-auth-action-buttons,
.feishu-auth-title-wrap {
  display: flex;
  align-items: center;
}

.feishu-auth-account,
.feishu-auth-panel-head,
.feishu-auth-actions {
  justify-content: space-between;
  gap: 20px;
}

.feishu-auth-account-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.feishu-auth-account-logo {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: #ffffff;
  color: #111111;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.06em;
}

.feishu-auth-account-meta strong,
.feishu-auth-title-wrap strong {
  display: block;
  color: #232834;
}

.feishu-auth-account-meta strong {
  font-size: 1.05rem;
}

.feishu-auth-account-meta span,
.feishu-auth-collapse,
.feishu-auth-footnote {
  color: #6b7280;
}

.feishu-auth-account-meta span {
  display: block;
  margin-top: 6px;
  font-size: 0.98rem;
}

.feishu-auth-link,
.feishu-auth-footnote a {
  color: #3f6df6;
  text-decoration: none;
}

.feishu-auth-title-wrap {
  gap: 14px;
  font-size: 1rem;
}

.feishu-auth-check {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #9ca3af;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
}

.feishu-auth-collapse {
  font-size: 0.98rem;
}

.feishu-auth-permissions {
  margin: 28px 0 0;
  padding-left: 28px;
  color: #232834;
  font-size: 1rem;
}

.feishu-auth-permissions li::marker {
  color: #c1c7d0;
}

.feishu-auth-footnote {
  margin: 44px 0 0;
  font-size: 1rem;
  line-height: 1.8;
}

.feishu-auth-locale {
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7280;
  font-size: 1rem;
}

.feishu-auth-action-buttons {
  gap: 18px;
}

.feishu-auth-button {
  min-width: 170px;
  min-height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 28px;
  border-radius: 14px;
  border: 1px solid #ccd3df;
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 600;
}

.feishu-auth-button.is-secondary {
  background: #ffffff;
  color: #232834;
}

.feishu-auth-button.is-primary {
  border-color: #3f6df6;
  background: #3f6df6;
  color: #ffffff;
}

.site-header,
.hero-grid,
.info-strip,
.panel,
.form-card,
.overview-card,
.editor-card {
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(182, 215, 217, 0.76);
  box-shadow: var(--shadow);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border-radius: var(--radius-lg);
  position: sticky;
  top: 16px;
  z-index: 10;
}

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

.brand-lockup h1 {
  margin: 0 0 4px;
  font-size: 1rem;
  line-height: 1.1;
}

.brand-lockup p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 12px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent-soft), #eefdfc);
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.site-nav a,
.secondary-button,
.toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.site-nav a.is-active {
  border-color: var(--accent);
  color: var(--accent-deep);
  background: #f8ffff;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent) 0%, #37c1be 100%);
  color: #ffffff;
  text-decoration: none;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(15, 167, 164, 0.22);
  transition: transform 0.2s ease;
}

.site-nav a:hover,
.secondary-button:hover,
.toolbar-button:hover,
.primary-button:hover,
.hint-button:hover,
.ghost-button:hover,
.inline-hint:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.secondary-button:active,
.toolbar-button:active,
.ghost-button:active,
.inline-hint:active {
  transform: translateY(1px) scale(0.99);
}

.hero-grid {
  margin-top: 28px;
  padding: 26px;
  border-radius: 28px;
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 24px;
  align-items: center;
}

.hero-copy h2 {
  margin: 0;
  font-size: clamp(2.1rem, 3vw, 3.9rem);
  line-height: 1;
  letter-spacing: -0.05em;
  max-width: 11ch;
}

.hero-text {
  margin: 16px 0 0;
  max-width: 46ch;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.66;
}

.hero-actions,
.form-actions,
.admin-toolbar,
.management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.toolbar-upload {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 16px 0 0;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.95);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.toolbar-file-name {
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
}

.toolbar-upload.is-dragover {
  border-color: rgba(15, 167, 164, 0.56);
  background: rgba(223, 246, 245, 0.96);
  box-shadow: 0 0 0 4px rgba(15, 167, 164, 0.12);
}

.hero-actions {
  margin-top: 26px;
}

.hero-visual {
  margin: 0;
  border-radius: 24px;
  overflow: hidden;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent-deep);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.info-strip,
.overview-grid {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.info-strip {
  padding: 18px 22px;
  border-radius: 22px;
}

.info-strip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.info-strip span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.overview-card {
  border-radius: 22px;
  padding: 20px;
}

.overview-card h3 {
  margin: 0 0 10px;
  font-size: 1.16rem;
}

.overview-card p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.62;
}

.panel {
  margin-top: 22px;
  border-radius: 26px;
  padding: 24px;
}

.backend-subnav {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: rgba(255, 255, 255, 0.74);
}

.backend-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 22px;
  margin-top: 22px;
  align-items: start;
}

.backend-sidebar {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 18px;
  padding: 20px;
  border-radius: 26px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(182, 215, 217, 0.76);
  box-shadow: var(--shadow);
}

.backend-sidebar-head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.backend-sidebar-head h1 {
  margin: 0 0 4px;
  font-size: 1.12rem;
}

.backend-sidebar-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.backend-menu,
.backend-sidebar-foot {
  display: grid;
  gap: 12px;
}

.backend-menu a,
.backend-sidebar-foot a {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: rgba(255, 255, 255, 0.72);
}

.backend-menu a.is-active {
  background: linear-gradient(135deg, rgba(15, 167, 164, 0.14), rgba(55, 193, 190, 0.1));
  border-color: rgba(15, 167, 164, 0.36);
  box-shadow: 0 12px 24px rgba(15, 167, 164, 0.12);
}

.backend-menu a strong {
  font-size: 0.98rem;
}

.backend-menu a span,
.backend-sidebar-foot a {
  color: var(--muted);
  line-height: 1.6;
}

.backend-content {
  margin-top: 0;
}

.backend-page-top {
  display: grid;
  gap: 16px;
  margin-bottom: 22px;
}

.backend-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.backend-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(182, 215, 217, 0.76);
}

.backend-page-head h3 {
  margin: 0;
  font-size: 1.5rem;
}

.backend-page-copy {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.backend-subnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
}

.backend-subnav a.is-active {
  background: linear-gradient(135deg, var(--accent) 0%, #37c1be 100%);
  color: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 167, 164, 0.18);
}

.panel-large {
  padding-bottom: 28px;
}

.panel-heading,
.section-title-row,
.form-header,
.canvas-toolbar,
.contract-paper-head,
.management-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading h3,
.section-title-row h4,
.form-header h4 {
  margin: 0;
  font-size: 1.25rem;
}

.panel-heading p,
.section-title-row p,
.form-header p,
.contract-paper-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.status-pill,
.required-chip,
.document-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.pending {
  background: #fff6e8;
  color: #99631a;
}

.status-pill.active {
  background: #e6faf5;
  color: #1a7f63;
}

.required-chip {
  background: #eef6ff;
  color: #2f618f;
}

.document-badge {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  color: var(--accent-deep);
}

.alert-banner {
  display: none;
  margin-top: 18px;
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: #fff1f1;
  border: 1px solid #f1c4c4;
  color: #8d2f2f;
}

.alert-banner.is-visible {
  display: block;
}

.form-card,
.editor-card {
  border-radius: 22px;
  padding: 22px;
}

.contract-entry-card,
.contract-form-card {
  margin-top: 22px;
}

.entry-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 16px;
  align-items: end;
  margin-top: 18px;
}

.entry-help {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.contract-paper {
  margin-top: 18px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid rgba(213, 231, 232, 0.9);
  background: linear-gradient(180deg, #ffffff, #fbfefe);
}

.contract-paper-head h5 {
  margin: 0;
  font-size: 1rem;
}

.contract-document {
  display: grid;
  gap: 18px;
  color: #294547;
  line-height: 1.75;
}

.contract-document h6 {
  margin: 0;
  font-size: 1.42rem;
  letter-spacing: -0.03em;
}

.contract-document p {
  margin: 0;
}

.inline-field-group {
  display: inline-block;
  vertical-align: middle;
  min-width: 0;
}

.inline-field,
.inline-document-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 4px;
}

.inline-field input,
.inline-document-field input,
.inline-document-field select {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  font-size: 0.92rem;
}

.inline-field input {
  min-width: 180px;
}

.inline-document-field select {
  min-width: 170px;
}

.inline-document-field input {
  min-width: 230px;
}

.inline-required {
  color: var(--warning);
  font-weight: 700;
}

.inline-hint,
.hint-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--accent-deep);
  padding: 0 12px;
}

.inline-hint {
  width: 24px;
  height: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 0.72rem;
  font-weight: 700;
}

.inline-example {
  display: none;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 0.86rem;
  line-height: 1.55;
}

.inline-example.is-visible {
  display: block;
}

.inline-error {
  margin-top: 8px;
  color: var(--warning);
  font-size: 0.84rem;
}

.inline-field-group.is-invalid input,
.inline-field-group.is-invalid select {
  border-color: var(--warning);
  box-shadow: 0 0 0 4px rgba(212, 84, 84, 0.12);
}

.signature-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(182, 215, 217, 0.78);
}

.signature-grid,
.admin-grid,
.config-grid,
.link-result-grid,
.contract-management-grid {
  display: grid;
  gap: 18px;
}

.signature-grid,
.admin-grid,
.link-result-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.contract-management-grid {
  grid-template-columns: 320px minmax(0, 1fr);
  margin-top: 18px;
}

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

.upload-card,
.canvas-card,
.link-result-card,
.management-card,
.field-config-item,
.status-item {
  border: 1px solid rgba(213, 231, 232, 0.9);
  border-radius: 18px;
  background: rgba(249, 253, 253, 0.96);
}

.upload-card,
.canvas-card {
  padding: 16px;
}

.upload-card {
  display: grid;
  gap: 12px;
}

.upload-card input {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed var(--line-strong);
  background: #ffffff;
}

.upload-card small,
.management-meta,
.field-meta,
.status-item p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.6;
}

.canvas-card {
  display: grid;
  gap: 12px;
}

#signature-pad {
  width: 100%;
  min-height: 190px;
  border-radius: 14px;
  border: 1px dashed var(--line-strong);
  background: #ffffff;
  touch-action: none;
}

.signature-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  margin-top: 14px;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
  background: rgba(239, 248, 248, 0.55);
  color: var(--muted);
  overflow: hidden;
  font-size: 0.9rem;
}

.signature-preview img {
  max-height: 84px;
  width: auto;
}

.link-result-card {
  margin-top: 16px;
  padding: 18px;
}

.link-result-grid strong,
.status-item strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
}

.link-result-grid p {
  margin: 0;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.6;
}

.field-config-list,
.status-board,
.management-list {
  display: grid;
  gap: 14px;
}

.field-config-item,
.status-item,
.management-card {
  padding: 16px;
}

.field-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.management-card-head strong {
  font-size: 0.96rem;
}

.summary-panel {
  margin-bottom: 8px;
}

.input-block {
  display: grid;
  gap: 8px;
}

.input-block span {
  font-weight: 600;
}

.input-block input,
.input-block select,
.input-block textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  padding: 12px 14px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-block textarea {
  min-height: 300px;
  resize: vertical;
  line-height: 1.7;
}

.template-editor-shell {
  display: grid;
  gap: 14px;
}

.template-toolbar {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(244, 251, 251, 0.94));
}

.template-toolbar-group {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.template-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: #ffffff;
  color: var(--text);
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.template-tool.is-active {
  border-color: rgba(15, 167, 164, 0.42);
  background: rgba(217, 247, 246, 0.92);
  color: #0b6e75;
  box-shadow: 0 0 0 3px rgba(15, 167, 164, 0.08);
}

.template-tool:disabled {
  opacity: 0.5;
  cursor: wait;
}

.template-editor-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.template-page {
  height: min(78vh, 1120px);
  padding: 26px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(242, 250, 250, 0.84), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(182, 215, 217, 0.76);
  overflow: auto;
}

#template-editor.template-editor {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

#template-editor.template-editor .tiptap.ProseMirror,
#template-editor.template-editor.ProseMirror {
  min-height: 1000px;
  padding: 54px 64px;
  border: 1px solid rgba(220, 233, 234, 0.96);
  border-radius: 18px;
  background: #ffffff;
  color: var(--text);
  line-height: 1.86;
  font-size: 1rem;
  box-sizing: border-box;
  box-shadow: 0 22px 50px rgba(42, 84, 86, 0.08);
  outline: none;
  overflow-wrap: break-word;
  white-space: normal;
}

#template-editor.template-editor .ProseMirror p,
#template-editor.template-editor .ProseMirror h1,
#template-editor.template-editor .ProseMirror h2,
#template-editor.template-editor .ProseMirror blockquote,
#template-editor.template-editor .ProseMirror ul,
#template-editor.template-editor .ProseMirror ol,
#template-editor.template-editor.ProseMirror p,
#template-editor.template-editor.ProseMirror h1,
#template-editor.template-editor.ProseMirror h2,
#template-editor.template-editor.ProseMirror blockquote,
#template-editor.template-editor.ProseMirror ul,
#template-editor.template-editor.ProseMirror ol {
  margin: 0 0 18px;
}

#template-editor.template-editor .ProseMirror h1,
#template-editor.template-editor.ProseMirror h1 {
  font-size: 1.7rem;
  line-height: 1.24;
}

#template-editor.template-editor .ProseMirror h2,
#template-editor.template-editor.ProseMirror h2 {
  font-size: 1.46rem;
  line-height: 1.35;
}

#template-editor.template-editor .ProseMirror .template-align-center,
#template-editor.template-editor.ProseMirror .template-align-center {
  text-align: center;
}

#template-editor.template-editor .ProseMirror .template-align-right,
#template-editor.template-editor.ProseMirror .template-align-right {
  text-align: right;
}

#template-editor.template-editor .ProseMirror blockquote,
#template-editor.template-editor.ProseMirror blockquote {
  padding-left: 18px;
  border-left: 3px solid rgba(15, 167, 164, 0.32);
  color: var(--muted);
}

#template-editor.template-editor .ProseMirror ul,
#template-editor.template-editor .ProseMirror ol,
#template-editor.template-editor.ProseMirror ul,
#template-editor.template-editor.ProseMirror ol {
  padding-left: 22px;
}

#template-editor.template-editor .ProseMirror:focus,
#template-editor.template-editor.ProseMirror:focus {
  border-color: rgba(15, 167, 164, 0.42);
  box-shadow:
    0 22px 50px rgba(42, 84, 86, 0.08),
    0 0 0 4px rgba(15, 167, 164, 0.1);
}

.input-block input::placeholder,
.input-block textarea::placeholder {
  color: #6f8c8f;
}

.input-block input:focus,
.input-block select:focus,
.input-block textarea:focus,
.upload-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 167, 164, 0.13);
}

.config-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

.config-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .login-main {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .login-stage {
    min-height: 420px;
    order: 1;
  }

  .login-panel {
    order: 2;
  }

  .hero-grid,
  .info-strip,
  .overview-grid,
  .signature-grid,
  .admin-grid,
  .link-result-grid,
  .contract-management-grid,
  .backend-layout {
    grid-template-columns: 1fr;
  }

  .hero-copy h2 {
    max-width: 13ch;
  }

  .toolbar-upload {
    width: 100%;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 22px;
  }

  .toolbar-file-name {
    max-width: 55vw;
    white-space: normal;
    text-align: right;
  }

  .backend-subnav {
    display: grid;
  }

  .backend-sidebar {
    position: static;
  }

  .backend-page-head {
    display: grid;
  }

  .template-page {
    height: min(70vh, 960px);
    padding: 16px;
  }

  #template-editor.template-editor {
    max-width: 100%;
  }

  #template-editor.template-editor .tiptap.ProseMirror,
  #template-editor.template-editor.ProseMirror {
    min-height: 900px;
    padding: 32px 24px;
  }
}

@media (max-width: 920px) {
  .login-shell {
    width: min(calc(100% - 24px), 1440px);
    padding-top: 18px;
  }

  .login-header,
  .login-footer {
    display: grid;
  }

  .login-nav {
    flex-wrap: wrap;
  }

  .login-copy h1 {
    font-size: clamp(3.2rem, 16vw, 5rem);
  }

  .stage-mark strong {
    font-size: 2.2rem;
  }

  .ring-a {
    width: 250px;
    height: 132px;
  }

  .ring-b {
    width: 320px;
    height: 320px;
  }

  .ring-c {
    width: 390px;
    height: 176px;
  }

  .page-shell {
    width: min(calc(100% - 24px), var(--max-width));
    padding-top: 14px;
  }

  .site-header,
  .panel-heading,
  .section-title-row,
  .form-header,
  .contract-paper-head,
  .field-config-head,
  .management-card-head {
    display: grid;
  }

  .site-header,
  .hero-grid,
  .info-strip,
  .panel,
  .form-card,
  .overview-card,
  .editor-card {
    border-radius: 20px;
  }

  .site-nav,
  .hero-actions,
  .form-actions,
  .admin-toolbar,
  .management-actions {
    flex-wrap: wrap;
  }

  .entry-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }
}

/* Template editor workbench redesign */
.editor-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 368px;
  gap: 18px;
  align-items: start;
}

.editor-stage,
.editor-sidebar {
  padding: 20px;
  border-radius: 26px;
}

.editor-stage {
  display: grid;
  gap: 16px;
}

.editor-stage-head {
  display: grid;
  gap: 16px;
}

.link-result-inline {
  margin: 0;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(247, 251, 252, 0.95), rgba(255, 255, 255, 0.96));
}

.link-result-inline .link-result-grid {
  grid-template-columns: 220px minmax(0, 1fr);
}

.editor-shell-workbench {
  gap: 12px;
}

.template-toolbar {
  padding: 12px;
  gap: 12px;
  border-radius: 18px;
}

.template-toolbar-group {
  gap: 8px;
  padding-right: 10px;
  margin-right: 2px;
  border-right: 1px solid rgba(182, 215, 217, 0.76);
}

.template-toolbar-group:last-child {
  border-right: none;
  padding-right: 0;
}

.template-tool {
  min-height: 38px;
}

.template-page {
  height: min(80vh, 1180px);
  padding: 20px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(240, 245, 248, 0.88), rgba(250, 252, 253, 0.98));
}

#template-editor.template-editor {
  max-width: 920px;
}

#template-editor.template-editor .tiptap.ProseMirror,
#template-editor.template-editor.ProseMirror {
  min-height: 1100px;
  padding: 56px 68px 72px;
  border-radius: 12px;
  box-shadow: 0 28px 58px rgba(42, 84, 86, 0.09);
}

.editor-sidebar {
  position: sticky;
  top: 20px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  background: linear-gradient(180deg, rgba(252, 254, 255, 0.98), rgba(247, 251, 252, 0.98));
}

.editor-sidebar-head h4,
.sidebar-section-head strong {
  margin: 0;
}

.editor-sidebar-head p,
.sidebar-section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.editor-sidebar-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.editor-sidebar-tab {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-weight: 700;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.editor-sidebar-tab.is-active {
  border-color: rgba(15, 167, 164, 0.4);
  background: rgba(216, 247, 246, 0.9);
  color: #0b6e75;
}

.editor-sidebar-panels {
  min-height: 0;
  overflow: auto;
  display: grid;
}

.editor-sidebar-panel {
  display: none;
  align-content: start;
  gap: 14px;
}

.editor-sidebar-panel.is-active {
  display: grid;
}

.sidebar-section-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(182, 215, 217, 0.68);
  background: rgba(255, 255, 255, 0.96);
}

.sidebar-section-head {
  margin-bottom: 14px;
}

.component-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.component-grid-single {
  grid-template-columns: 1fr;
}

.component-chip {
  min-height: 88px;
  padding: 12px;
  display: grid;
  align-content: space-between;
  justify-items: start;
  gap: 8px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: linear-gradient(180deg, rgba(246, 251, 252, 0.95), rgba(255, 255, 255, 0.98));
  color: var(--text);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.component-chip strong {
  font-size: 0.95rem;
}

.component-chip span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.component-chip-signature {
  background: linear-gradient(180deg, rgba(255, 246, 232, 0.96), rgba(255, 255, 255, 0.98));
}

.component-chip-page {
  background: linear-gradient(180deg, rgba(236, 244, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.component-chip:hover,
.editor-sidebar-tab:hover {
  transform: translateY(-1px);
}

.component-chip:hover {
  border-color: rgba(15, 167, 164, 0.38);
  box-shadow: 0 12px 22px rgba(15, 167, 164, 0.08);
}

.field-config-list {
  gap: 12px;
}

.field-config-item {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(182, 215, 217, 0.7);
  background: rgba(249, 252, 253, 0.96);
}

.field-config-head {
  align-items: start;
}

.field-config-item strong {
  display: block;
  margin-bottom: 4px;
}

.field-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.counterparty-signing {
  display: grid;
  gap: 12px;
}

.counterparty-signing .primary-button {
  width: 100%;
}

.status-board {
  gap: 10px;
}

.status-item {
  border-radius: 14px;
  border: 1px solid rgba(182, 215, 217, 0.6);
  background: rgba(248, 252, 253, 0.92);
}

@media (max-width: 1280px) {
  .editor-workbench {
    grid-template-columns: 1fr;
  }

  .editor-sidebar {
    position: static;
    max-height: none;
  }
}

@media (max-width: 920px) {
  .editor-stage,
  .editor-sidebar {
    padding: 16px;
  }

  .link-result-inline .link-result-grid,
  .component-grid,
  .editor-sidebar-tabs {
    grid-template-columns: 1fr;
  }

  .template-toolbar-group {
    border-right: none;
    padding-right: 0;
  }

  .template-page {
    height: min(74vh, 980px);
    padding: 12px;
  }

  #template-editor.template-editor .tiptap.ProseMirror,
  #template-editor.template-editor.ProseMirror {
    min-height: 920px;
    padding: 32px 24px 44px;
  }
}

/* Template center list page */
.template-center-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.template-center-nav,
.template-list-panel {
  padding: 18px;
  border-radius: 20px;
}

.template-center-nav {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 16px;
}

.template-center-title {
  font-size: 1.4rem;
  font-weight: 700;
}

.template-create-button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  box-shadow: none;
}

.template-center-menu {
  display: grid;
  gap: 6px;
}

.template-center-link {
  min-height: 42px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.template-center-link.is-active {
  background: rgba(223, 246, 245, 0.9);
  color: var(--accent-deep);
}

.template-list-panel {
  display: grid;
  gap: 14px;
}

.template-list-toolbar,
.template-bulk-bar,
.template-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

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

.template-search-input,
.template-date-input,
.template-page-size-wrap select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
}

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

.template-date-range {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.template-table-wrap {
  border: 1px solid rgba(182, 215, 217, 0.6);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
}

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

.template-table th,
.template-table td {
  position: relative;
  padding: 16px 14px;
  text-align: left;
  border-bottom: 1px solid rgba(226, 236, 237, 0.9);
  vertical-align: middle;
}

.template-table tr.is-menu-open td,
.template-table tr.is-menu-open th {
  z-index: 140;
}

.template-table thead th {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  background: rgba(250, 253, 254, 0.96);
}

.template-table tbody tr:hover {
  background: rgba(244, 249, 250, 0.92);
}

.template-check-col {
  width: 48px;
}

.template-row-check {
  display: inline-flex;
  align-items: center;
}

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

.template-row-time {
  display: grid;
  gap: 4px;
}

.template-row-time strong {
  font-weight: 600;
}

.template-row-time span {
  color: var(--muted);
  font-size: 0.82rem;
}

.template-row-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.template-action-link {
  border: none;
  background: transparent;
  color: #56bdb2;
  font-weight: 700;
  text-decoration: none;
}

.template-action-link.is-primary {
  color: var(--accent-deep);
}

.template-empty-state {
  padding: 48px 16px !important;
  text-align: center !important;
  color: var(--muted);
}

.template-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.template-page-number {
  min-width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: #fff;
}

.template-page-button {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: #fff;
  color: var(--text);
}

.template-page-button:disabled,
#delete-selected-templates:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Template editor page */
body[data-page="template-editor"] {
  background: #f4f6f8;
}

.template-editor-app {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr;
}

.template-editor-topbar,
.template-editor-actionbar {
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(208, 223, 226, 0.92);
}

.template-editor-topbar {
  min-height: 72px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.template-editor-topbar-left,
.template-editor-topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.template-editor-close {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  color: var(--text);
  text-decoration: none;
  background: rgba(244, 247, 248, 0.96);
  border: 1px solid rgba(208, 223, 226, 0.9);
}

.template-editor-topbar-title {
  font-size: 1.45rem;
  font-weight: 700;
}

.template-editor-topbar-subtitle {
  color: var(--muted);
  font-size: 0.84rem;
}

.template-editor-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.template-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}

.template-step span {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(182, 215, 217, 0.9);
  background: #fff;
  font-weight: 700;
}

.template-step.is-active,
.template-step.is-done {
  color: var(--accent-deep);
}

.template-step.is-active span,
.template-step.is-done span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.template-step-line {
  width: 42px;
  height: 2px;
  background: rgba(208, 223, 226, 0.92);
}

.template-editor-topbar-actions .ghost-button,
.template-editor-topbar-actions .primary-button {
  min-height: 40px;
}

.template-editor-actionbar {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.template-editor-workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 0;
}

.template-editor-main {
  min-width: 0;
  align-self: start;
  padding: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #f1f4f7;
}

.template-editor-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 20px 0;
}

.template-editor-summary div {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(208, 223, 226, 0.92);
  background: rgba(255, 255, 255, 0.96);
}

.template-editor-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 6px;
}

.template-editor-summary strong {
  display: block;
  word-break: break-all;
}

.template-editor-main .template-editor-shell {
  gap: 0;
}

.template-editor-main .template-toolbar {
  margin: 16px 20px 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-top: none;
  background: rgba(255, 255, 255, 0.98);
}

.template-editor-main .template-editor-status {
  padding: 10px 20px 0;
}

.template-editor-main .template-page {
  height: calc(100dvh - 220px);
  margin: 0;
  padding: 18px 20px 28px;
  border: none;
  border-radius: 0;
  background: #f1f4f7;
}

.template-editor-main #template-editor.template-editor {
  max-width: 980px;
}

.template-editor-main #template-editor.template-editor .tiptap.ProseMirror,
.template-editor-main #template-editor.template-editor.ProseMirror {
  min-height: 1160px;
  padding: 56px 72px 84px;
  border-radius: 0;
  border-color: rgba(226, 236, 237, 0.96);
  box-shadow: 0 8px 20px rgba(28, 58, 67, 0.08);
}

.template-editor-sidepanel {
  min-height: calc(100dvh - 120px);
  border-left: 1px solid rgba(208, 223, 226, 0.92);
  background: rgba(255, 255, 255, 0.98);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  padding: 18px;
}

.template-editor-sidepanel .editor-sidebar-panels {
  min-height: 0;
  overflow: auto;
}

body[data-page="contract-editor"] {
  overflow: hidden;
}

.contract-editor-workspace {
  grid-template-columns: minmax(0, 1fr);
}

.contract-editor-main {
  min-height: calc(100dvh - 90px);
}

.contract-editor-main .template-editor-shell {
  min-height: 0;
}

.contract-editor-main .template-page {
  height: calc(100dvh - 174px);
  overflow: auto;
}

.contract-editor-main #contract-editor.template-editor {
  max-width: 980px;
  min-height: 1160px;
  padding: 56px 72px 84px;
  margin: 0 auto;
  border-radius: 0;
  border: 1px solid rgba(226, 236, 237, 0.96);
  background: #fff;
  box-shadow: 0 8px 20px rgba(28, 58, 67, 0.08);
  outline: none;
}

@media (max-width: 1280px) {
  .template-center-layout,
  .template-editor-workspace {
    grid-template-columns: 1fr;
  }

  .template-center-nav {
    position: static;
  }

  .template-editor-topbar {
    grid-template-columns: 1fr;
    padding: 16px 20px;
  }

  .template-editor-steps {
    justify-content: flex-start;
    overflow: auto;
  }

  .template-editor-sidepanel {
    min-height: auto;
    border-left: none;
    border-top: 1px solid rgba(208, 223, 226, 0.92);
  }
}

@media (max-width: 920px) {
  .template-list-toolbar,
  .template-bulk-bar,
  .template-table-footer,
  .template-date-range,
  .template-editor-actionbar,
  .template-editor-topbar-actions,
  .template-row-actions,
  .template-editor-summary {
    display: grid;
    grid-template-columns: 1fr;
  }

  .template-table-wrap {
    overflow: auto;
  }

  .template-table {
    min-width: 720px;
  }

  .template-editor-main .template-page {
    height: auto;
    min-height: 68vh;
    padding: 14px;
  }

  .template-editor-main #template-editor.template-editor .tiptap.ProseMirror,
  .template-editor-main #template-editor.template-editor.ProseMirror {
    min-height: 860px;
    padding: 32px 24px 48px;
  }
}


/* Global navigation refresh */
.workspace-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.workspace-main {
  width: min(calc(100% - 40px), var(--max-width));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.workspace-topnav {
  min-height: 78px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(208, 223, 226, 0.9);
  overflow: visible;
}

.workspace-topnav-left,
.workspace-topnav-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.workspace-topnav-left {
  overflow: visible;
}

.auth-role-pill {
  min-height: 30px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(223, 246, 245, 0.96);
  color: var(--accent-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

.workspace-brand {
  text-decoration: none;
}

.workspace-tabnav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.workspace-tabnav a,
.workspace-more-toggle {
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  font-weight: 700;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
}

.workspace-tabnav a.is-active,
.workspace-more-toggle.is-active,
.workspace-more-nav.is-active .workspace-more-toggle {
  color: var(--accent-deep);
  border-bottom-color: var(--accent);
}

.workspace-more-nav {
  position: relative;
  z-index: 80;
}

.workspace-more-toggle {
  cursor: pointer;
  gap: 8px;
  position: relative;
  z-index: 81;
  appearance: none;
  -webkit-appearance: none;
}

.workspace-more-caret {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid currentColor;
  transform: translateY(2px);
  transition: transform 160ms ease;
}

.workspace-more-nav.is-open .workspace-more-caret,
.workspace-more-nav:hover .workspace-more-caret,
.workspace-more-nav:focus-within .workspace-more-caret {
  transform: translateY(2px) rotate(180deg);
}

.workspace-more-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 176px;
  padding: 8px;
  display: none;
  border-radius: 16px;
  border: 1px solid rgba(182, 215, 217, 0.9);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 38px rgba(24, 50, 52, 0.16);
  z-index: 82;
  pointer-events: auto;
}

.workspace-more-nav.is-open .workspace-more-menu,
.workspace-more-nav:hover .workspace-more-menu,
.workspace-more-nav:focus-within .workspace-more-menu {
  display: grid;
}

.workspace-more-menu a {
  min-height: 42px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.workspace-more-menu a:hover,
.workspace-more-menu a.is-active {
  background: rgba(223, 246, 245, 0.9);
  color: var(--accent-deep);
}

body[data-page="admin"] .page-shell,
body[data-page="contracts"] .page-shell,
body[data-page="accounts"] .page-shell {
  width: 100%;
  padding: 0;
}

body[data-page="admin"] .backend-content,
body[data-page="contracts"] .backend-content,
body[data-page="accounts"] .accounts-primary {
  padding: 24px;
  border-radius: 24px;
}

.accounts-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.accounts-primary,
.accounts-side-rail,
.accounts-table-panel,
.accounts-drawer-panel {
  padding: 20px;
  border-radius: 24px;
}

.accounts-toolbar,
.accounts-toolbar-primary,
.accounts-toolbar-filters,
.accounts-sidebar-head,
.account-form-actions,
.account-row-actions {
  display: flex;
  align-items: center;
}

.accounts-toolbar,
.accounts-sidebar-head,
.accounts-toolbar-primary {
  justify-content: space-between;
  gap: 16px;
}

.accounts-toolbar {
  margin-bottom: 18px;
}

.accounts-toolbar-primary {
  justify-content: flex-start;
}

.accounts-toolbar-filters {
  gap: 10px;
}

.accounts-create-button,
.accounts-role-button {
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
}

.accounts-side-rail {
  display: grid;
  gap: 18px;
  position: sticky;
  top: 0;
  align-self: start;
  margin-top: 24px;
}

.accounts-side-search {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(213, 231, 232, 0.8);
}

.accounts-side-menu {
  display: grid;
  gap: 10px;
}

.accounts-side-link {
  min-height: 48px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-align: left;
}

.accounts-side-link.is-active {
  border-color: rgba(154, 215, 213, 0.76);
  background: rgba(223, 246, 245, 0.78);
  color: var(--accent-deep);
}

.accounts-side-link-icon {
  font-size: 1rem;
}

.accounts-sidebar-head {
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.accounts-sidebar-head h4 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.2;
}

.accounts-drawer {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  z-index: 120;
}

.accounts-drawer.hidden {
  display: none;
}

.accounts-drawer-backdrop {
  background: rgba(24, 50, 52, 0.22);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.accounts-drawer-panel {
  height: 100%;
  overflow-y: auto;
  border-radius: 0;
  border-left: 1px solid rgba(182, 215, 217, 0.8);
  background: rgba(252, 255, 255, 0.98);
  padding: 24px 22px 28px;
}

.accounts-form {
  display: grid;
  gap: 18px;
}

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

.accounts-drawer-panel .input-block {
  gap: 10px;
}

.accounts-drawer-panel .input-block span {
  font-size: 0.92rem;
  font-weight: 700;
}

.accounts-drawer-panel .input-block input,
.accounts-drawer-panel .input-block textarea {
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.98rem;
}

.account-role-picker {
  position: relative;
}

.account-role-trigger {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-radius: 16px;
  border: 1px solid rgba(190, 222, 225, 0.95);
  background: rgba(255, 255, 255, 0.98);
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
  box-shadow: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.account-role-trigger:hover {
  border-color: rgba(38, 183, 189, 0.55);
}

.account-role-trigger:focus-visible,
.account-role-picker.is-open .account-role-trigger {
  outline: none;
  border-color: rgba(38, 183, 189, 0.88);
  box-shadow: 0 0 0 4px rgba(38, 183, 189, 0.14);
}

.account-role-trigger:disabled {
  color: rgba(37, 60, 61, 0.55);
  background: rgba(247, 251, 251, 0.96);
  cursor: not-allowed;
}

.account-role-caret {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 180ms ease;
}

.account-role-picker.is-open .account-role-caret {
  transform: rotate(-135deg) translateY(-1px);
}

.account-role-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  padding: 12px;
  display: grid;
  gap: 6px;
  border-radius: 24px;
  border: 1px solid rgba(191, 224, 226, 0.98);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 60px rgba(31, 65, 67, 0.16);
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 30;
}

.account-role-picker.is-open .account-role-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.account-role-option {
  width: 100%;
  min-height: 56px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  text-align: left;
}

.account-role-option:hover {
  background: rgba(244, 250, 250, 0.96);
}

.account-role-option.is-selected {
  background: rgba(223, 246, 245, 0.92);
  color: var(--accent-deep);
}

.account-role-option-check {
  width: 18px;
  color: transparent;
  font-size: 1rem;
  line-height: 1;
}

.account-role-option.is-selected .account-role-option-check {
  color: currentColor;
}

.accounts-drawer-panel .input-block textarea {
  min-height: 180px;
  padding-top: 14px;
  line-height: 1.65;
}

.accounts-enabled-check {
  height: 52px;
  margin-top: 34px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 16px;
  border: 1px solid rgba(182, 215, 217, 0.8);
  background: rgba(255, 255, 255, 0.82);
}

.accounts-enabled-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.account-note,
.account-feedback {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
}

.account-note {
  color: var(--muted);
}

.account-feedback {
  min-height: 24px;
  margin-bottom: 10px;
  color: var(--muted);
}

.account-feedback.is-error {
  color: var(--warning);
}

.account-feedback.is-success {
  color: var(--success);
}

.accounts-enabled-check span {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.accounts-sidebar-head .ghost-button,
.account-form-actions .secondary-button,
.account-form-actions .primary-button {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 999px;
  white-space: nowrap;
}

.account-form-actions {
  justify-content: flex-end;
  gap: 12px;
  margin-top: 4px;
}

.account-table {
  table-layout: fixed;
}

.account-table th:nth-child(1),
.account-table td:nth-child(1) {
  width: auto;
}

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

.account-table th:nth-child(3),
.account-table td:nth-child(3) {
  width: 120px;
  text-align: center;
}

.account-table th:nth-child(4),
.account-table td:nth-child(4) {
  width: 190px;
  text-align: center;
}

.account-table th:last-child,
.account-table td:last-child {
  width: 156px;
}

.account-table th:last-child {
  text-align: center;
}

.account-table td:last-child {
  text-align: center;
  padding-right: 14px;
}

.account-identity,
.account-matchers,
.account-time-meta {
  display: grid;
  gap: 6px;
}

.account-identity {
  min-width: 0;
  gap: 10px;
}

.account-identity strong {
  font-size: 0.98rem;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.account-identity span,
.account-matchers span,
.account-time-meta span {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
  word-break: break-word;
}

.account-matchers {
  gap: 4px;
}

.account-current-badge {
  min-height: 22px;
  padding: 0 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(223, 246, 245, 0.95);
  color: var(--accent-deep);
  font-size: 0.74rem;
  font-weight: 700;
}

.account-row-actions {
  justify-content: center;
  gap: 18px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.account-time-meta {
  justify-items: center;
  text-align: center;
}

.account-row-hint {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.account-empty-state {
  padding: 36px 0 !important;
  text-align: center;
  color: var(--muted);
}

.compact-only {
  margin-bottom: 16px;
}

.minimalist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.minimalist-head h3 {
  margin: 0;
  font-size: 2rem;
}

.single-line-title p,
.backend-page-copy,
.backend-sidebar-head p,
.backend-menu span,
.section-title-row p,
.template-editor-topbar-subtitle,
.editor-sidebar-head p,
.sidebar-section-head p,
.sign-unlock-copy p,
#sign-contract-subtitle,
.document-stage-head p,
#signature-panel-copy,
.signature-toolbox-empty p,
.upload-card small,
.login-kicker,
.login-method-text small,
.entry-help:empty,
#active-slot-status:empty,
#complete-summary:empty,
.template-editor-status:empty {
  display: none !important;
}

.template-center-layout {
  grid-template-columns: 240px minmax(0, 1fr);
}

.template-center-nav {
  top: 0;
}

.template-list-panel {
  gap: 18px;
}

.template-table th:last-child,
.template-table td:last-child {
  width: 220px;
}

.template-row-actions {
  justify-content: flex-start;
  gap: 16px;
}

.template-more-button {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: #fff;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.template-more-button:hover {
  border-color: rgba(15, 167, 164, 0.4);
  color: var(--accent-deep);
}

.template-row-title {
  gap: 14px;
}

.template-editor-topbar-actions .primary-button,
.template-editor-topbar-actions .ghost-button,
.workspace-topnav-right .ghost-button {
  min-height: 40px;
  border-radius: 10px;
  box-shadow: none;
}

.workspace-topnav-right .ghost-button,
.contracts-filter-actions .ghost-button,
.contracts-filter-actions .secondary-button {
  min-width: 112px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 0.98rem;
  font-weight: 700;
  box-shadow: none;
}

.template-editor-sidepanel .editor-sidebar-head,
.template-editor-sidepanel .sidebar-section-head {
  margin-bottom: 0;
}

@media (max-width: 1180px) {
  .workspace-topnav {
    padding: 14px 18px;
    flex-direction: column;
    align-items: flex-start;
  }

  .workspace-topnav-left,
  .workspace-topnav-right,
  .workspace-tabnav,
  .minimalist-head {
    width: 100%;
  }

  .workspace-tabnav {
    overflow: auto;
  }
}

@media (max-width: 920px) {
  .workspace-main {
    width: min(calc(100% - 24px), var(--max-width));
    padding: 12px 0 24px;
  }

  .accounts-layout,
  .template-center-layout {
    grid-template-columns: 1fr;
  }

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

  .accounts-toolbar,
  .accounts-toolbar-filters,
  .accounts-toolbar-primary {
    align-items: stretch;
    flex-direction: column;
  }

  .accounts-side-rail {
    position: static;
    margin-top: 0;
  }

  .account-table {
    table-layout: auto;
  }

  .accounts-drawer {
    grid-template-columns: 1fr;
  }

  .accounts-drawer-backdrop {
    display: none;
  }

  .accounts-drawer-panel {
    width: min(100%, 100vw);
    margin-left: auto;
  }

  .template-row-actions {
    gap: 10px;
  }
}

@media (max-width: 700px) {
  .accounts-enabled-check {
    margin-top: 0;
  }

  .accounts-form-grid {
    grid-template-columns: 1fr;
  }

  .accounts-sidebar-head {
    grid-template-columns: 1fr;
  }

  .accounts-sidebar-head .ghost-button,
  .account-form-actions .secondary-button,
  .account-form-actions .primary-button {
    width: 100%;
    justify-content: center;
  }

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


.template-upload-button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
}

.template-toolbar {
  flex-wrap: nowrap;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  gap: 0;
  padding: 8px 10px;
  scrollbar-width: none;
}

.template-toolbar::-webkit-scrollbar {
  display: none;
}

.template-toolbar-group {
  align-items: center;
  flex-wrap: nowrap;
  flex: 0 0 auto;
  gap: 6px;
}

.template-toolbar-group-icon {
  gap: 4px;
}

.template-tool {
  align-self: center;
  min-height: 34px;
  height: 34px;
  padding: 0 10px;
  border-radius: 6px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.template-tool-icon {
  min-width: 34px;
  padding: 0 8px;
}

.template-tool-compact {
  padding: 0 12px;
}

.template-editor-main .template-toolbar {
  flex-wrap: nowrap;
}

.template-more-menu-wrap {
  position: relative;
}

.template-more-menu-wrap.is-open {
  z-index: 180;
}

.template-more-button {
  min-width: 74px;
  height: 34px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 0;
  border: none;
  background: transparent;
  color: var(--accent-deep);
  font-size: 0.96rem;
  font-weight: 700;
}

.template-more-button span {
  font-size: 0.72rem;
}

.template-more-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 8px;
  display: none;
  border-radius: 12px;
  border: 1px solid rgba(182, 215, 217, 0.9);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 32px rgba(24, 50, 52, 0.14);
  z-index: 200;
}

.template-more-menu-wrap.is-open .template-more-menu {
  display: grid;
}

.template-more-menu-item {
  min-height: 38px;
  padding: 0 12px;
  text-align: left;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
}

.template-more-menu-item:hover {
  background: rgba(223, 246, 245, 0.9);
  color: var(--accent-deep);
}

@media (max-width: 920px) {
  .template-upload-button {
    width: 100%;
  }
}


.template-list-panel,
.template-table-wrap,
.template-table,
.template-table tbody,
.template-table tr,
.template-table td {
  overflow: visible;
}

.template-table-wrap {
  position: relative;
}

.template-row-actions {
  display: inline-flex;
  justify-content: flex-start;
  gap: 20px;
  align-items: center;
  flex-wrap: nowrap;
}

.template-action-link,
.template-more-button {
  height: auto;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--accent-deep);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1;
}

.template-action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.template-more-button {
  min-width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.template-more-button span {
  font-size: 0.62rem;
  transform: translateY(1px);
}

.template-more-menu-wrap {
  position: relative;
  z-index: 60;
}

.template-more-menu {
  top: calc(100% + 12px);
  bottom: auto;
  right: -8px;
  z-index: 200;
}

.backend-content,
.template-list-panel,
.template-table-wrap,
.template-table,
.template-table tbody,
.template-table tr,
.template-table td,
.template-table th {
  overflow: visible;
}

.template-editor-topbar-title {
  font-size: 1.7rem;
}

.template-editor-main {
  grid-template-rows: auto 1fr;
}

.contracts-workbench {
  display: grid;
  gap: 18px;
}

.contracts-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.contracts-filter-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.contracts-inline-filter {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.contracts-inline-filter span {
  font-weight: 600;
  color: var(--text);
}

.contracts-inline-filter select {
  min-width: 180px;
}

.contracts-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(177, 228, 223, 0.78), transparent 42%),
    linear-gradient(135deg, rgba(13, 58, 69, 0.98), rgba(24, 86, 98, 0.94));
  color: #effcf9;
}

.contracts-kicker {
  display: inline-flex;
  margin-bottom: 10px;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(239, 252, 249, 0.72);
}

.contracts-hero-copy h4 {
  margin: 0;
  font-size: 1.9rem;
  line-height: 1.15;
}

.contracts-hero-copy p {
  margin: 10px 0 0;
  max-width: 680px;
  color: rgba(239, 252, 249, 0.78);
}

.contracts-hero-actions {
  display: inline-flex;
  gap: 12px;
  flex-wrap: wrap;
}

.contracts-hero-actions .secondary-button {
  border-color: rgba(239, 252, 249, 0.26);
  color: #effcf9;
  background: rgba(255, 255, 255, 0.08);
}

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

.contract-metric-card {
  padding: 18px;
  border: 1px solid rgba(203, 229, 227, 0.92);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(243, 251, 251, 0.96));
  box-shadow: 0 18px 40px rgba(22, 64, 73, 0.08);
}

.contract-metric-card span,
.contract-detail-grid span,
.contract-next-action span,
.contracts-table-title span,
.contracts-date-cell span,
.contract-timeline-item span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.contract-metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
  line-height: 1;
}

.contract-metric-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.contracts-toolbar {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.contracts-toolbar-main {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.contracts-search-block input {
  padding-left: 16px;
}

.contracts-toolbar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.contracts-result-copy {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.contracts-result-copy strong {
  font-size: 1.6rem;
  color: var(--accent-deep);
}

.contracts-result-copy span {
  color: var(--muted);
}

.contracts-reset-button {
  min-width: auto;
}

.contracts-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 360px;
  gap: 18px;
  align-items: start;
}

.contracts-table-panel,
.contract-detail-card,
.contract-timeline-card {
  padding: 18px;
}

.contracts-table-head-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

.contracts-table-wrap {
  overflow: auto;
  border: 1px solid rgba(218, 236, 236, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
}

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

.contracts-table th,
.contracts-table td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid rgba(222, 237, 237, 0.94);
  vertical-align: middle;
}

.contracts-table thead th {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(242, 249, 249, 0.92);
}

.contracts-table tbody tr {
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.contracts-table tbody tr:hover,
.contracts-table tbody tr.is-selected {
  background: rgba(230, 247, 246, 0.92);
}

.contracts-table tbody tr.is-selected {
  box-shadow: inset 3px 0 0 var(--accent);
}

.contracts-table-title {
  display: grid;
  gap: 6px;
}

.contracts-table-title strong,
.contracts-date-cell strong {
  display: block;
}

.contracts-table-party {
  margin-top: 10px;
  color: var(--text);
  font-weight: 600;
}

.contracts-status-stack {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.contracts-priority-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
}

.priority-高 {
  color: #9b2c2c;
  background: rgba(255, 224, 224, 0.95);
}

.priority-中 {
  color: #9a6700;
  background: rgba(255, 240, 206, 0.98);
}

.priority-低 {
  color: #17664f;
  background: rgba(219, 244, 236, 0.98);
}

.contracts-progress-cell {
  display: grid;
  gap: 10px;
  min-width: 132px;
}

.contract-progress-card {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid rgba(214, 235, 234, 0.94);
  border-radius: 16px;
  background: rgba(247, 251, 251, 0.96);
}

.contract-progress-copy {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.contract-progress-copy strong {
  font-size: 1.3rem;
  color: var(--accent-deep);
}

.contract-progress-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(196, 221, 220, 0.72);
  overflow: hidden;
}

.contract-progress-bar.compact {
  height: 8px;
}

.contract-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #54b9ab);
}

.contracts-date-cell {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.contracts-row-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

.contracts-sidepanel {
  display: grid;
  gap: 18px;
}

.contract-detail-panel {
  display: grid;
  gap: 18px;
}

.contract-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.contract-detail-head strong {
  display: block;
  color: var(--accent-deep);
}

.contract-detail-head h5 {
  margin: 8px 0 0;
  font-size: 1.26rem;
  line-height: 1.3;
}

.contract-detail-summary {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

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

.contract-detail-grid div,
.contract-next-action {
  padding: 14px;
  border: 1px solid rgba(218, 236, 236, 0.96);
  border-radius: 16px;
  background: rgba(250, 253, 253, 0.98);
}

.contract-detail-grid strong,
.contract-next-action strong {
  display: block;
  margin-top: 8px;
  line-height: 1.5;
}

.contract-tag-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.contract-tag-list span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(226, 244, 243, 0.92);
  color: var(--accent-deep);
  font-size: 0.8rem;
  font-weight: 700;
}

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

.contract-timeline {
  display: grid;
  gap: 16px;
}

.contract-timeline-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.contract-timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), #54b9ab);
  box-shadow: 0 0 0 5px rgba(129, 207, 196, 0.18);
}

.contract-timeline-item strong {
  display: block;
  margin-bottom: 4px;
}

.contract-timeline-item p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.contracts-empty {
  margin-top: 14px;
  padding: 18px;
  border: 1px dashed rgba(193, 219, 218, 0.98);
  border-radius: 18px;
  text-align: center;
  color: var(--muted);
  background: rgba(248, 252, 252, 0.94);
}

.contracts-empty strong {
  display: block;
  color: var(--text);
}

.contracts-empty p {
  margin: 8px 0 0;
}

.contracts-link-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 16px;
}

.contracts-link-modal.hidden {
  display: none;
}

.contracts-link-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 28, 33, 0.48);
}

.contracts-link-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  padding: 20px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(208, 228, 228, 0.96);
  box-shadow: 0 28px 56px rgba(18, 52, 59, 0.18);
  display: grid;
  gap: 18px;
}

.contracts-detail-modal-panel {
  width: min(1100px, calc(100vw - 32px));
  max-height: none;
  overflow: visible;
  grid-template-rows: auto auto;
  margin: 0 auto;
}

#contracts-detail-modal {
  place-items: start center;
  overflow-y: auto;
  overflow-x: hidden;
}

.contracts-create-modal-panel {
  width: min(640px, calc(100vw - 32px));
}

.contracts-create-template-list {
  display: grid;
  gap: 12px;
}

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

.contracts-create-selected-template {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid rgba(208, 228, 228, 0.96);
  background: rgba(248, 252, 252, 0.96);
}

.contracts-create-selected-template strong {
  font-size: 1rem;
  color: var(--text);
}

.contracts-create-selected-template span {
  color: var(--muted);
  line-height: 1.6;
}

.contracts-create-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.contracts-preview-shell {
  display: block;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: visible;
  padding-right: 4px;
}

.contracts-preview-frame {
  max-width: 980px;
}

.contracts-preview-surface {
  min-height: auto;
  padding: 24px;
  display: grid;
  gap: 24px;
  background: linear-gradient(180deg, rgba(246, 252, 252, 0.98), rgba(234, 245, 245, 0.98));
}

.contracts-preview-meta {
  display: grid;
  gap: 14px;
}

.contracts-preview-head strong {
  display: block;
  color: var(--accent-deep);
  font-size: 1.1rem;
}

.contracts-preview-head h5 {
  margin: 10px 0 0;
  font-size: 1.9rem;
  line-height: 1.2;
}

.contracts-preview-head span {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 1rem;
}

.contracts-preview-subhead {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
}

.contracts-preview-pages {
  display: grid;
  gap: 28px;
}

.contracts-preview-paper {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
}

.contracts-template-option {
  width: 100%;
  padding: 16px 18px;
  display: grid;
  gap: 10px;
  text-align: left;
  border: 1px solid rgba(208, 228, 228, 0.96);
  border-radius: 16px;
  background: rgba(248, 252, 252, 0.96);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.contracts-template-option:hover {
  border-color: rgba(15, 167, 164, 0.36);
  background: rgba(223, 246, 245, 0.88);
  box-shadow: 0 12px 24px rgba(15, 167, 164, 0.08);
}

.contracts-template-option-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.contracts-template-option-head strong {
  font-size: 1rem;
  color: var(--text);
}

.contracts-template-option-meta {
  color: var(--muted);
  font-size: 0.84rem;
}

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

.contracts-link-modal-head h4 {
  margin: 0;
}

.contracts-link-modal-close {
  min-width: auto;
}

.contracts-link-modal-body {
  display: grid;
  gap: 12px;
}

.contracts-link-row {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(214, 234, 234, 0.94);
  background: rgba(247, 251, 251, 0.96);
}

.contracts-link-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.contracts-link-row strong {
  line-height: 1.6;
  word-break: break-all;
}

.contracts-link-anchor {
  color: var(--accent-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.contracts-link-anchor:hover {
  color: var(--accent);
}

.contract-pdf-export-shell {
  position: fixed;
  left: 0;
  top: 0;
  width: 794px;
  padding: 0;
  background: #ffffff;
  opacity: 0.01;
  pointer-events: none;
  z-index: -1;
}

.contract-pdf-export-surface {
  width: 794px;
  background: #ffffff;
}

.contract-pdf-export-paper {
  width: 794px;
  min-height: 1123px;
  margin: 0;
  padding: 52px 56px 64px;
  border-radius: 0;
  box-shadow: none;
  page-break-after: always;
  break-after: page;
}

.contract-pdf-export-paper:last-child {
  page-break-after: auto;
  break-after: auto;
}

body[data-page="contracts"] .backend-content {
  background:
    radial-gradient(circle at top right, rgba(208, 240, 236, 0.54), transparent 22%),
    rgba(248, 252, 252, 0.95);
}

@media (max-width: 920px) {
  .template-row-actions {
    gap: 14px;
  }

  .contracts-hero,
  .contracts-toolbar-meta,
  .contract-detail-head,
  .contract-progress-copy,
  .contracts-link-modal-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .contracts-metrics,
  .contract-detail-grid,
  .contract-detail-actions {
    grid-template-columns: 1fr 1fr;
  }

  .contracts-toolbar-main,
  .contracts-layout {
    grid-template-columns: 1fr;
  }

  .contracts-sidepanel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .contracts-hero {
    padding: 18px;
  }

  .contracts-hero-copy h4 {
    font-size: 1.5rem;
  }

  .contracts-metrics,
  .contract-detail-grid,
  .contract-detail-actions {
    grid-template-columns: 1fr;
  }

  .contracts-row-actions {
    gap: 10px;
  }

  .contracts-table th,
  .contracts-table td {
    padding: 14px 12px;
  }
}

.template-preview-frame {
  max-width: 980px;
  margin: 0 auto;
}

.template-preview-surface {
  position: relative;
  min-height: 1160px;
  background: #fff;
  border: 1px solid rgba(226, 236, 237, 0.96);
  box-shadow: 0 8px 20px rgba(28, 58, 67, 0.08);
  overflow: hidden;
}

.template-preview-surface.is-placing {
  cursor: crosshair;
}

.template-preview-surface.is-dragover {
  box-shadow: 0 0 0 2px rgba(15, 167, 164, 0.22), 0 8px 20px rgba(28, 58, 67, 0.08);
}

#template-editor.template-editor {
  position: relative;
  min-height: 1160px;
  padding: 56px 72px 84px;
  background: #fff;
  line-height: 1.75;
}

#template-editor.template-editor h1,
#template-editor.template-editor h2,
#template-editor.template-editor h3,
#template-editor.template-editor h4,
#template-editor.template-editor h5,
#template-editor.template-editor h6 {
  color: var(--text);
}

#template-editor.template-editor .sign-contract-name {
  margin-top: 0;
  margin-bottom: 28px;
  font-size: clamp(1.3rem, 2.2vw, 1.9rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 800;
}

#template-editor.template-editor .sign-section-heading {
  margin-top: 40px;
  margin-bottom: 18px;
  font-size: clamp(0.82rem, 1.5vw, 1.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 800;
}

#template-editor.template-editor p,
#template-editor.template-editor li {
  color: var(--text);
}

.template-annotation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.template-annotation {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 132px;
  max-width: 220px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(182, 215, 217, 0.95);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(22, 48, 51, 0.14);
  text-align: left;
  pointer-events: auto;
  cursor: grab;
}

.template-annotation strong,
.template-annotation span {
  display: block;
}

.template-annotation strong {
  font-size: 0.9rem;
  color: var(--text);
}

.template-annotation span {
  margin-top: 4px;
  font-size: 0.76rem;
  color: var(--muted);
}

.template-annotation-field {
  border-color: rgba(132, 201, 198, 0.95);
  background: rgba(239, 251, 250, 0.96);
}

.template-annotation-signature {
  border-color: rgba(239, 212, 167, 0.95);
  background: rgba(255, 248, 238, 0.98);
}

.template-annotation.is-selected {
  box-shadow: 0 0 0 2px rgba(15, 167, 164, 0.24), 0 10px 24px rgba(22, 48, 51, 0.14);
}

.component-chip.is-active {
  border-color: rgba(15, 167, 164, 0.7);
  background: rgba(223, 246, 245, 1);
  box-shadow: 0 10px 24px rgba(15, 167, 164, 0.14);
}

.template-bound-field {
  padding: 0 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: box-shadow 0.2s ease, background 0.2s ease;
}

.template-bound-field-field {
  background: rgba(255, 241, 153, 0.55);
  box-shadow: inset 0 -1px 0 rgba(201, 168, 52, 0.45);
}

.template-bound-field-signature {
  background: rgba(191, 236, 233, 0.7);
  box-shadow: inset 0 -1px 0 rgba(15, 167, 164, 0.42);
}

.template-bound-field:hover {
  box-shadow: 0 0 0 2px rgba(15, 167, 164, 0.14);
}

.template-letterhead-block {
  margin: 0 0 32px;
  padding: 0;
}

.sign-document-paper .template-letterhead-block {
  margin-bottom: 56px;
}

.sign-document-paper .sign-letterhead-block {
  margin-bottom: 56px;
}

.template-letterhead-image {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

body[data-page="sign"] {
  overflow-x: hidden;
}

.sign-shell {
  width: min(calc(100% - 40px), 1600px);
  margin: 0 auto;
  padding: 28px 0 36px;
}

.sign-unlock {
  min-height: calc(100dvh - 56px);
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.sign-unlock-card {
  width: min(100%, 760px);
  padding: 40px;
  display: grid;
  gap: 24px;
  border-radius: 32px;
  border: 1px solid rgba(206, 225, 227, 0.95);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 24px 56px rgba(28, 62, 66, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sign-unlock-copy {
  display: grid;
  gap: 14px;
}

.sign-unlock-copy h1 {
  margin: 0;
  font-size: clamp(1.5rem, 2.4vw, 2.1rem);
  line-height: 0.94;
  letter-spacing: -0.05em;
  color: var(--text);
}

.sign-unlock-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.sign-unlock-grid .input-block {
  margin: 0;
}

.sign-unlock-grid .primary-button {
  min-width: 180px;
  min-height: 56px;
}

.sign-unlock-meta {
  display: none;
}

.sign-unlock-meta .document-badge {
  min-height: 40px;
  padding: 0 16px;
  font-size: 0.96rem;
}

.sign-workspace {
  display: grid;
  gap: 20px;
}

.sign-topbar {
  padding: 22px 24px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, auto) minmax(240px, auto);
  align-items: center;
  gap: 20px;
  border-radius: 28px;
  border: 1px solid rgba(206, 225, 227, 0.95);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 48px rgba(28, 62, 66, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.sign-topbar-brand {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.sign-close {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid rgba(182, 215, 217, 0.84);
  background: rgba(248, 252, 252, 0.96);
  color: var(--accent-deep);
  text-decoration: none;
  font-size: 1.7rem;
  line-height: 1;
}

.sign-topbar-brand strong {
  display: block;
  font-size: clamp(0.78rem, 1.2vw, 1rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sign-stepper {
  min-width: 0;
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.sign-step {
  min-height: 62px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 18px;
  border: 1px solid rgba(182, 215, 217, 0.82);
  background: rgba(248, 252, 252, 0.95);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.sign-step span {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(223, 246, 245, 0.95);
  color: var(--accent-deep);
}

.sign-step strong {
  font-size: 1rem;
}

.sign-step.is-active {
  border-color: rgba(15, 167, 164, 0.28);
  background: linear-gradient(135deg, rgba(223, 246, 245, 0.98), rgba(234, 248, 247, 0.96));
  color: var(--accent-deep);
  box-shadow: 0 14px 28px rgba(15, 167, 164, 0.12);
}

.sign-step.is-complete {
  border-color: rgba(15, 167, 164, 0.2);
  background: rgba(248, 252, 252, 0.96);
  color: var(--accent-deep);
}

.sign-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.sign-topbar-actions .primary-button {
  min-width: 190px;
}

.sign-layout {
  min-height: calc(100dvh - 170px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.sign-sidebar,
.document-stage,
.signature-sidebar {
  min-width: 0;
  border-radius: 28px;
  border: 1px solid rgba(206, 225, 227, 0.95);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 42px rgba(28, 62, 66, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.sign-sidebar,
.signature-sidebar {
  padding: 20px;
  position: sticky;
  top: 20px;
}

.sign-sidebar {
  display: none;
}

.sign-sidebar-head,
.signature-sidebar-head,
.document-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sign-sidebar-head strong,
.signature-sidebar-head strong,
.document-stage-head strong {
  font-size: 1.25rem;
}

.page-thumbnails,
.signature-slot-list {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.document-stage {
  padding: 20px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
  min-height: calc(100dvh - 170px);
}

.document-zoom {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.document-zoom .ghost-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
}

.document-zoom span {
  min-width: 54px;
  text-align: center;
  font-size: 1.5rem;
  color: var(--text);
}

.document-viewport {
  min-height: 0;
  max-height: calc(100dvh - 270px);
  padding: 28px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(246, 252, 252, 0.98), rgba(234, 245, 245, 0.98));
  overflow: auto;
}

.document-stack {
  display: grid;
  gap: 36px;
  align-content: start;
  justify-items: center;
  transform: scale(var(--sign-document-scale, 1));
  transform-origin: top center;
  padding-bottom: 8px;
}

.signature-sidebar {
  display: grid;
  gap: 18px;
  max-height: calc(100dvh - 170px);
  overflow-y: auto;
  overflow-x: hidden;
}

.signature-toolbox,
.sign-complete-card {
  min-width: 0;
  padding: 18px;
  border-radius: 22px;
  border: 1px solid rgba(206, 225, 227, 0.92);
  background: rgba(248, 252, 252, 0.92);
  overflow: hidden;
}

.signature-toolbox-content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.signature-slot-meta {
  display: grid;
  gap: 8px;
}

.required-chip {
  width: fit-content;
}

.canvas-card,
.upload-card,
.signature-toolbox-empty {
  min-width: 0;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(206, 225, 227, 0.92);
  background: rgba(255, 255, 255, 0.96);
  overflow: hidden;
}

.upload-card,
.signature-actions {
  display: grid;
  gap: 10px;
}

.upload-card input {
  width: 100%;
  min-width: 0;
}

#signature-pad {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px dashed rgba(182, 215, 217, 0.95);
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

.alert-banner {
  width: 100%;
}

@media (max-width: 1380px) {
  .sign-topbar {
    grid-template-columns: 1fr;
  }

  .sign-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
  }
}

@media (max-width: 1040px) {
  .sign-shell {
    width: min(calc(100% - 24px), 1600px);
    padding: 16px 0 24px;
  }

  .sign-unlock-card {
    padding: 28px 24px;
    border-radius: 24px;
  }

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

  .signature-sidebar {
    position: static;
    max-height: none;
  }

  .document-viewport {
    max-height: none;
    padding: 16px;
  }

  .sign-document-paper {
    padding: 38px 28px 48px;
  }
}

@media (max-width: 720px) {
  .sign-unlock {
    min-height: auto;
    padding: 10px 0 18px;
  }

  .sign-unlock-card {
    padding: 22px 18px;
    gap: 18px;
  }

  .sign-unlock-copy h1 {
    font-size: clamp(1.8rem, 9vw, 2.4rem);
  }

  .sign-unlock-grid {
    grid-template-columns: 1fr;
  }

  .sign-unlock-grid .primary-button {
    width: 100%;
  }

  .sign-topbar,
  .sign-sidebar,
  .document-stage,
  .signature-sidebar {
    border-radius: 22px;
  }

  .sign-stepper {
    grid-template-columns: 1fr;
  }

  .sign-step {
    justify-content: flex-start;
  }

  .sign-topbar-actions {
    justify-content: stretch;
  }

  .sign-topbar-actions .primary-button {
    width: 100%;
  }

  .document-stage-head,
  .sign-sidebar-head,
  .signature-sidebar-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-zoom span {
    font-size: 1.15rem;
  }
}

.sign-document-paper {
  width: min(100%, 794px);
  min-height: 1123px;
  margin: 0 auto;
  padding: 56px 52px 72px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 28px 58px rgba(42, 84, 86, 0.09);
}

.sign-document-success {
  width: min(100%, 560px);
  min-height: 480px;
  margin: 40px auto;
  padding: 48px 36px;
  display: grid;
  place-items: center;
  gap: 18px;
  text-align: center;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 24px 56px rgba(28, 62, 66, 0.08);
}

.sign-document-success-icon {
  width: 88px;
  height: 88px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #26b7b1, #79d6d2);
  color: #fff;
  font-size: 2.4rem;
  font-weight: 800;
}

.sign-document-success strong {
  font-size: 2rem;
  color: var(--text);
  letter-spacing: -0.04em;
}

.sign-document-success p {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.sign-document-paper .sign-contract-name {
  margin-top: 0;
  margin-bottom: 28px;
  font-size: clamp(1.3rem, 2.2vw, 1.9rem);
  line-height: 0.95;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: var(--text);
}

.sign-document-paper .sign-contract-name-after-letterhead {
  margin-top: 36px;
}

.sign-document-paper .sign-section-heading {
  margin-top: 40px;
  margin-bottom: 18px;
  font-size: clamp(0.82rem, 1.5vw, 1.2rem);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 800;
  color: var(--text);
}

.sign-document-paper ol,
.sign-document-paper ul {
  margin: 0 0 22px 30px;
  padding: 0;
}

.sign-document-paper li + li {
  margin-top: 10px;
}

.sign-document-paper li.sign-list-continuation {
  list-style: none;
}

.page-thumbnail {
  width: 100%;
  padding: 12px 14px;
  display: grid;
  gap: 10px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(182, 215, 217, 0.76);
  background: rgba(255, 255, 255, 0.96);
  overflow: hidden;
}

.page-thumbnail.is-active {
  border-color: rgba(15, 167, 164, 0.42);
  background: rgba(223, 246, 245, 0.9);
}

.page-thumbnail span {
  color: var(--muted);
  font-size: 0.76rem;
}

.page-thumbnail strong {
  font-size: 0.95rem;
}

.page-thumbnail-preview {
  height: 168px;
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(240, 248, 248, 0.98), rgba(232, 244, 244, 0.96));
  overflow: hidden;
}

.page-thumbnail-paper {
  width: 794px;
  padding: 28px 32px;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  transform: scale(0.17);
  transform-origin: top left;
  box-shadow: 0 6px 16px rgba(42, 84, 86, 0.08);
  pointer-events: none;
}

.page-thumbnail-paper > :first-child {
  margin-top: 0;
}

.page-thumbnail-paper > :last-child {
  margin-bottom: 0;
}

.sign-measure-host {
  position: absolute;
  left: -99999px;
  top: 0;
  width: 794px;
  visibility: hidden;
  pointer-events: none;
}

.sign-document-paper-measure {
  box-shadow: none;
}

.signature-slot-item {
  width: 100%;
  padding: 12px 14px;
  display: grid;
  gap: 4px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid rgba(182, 215, 217, 0.72);
  background: rgba(255, 255, 255, 0.96);
}

.signature-slot-item.is-active {
  border-color: rgba(15, 167, 164, 0.52);
  background: rgba(223, 246, 245, 0.9);
}

.signature-slot-item.is-complete {
  border-color: rgba(228, 190, 118, 0.8);
  background: rgba(255, 249, 239, 0.96);
}

.signature-slot-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.sign-template-field {
  padding: 0 4px;
  border-radius: 6px;
  cursor: pointer;
}

.sign-template-field-text {
  background: rgba(255, 241, 153, 0.55);
  box-shadow: inset 0 -1px 0 rgba(201, 168, 52, 0.45);
}

.sign-template-field-signature {
  background: rgba(191, 236, 233, 0.7);
  box-shadow: inset 0 -1px 0 rgba(15, 167, 164, 0.42);
}

.sign-template-field.is-filled {
  background: rgba(223, 246, 245, 0.85);
}

.sign-template-field.is-editing {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 2px rgba(15, 167, 164, 0.18);
}

.sign-template-inline-input {
  min-width: 160px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid rgba(15, 167, 164, 0.35);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.sign-template-field-value {
  font-weight: 600;
  color: var(--text);
}

.sign-template-signature-done {
  color: var(--accent-deep);
}

.sign-template-signature-image {
  display: inline-block;
  max-width: 180px;
  max-height: 72px;
  object-fit: contain;
  vertical-align: middle;
}

.sign-page-block {
  display: flow-root;
}
