/* Agreement drafting surface. It uses the portal palette when mounted inside
   Kinsera and remains readable if used on a standalone admin surface. */
.agreement-surface {
  --agreement-ink: var(--ink, #141618);
  --agreement-muted: var(--muted, #5D636B);
  --agreement-line: var(--line, #E8E6E1);
  --agreement-card: var(--card, #FFFFFF);
  --agreement-paper: var(--paper, #FAFAF8);
  --agreement-navy: var(--navy-700, #0D1623);
  --agreement-gold: var(--gold-400, #C2A14E);
  --agreement-amber-bg: var(--amber-bg, #FBF1DF);
  --agreement-rose: var(--rose, #9B3A3A);
  --agreement-rose-bg: var(--rose-bg, #F8E7E7);
  color: var(--agreement-ink);
  max-width: 980px;
  margin: 0 auto;
  padding: 1rem 0 3rem;
}

.agreement-surface.is-loading { opacity: .72; }
.agreement-surface__head,
.agreement-panel__head,
.agreement-template__head,
.agreement-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.agreement-surface__head {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--agreement-line);
  padding-bottom: 1rem;
}

.agreement-surface h2,
.agreement-surface h3,
.agreement-surface h4 {
  margin: 0;
  color: var(--agreement-ink);
}

.agreement-surface h2 {
  font-family: Newsreader, Georgia, serif;
  font-size: 1.85rem;
  font-weight: 500;
}

.agreement-surface h3 { font-size: 1.1rem; }
.agreement-surface h4 { font-size: 1rem; }
.agreement-surface p { margin: .35rem 0 .75rem; }
.agreement-muted { color: var(--agreement-muted); font-size: .88rem; }
.agreement-surface__scope {
  color: var(--agreement-muted);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.agreement-provider-notice {
  background: var(--agreement-amber-bg);
  border-left: 4px solid var(--agreement-gold);
  border-radius: 6px;
  margin-bottom: 1rem;
  padding: .85rem 1rem;
}

.agreement-provider-notice strong {
  display: block;
  color: var(--agreement-navy);
  font-size: .95rem;
}

.agreement-provider-notice p {
  color: var(--agreement-navy);
  font-size: .88rem;
  margin: .2rem 0 0;
}

.agreement-provider-notice__detail {
  font-weight: 600;
}

.agreement-surface__error,
.agreement-form-status {
  color: var(--agreement-rose);
  font-size: .84rem;
  min-height: 1.3em;
}

.agreement-surface__error {
  background: var(--agreement-rose-bg);
  border-radius: 5px;
  padding: .55rem .7rem;
}

.agreement-panel {
  background: var(--agreement-card);
  border: 1px solid var(--agreement-line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(4, 7, 11, .05);
  margin: 1rem 0;
  padding: 1.1rem;
}

.agreement-panel__head { margin-bottom: .85rem; }
.agreement-panel__head > div:first-child { min-width: 0; }
.agreement-panel__head p { max-width: 700px; }

.agreement-field {
  display: block;
  margin: .75rem 0;
}

.agreement-field__label {
  color: var(--agreement-muted);
  display: block;
  font-size: .76rem;
  font-weight: 600;
  letter-spacing: .04em;
  margin-bottom: .25rem;
  text-transform: uppercase;
}

.agreement-field__input {
  background: var(--agreement-paper);
  border: 1px solid #CFCBC2;
  border-radius: 5px;
  color: var(--agreement-ink);
  display: block;
  font: inherit;
  line-height: 1.45;
  max-width: 100%;
  padding: .55rem .65rem;
  width: 100%;
}

.agreement-field__input:focus {
  border-color: var(--agreement-navy);
  box-shadow: 0 0 0 2px rgba(13, 22, 35, .12);
  outline: none;
}

textarea.agreement-field__input {
  min-height: 8rem;
  resize: vertical;
}

.agreement-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: .8rem 0 .2rem;
}

.agreement-button {
  background: var(--agreement-card);
  border: 1px solid #B9B5AD;
  border-radius: 5px;
  color: var(--agreement-navy);
  cursor: pointer;
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  padding: .5rem .72rem;
}

.agreement-button:hover:not(:disabled) { background: #F1EFEA; }
.agreement-button:focus-visible { outline: 2px solid var(--agreement-gold); outline-offset: 2px; }
.agreement-button--primary { background: var(--agreement-navy); border-color: var(--agreement-navy); color: #fff; }
.agreement-button--primary:hover:not(:disabled) { background: #182B43; }
.agreement-button--danger { color: var(--agreement-rose); }
.agreement-button--blocked {
  border-color: #C2A14E;
  color: #785B1A;
}
.agreement-button:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.agreement-template-list,
.agreement-list {
  display: grid;
  gap: .8rem;
}

.agreement-template,
.agreement-card {
  background: var(--agreement-paper);
  border: 1px solid var(--agreement-line);
  border-radius: 7px;
  padding: .9rem;
}

.agreement-template__head,
.agreement-card__head { margin-bottom: .45rem; }
.agreement-version { color: var(--agreement-muted); font-size: .78rem; white-space: nowrap; }
.agreement-template-create { border-top: 1px solid var(--agreement-line); margin: .8rem 0 1rem; padding-top: .55rem; }
.agreement-template-create[hidden] { display: none; }

.agreement-status {
  border-radius: 99px;
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .18rem .5rem;
  white-space: nowrap;
}
.agreement-status--draft { background: #E8EEF5; color: var(--agreement-navy); }
.agreement-status--setup_required { background: var(--agreement-amber-bg); color: #785B1A; }

.agreement-card__notice {
  background: var(--agreement-amber-bg);
  border-radius: 4px;
  color: var(--agreement-navy);
  font-size: .82rem;
  padding: .5rem .6rem;
}

.agreement-print {
  box-sizing: border-box;
  font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  margin: 0;
  padding: 2rem;
  white-space: pre-wrap;
}

@media (max-width: 640px) {
  .agreement-surface { padding: .75rem 0 2rem; }
  .agreement-surface__head,
  .agreement-panel__head,
  .agreement-template__head,
  .agreement-card__head { display: block; }
  .agreement-surface__scope { display: block; margin-top: .5rem; }
  .agreement-version,
  .agreement-status { display: inline-block; margin-top: .4rem; }
  .agreement-actions .agreement-button { flex: 1 1 auto; }
}

@media print {
  .agreement-surface { max-width: none; }
  .agreement-surface__head,
  .agreement-provider-notice,
  .agreement-actions,
  .agreement-surface__error { display: none !important; }
  .agreement-panel { border: 0; box-shadow: none; margin: 0; padding: 0; }
}