:root {
  color-scheme: light;
  --ink: #17252d;
  --ink-soft: #314750;
  --muted: #66757b;
  --line: #dce5e2;
  --line-strong: #b9c9c4;
  --paper: #ffffff;
  --canvas: #f6f8f7;
  --wash: #edf5f2;
  --navy: #14313d;
  --teal: #1b8a6f;
  --teal-dark: #12624f;
  --blue: #2f6f9f;
  --amber: #b7791f;
  --coral: #e86f51;
  --red: #b42318;
  --green-wash: #e6f4ef;
  --blue-wash: #e7f0f5;
  --amber-wash: #fff5db;
  --red-wash: #fff0ed;
  --shadow-sm: 0 1px 2px rgba(20, 49, 61, 0.08);
  --shadow-md: 0 16px 40px rgba(20, 49, 61, 0.12);
  --radius: 8px;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(237, 245, 242, 0.7), rgba(246, 248, 247, 0) 420px),
    var(--canvas);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

body.is-public {
  background:
    linear-gradient(90deg, rgba(20, 49, 61, 0.82), rgba(20, 49, 61, 0.32)),
    url("/static/img/signtime-hero.png") center / cover fixed no-repeat;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  color: var(--teal-dark);
}

.icon {
  width: 1.05em;
  height: 1.05em;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.site-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(220, 229, 226, 0.85);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.is-public .site-nav {
  border-bottom-color: rgba(255, 255, 255, 0.18);
  background: rgba(20, 49, 61, 0.58);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.is-public .brand,
.is-public .nav-link,
.is-public .logout-button,
.is-public .nav-user {
  color: #fff;
}

.brand-mark {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--navy);
  box-shadow: var(--shadow-sm);
}

.brand-mark img {
  width: 38px;
  height: 38px;
  display: block;
}

.brand-text {
  font-size: 1.06rem;
}

.nav-link,
.logout-button {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  min-height: 38px;
  padding: 0.42rem 0.58rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font: inherit;
  font-size: 0.94rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover,
.logout-button:hover {
  background: rgba(27, 138, 111, 0.1);
  color: var(--teal-dark);
}

.is-public .nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-spacer {
  flex: 1;
}

.nav-user {
  color: var(--muted);
  font-size: 0.9rem;
}

.app-main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.public-main {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 68px);
  margin: 0 auto;
  padding: 52px 0;
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: center;
  gap: 56px;
}

.auth-hero {
  max-width: 640px;
  color: #fff;
}

.hero-kicker,
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0 0 0.85rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-hero .hero-kicker {
  color: #bde8dc;
}

.auth-hero h1,
.dashboard-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: 4.6rem;
  line-height: 0.98;
  letter-spacing: 0;
}

.auth-hero p,
.dashboard-hero p {
  max-width: 600px;
  margin: 1.25rem 0 0;
  font-size: 1.05rem;
}

.auth-hero p {
  color: rgba(255, 255, 255, 0.84);
}

.hero-stat-row {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.hero-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.48rem 0.7rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.85rem;
}

.auth-card,
.card,
.panel,
.how-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
}

.auth-card,
.card {
  padding: 28px;
}

.auth-card {
  box-shadow: var(--shadow-md);
}

.card {
  max-width: 520px;
  margin: 0 auto;
}

.card.wide {
  max-width: 760px;
}

.panel {
  padding: 22px;
}

a.panel {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

a.panel:hover {
  border-color: var(--line-strong);
  color: var(--ink);
  transform: translateY(-1px);
  transition: transform 120ms ease, border-color 120ms ease;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 24px;
}

.page-header h1,
.page-header h2,
.auth-card h1,
.card h1,
.panel h2 {
  margin: 0;
  line-height: 1.1;
}

.page-subtitle,
.muted,
.hint,
.meta {
  color: var(--muted);
}

.page-subtitle {
  margin: 0.45rem 0 0;
  font-size: 0.95rem;
}

.dashboard-hero {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  margin: -6px 0 28px;
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, rgba(20, 49, 61, 0.86), rgba(20, 49, 61, 0.34)),
    url("/static/img/signtime-hero.png") center / cover no-repeat;
  color: #fff;
}

.dashboard-hero-content {
  max-width: 760px;
  padding: 46px;
}

.dashboard-hero p {
  color: rgba(255, 255, 255, 0.84);
}

.dashboard-hero .btn-secondary {
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.hero-actions,
.action-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.48rem;
  min-height: 40px;
  padding: 0.62rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--navy);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  background: #0f252f;
  color: #fff;
}

.btn:disabled {
  border-color: var(--line);
  background: #d8dfdc;
  color: #768680;
  cursor: not-allowed;
}

.btn-primary,
.btn-success {
  background: var(--teal);
}

.btn-primary:hover,
.btn-success:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--wash);
  color: var(--ink);
}

.btn-danger {
  background: var(--red);
}

.btn-danger:hover {
  background: #851b13;
}

.btn-sm {
  min-height: 34px;
  padding: 0.46rem 0.72rem;
  font-size: 0.86rem;
}

.icon-button,
.ghost-button,
.remove-btn,
.link-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  text-decoration: none;
}

.icon-button {
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink-soft);
}

