/* =====================================================================
   Lunar – wartości 1:1 z projektu w Figmie (ramka 941 px szerokości).
   Panel ma 904 px i jest skalowany przez `zoom` (--z) do szerokości okna.
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg: #050814;
  --surface: #0b1020;
  --border: #7167a5;
  --card-border: #a198db;
  --text: #f3f0ff;
  --muted: #beb8d8;
  --pos: #54efb4;
  --neg: #ff486b;
  --accent: #a38bfa;
  --ma20: #eac668;
  --ma50: #6be6be;
  --trend-up: #2ff33f;
  --live: #1af04d;
  --tag-up: #13bd1b;
  --tag-down: #e23b58;
  --bar-up: #1cee56;
  --grid-h: #252b3e;
  --grid-v: #1a2132;
  --chart-bg: #0c111d;
  --good: var(--pos);
  --bad: var(--neg);
  --good-text: var(--pos);
  --bad-text: var(--neg);
  --good-wash: #0b221c;
  --bad-wash: #301724;
  --surface-chart: var(--chart-bg);

  --z: 1;      /* skala panelu */
  --hz: 1;     /* skala typografii hero */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --font: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 10px; line-height: 1.25; -webkit-font-smoothing: antialiased; }
h1, h2, p, dl, dd, ol { margin: 0; }
[hidden] { display: none !important; }
.t10 { font-size: 10px; } .t11 { font-size: 11px; } .t13 { font-size: 13px; }

/* ---------- Marka ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { width: 40px; height: 40px; display: block; }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 600; font-size: 20px; line-height: 25px; }
.brand .brand-text .brand-name { font-size: 16px; line-height: 20px; }
.brand-sub { font-size: 11px; line-height: 13.75px; color: var(--muted); }

/* =====================================================================
   01 · HERO (941 × 426 w projekcie; tu: pełny ekran, ta sama kompozycja)
   ===================================================================== */
