/* Component styles.
 *
 * Everything here is written against logical properties (inline-start, margin-
 * inline) rather than left/right, so the same rules lay out correctly in Persian
 * RTL and English LTR without a mirrored stylesheet.
 */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  font-weight: 400;
  font-size: 15px;
  line-height: 1.7;
  padding: 0 0 64px;
  -webkit-text-size-adjust: 100%;
}

:where(a) { color: inherit; }

/* Numbers stay left-to-right and monospaced in both languages: a rial figure
   reordered by the bidi algorithm is unreadable. */
.num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 18px; }
.eyebrow { font-size: 11px; letter-spacing: .22em; color: var(--mute); font-weight: 600; }

/* ---- header ------------------------------------------------------------ */
.site-head { border-bottom: 1px solid var(--rule); padding: 22px 0 18px; margin-bottom: 22px; }
/* Not ".bar" — that name belongs to the allocation meter below, and a generic
   class shared by two unrelated components is how a 3px-tall header happens. */
.head-bar { display: flex; flex-direction: column; gap: 12px; }
/* On a phone the switches get their own row: sharing it with the title leaves
   the tagline two words wide. */
@media (min-width: 560px) {
  .head-bar { flex-direction: row; align-items: flex-start; justify-content: space-between; }
}
.site-head h1 { font-size: 22px; font-weight: 800; margin: 6px 0 2px; letter-spacing: -.01em; }
.site-head p { margin: 0; color: var(--mute); font-size: 13px; }
.switches { display: flex; gap: 6px; flex-shrink: 0; }

/* ---- card -------------------------------------------------------------- */
.card {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card > h2 {
  font-size: 13px; font-weight: 600; letter-spacing: .12em;
  color: var(--mute); margin: 0 0 4px;
}
.card > .sub { color: var(--mute); font-size: 12px; margin: 0 0 16px; }

/* ---- currency tracks --------------------------------------------------- */
.track {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 12px;
  align-items: center; padding: 14px 0; border-bottom: 1px solid var(--rule);
}
.track:last-child { border-bottom: none; }
.track .tag {
  font-size: 11px; font-weight: 600; letter-spacing: .1em;
  text-align: center; padding: 3px 0; border-radius: 3px;
}
.track.usd .tag { color: var(--usd); border: 1px solid var(--usd); }
.track.jpy .tag { color: var(--jpy); border: 1px solid var(--jpy); }
.track.irr .tag { color: var(--irr); border: 1px solid var(--irr); }
.track svg { width: 100%; height: 34px; display: block; }
.track .total { font-size: 16px; font-weight: 600; white-space: nowrap; text-align: end; }
/* "no rate" is a sentence, not a figure: let it wrap so it does not squeeze the
   line beside it down to a sliver. */
.track .total.unknown { white-space: normal; max-width: 15ch; font-weight: 400; }
.track .delta { font-size: 11px; color: var(--mute); display: block; }

/* ---- attribution ------------------------------------------------------- */
.attr-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.attr-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.attr-row .label { font-size: 13px; }
.attr-row .label small { display: block; color: var(--mute); font-size: 11px; line-height: 1.5; }
.attr-row .value { font-size: 15px; font-weight: 600; white-space: nowrap; }
.attr-row.total { border-top: 1px solid var(--rule); padding-top: 10px; margin-top: 2px; }

/* A signed bar grows from the centre so a gain and a loss are not the same
   picture with a different colour. */
.signed { height: 4px; background: var(--rule); border-radius: 2px; position: relative; }
.signed i { position: absolute; top: 0; height: 100%; border-radius: 2px; }
.signed i.pos { inset-inline-start: 50%; background: var(--up); }
.signed i.neg { inset-inline-end: 50%; background: var(--down); }
.signed::after {
  content: ""; position: absolute; inset-block: -2px; inset-inline-start: 50%;
  width: 1px; background: var(--mute); opacity: .5;
}

/* ---- allocation -------------------------------------------------------- */
.alloc-row { margin-bottom: 12px; }
.alloc-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; gap: 10px; }
.alloc-head .pct { color: var(--mute); }
.bar { height: 3px; background: var(--rule); border-radius: 2px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--text); }

