/* Kachet notary portal */
:root {
  --paper: #F6F3EC;
  --card: #FFFFFF;
  --ink: #1B1F2A;
  --muted: #5C606B;
  --line: #E6E0D3;
  --field: #D9D2C3;
  --seal: #7E2A33;
  --seal-dark: #5E1F26;
  --seal-tint: #F3E4E5;
  --ok: #1D5B3F;
  --ok-tint: #DCEFE4;
  --warn: #7A4506;
  --warn-tint: #FBEBD2;
  --err: #9B1C1C;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--seal); font-weight: 600; }
a:hover { color: var(--seal-dark); }
:focus-visible { outline: 3px solid #2F5DA8; outline-offset: 2px; border-radius: 6px; }

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-name { font-family: "Fraunces", Georgia, serif; font-size: 26px; font-weight: 600; letter-spacing: -0.3px; }

/* Auth pages */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 40px 20px; }
.auth-box { width: 100%; max-width: 440px; margin-top: 32px; }
.auth h1 { font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 34px; line-height: 1.15; margin: 0 0 8px; }
.auth .lede { color: var(--muted); margin: 0 0 28px; }
.auth .switch { margin-top: 24px; color: var(--muted); text-align: center; }

form { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 12px; }
.row > .field { flex: 1; min-width: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 14px; font-weight: 600; color: #3D414C; }
.field .hint { font-size: 13px; color: var(--muted); }
input, select {
  font: inherit; color: var(--ink);
  height: 48px; padding: 0 14px;
  border: 1px solid var(--field); border-radius: 12px; background: var(--card);
  width: 100%;
}
input:focus, select:focus { border-color: var(--seal); outline: 3px solid var(--seal-tint); outline-offset: 0; }
fieldset { border: 0; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
legend { font-family: "Fraunces", Georgia, serif; font-size: 20px; font-weight: 600; padding: 0; margin-bottom: 4px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 54px; padding: 0 22px; border-radius: 14px; border: 0;
  font: inherit; font-size: 17px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--seal); color: #fff; }
.btn-primary:hover { background: var(--seal-dark); color: #fff; }
.btn-primary[disabled] { background: #B9A7A9; cursor: not-allowed; }
.btn-quiet { background: transparent; color: var(--ink); border: 1px solid var(--field); height: 44px; font-size: 15px; }
.btn-block { width: 100%; }

.alert { padding: 12px 14px; border-radius: 12px; font-size: 15px; background: #FBE6E6; color: var(--err); display: none; }
.alert.show { display: block; }

/* Dashboard */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; max-width: 760px; margin: 0 auto; }
.main { max-width: 760px; margin: 0 auto; padding: 0 20px 48px; display: flex; flex-direction: column; gap: 20px; }
.greeting { font-family: "Fraunces", Georgia, serif; font-size: 34px; font-weight: 600; line-height: 1.15; margin: 8px 0 0; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 22px; }
.panel h2 { font-size: 18px; margin: 0 0 4px; }
.panel p { margin: 0; color: var(--muted); }

.steps { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; }
.steps li { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.steps li:first-child { border-top: 0; }
.dot {
  flex: none; width: 30px; height: 30px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; border: 2px solid var(--field); color: var(--muted);
}
.dot.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.dot.next { border-color: var(--seal); color: var(--seal); }
.steps strong { display: block; }
.steps span { color: var(--muted); font-size: 14px; }
.tag { display: inline-block; font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 10px; margin-top: 6px; }
.tag-warn { background: var(--warn-tint); color: var(--warn); }

.balance { background: var(--ink); color: var(--paper); border-radius: 18px; padding: 22px; }
.balance .label { color: #C9C3B6; font-size: 14px; }
.balance .amount { font-family: "Fraunces", Georgia, serif; font-size: 42px; font-weight: 600; font-variant-numeric: tabular-nums; }
.balance .foot { color: #C9C3B6; font-size: 14px; border-top: 1px solid #343A48; padding-top: 10px; margin-top: 8px; }

.empty { text-align: center; padding: 26px 10px; }
.empty p { max-width: 360px; margin: 6px auto 0; }

.details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; margin-top: 14px; }
.details dt { font-size: 13px; color: var(--muted); }
.details dd { margin: 2px 0 0; font-weight: 600; }

.loading { text-align: center; padding: 80px 20px; color: var(--muted); }

@media (max-width: 480px) {
  .row { flex-direction: column; }
  .greeting, .auth h1 { font-size: 28px; }
  .details { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Verification step */
.grow { flex: 1; min-width: 0; }
.step-actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn-small { height: 44px; font-size: 15px; padding: 0 18px; border-radius: 12px; }
.tag-ok { background: var(--ok-tint); color: var(--ok); }
.tag-err { background: #FBE6E6; color: var(--err); }
.notice { padding: 14px 16px; border-radius: 14px; background: var(--ok-tint); color: var(--ok); font-weight: 500; }
.notice.warn { background: var(--warn-tint); color: var(--warn); }
.notice.err { background: #FBE6E6; color: var(--err); }

/* Request payment */
.money-input { position: relative; }
.money-input span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-family: "Fraunces", Georgia, serif; font-size: 28px; font-weight: 600; color: var(--muted); }
.money-input input { height: 64px; padding-left: 40px; font-family: "Fraunces", Georgia, serif; font-size: 30px; font-weight: 600; }
.hint { font-size: 14px; color: var(--muted); margin: 0; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; color: #fff; }
.ready { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ready-for { color: var(--muted); text-align: center; }
.ready-amount { font-family: "Fraunces", Georgia, serif; font-size: 42px; font-weight: 600; font-variant-numeric: tabular-nums; }
.qr { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.qr img, .qr canvas { display: block; }
.link-box { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #ECE6DA; border-radius: 12px; padding: 6px 6px 6px 14px; }
.link-box span { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.share { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.ready-actions { display: flex; justify-content: space-between; gap: 12px; }
.ready-actions .btn { flex: 1; }

/* Payments list */
.pay-row { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.pay-row:first-child { border-top: 0; }
.pay-main { flex: 1; min-width: 0; }
.pay-main strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-main span { color: var(--muted); font-size: 14px; }
.pay-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.pay-amount { font-weight: 700; font-variant-numeric: tabular-nums; }
.pay-actions { display: flex; gap: 12px; margin-top: 4px; }
.linkish { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; font-weight: 600; color: var(--seal); cursor: pointer; }
.tag-muted { background: #ECE6DA; color: var(--muted); }
.list { margin-top: 8px; }

/* Paid page */
.paid-check { width: 64px; height: 64px; border-radius: 32px; background: var(--ok); color: #fff; font-size: 32px; display: flex; align-items: center; justify-content: center; margin: 0 auto 16px; }

a.btn[aria-disabled="true"] { background: #B9A7A9; color: #fff; pointer-events: none; cursor: not-allowed; }
#form-view, #ready-view { display: flex; flex-direction: column; gap: 16px; }
.ready-actions .btn { height: 54px; font-size: 16px; white-space: nowrap; }

/* Dashboard: two columns on wide screens.
   Left = day-to-day money (setup, balance, request, payments).
   Right = the notary's business (public page, details, and later documents). */
body[data-page="dashboard"] .topbar { max-width: 1120px; }
.main.dash { max-width: 1120px; }
.dash-grid { display: flex; flex-direction: column; gap: 20px; }
.dash-main, .dash-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
.req-hint { margin: -10px 0 0; text-align: center; }
.dash-side .panel p { font-size: 15px; }
.dash-side .link-box { margin-top: 14px; }
.dash-side .page-open { margin-top: 10px; }
.dash-side .details { grid-template-columns: minmax(0, 1fr); }
.dash-side .details dd { overflow-wrap: anywhere; }
@media (min-width: 960px) {
  .dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; }
  .dash-side { position: sticky; top: 20px; }
}