.hero { position: relative; height: 100vh; min-height: 560px; overflow: hidden; background: var(--bg); }
.hero-art {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center bottom;
  transform-origin: 50% 85%;
  animation: breathe 48s ease-in-out infinite alternate;
}
.hero-twinkle {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background-image:
    radial-gradient(1.6px 1.6px at 8% 14%, rgba(255,255,255,.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 19% 34%, rgba(255,255,255,.7), transparent 60%),
    radial-gradient(1.8px 1.8px at 27% 9%, rgba(226,221,255,.9), transparent 60%),
    radial-gradient(1.2px 1.2px at 36% 27%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.6px 1.6px at 58% 7%, rgba(255,255,255,.85), transparent 60%),
    radial-gradient(1.2px 1.2px at 66% 31%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(2px 2px at 74% 12%, rgba(226,221,255,.95), transparent 60%),
    radial-gradient(1.2px 1.2px at 83% 36%, rgba(255,255,255,.6), transparent 60%),
    radial-gradient(1.6px 1.6px at 91% 19%, rgba(255,255,255,.8), transparent 60%),
    radial-gradient(1.2px 1.2px at 12% 48%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.2px 1.2px at 47% 44%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.2px 1.2px at 88% 50%, rgba(255,255,255,.5), transparent 60%);
  animation: twinkle 5s ease-in-out infinite alternate;
}
.hero-horizon {
  position: absolute; left: 50%; bottom: 18%; width: 140vw; height: 30vh; margin-left: -70vw; pointer-events: none;
  background: radial-gradient(50% 50% at 50% 50%, rgba(201, 185, 255, .22), transparent 70%);
  animation: glow 6s ease-in-out infinite alternate;
}
@keyframes breathe { from { transform: scale(1); } to { transform: scale(1.045); } }
@keyframes twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes glow { from { opacity: .55; } to { opacity: 1; } }

.hero-brand { position: absolute; left: 8.7%; top: calc(11px * var(--hz)); }
.hero-brand .brand-logo { width: calc(40px * var(--hz)); height: calc(40px * var(--hz)); }
.hero-brand .brand-name { font-size: calc(20px * var(--hz)); line-height: 1.25; }

.hero-title, .hero-title-wrap { position: absolute; left: 0; right: 0; top: 14.8%; text-align: center; font-weight: 400; font-size: calc(104px * var(--hz)); line-height: 1.25; letter-spacing: 0; white-space: nowrap; }
.hero-title-wrap { color: var(--accent); opacity: .36; text-shadow: 0 0 calc(20px * var(--hz)) rgba(158, 134, 255, .75); }
.hero-title {
  background: linear-gradient(180deg, #ffffff 0%, #f7f4ff 23%, #a697e0 48%, #f2eaff 65%, #8672c0 85%, #d5c8ff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 calc(7px * var(--hz)) rgba(187, 167, 255, .65));
}
.hero-sub { position: absolute; left: 0; right: 0; top: 39%; text-align: center; font-weight: 300; font-size: calc(44px * var(--hz)); line-height: 1.25; color: var(--text); }
.hero-greeting { position: absolute; left: 0; right: 0; top: 52.1%; text-align: center; font-weight: 300; font-size: calc(20px * var(--hz)); line-height: 1.25; color: var(--muted); }

.hero-arrow {
  position: absolute; left: 50%; bottom: 2.2%; width: 48px; height: 48px; margin-left: -24px;
  display: inline-flex; align-items: center; justify-content: center;
  opacity: .55; animation: bounce 2.2s cubic-bezier(.4, 0, .2, 1) infinite, shimmer 2.2s ease-in-out infinite;
}
.hero-arrow img { width: calc(32px * var(--hz)); height: auto; display: block; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(8px); } }
@keyframes shimmer { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.hero.is-away .hero-art, .hero.is-away .hero-twinkle, .hero.is-away .hero-horizon, .hero.is-away .hero-arrow { animation-play-state: paused; }

/* =====================================================================
   02 · PANEL
   ===================================================================== */
.panel { position: relative; background: var(--bg); padding: 18px 0 0; }
.panel-shell { width: 904px; margin: 0 auto; zoom: var(--z); }

.dashboard {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 12px;
  background: var(--surface); border: 0.7px solid var(--border); border-radius: 18px;
  box-shadow: inset 0 1px 15px rgba(149, 129, 239, .12);
}
.row { display: flex; gap: 12px; align-items: stretch; }
.half { width: 434px; }

/* nagłówek panelu */
.topbar { display: flex; align-items: center; gap: 10px; height: 39px; }
.topbar .brand { flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.market-pill {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 32px; min-width: 120px; padding: 0 12px;
  background: #0a1021; border: 0.7px solid var(--border); border-radius: 10px; font-size: 11px; color: var(--text); white-space: nowrap;
}
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: #5c5a7a; transition: background-color 300ms ease, box-shadow 300ms ease; }
[data-open="true"] .live-dot { background: #1eeb56; box-shadow: 0 0 7px rgba(28, 255, 90, .6), 0 0 14px rgba(28, 255, 90, .35); animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 0%, 100% { box-shadow: 0 0 7px rgba(28,255,90,.6), 0 0 14px rgba(28,255,90,.35); } 50% { box-shadow: 0 0 10px rgba(28,255,90,.9), 0 0 22px rgba(28,255,90,.5); } }
.icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; background: #0a1021; border: 0.7px solid var(--border); border-radius: 10px; color: var(--muted); cursor: pointer; padding: 0; transition: transform 160ms var(--ease-out), color 150ms ease; }
.icon-btn:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .icon-btn:hover { color: var(--text); } }

/* karty */
.card {
  position: relative; display: flex; flex-direction: column; gap: 7px; padding: 16px; overflow: hidden;
  border: 0.8px solid var(--card-border); border-radius: 12px;
  background: linear-gradient(180deg, #171b32 0%, #0c1121 28%, #0a0e1c 100%);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .16), inset 0 1px 6px rgba(199, 183, 255, .13);
  min-width: 0;
}
.metric-l { height: 114px; }
.metric-s { height: 96px; }
.metric-title { font-size: 10px; line-height: 1.25; color: var(--text); white-space: nowrap; }
.metric-title.t11 { font-size: 11px; }
.metric-value { font-weight: 600; font-size: 20px; line-height: 25px; white-space: nowrap; }
.metric-value.v28 { font-weight: 700; font-size: 28px; line-height: 35px; }
.metric-value.trend { font-size: 16px; line-height: 20px; }
.metric-value.trend.tone-good { color: var(--trend-up); }
.metric-detail { font-size: 10.5px; line-height: 1.25; color: var(--muted); }
.tone-good { color: var(--pos); }
.tone-bad { color: var(--neg); }

.pill {
  display: inline-flex; align-items: center; justify-content: center; align-self: flex-start; height: 24px; padding: 0 10px;
  border-radius: 12px; font-size: 10px; font-weight: 500; line-height: 1.25; white-space: nowrap;
  background: #141a2e; border: 0.6px solid var(--border); color: var(--text);
  transition: background-color 200ms ease, color 200ms ease, border-color 200ms ease;
}
.pill:empty { display: none; }
.pill.tone-bad { background: #301724; border-color: rgba(139, 64, 87, .7); color: var(--text); }
.pill.tone-good { background: #0b221c; border-color: var(--border); color: var(--pos); }

/* wykres kursu */
.chart-card { width: 880px; padding: 12px 16px 10px; gap: 0; }
.chart-head { display: flex; flex-direction: column; gap: 1px; height: 35px; }
.chart-title { font-weight: 600; font-size: 14px; line-height: 17.5px; }
.chart-sub { font-size: 10.5px; line-height: 13.125px; color: var(--muted); }
.chart-controls { display: flex; align-items: center; gap: 13px; height: 41px; }
.flex-space { flex: 1; }
.live-pill { display: inline-flex; align-items: center; justify-content: center; height: 24px; padding: 0 10px; border-radius: 12px; background: #0d1420; border: 0.6px solid var(--border); font-size: 10px; font-weight: 500; color: #d6d6f2; white-space: nowrap; }
.live-pill-dot { color: #5c5a7a; transition: color 300ms ease, text-shadow 300ms ease; }
.live-pill[data-open="true"] .live-pill-dot { color: var(--live); text-shadow: 0 0 6px rgba(26, 240, 77, .8); }
.ticker-symbol { font-weight: 600; font-size: 12px; }
.ticker-price { font-weight: 700; font-size: 18px; line-height: 22.5px; }
.period { position: relative; display: inline-flex; height: 32px; border: 0.6px solid var(--border); border-radius: 6px; overflow: hidden; }
.period button { position: relative; z-index: 1; width: 44px; height: 31px; border: 0; background: none; color: var(--text); font: 500 11px/13.75px var(--font); cursor: pointer; padding: 0; transition: color 150ms ease, transform 120ms var(--ease-out); }
.period button:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) { .period button:not([aria-checked="true"]):hover { color: #fff; } }
.period-indicator { position: absolute; top: 0; left: 0; width: 44px; height: 31px; border-radius: 6px; background: linear-gradient(180deg, #8173cf, #3a286f); border: 0.7px solid #a995f8; box-shadow: 0 0 7px rgba(128, 99, 255, .35); transition: transform 220ms var(--ease-in-out); }
.chart-frame { position: relative; width: 848px; height: 272px; padding: 4px 6px 2px; background: var(--chart-bg); border: 0.6px solid var(--border); border-radius: 6px; display: flex; flex-direction: column; }
.legend { display: flex; flex-wrap: wrap; gap: 2px 14px; list-style: none; margin: 0 0 2px 7px; padding: 0; font-size: 9px; line-height: 11.25px; color: var(--text); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 10px; height: 2px; }
.legend .marker { font-size: 9px; line-height: 1; }
.chart-box { position: relative; flex: 1; min-height: 0; }
.chart-box-sm { height: 145px; flex: none; }
.chart-box.is-empty canvas { visibility: hidden; }
.empty-state { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; color: var(--muted); font-size: 10px; }
.table-view { margin-top: 10px; font-size: 10px; font-weight: 500; color: var(--text); }
.table-view summary { cursor: pointer; list-style: none; width: max-content; }
.table-view summary::-webkit-details-marker { display: none; }
.table-view table { margin-top: 8px; }
.table-view[open] .table-scroll { animation: unfold 180ms var(--ease-out) both; }
@keyframes unfold { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* wykresy portfela */
.half.card { height: 200px; gap: 8px; }
.card-title-row { display: flex; justify-content: space-between; align-items: flex-start; height: 25px; }
.card-title { font-weight: 600; font-size: 14px; line-height: 17.5px; }
.card-title.t13 { font-size: 13px; line-height: 16.25px; }
.card-note { font-size: 10px; line-height: 12.5px; color: var(--muted); }

/* tabele */
.card.half.table-card { height: auto; min-height: 102px; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 10px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 400; font-size: 9px; line-height: 20px; color: var(--muted); padding: 0 6px 0 0; white-space: nowrap; }
td { font-weight: 500; font-size: 10px; line-height: 20px; padding: 0 6px 0 0; white-space: nowrap; }
.num { text-align: left; }
.pl-pill { display: inline; }
.side-chip { font-weight: 500; }
.side-chip.buy { color: var(--pos); }
.side-chip.sell { color: var(--neg); }
.empty-row td { color: var(--muted); }

/* bot */
.bot-card { height: 190px; gap: 6px; }
.bot-head { display: flex; align-items: center; gap: 9px; height: 21px; }
.bot-head .card-title { margin-right: auto; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 10px; color: var(--text); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 31px; height: 17px; border-radius: 8.5px; background: #2a2f4a; transition: background-color 200ms ease, box-shadow 200ms ease; }
.switch-knob { position: absolute; top: 1px; left: 1px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform 200ms var(--ease-out); }
.switch input:checked + .switch-track { background: #12e349; box-shadow: 0 0 10px rgba(18, 227, 73, .55); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(14px); }
/* gałka ugina się pod palcem; po puszczeniu wraca z ease-out */
.switch:active .switch-knob { transform: scaleX(1.18); transform-origin: left center; }
.switch:active input:checked + .switch-track .switch-knob { transform: translateX(14px) scaleX(1.18); transform-origin: right center; }
.bot-config { display: grid; grid-template-columns: 110px 1fr; row-gap: 4px; font-size: 10.5px; line-height: 13.125px; }
.bot-config dt { color: var(--muted); }
.bot-config dd { font-weight: 600; }
.bot-next { font-size: 9.2px; line-height: 11.5px; color: var(--muted); }
.history-card { height: 190px; gap: 8px; }
.timeline { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.timeline li { display: flex; align-items: center; gap: 14px; min-height: 28px; font-size: 11px; }
.timeline .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: none; }
.timeline .dot.buy { background: var(--pos); box-shadow: 0 0 6px var(--pos); }
.timeline .dot.sell, .timeline .dot.error { background: var(--neg); box-shadow: 0 0 6px var(--neg); }
.timeline .run-action { line-height: 1.25; }
.timeline .run-meta { font-size: 9px; color: var(--muted); }
.timeline time { margin-left: auto; font-size: 9px; color: var(--muted); white-space: nowrap; }

/* przyciski */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; align-self: flex-start;
  padding: 6px 8px; min-height: 26px; border-radius: 6px; cursor: pointer;
  font: 600 10.5px/14px var(--font); color: var(--text); border: 0.8px solid transparent;
  transition: transform 160ms var(--ease-out), box-shadow 150ms ease, opacity 150ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { cursor: default; opacity: .7; }
.btn-primary { background: linear-gradient(180deg, #a798fa 0%, #8871ee 35%, #5c43c8 100%); border-color: #c1acff; box-shadow: 0 0 9px rgba(157, 123, 255, .45), inset 0 1px 3px rgba(242, 234, 255, .35); }
@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { box-shadow: 0 0 14px rgba(157, 123, 255, .7), inset 0 1px 3px rgba(242, 234, 255, .35); }
}
.btn .spinner { width: 10px; height: 10px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: none; animation: spin 600ms linear infinite; }
.btn.loading .spinner { display: inline-block; }
.btn .btn-label { transition: filter 200ms ease, opacity 200ms ease; }
.btn.loading .btn-label { filter: blur(1px); opacity: .8; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn:focus-visible, input:focus-visible, .period button:focus-visible, summary:focus-visible, .hero-arrow:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* wartości na żywo */
.live-value { display: inline-block; padding: 0 3px; margin: 0 -3px; border-radius: 4px; transition: color 900ms ease, background-color 900ms ease, transform 420ms var(--ease-out); }
.live-value[data-flash] { transition-duration: 120ms; }
.live-value[data-flash="up"] { color: var(--pos); background-color: rgba(84, 239, 180, .16); transform: translateY(-2px); }
.live-value[data-flash="down"] { color: var(--neg); background-color: rgba(255, 72, 107, .18); transform: translateY(1.5px); }
.digit { display: inline-block; white-space: pre; }

/* logowanie */
.login-wrap { display: grid; place-items: center; padding: 40px 0; }
.login-card { width: 332px; gap: 12px; padding: 20px; animation: rise 400ms var(--ease-out) both; }
.login-card h2 { font-size: 14px; font-weight: 600; }
.login-card label { display: flex; flex-direction: column; gap: 4px; font-size: 10px; color: var(--muted); }
.login-card input { font: 500 11px/1.4 var(--font); color: var(--text); padding: 8px 10px; border-radius: 6px; border: 0.6px solid var(--border); background: var(--chart-bg); }
.login-card input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(163, 139, 250, .25); }
.login-card .btn { align-self: stretch; margin-top: 4px; }
.form-error { color: var(--neg); font-size: 10px; }
.shake { animation: shake 320ms var(--ease-out); }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* stopka */
.page-foot { height: 26px; display: flex; align-items: center; justify-content: center; font-size: 9px; color: var(--muted); margin-top: 6px; zoom: var(--z); }

/* toasty */
.toaster { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(300px, calc(100vw - 32px)); }
.toast { padding: 10px 12px; border-radius: 10px; border: 0.8px solid var(--card-border); background: linear-gradient(180deg, #171b32, #0a0e1c); box-shadow: 0 4px 10px rgba(0,0,0,.3); font-size: 11px; transition: transform 400ms var(--ease-out), opacity 400ms var(--ease-out); }
.toast[data-state="entering"], .toast[data-state="leaving"] { transform: translateY(100%); opacity: 0; }
.toast[data-state="leaving"] { transition-duration: 200ms; }
.toast strong { display: block; margin-bottom: 2px; }
.toast p { color: var(--muted); font-size: 10px; }

/* wejście */
.enter { animation: rise 450ms var(--ease-out) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.chart-reveal { clip-path: inset(0 100% 0 0); }
.chart-reveal.revealed { clip-path: inset(0 0 0 0); transition: clip-path 700ms var(--ease-in-out); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-art, .hero-twinkle, .hero-horizon, .hero-arrow, .live-dot, .enter, .login-card, .table-view[open] .table-scroll { animation: none !important; }
  .icon-btn:active, .period button:active, .switch:active .switch-knob { transform: none; }
  .hero-arrow { opacity: .8; }
  .chart-reveal, .chart-reveal.revealed { clip-path: none; transition: none; }
  .live-value, .live-value[data-flash] { transform: none; }
  .toast[data-state="entering"], .toast[data-state="leaving"] { transform: none; }
}

/* ---------- Wąskie ekrany: ten sam system, układ w jednej kolumnie ---------- */
@media (max-width: 940px) {
  .panel { padding: 12px 10px 0; }
  .panel-shell { width: 100%; }
  .row { flex-wrap: wrap; }
  .row > .card, .half, .chart-card, .bot-card, .history-card { width: 100% !important; }
  .metric-l, .metric-s, .half.card, .bot-card, .history-card { height: auto; }
  .chart-frame { width: 100%; }
  .chart-controls { flex-wrap: wrap; height: auto; padding: 8px 0; }
  .flex-space { display: none; }
  .hero-brand { left: 16px; }
}
