/* Futurystyczny ciemny motyw: neon (cyjan + fiolet), szkło, siatka w tle. */
:root {
  color-scheme: dark;
  --bg: #05070d;
  --bg-2: #0a0f1c;
  --glass: rgba(14, 20, 36, .72);
  --glass-strong: rgba(10, 15, 28, .92);
  --text: #e6f1ff;
  --muted: #7d8aa8;
  --line: rgba(120, 200, 255, .14);
  --line-strong: rgba(120, 200, 255, .3);
  --cyan: #22e3ff;
  --violet: #a78bfa;
  --accent: var(--cyan);
  --accent-text: #041018;
  --grad: linear-gradient(135deg, #22e3ff 0%, #7c8cff 55%, #c084fc 100%);
  --ok: #34f5a5;
  --err: #ff5c7a;
  --glow: 0 0 0 1px rgba(34, 227, 255, .25), 0 0 24px rgba(34, 227, 255, .18);
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; padding: 16px;
  display: grid; place-items: center;
  font-family: "Segoe UI Variable", "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(900px 500px at 10% -10%, rgba(34, 227, 255, .14), transparent 60%),
    radial-gradient(800px 600px at 110% 110%, rgba(167, 139, 250, .16), transparent 60%),
    linear-gradient(rgba(120, 200, 255, .045) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(120, 200, 255, .045) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--bg);
  background-attachment: fixed;
}
::selection { background: rgba(34, 227, 255, .3); }

.card {
  position: relative; width: 100%; max-width: 440px; padding: 28px 32px;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.card::before { /* świecąca linia u góry karty */
  content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 1px;
  background: var(--grad); opacity: .8;
}
@media (max-width: 480px) { .card { padding: 22px 18px; } }

h1 { margin: 0 0 8px; font-size: 24px; font-weight: 650; letter-spacing: .01em; }
h2 { margin: 24px 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
p { margin: 6px 0; color: var(--muted); }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mono { font-family: var(--mono); }

label { display: block; margin: 14px 0 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
input {
  width: 100%; padding: 11px 13px; font: inherit; color: var(--text);
  background: rgba(5, 8, 16, .7); border: 1px solid var(--line); border-radius: 10px; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: var(--cyan); box-shadow: var(--glow); }

button {
  margin-top: 18px; width: 100%; padding: 11px 14px; font: inherit; font-weight: 650; letter-spacing: .02em;
  cursor: pointer; border: 0; border-radius: 10px; color: var(--accent-text); background: var(--grad);
  box-shadow: 0 0 20px rgba(34, 227, 255, .25); transition: box-shadow .15s, transform .15s;
}
button:hover { box-shadow: 0 0 30px rgba(34, 227, 255, .45); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
button.secondary { background: transparent; color: var(--text); border: 1px solid var(--line-strong); font-weight: 500; box-shadow: none; }
button.secondary:hover { border-color: var(--cyan); box-shadow: var(--glow); }
button.danger { background: transparent; color: var(--err); border: 1px solid rgba(255, 92, 122, .5); font-weight: 500; box-shadow: none; }
button.danger:hover { box-shadow: 0 0 20px rgba(255, 92, 122, .25); }
button:disabled { opacity: .5; cursor: default; }

.tabs { display: flex; gap: 6px; margin: 18px 0 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 8, 16, .5); }
.tabs button { margin: 0; padding: 8px; background: transparent; color: var(--muted); box-shadow: none; font-weight: 500; }
.tabs button.active { background: var(--grad); color: var(--accent-text); font-weight: 650; }

.msg { min-height: 20px; margin-top: 12px; font-size: 14px; }
.msg.err { color: var(--err); } .msg.ok { color: var(--ok); }
.row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row span:first-child { color: var(--muted); }
.row strong { font-family: var(--mono); font-weight: 600; }
.bar { height: 6px; background: rgba(120, 200, 255, .1); border-radius: 3px; overflow: hidden; margin: 4px 0 8px; }
.bar div { height: 100%; background: var(--grad); box-shadow: 0 0 10px rgba(34, 227, 255, .6); }
details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
summary { cursor: pointer; color: var(--muted); font-size: 14px; }
summary:hover { color: var(--text); }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); margin-right: 8px; vertical-align: 1px; }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); animation: pulse 2s ease-in-out infinite; }
.dot.err { background: var(--err); box-shadow: 0 0 10px var(--err); }
@keyframes pulse { 50% { opacity: .45; } }

/* --- Górny pasek i menu boczne (shell.js) --- */
body.app { display: block; padding: 80px 16px 24px; }
body.app .card { margin: 0 auto; }
body.menu-open { overflow: hidden; }
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 60px; z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: rgba(5, 8, 16, .75); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--grad); opacity: .45; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; letter-spacing: .12em; text-transform: uppercase; font-size: 13px; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; filter: drop-shadow(0 0 6px rgba(34, 227, 255, .6)); }
.topbar .burger {
  width: 42px; height: 42px; margin: 0; padding: 12px 10px; border-radius: 10px;
  display: flex; flex-direction: column; justify-content: space-between;
  background: transparent; border: 1px solid var(--line); box-shadow: none;
}
.topbar .burger:hover { border-color: var(--cyan); box-shadow: var(--glow); }
.burger span { display: block; height: 2px; border-radius: 1px; background: var(--cyan); box-shadow: 0 0 6px rgba(34, 227, 255, .7); }
.burger span:nth-child(2) { width: 70%; }

