/* The secure Paper and Live trade reviews in Lakina HQ's type, palette and controls.
   Values follow apps/web/app/globals.css and hq/brand/tokens.css. Change them there first.
   The fonts are the licensed files the iOS app ships, served from this origin only. */
@font-face { font-family: "Instrument Serif"; src: url("/fonts/InstrumentSerif-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url("/fonts/Inter.ttf") format("truetype"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: light dark;
  --lk-color-bg: light-dark(#f2f0e9, #171918);
  --lk-color-text: light-dark(#171918, #f2f0e9);
  --lk-color-text-muted: light-dark(#626865, #9ba6a2);
  --lk-color-control-bg: light-dark(#e7e3d9, #303632);
  --lk-color-rule: light-dark(rgba(23, 25, 24, 0.16), rgba(242, 240, 233, 0.18));
  --lk-color-panel: light-dark(rgba(23, 25, 24, 0.028), rgba(242, 240, 233, 0.02));
  --lk-color-panel-hover: light-dark(rgba(23, 25, 24, 0.05), rgba(242, 240, 233, 0.045));
  --lk-color-accent: light-dark(#23433c, #a8c4bb);
  --lk-color-error-text: light-dark(#8c3a2b, #e49482);
  --lk-color-caution-rule: light-dark(rgba(122, 90, 18, 0.4), rgba(226, 184, 102, 0.4));
  --lk-color-caution-fill: light-dark(rgba(122, 90, 18, 0.1), rgba(226, 184, 102, 0.12));
  --lk-font-display: "Instrument Serif", "Iowan Old Style", Baskerville, "Times New Roman", serif;
  --lk-font-body: Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --lk-font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  background: var(--lk-color-bg);
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--lk-color-text); font: 400 1rem/1.6 var(--lk-font-body); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
:is(a, button, summary, input, select, textarea, [tabindex]):focus-visible { outline: 3px solid var(--lk-color-accent); outline-offset: 3px; }

/* A small secure chrome instead of HQ's rail: the wordmark, and what this page is. */
.secure-bar, main { width: min(64rem, 100% - 2.5rem); margin-inline: auto; }
.secure-bar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem 2rem; padding: 2rem 0 1.25rem; border-bottom: 1px solid var(--lk-color-rule); }
.secure-wordmark { display: inline-flex; flex-direction: column; text-decoration: none; }
.secure-wordmark span { font-family: var(--lk-font-display); font-size: 1.75rem; line-height: 1; }
.secure-wordmark small, .secure-bar p { color: var(--lk-color-text-muted); font-size: .62rem; letter-spacing: .12em; text-transform: uppercase; }
.secure-wordmark small { margin-top: .45rem; }
.secure-bar p { margin: 0; }

main { display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; padding: clamp(2rem, 5vh, 3.5rem) 0 5rem; }
main > * { max-width: 100%; margin: 0; }
.secure-header { width: 100%; padding-bottom: 2rem; margin-bottom: 1rem; border-bottom: 1px solid var(--lk-color-rule); }
.secure-back { color: var(--lk-color-text-muted); font-size: .8rem; }
.secure-account { margin: 1rem 0 0; color: var(--lk-color-text-muted); font-size: .72rem; letter-spacing: .09em; text-transform: uppercase; }
h1 { margin: .55rem 0 0; font: 400 clamp(3rem, 6vw, 4.8rem)/.96 var(--lk-font-display); letter-spacing: -.025em; }
h2 { margin: 0; font: 400 1.6rem/1.1 var(--lk-font-display); }
.secure-live { max-width: 78ch; margin: 1rem 0 0; padding: .7rem .9rem; border: 1px solid var(--lk-color-caution-rule); border-inline-start-width: 4px; background: var(--lk-color-caution-fill); }
[role=note]:not(.secure-live), main > p:not([role]) { max-width: 68ch; }
[role=note]:not(.secure-live) { color: var(--lk-color-text-muted); font-size: .85rem; }
[role=alert] { color: var(--lk-color-error-text); }

/* Batch facts: HQ's staged metrics. */
dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); gap: .65rem; width: 100%; }
dl div { padding: .8rem 1rem; border: 1px solid var(--lk-color-rule); }
dt { color: var(--lk-color-text-muted); font-size: .88rem; }
dd { margin: .3rem 0 0; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
dd strong { font-weight: 600; }

/* Orders: HQ's evidence table. */
.order-table { width: 100%; overflow-x: auto; }
.order-table-preview { width: 100%; }
.order-table-preview:has(> .order-table-toggle:not([open])) .order-table-remainder,
.order-table-toggle:not([open]) .orders-collapse,
.order-table-toggle[open] .orders-expand { display: none; }
.order-table-toggle { margin-block: .65rem 1rem; }
.order-table-toggle summary { width: fit-content; cursor: pointer; }
.order-table-toggle summary { min-height: 2.75rem; padding: .6rem 1rem; border-color: var(--lk-color-text); border-radius: 2px; font-size: .9rem; }
table { width: 100%; border-collapse: collapse; font-size: .72rem; font-variant-numeric: tabular-nums; }
th, td { padding: .75rem; border: 1px solid var(--lk-color-rule); text-align: right; white-space: nowrap; }
thead th { vertical-align: bottom; border-bottom: 2px solid var(--lk-color-text-muted); color: var(--lk-color-text-muted); font-size: .62rem; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; }
td, tbody th { font-family: var(--lk-font-mono); font-weight: 400; }
tr > :first-child { text-align: left; }
td strong { font-family: var(--lk-font-body); font-weight: 600; }

/* Controls: HQ's .hq-button, .hq-input and select. */
form { display: flex; flex-direction: column; align-items: flex-start; gap: .65rem; }
button, .paper-action { display: inline-flex; align-items: center; justify-content: center; min-height: 2.75rem; margin: 0; padding: .6rem 1rem;
  background: var(--lk-color-text); border: 1px solid var(--lk-color-text); border-radius: 2px; color: var(--lk-color-bg);
  font: 500 .9rem/1.3 var(--lk-font-body); text-decoration: none; cursor: pointer; transition: border-color 160ms ease, background 160ms ease; }
button:hover:not(:disabled), .paper-action:hover { border-color: var(--lk-color-accent); background: var(--lk-color-accent); }
button:disabled { opacity: .5; cursor: not-allowed; }
label { display: grid; gap: .35rem; color: var(--lk-color-text-muted); font-size: .85rem; }
input, select, textarea { width: min(100%, 22rem); min-height: 3rem; padding: .65rem .9rem; background: transparent; border: 1px solid var(--lk-color-rule);
  border-radius: 2px; color: var(--lk-color-text); font: 400 1rem/1.4 var(--lk-font-body); }
select { background: var(--lk-color-control-bg); border-color: var(--lk-color-text-muted); }
textarea { width: min(100%, 36rem); font-family: var(--lk-font-mono); font-size: .85rem; }
form p { margin: 0; }

details { width: 100%; }
summary { width: fit-content; padding: .55rem .9rem; border: 1px solid var(--lk-color-rule); font-size: .78rem; letter-spacing: .04em; cursor: pointer; }
summary:hover { background: var(--lk-color-panel-hover); }
details[open] > summary { margin-bottom: .85rem; }
code { font-family: var(--lk-font-mono); font-size: .85em; overflow-wrap: anywhere; }

.trade-progress:not([hidden]) { display: block; width: min(100%, 22rem); height: .55rem; margin-block: .8rem .65rem; accent-color: var(--lk-color-text); }
.share-progress { width: 100%; padding: 1.5rem; border: 1px solid var(--lk-color-rule); background: var(--lk-color-panel); }
.share-progress p { margin-block: .5rem; }
#paper-sign-in { width: min(100%, 22rem); }
#paper-sign-in input { width: 100%; }

@media (max-width: 640px) {
  h1 { font-size: clamp(2.8rem, 15vw, 4.5rem); }
  .secure-bar { padding-top: 1.5rem; }
  dl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  dl div { padding: .65rem .7rem; }
  dd { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
