/*
 * Calm Ledger, standalone. Values mirror apps/web/src/app/globals.css
 * (:root); this page cannot share that stylesheet, so keep them in step.
 * Inter is self-hosted because the CSP allows fonts from 'self' only.
 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("inter-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

:root {
  --background: oklch(1 0 0); /* the dialog's popover surface it sits on */
  --foreground: oklch(0.28 0.01 106);
  --card: oklch(0.99 0.002 106);
  --primary: oklch(0.46 0.08 168);
  --primary-foreground: oklch(0.98 0.008 168);
  --muted: oklch(0.955 0.004 106);
  --muted-foreground: oklch(0.5 0.012 106);
  --accent-soft: oklch(0.93 0.02 165);
  --accent-soft-foreground: oklch(0.32 0.05 168);
  --destructive: oklch(0.53 0.17 29);
  --border: oklch(0.91 0.005 106);
  --input: oklch(0.91 0.005 106);
  --ring: oklch(0.46 0.08 168);
  --radius: 0.5rem;
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

p {
  margin: 0;
}

/* No fixed height: the page reports its height and the embedding frame
   follows it (see the "resize" event in signer.js). */
.shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* --- Trust line ------------------------------------------------------ */

.trust {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  color: var(--accent-soft-foreground);
  font-size: 13px;
}

.trust-icon {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.status {
  color: var(--muted-foreground);
  font-size: 13px;
}

/* --- Fields ---------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.label {
  font-size: 14px;
  font-weight: 500;
}

.hint {
  color: var(--muted-foreground);
  font-size: 13px;
}

.input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: transparent;
  color: inherit;
  font: inherit;
  transition: border-color 120ms, box-shadow 120ms;
}

.input:focus-visible {
  border-color: var(--ring);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 25%, transparent);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.dropzone {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px dashed color-mix(in oklch, var(--foreground) 22%, transparent);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  transition: border-color 120ms, background-color 120ms;
}

.dropzone:hover {
  border-color: var(--primary);
}

.dropzone:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 25%, transparent);
}

.dropzone[data-filled] {
  border-style: solid;
  border-color: var(--border);
}

.dropzone-icon {
  flex: none;
  width: 28px;
  height: 28px;
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dropzone-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropzone-title {
  overflow: hidden;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone-hint {
  color: var(--muted-foreground);
  font-size: 13px;
}

.dropzone-compact {
  padding: 10px 14px;
}

.dropzone-compact .dropzone-icon {
  width: 22px;
  height: 22px;
}

/* --- Button ---------------------------------------------------------- */

.button {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 120ms;
}

.button:hover {
  background: color-mix(in oklch, var(--primary) 90%, black);
}

.button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 35%, transparent);
}

.button:disabled {
  opacity: 0.55;
  cursor: progress;
}

/* --- Read key: card with a ledger row -------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
}

.card-eyebrow {
  color: var(--muted-foreground);
  font-size: 12px;
  font-weight: 500;
}

.card-title {
  font-weight: 600;
}

/* The product's LedgerRow motif: label, dotted leader, figure. */
.ledger-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: var(--muted-foreground);
}

.ledger-leader {
  flex: 1;
  min-width: 16px;
  border-bottom: 1px dotted color-mix(in oklch, var(--foreground) 30%, transparent);
  transform: translateY(-3px);
}

.figure {
  color: var(--foreground);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* --- Sign request ---------------------------------------------------- */

.request {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.request-text {
  font-weight: 500;
}

.request-text .figure {
  white-space: nowrap;
}

.error {
  color: var(--destructive);
  font-size: 13px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

.status:empty {
  display: none;
}
