/* App pages — dark theme extensions, single-page flow */
.app-page { min-height: 100vh; padding: 2rem; }
.app-container { max-width: 720px; margin: 0 auto; }

.app-header { margin-bottom: 2.5rem; }
.app-title {
  font-family: var(--font-display);
  font-size: 1.8rem; font-weight: 900; color: var(--text); margin-bottom: 0.5rem;
}
.app-subtitle { font-size: 0.9rem; color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 2rem;
  margin-bottom: 1.5rem;
}
.card-title {
  font-family: var(--font-display);
  font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 1.5rem;
  display: flex; align-items: center; gap: 0.6rem;
}
.card-title .num {
  background: var(--gold-dim); border: 1px solid var(--border);
  color: var(--gold); font-size: 0.75rem; font-weight: 700;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.form-group { margin-bottom: 1.2rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; text-transform: uppercase; margin-bottom: 0.5rem; }
input, select, textarea {
  width: 100%; padding: 0.7rem 1rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--font-body);
  font-size: 0.95rem; outline: none;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold); }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.6; }
select { cursor: pointer; }

.clause-option {
  border: 1px solid var(--border); border-radius: 6px; padding: 0.8rem 1rem;
  margin-bottom: 0.6rem; cursor: pointer;
  display: flex; align-items: flex-start; gap: 0.8rem;
  transition: border-color 0.2s, background 0.2s;
}
.clause-option:hover { border-color: var(--gold); }
.clause-option input[type="radio"] { margin-top: 3px; accent-color: var(--gold); cursor: pointer; }
.clause-option label { text-transform: none; font-size: 0.85rem; font-weight: 400; color: var(--text-muted); cursor: pointer; }
.clause-option label strong { color: var(--text); font-weight: 500; display: block; margin-bottom: 0.2rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.85rem 2rem; border-radius: 6px; border: none;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all 0.2s;
}
.btn-primary { background: var(--gold); color: #0b0b14; }
.btn-primary:hover { background: #e8b420; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-muted); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }
.btn-block { width: 100%; }

.error-msg {
  background: rgba(239, 68, 68, 0.1); border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5; padding: 0.8rem 1rem; border-radius: 6px;
  font-size: 0.88rem; margin-bottom: 1.5rem;
}
.success-msg {
  background: var(--gold-dim); border: 1px solid var(--border);
  color: var(--gold); padding: 0.8rem 1rem; border-radius: 6px;
  font-size: 0.88rem; margin-bottom: 1.5rem;
}

/* Agreement view */
.agreement-clause {
  border: 1px solid var(--border); border-radius: 6px; padding: 1.2rem;
  margin-bottom: 1rem;
}
.agreement-clause-label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--gold); font-weight: 600; margin-bottom: 0.6rem;
}
.agreement-clause-text { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }

.parties-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 2rem; }
.party-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 1rem;
}
.party-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; color: var(--gold); font-weight: 600; margin-bottom: 0.4rem; }
.party-name { font-weight: 600; color: var(--text); margin-bottom: 0.2rem; }
.party-email { font-size: 0.82rem; color: var(--text-muted); }

.sig-section {
  border-top: 1px solid var(--border); padding-top: 1.5rem; margin-top: 1.5rem;
}
.sig-section h3 { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 1rem; }
.sig-canvas-wrap { border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 0.8rem; position: relative; }
#sig-canvas { display: block; width: 100%; height: 100px; background: var(--surface-2); cursor: crosshair; touch-action: none; }
.sig-clear-btn {
  font-size: 0.78rem; color: var(--text-muted); background: none; border: none;
  cursor: pointer; padding: 0; font-family: var(--font-body);
}
.sig-clear-btn:hover { color: var(--gold); }

.status-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.8rem; border-radius: 100px;
  font-size: 0.78rem; font-weight: 600;
}
.status-pending { background: rgba(234,179,8,0.15); color: #eab308; border: 1px solid rgba(234,179,8,0.3); }
.status-paid { background: rgba(34,197,94,0.1); color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
.status-signed { background: rgba(212,160,23,0.15); color: var(--gold); border: 1px solid var(--border); }

.agreement-meta {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 2rem;
  border-top: 1px solid var(--border); padding-top: 1rem;
}
.agreement-meta p { margin-bottom: 0.3rem; }

/* Agreements list */
.agreements-list { display: flex; flex-direction: column; gap: 1rem; }
.agreement-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 1.2rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between;
  transition: border-color 0.2s;
}
.agreement-row:hover { border-color: var(--gold); }
.agreement-row-info { flex: 1; }
.agreement-row-id { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.3rem; }
.agreement-row-names { font-weight: 600; color: var(--text); margin-bottom: 0.2rem; }
.agreement-row-date { font-size: 0.8rem; color: var(--text-muted); }
.agreement-row-actions { display: flex; align-items: center; gap: 1rem; }
.empty-state {
  text-align: center; padding: 3rem 2rem;
  color: var(--text-muted); font-size: 0.9rem;
}
.empty-state svg { margin-bottom: 1rem; opacity: 0.4; }

@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
  .parties-grid { grid-template-columns: 1fr; }
  .agreement-row { flex-direction: column; align-items: flex-start; gap: 1rem; }
}