.agreement-app {
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

.agreement-app .agreement-topbar {
  padding-right: max(5vw, 34px);
}

.agreement-nav {
  display: flex;
  gap: 22px;
  color: rgba(255, 250, 243, 0.78);
  font-size: 0.9rem;
  font-weight: 800;
}

.agreement-nav a:hover,
.agreement-contact:hover {
  color: var(--white);
}

.agreement-contact {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 250, 243, 0.3);
  border-radius: var(--radius);
  padding: 0 16px;
  color: var(--white);
  font-size: 0.9rem;
  font-weight: 800;
}

.dashboard-main {
  width: min(1240px, 92vw);
  margin: 0 auto;
  padding: 130px 0 72px;
}

.agreement-eyebrow {
  display: block;
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.dashboard-intro {
  max-width: 760px;
  margin-bottom: 46px;
}

.dashboard-intro h1 {
  margin: 0 0 18px;
  font-size: clamp(2.5rem, 5vw, 4.6rem);
  line-height: 0.98;
}

.dashboard-intro p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.7;
}

.auth-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 30px);
  background: var(--white);
}

.admin-auth {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 30px;
}

.admin-auth h2,
.client-access h1 {
  margin: 0 0 12px;
  font-size: clamp(1.38rem, 2.2vw, 1.8rem);
  line-height: 1.16;
}

.admin-auth p,
.client-access p {
  margin: 0;
  color: var(--muted);
  line-height: 1.62;
}

.auth-actions {
  display: grid;
  gap: 10px;
  min-width: 245px;
}

.auth-actions .button {
  width: 100%;
}

.auth-actions .button[hidden] {
  display: none;
}

.admin-login-form {
  display: grid;
  gap: 12px;
}

.admin-login-form[hidden] {
  display: none;
}

.admin-login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-login-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 13px;
  color: var(--ink);
  background: #fffdf9;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 650;
  text-transform: none;
}

.admin-login-form input:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(201, 154, 72, 0.17);
}

.admin-login-form input[readonly] {
  color: var(--muted);
  background: #f4ece1;
}

.password-reset {
  justify-self: end;
  border: 0;
  padding: 2px 0;
  color: var(--red);
  background: transparent;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.login-divider {
  position: relative;
  height: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 8px;
  text-align: center;
}

.login-divider span {
  position: relative;
  top: 9px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--white);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-message {
  min-height: 21px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}

.metric {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--white);
}

.metric span {
  display: block;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.metric strong {
  font-size: clamp(1.36rem, 2.3vw, 2rem);
  line-height: 1;
}

.dashboard-workspace {
  display: grid;
  grid-template-columns: minmax(450px, 1fr) 370px;
  align-items: start;
  gap: 20px;
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(22px, 3vw, 30px);
  background: var(--white);
}

.panel-heading {
  margin-bottom: 28px;
}

.admin-panel h2,
.records-heading h2,
.sign-step h2,
.signed-confirmation h2 {
  margin: 0;
  font-size: clamp(1.38rem, 2.2vw, 1.8rem);
  line-height: 1.16;
}

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

.field-grid label,
.signature-field {
  display: flex;
  flex-direction: column;
  gap: 9px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.field-grid .wide {
  grid-column: 1 / -1;
}

.agreement-form input,
.agreement-form select,
.agreement-form textarea,
.signature-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 14px;
  color: var(--ink);
  background: #fffdf9;
  font: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  text-transform: none;
}

.agreement-form textarea {
  resize: vertical;
  line-height: 1.55;
}

.agreement-form input:focus,
.agreement-form select:focus,
.agreement-form textarea:focus,
.signature-field input:focus {
  border-color: var(--gold);
  outline: 2px solid rgba(201, 154, 72, 0.17);
}

.create-button {
  width: 100%;
  margin-top: 24px;
}

.blog-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.blog-form-actions .button {
  min-width: 180px;
  flex: 1 1 180px;
}

.blog-form-actions .create-button {
  margin-top: 0;
}

.dashboard-side {
  display: grid;
  gap: 16px;
}

.output-panel h2 {
  margin: 0 0 12px;
}

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

.generated-ref {
  display: block;
  margin: 16px 0 12px;
  color: var(--red);
  font-weight: 900;
}

.generated-url {
  overflow-wrap: anywhere;
  display: block;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: var(--muted);
  background: #f4ece1;
  font-size: 0.82rem;
}

.link-actions {
  display: grid;
  gap: 10px;
}

.link-actions .button {
  width: 100%;
  min-height: 46px;
}

.share-message {
  min-height: 22px;
  margin-top: 12px;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 800;
}

.launch-note {
  border: 1px solid rgba(154, 46, 32, 0.24);
  border-radius: var(--radius);
  padding: 22px;
  background: rgba(154, 46, 32, 0.045);
}

.launch-note p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.65;
}

.agreement-records {
  margin-top: 54px;
}

.blog-manager {
  scroll-margin-top: 110px;
}

.blog-public-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.blog-publish-toggle {
  flex-direction: row;
  align-items: center;
  color: var(--ink);
  text-transform: none;
}