.icon-button:hover,
.ghost-button:hover,
.link-button:hover {
  color: var(--teal-dark);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 28px 0 12px;
  font-size: 1.05rem;
}

.surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.surface-pad {
  padding: 18px;
}

.grid-2,
.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.how-card {
  padding: 18px;
}

.how-card h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.65rem;
  font-size: 0.98rem;
}

.how-card ol {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

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

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

th,
td {
  padding: 0.78rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.94rem;
}

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

th {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0.18rem 0.55rem;
  border-radius: 6px;
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.badge-ADMIN,
.badge-env-SENT,
.badge-r-VIEWED {
  background: var(--blue-wash);
  color: #245d7c;
}

.badge-SENDER,
.badge-env-COMPLETED,
.badge-r-COMPLETED {
  background: var(--green-wash);
  color: var(--teal-dark);
}

.badge-MEMBER,
.badge-env-DRAFT,
.badge-env-EXPIRED,
.badge-r-PENDING {
  background: #eef2f1;
  color: var(--ink-soft);
}

.badge-env-IN_PROGRESS {
  background: var(--amber-wash);
  color: var(--amber);
}

.badge-env-VOIDED,
.badge-r-DECLINED {
  background: var(--red-wash);
  color: var(--red);
}

.inactive {
  color: #9aa7a3;
}

.alert {
  margin-bottom: 1.1rem;
  padding: 0.82rem 1rem;
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.alert-error {
  border: 1px solid #fac8bf;
  background: var(--red-wash);
  color: var(--red);
}

.alert-success {
  border: 1px solid #b9dfd4;
  background: var(--green-wash);
  color: var(--teal-dark);
}

label {
  display: block;
  margin-top: 1rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 720;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="number"],
select {
  display: block;
  width: 100%;
  min-height: 42px;
  margin-top: 0.32rem;
  padding: 0.58rem 0.72rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input[type="file"] {
  display: block;
  width: 100%;
  margin-top: 0.45rem;
  padding: 0.7rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink-soft);
}

input:focus,
select:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(27, 138, 111, 0.24);
  outline-offset: 2px;
}

.form-section {
  max-width: 820px;
}

.form-section h2 {
  margin: 1.8rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--line);
  font-size: 1.05rem;
}

.recipient-row,
.recipient-header {
  display: grid;
  grid-template-columns: 1fr 1.4fr 132px 78px 42px;
  gap: 0.55rem;
  align-items: center;
}

.recipient-row {
  margin-bottom: 0.55rem;
}

.recipient-header {
  margin-bottom: 0.35rem;
}

.recipient-header span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.remove-btn {
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--red);
}

.tier-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}

.tier-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
}

.tier-option:has(input:checked) {
  border-color: var(--teal);
  background: var(--green-wash);
  box-shadow: 0 0 0 3px rgba(27, 138, 111, 0.1);
}

.tier-option small {
  display: block;
  margin-top: 0.22rem;
  color: var(--muted);
  font-weight: 500;
}

.fields-layout,
.sign-layout {
  display: flex;
  align-items: flex-start;
  gap: 20px;
}

.sidebar,
.sig-col {
  flex: 0 0 300px;
}

.pdf-col {
  flex: 1 1 0;
  min-width: 0;
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

#pdf-canvas {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

#sig-canvas {
  display: block;
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  cursor: crosshair;
}

.recipient-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  margin-bottom: 0.55rem;
  padding: 0.65rem 0.72rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.recipient-btn.active {
  border-color: var(--color);
  background: var(--color-bg);
  font-weight: 760;
}

.color-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
}

.empty-state,
.done-state {
  max-width: 620px;
  margin: 48px auto;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.done-icon {
  display: inline-grid;
  width: 64px;
  height: 64px;
  place-items: center;
  margin-bottom: 1rem;
  border-radius: 50%;
  background: var(--green-wash);
  color: var(--teal);
}

.verdict {
  padding: 1.5rem;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.verdict-ok {
  border: 1px solid #9bd2c2;
  background: var(--green-wash);
}

.verdict-fail {
  border: 1px solid #fac8bf;
  background: var(--red-wash);
}

.verdict-visual {
  border: 1px solid var(--line-strong);
  background: #fff;
}

details.surface > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1rem;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

details.surface > summary::-webkit-details-marker {
  display: none;
}

code {
  padding: 0.14rem 0.35rem;
  border-radius: 5px;
  background: #eef2f1;
  color: var(--ink-soft);
  font-size: 0.86em;
}

@media (max-width: 860px) {
  .nav-inner {
    width: min(100% - 24px, 1180px);
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.55rem 0;
  }

  .nav-spacer {
    display: none;
  }

  .app-main,
  .public-main {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .auth-shell {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .auth-hero h1,
  .dashboard-hero h1 {
    font-size: 2.45rem;
  }

  .dashboard-hero-content {
    padding: 28px;
  }

  .page-header,
  .fields-layout,
  .sign-layout {
    flex-direction: column;
  }

  .sidebar,
  .sig-col {
    width: 100%;
    flex-basis: auto;
  }

  .recipient-row,
  .recipient-header {
    grid-template-columns: 1fr;
  }

  .recipient-header {
    display: none;
  }
}