/* ---- ledger ------------------------------------------------------------ */
.row {
  display: grid; grid-template-columns: 1fr auto; gap: 8px;
  padding: 13px 0; border-bottom: 1px solid var(--rule);
}
.row:last-child { border-bottom: none; }
.row .name { font-size: 15px; }
.row .meta { font-size: 12px; color: var(--mute); }
.row .val { text-align: end; font-size: 15px; font-weight: 600; white-space: nowrap; }
.row .pnl { font-size: 12px; display: block; font-weight: 400; }
.up { color: var(--up); }
.down { color: var(--down); }

.badge {
  font-size: 10px; color: var(--warn); border: 1px solid var(--warn);
  border-radius: 3px; padding: 1px 5px; margin-inline-start: 6px;
  white-space: nowrap; display: inline-block; vertical-align: middle;
}

/* ---- controls ---------------------------------------------------------- */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button {
  background: transparent; border: 1px solid var(--rule); color: var(--mute);
  font-family: inherit; font-size: 12px; padding: 5px 12px;
  border-radius: 20px; cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--text); }

label { display: block; font-size: 12px; color: var(--mute); margin: 10px 0 4px; }
input, select {
  width: 100%; background: var(--panel-2); border: 1px solid var(--rule);
  color: var(--text); font-family: inherit; font-size: 14px;
  padding: 9px 11px; border-radius: var(--radius-sm);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

button.act {
  width: 100%; margin-top: 16px; background: var(--text); color: var(--panel);
  border: none; font-family: inherit; font-weight: 600; font-size: 14px;
  padding: 11px; border-radius: var(--radius-sm); cursor: pointer;
}
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--rule); }
/* .chip, not button.chip: the header's "Sign in" is an anchor because it is a
   link to a page, and it has to look identical to the toggles beside it. */
.chip {
  background: var(--panel); border: 1px solid var(--rule); color: var(--mute);
  font-family: inherit; font-size: 12px; line-height: 1.6; padding: 5px 10px;
  border-radius: 20px; cursor: pointer; text-decoration: none;
  display: inline-block; white-space: nowrap;
}
.chip[aria-pressed="true"], a.chip:hover { color: var(--text); border-color: var(--text); }

/* One focus rule for everything, and it is never removed. Keyboard users lose
   the app entirely without it. */
:where(input, select, button, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

details > summary { cursor: pointer; font-size: 13px; color: var(--mute); list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { margin-bottom: 8px; color: var(--text); }

/* ---- feedback ---------------------------------------------------------- */
.notice {
  border-inline-start: 2px solid var(--warn); background: var(--warn-bg);
  padding: 8px 12px; font-size: 13px; color: var(--warn);
  margin-bottom: 14px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.empty { color: var(--mute); font-size: 14px; }

#toast {
  position: fixed; inset-inline: 18px; bottom: 18px;
  background: var(--panel-2); border: 1px solid var(--rule);
  border-radius: 8px; padding: 12px 14px; font-size: 13px;
  display: none; z-index: 9; box-shadow: var(--shadow);
  max-width: 724px; margin: 0 auto;
}

@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise .35s ease both; }
  @keyframes rise {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
  }
}

@media (min-width: 720px) {
  .attr-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .attr-row { grid-template-columns: 1fr; align-items: start; }
  .attr-row.total { border-top: none; border-inline-start: 1px solid var(--rule);
                    padding-top: 0; padding-inline-start: 14px; margin-top: 0; }
}

/* ---- landing ------------------------------------------------------------
 * Its own scale. The app is a dense instrument panel; the landing page has one
 * argument to make, so it gets room to make it.
 */
.landing { max-width: 980px; margin: 0 auto; padding: 0 18px; }

