:root {
  color-scheme: dark;
  --page: #111522;
  --surface: #181e2e;
  --surface-soft: #1c2435;
  --border: #2a354a;
  --text: #eef2fa;
  --muted: #a8b4c8;
  --accent: #70dcbb;
  --accent-ink: #122b28;
  --supply: #f3838f;
  --radius: 14px;
  font: 15px/1.5 system-ui, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--text); }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.45rem, 3vw, 2rem); line-height: 1.16; font-weight: 680; }
h2 { font-size: 1.08rem; line-height: 1.3; font-weight: 680; }
button, input, select { font: inherit; }
button, input, select, .quiet { min-height: 44px; }
button, input, select {
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-soft);
}
input, select { min-width: 0; padding: 8px 11px; }
input { width: 100%; }
button, .quiet { padding: 8px 13px; font-weight: 620; }
button { cursor: pointer; }
button:hover { border-color: #536687; }
button:disabled { cursor: wait; opacity: .63; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
a { color: inherit; }
label { display: block; color: var(--muted); font-size: .79rem; font-weight: 680; margin-bottom: 5px; }
.primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.primary:hover { background: #98e9d1; border-color: #98e9d1; }
.quiet {
  display: inline-flex; align-items: center; justify-content: center;
  align-self: stretch; color: var(--muted); background: transparent;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap;
}
.quiet:hover { color: var(--text); background: var(--surface-soft); }
.frame { width: min(1120px, calc(100% - 34px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--border); background: #151a28; }
.masthead-inner {
  min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
  font-size: 1.14rem; font-weight: 750; letter-spacing: -.025em; text-decoration: none;
}
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center; gap: 3px;
  width: 32px; height: 32px; border-radius: 9px;
  background: #223b38; color: var(--accent);
}
.brand-mark i { width: 3px; border-radius: 2px; background: currentColor; }
.brand-mark i:nth-child(1) { height: 11px; transform: translateY(3px); }
.brand-mark i:nth-child(2) { height: 15px; }
.brand-mark i:nth-child(3) { height: 11px; transform: translateY(-4px); }
.brand-divider { width: 1px; height: 17px; background: var(--border); }
.brand-detail { font-weight: 550; font-size: .83rem; color: var(--muted); letter-spacing: 0; }
.account-actions { display: flex; align-items: center; gap: 3px; }
.main { padding-block: 29px 42px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.muted { color: var(--muted); }
.notice {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface-soft); color: var(--muted); font-size: .86rem;
}
.notice.error { color: #ffb9c1; border-color: #623945; background: #312531; }
.login-panel { margin: min(9vh, 75px) auto 0; max-width: 500px; padding: clamp(20px, 5vw, 35px); }
.login-panel .muted { margin: 8px 0 23px; }
.login-panel .notice, .members-panel .notice { margin-top: 12px; }
.field-inline { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.workspace-heading { margin-bottom: 20px; }
.workspace-heading .muted { font-size: .83rem; margin-top: 5px; }
.controls {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, 176px) auto;
  align-items: end; gap: 12px; padding: 14px; margin-bottom: 13px;
}
.field { min-width: 0; }
.field select { width: 100%; }
.market-field { position: relative; }
.market-hint, .search-results {
  position: absolute; z-index: 3; inset: calc(100% + 5px) 0 auto;
  border: 1px solid #485975; background: #222c40; border-radius: 9px;
  box-shadow: 0 12px 22px #0e1327a0;
}
.market-hint { padding: 9px 10px; font-size: .82rem; color: var(--muted); }
.search-results { padding: 4px; max-height: 252px; overflow-y: auto; }
.search-results button {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  min-height: 42px; width: 100%; background: transparent; border-color: transparent; text-align: left;
}
.search-results button:hover, .search-results button:focus-visible { background: #2b3a54; }
.search-results .exchange { color: var(--muted); font-size: .78rem; font-weight: 500; }
#workspace-status { margin-bottom: 13px; }
.chart-panel { overflow: hidden; }
.chart-toolbar {
  display: flex; justify-content: space-between; align-items: center; gap: 9px; padding: 15px 15px 0;
}
.chart-source {
  display: inline-flex; padding: 2px 6px; margin-top: 4px; color: #b6c8e9; background: #232d42;
  border-radius: 5px; font-size: .72rem; font-weight: 620;
}
.chart-zoom { display: flex; gap: 5px; }
.chart-zoom button { min-width: 44px; }
.chart-zoom button:not(:last-child) { font-size: 1.15rem; }
.chart-zoom button:last-child { padding-inline: 8px; font-size: .74rem; }
.chart-meta {
  min-height: 44px; padding: 6px 15px 4px; display: flex; align-items: baseline; flex-wrap: wrap;
  gap: 1px 14px; font-size: .73rem;
}
.last-price { font-size: 1.42rem; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.chart-canvas { height: clamp(295px, 54vh, 545px); background: #151c2d; }
.chart-canvas canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; cursor: grab; }
.chart-canvas canvas:active { cursor: grabbing; }
.chart-footer {
  display: flex; justify-content: space-between; flex-wrap: wrap; align-items: center;
  gap: 5px 12px; padding: 10px 15px 11px; font-size: .76rem; border-top: 1px solid var(--border);
}
.legend { display: flex; gap: 5px 14px; flex-wrap: wrap; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; flex: none; width: 11px; height: 8px; border: 1px solid; border-radius: 2px; }
.swatch.demand { background: #70dcbb3d; border-color: var(--accent); }
.swatch.supply { background: #f3838f3d; border-color: var(--supply); }
.swatch.tested { border-style: dashed; border-color: #c3cee0; }
.zone-panel, .members-panel { padding: 16px; margin-top: 14px; }
.zone-panel p, .members-panel p { margin-top: 8px; font-size: .85rem; }
.rows { margin: 9px 0 0; padding: 0; list-style: none; }
.rows li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px;
  align-items: center; padding: 9px 0; border-top: 1px solid var(--border);
}
.rows li > div { min-width: 0; display: grid; }
.rows strong, .rows small { overflow-wrap: anywhere; }
.rows strong { font-size: .89rem; }
.rows small { color: var(--muted); font-size: .76rem; }
.rows .row-value { font-size: .81rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.row-demand { color: var(--accent); }
.row-supply { color: var(--supply); }
.invite-form { max-width: 520px; margin-top: 12px; }
.invite-output { margin-top: 13px; padding: 11px; border: 1px solid var(--border); border-radius: 8px; }
#czlonkowie { scroll-margin-top: 12px; }

@media (max-width: 580px) {
  .frame { width: calc(100% - 22px); }
  .main { padding-top: 20px; }
  .masthead-inner { min-height: 58px; }
  .brand { gap: 7px; }
  .brand-divider, .brand-detail { display: none; }
  .workspace-heading { margin-bottom: 13px; }
  .controls { grid-template-columns: minmax(0, 1fr) auto; padding: 10px; gap: 8px; }
  .market-field { grid-column: 1 / -1; }
  .chart-toolbar, .chart-meta, .chart-footer { padding-inline: 10px; }
  .chart-canvas { height: clamp(285px, 43vh, 430px); }
  .zone-panel, .members-panel { padding: 12px; }
  .members-panel .field-inline { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; }
}
.key-file {
  margin-top: 1.15rem;
  color: var(--muted);
}
.key-file summary {
  cursor: pointer;
  margin-bottom: .6rem;
}
.key-file label {
  display: block;
  margin-bottom: .35rem;
}
.key-file input {
  max-width: 100%;
}