.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(2, 4, 10, .6); backdrop-filter: blur(3px);
           opacity: 0; pointer-events: none; transition: opacity .25s; }
.sidebar {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: 290px; max-width: 86vw; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--glass-strong); border-right: 1px solid var(--line-strong);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  transform: translateX(-100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.menu-open .overlay { opacity: 1; pointer-events: auto; }
.menu-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(34, 227, 255, .12); }
@media (prefers-reduced-motion: reduce) {
  .sidebar, .overlay { transition: none; }
  .dot.ok { animation: none; }
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; height: 60px; padding: 0 12px 0 20px;
                border-bottom: 1px solid var(--line); }
.sidebar-head strong { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.sidebar .sidebar-close { width: 36px; height: 36px; margin: 0; padding: 0; font-size: 24px; line-height: 1; border-radius: 8px;
                          background: transparent; color: var(--muted); box-shadow: none; }
.sidebar .sidebar-close:hover { color: var(--text); background: rgba(120, 200, 255, .08); }
.nav-list { padding: 10px; flex: 1; }
.nav-account { padding: 10px; border-top: 1px solid var(--line); }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin: 2px 0;
  border-radius: 10px; color: var(--text); font-size: 14.5px; text-decoration: none;
  border: 1px solid transparent; transition: background .15s, border-color .15s;
}
.nav-item svg { flex: none; width: 19px; height: 19px; color: var(--cyan); opacity: .85; }
.nav-item .label { flex: 1; }
a.nav-item:hover { background: rgba(34, 227, 255, .07); border-color: var(--line); text-decoration: none; }
.nav-item.active { background: linear-gradient(90deg, rgba(34, 227, 255, .16), rgba(167, 139, 250, .08)); border-color: var(--line-strong); }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 2px;
                           background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.nav-item.disabled { color: var(--muted); cursor: default; }
.nav-item.disabled svg { color: var(--muted); opacity: .6; }
.badge { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
         padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); }
.badge.new { color: var(--violet); border-color: rgba(167, 139, 250, .45); }
.sidebar .nav-logout { width: 100%; margin: 2px 0 0; background: transparent; color: var(--err); font-weight: 500; box-shadow: none; text-align: left; }
.sidebar .nav-logout svg { color: var(--err); }
.sidebar .nav-logout:hover { background: rgba(255, 92, 122, .08); }
.nav-email { margin: 6px 12px 10px; font-size: 12.5px; overflow-wrap: anywhere; font-family: var(--mono); }

/* --- Pulpit --- */
.page { max-width: 1100px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 22px; }
.page-head h1 { font-size: 30px; margin: 0; }
.status { font-family: var(--mono); font-size: 13px; color: var(--muted); padding: 7px 12px;
          border: 1px solid var(--line); border-radius: 999px; background: rgba(5, 8, 16, .6); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.tile {
  position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px; min-height: 150px;
  color: var(--text); background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); overflow: hidden;
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.tile::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 160px; height: 160px; border-radius: 50%;
               background: radial-gradient(circle, rgba(34, 227, 255, .12), transparent 70%); pointer-events: none; }
a.tile:hover { text-decoration: none; border-color: var(--cyan); box-shadow: var(--glow); transform: translateY(-2px); }
.tile-top { display: flex; align-items: center; justify-content: space-between; }
.tile-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px;
             border: 1px solid var(--line-strong); background: rgba(34, 227, 255, .07); }
.tile-icon svg { width: 21px; height: 21px; color: var(--cyan); filter: drop-shadow(0 0 5px rgba(34, 227, 255, .6)); }
.tile h3 { margin: 6px 0 0; font-size: 16px; font-weight: 600; }
.tile p { margin: 0; font-size: 13.5px; line-height: 1.45; }
.tile.featured { grid-column: span 2; background: linear-gradient(135deg, rgba(34, 227, 255, .12), rgba(167, 139, 250, .12)), var(--glass);
                 border-color: var(--line-strong); }
.tile.featured .tile-icon svg { color: var(--violet); filter: drop-shadow(0 0 6px rgba(167, 139, 250, .8)); }
@media (max-width: 560px) { .tile.featured { grid-column: auto; } .page-head h1 { font-size: 24px; } }
.footnote { margin-top: 26px; font-size: 12px; text-align: center; }

/* --- Wykresy --- */
.chart-page { max-width: 1400px; }
.chart-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-bottom: 12px; }
.search { position: relative; flex: 1 1 320px; max-width: 520px; }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 15; max-height: 60vh; overflow-y: auto;
           padding: 6px; background: var(--glass-strong); border: 1px solid var(--line-strong); border-radius: 12px;
           backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 20px 50px rgba(0,0,0,.5);
           color: var(--muted); font-size: 14px; }