.hero { padding: 56px 0 40px; }
.hero h1 {
  font-size: clamp(30px, 7vw, 52px); line-height: 1.15; font-weight: 800;
  letter-spacing: -.02em; margin: 12px 0 0; white-space: pre-line;
}
.hero .lead { font-size: clamp(15px, 2.2vw, 18px); color: var(--mute); max-width: 62ch; margin: 18px 0 0; }
.hero .actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 26px; }
.hero .actions a { text-decoration: none; }

.btn {
  display: inline-block; font-family: inherit; font-size: 15px; font-weight: 600;
  padding: 11px 22px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid transparent; background: var(--text); color: var(--panel);
}
.btn.secondary { background: transparent; color: var(--text); border-color: var(--rule); }

/* The hero chart repeats the dashboard's signature rather than inventing a
   new visual: what you are shown here is what you get. */
.hero-chart { margin-top: 40px; border: 1px solid var(--rule); border-radius: var(--radius);
              background: var(--panel); padding: 20px 18px 14px; box-shadow: var(--shadow); }
.hero-chart svg { width: 100%; height: 190px; display: block; overflow: visible; }
.hero-chart .caption { color: var(--mute); font-size: 12px; margin: 14px 0 0; }
.hero-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.hero-legend span { font-size: 11px; font-weight: 600; letter-spacing: .1em; display: flex; align-items: center; gap: 6px; }
.hero-legend i { width: 14px; height: 2px; border-radius: 2px; display: inline-block; }

section.band { padding: 44px 0; border-top: 1px solid var(--rule); }
section.band > h2 { font-size: 13px; font-weight: 600; letter-spacing: .12em; color: var(--mute); margin: 0 0 20px; }

.case { display: grid; gap: 12px; grid-template-columns: 1fr; }
.case-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--panel);
}
.case-row .k { font-size: 14px; }
.case-row .v { font-size: 20px; font-weight: 700; }
.case-row.result { border-color: var(--down); }
.case-note { color: var(--mute); font-size: 12px; margin-top: 14px; }

.features { display: grid; gap: 20px; grid-template-columns: 1fr; }
.feature h3 { font-size: 15px; margin: 0 0 6px; font-weight: 600; }
.feature p { margin: 0; color: var(--mute); font-size: 14px; line-height: 1.65; }
.feature .rule { width: 26px; height: 2px; background: var(--usd); border-radius: 2px; margin-bottom: 12px; }

.nots { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.nots li { color: var(--mute); font-size: 14px; padding-inline-start: 18px; position: relative; line-height: 1.65; }
.nots li::before { content: "—"; position: absolute; inset-inline-start: 0; color: var(--rule); }

.cta-band { text-align: center; padding: 52px 0 60px; border-top: 1px solid var(--rule); }
.cta-band h2 { font-size: clamp(22px, 4vw, 30px); margin: 0 0 10px; letter-spacing: -.01em; }
.cta-band p { color: var(--mute); margin: 0 auto 24px; max-width: 46ch; font-size: 14px; }

.site-foot { border-top: 1px solid var(--rule); padding: 22px 0 40px; color: var(--mute); font-size: 12px; }

/* ---- auth pages --------------------------------------------------------- */
.auth-wrap { max-width: 420px; margin: 0 auto; padding: 48px 18px 0; }
.hint { color: var(--mute); font-size: 12px; line-height: 1.6; margin: 14px 0 0; }
.auth-alt { text-align: center; color: var(--mute); font-size: 13px; margin-top: 18px; }
.auth-alt a { color: var(--text); }

.session-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0;
               border-bottom: 1px solid var(--rule); font-size: 13px; }
.session-row:last-child { border-bottom: none; }
.session-row .ua { color: var(--mute); word-break: break-word; }

@media (min-width: 700px) {
  .case { grid-template-columns: repeat(3, 1fr); }
  .case-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .features { grid-template-columns: repeat(2, 1fr); gap: 28px 34px; }
  .nots { grid-template-columns: repeat(2, 1fr); gap: 18px 34px; }
}