.blog-publish-toggle input {
  width: 18px;
  height: 18px;
}

.blog-message {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--green);
  font-weight: 800;
}

.blog-message a {
  color: var(--red);
}

.blog-help {
  margin: -8px 0 6px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  text-transform: none;
}

.blog-file-input {
  margin-top: 10px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.75);
}

.blog-photo-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.8fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
}

.blog-photo-tools input[type="file"] {
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
}

.blog-photo-tools input[type="text"] {
  width: 100%;
}

.blog-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.blog-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--white);
}

.blog-row h3 {
  margin: 10px 0 6px;
  font-size: 1rem;
}

.blog-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 650;
}

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

.records-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.records-heading select {
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--white);
  font-weight: 750;
}

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

.agreement-row {
  display: grid;
  grid-template-columns: 1.45fr 1fr auto auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  background: var(--white);
}

.agreement-row h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.agreement-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 650;
}

.row-value {
  font-weight: 900;
}

.row-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 13px;
  color: var(--ink);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.row-action:hover {
  border-color: var(--gold);
}

.empty-list {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 30px 20px;
  color: var(--muted);
  text-align: center;
}

.status-chip {
  display: inline-flex;
  width: fit-content;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  padding: 0 13px;
  color: var(--red);
  background: rgba(154, 46, 32, 0.09);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-chip.signed {
  color: var(--green);
  background: rgba(86, 111, 100, 0.13);
}

.client-main {
  width: min(940px, 92vw);
  min-height: calc(100vh - 76px);
  margin: 0 auto;
  padding: 128px 0 64px;
}

.client-access {
  max-width: 560px;
  margin: 44px auto;
}

.access-phone {
  margin: 26px 0 18px;
}

#recaptcha-container {
  margin-bottom: 18px;
}

.otp-actions .button,
.otp-entry .button {
  width: 100%;
}

.otp-entry {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.otp-entry[hidden] {
  display: none;
}

.otp-entry .signature-field {
  margin-top: 0;
}

.empty-contract {
  max-width: 600px;
  margin: 90px auto;
  text-align: center;
}

.empty-contract h1 {
  margin: 0 0 14px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.empty-contract p {
  margin: 0 0 28px;
  color: var(--muted);
  line-height: 1.65;
}

.agreement-sheet {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(24px, 5vw, 50px);
  background: var(--white);
}

.contract-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 30px;
}

.contract-header h1 {
  margin: 0 0 10px;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.contract-header p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.contract-details {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  border-bottom: 1px solid var(--line);
  padding: 30px 0;
}

.contract-details span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.contract-details strong {
  font-size: 0.98rem;
  line-height: 1.45;
}

.contract-copy {
  border-bottom: 1px solid var(--line);
  padding: 30px 0;
}

.contract-copy h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.contract-copy h2:not(:first-child) {
  margin-top: 28px;
}

.contract-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  white-space: pre-line;
}

.sign-step,
.signed-confirmation {
  padding-top: 34px;
}

.sign-step > p {
  margin: 14px 0 22px;
  color: var(--muted);
  line-height: 1.64;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 22px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.5;
}

.check-field input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--red);
}

.signature-field {
  margin-top: 20px;
}

.signature-pad {
  display: block;
  width: 100%;
  height: 190px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fffdf9;
  touch-action: none;
}

.clear-signature {
  margin: 12px 0 22px;
  border: 0;
  color: var(--red);
  background: transparent;
  font-weight: 850;
  cursor: pointer;
}

.consent {
  margin-bottom: 14px;
}

.sign-message {
  min-height: 23px;
  color: var(--red);
  font-size: 0.9rem;
  font-weight: 800;
}

.signed-confirmation p {
  color: var(--muted);
  line-height: 1.65;
}

.signed-confirmation img {
  width: min(360px, 100%);
  max-height: 130px;
  object-fit: contain;
  object-position: left center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-top: 14px;
  padding: 10px;
  background: #fffdf9;
}

.agreement-footer {
  margin-top: 0;
}

@media (max-width: 940px) {
  .metrics,
  .dashboard-workspace {
    grid-template-columns: 1fr 1fr;
  }

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

  .dashboard-side {
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .agreement-row {
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 640px) {
  .agreement-app .agreement-topbar {
    padding: 0 4vw;
  }

  .agreement-app .brand-logo {
    width: min(58vw, 232px);
  }

  .agreement-nav {
    gap: 12px;
    font-size: 0.8rem;
  }

  .agreement-contact {
    min-height: 40px;
    padding: 0 11px;
    font-size: 0.78rem;
  }

  .dashboard-main,
  .client-main {
    padding-top: 108px;
  }

  .admin-auth {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-actions {
    min-width: 0;
  }

  .metrics,
  .dashboard-side,
  .field-grid,
  .blog-photo-tools {
    grid-template-columns: 1fr;
  }

  .field-grid .wide {
    grid-column: auto;
  }

  .records-heading,
  .contract-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .records-heading select {
    width: 100%;
  }

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

  .contract-details {
    grid-template-columns: 1fr 1fr;
    gap: 22px 14px;
  }
}