.res-title { padding: 8px 10px 4px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.results .res { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; margin: 0;
                padding: 9px 10px; border-radius: 8px; background: transparent; color: var(--text); font-weight: 500;
                text-align: left; box-shadow: none; }
.results .res:hover { background: rgba(34, 227, 255, .08); }
.results .res small { color: var(--muted); font-size: 12px; text-align: right; }
.quote { text-align: right; }
.inst-name { font-size: 13px; color: var(--muted); letter-spacing: .04em; }
.price { font-size: 22px; font-weight: 600; }
.change { font-size: 13px; }
.change.up { color: var(--ok); } .change.down { color: var(--err); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.seg { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5, 8, 16, .5); }
.seg button { width: auto; margin: 0; padding: 6px 11px; font-size: 13px; font-family: var(--mono); background: transparent;
              color: var(--muted); box-shadow: none; font-weight: 500; border-radius: 7px; }
.seg button.active { background: var(--grad); color: var(--accent-text); font-weight: 650; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .chip { --chip: var(--cyan); width: auto; margin: 0; padding: 6px 11px; font-size: 13px; font-weight: 500; border-radius: 999px;
               background: transparent; color: var(--muted); border: 1px solid var(--line); box-shadow: none; }
.chips .chip.on { color: var(--text); border-color: var(--chip); box-shadow: 0 0 12px color-mix(in srgb, var(--chip) 35%, transparent);
                  background: color-mix(in srgb, var(--chip) 12%, transparent); }
.chips .chip:disabled { opacity: .35; }
.recent { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; min-height: 18px; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
.recent button.link { width: auto; margin: 0; padding: 0; background: none; box-shadow: none; color: var(--cyan); font-weight: 500; font-size: 13px; }
.recent button.link:hover { text-decoration: underline; }
.chart-wrap { position: relative; background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chart { height: calc(100vh - 260px); min-height: 440px; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center;
             color: var(--muted); background: rgba(5, 8, 16, .6); }
@media (max-width: 640px) {
  .quote { text-align: left; }
  .chart { height: 70vh; min-height: 380px; }
}
/* --- Wspólne elementy modułów --- */
.panel { background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px;
         backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); margin-bottom: 14px; }
.panel h2 { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row-inline > input, .row-inline > select { flex: 1 1 200px; width: auto; }
.row-inline > button { width: auto; margin: 0; padding: 10px 18px; }
select { padding: 10px 12px; font: inherit; color: var(--text); background: rgba(5, 8, 16, .7);
         border: 1px solid var(--line); border-radius: 10px; }
textarea { width: 100%; min-height: 90px; padding: 11px 13px; font: inherit; color: var(--text); resize: vertical;
           background: rgba(5, 8, 16, .7); border: 1px solid var(--line); border-radius: 10px; outline: none; }
textarea:focus, select:focus { border-color: var(--cyan); box-shadow: var(--glow); }
button.small-btn { width: auto; margin: 0; padding: 6px 12px; font-size: 13px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.kv span:nth-child(odd) { color: var(--muted); }
.kv span:nth-child(even) { font-family: var(--mono); overflow-wrap: anywhere; }
.list { margin: 0; padding-left: 18px; }
.list li { margin: 5px 0; }
.flag-red li::marker { color: var(--err); }
.flag-warn li::marker { color: #fbbf24; }
.flag-ok li::marker { color: var(--ok); }
.verdict { display: inline-block; padding: 6px 14px; border-radius: 999px; font-weight: 700; letter-spacing: .08em; font-family: var(--mono); }
.verdict.RED { color: #fff; background: rgba(255, 92, 122, .25); border: 1px solid var(--err); box-shadow: 0 0 18px rgba(255, 92, 122, .35); }
.verdict.YELLOW { color: #fde68a; background: rgba(251, 191, 36, .15); border: 1px solid #fbbf24; }
.verdict.GREEN { color: #bbf7d0; background: rgba(52, 245, 165, .12); border: 1px solid var(--ok); box-shadow: 0 0 18px rgba(52, 245, 165, .25); }
.verdict.UNKNOWN { color: var(--muted); border: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; font-weight: 600; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
                padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; cursor: default; }
table.data th.sortable { cursor: pointer; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tr:hover td { background: rgba(34, 227, 255, .04); }
td.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.up { color: var(--ok); } .down { color: var(--err); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line); color: var(--muted); margin: 1px 2px; }
.pill.red { color: var(--err); border-color: rgba(255, 92, 122, .45); }
.pill.good { color: var(--ok); border-color: rgba(52, 245, 165, .4); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--cyan);
           border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -3px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
.notice { padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(251, 191, 36, .4); background: rgba(251, 191, 36, .07);
          color: #fde68a; font-size: 14px; margin-bottom: 14px; }
.notice.err { border-color: rgba(255, 92, 122, .5); background: rgba(255, 92, 122, .08); color: #fecdd3; }
.picker { position: relative; flex: 1 1 280px; }
.picker .results { top: calc(100% + 4px); }
.chosen { font-size: 13px; color: var(--muted); }
.chosen strong { color: var(--text); }
.disclaimer { font-size: 12px; color: var(--muted); margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.coin-img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 8px; background: var(--line); }