:root {
  --bg0: #070611;
  --bg1: #0b0a18;
  --panel: rgba(255, 255, 255, .06);
  --panel2: rgba(255, 255, 255, .08);
  --border: rgba(255, 255, 255, .10);
  --text: #e9e7ff;
  --muted: rgba(233, 231, 255, .65);
  --accent: #ff8a2a;
  --accent2: #b24cff;
  --shadow: 0 18px 60px rgba(0, 0, 0, .55);
  --radius: 18px;
  --blur: 16px;
  --max: 1280px;
  --gap: 18px;
  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
}

* {
  box-sizing: border-box;
}

html {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  height: 100%;
  background:
    radial-gradient(1200px 800px at 20% 10%, rgba(178, 76, 255, .20), transparent 60%),
    radial-gradient(900px 700px at 80% 20%, rgba(255, 138, 42, .16), transparent 55%),
    linear-gradient(135deg, var(--bg0), var(--bg1));
}


.app {
  position: relative;
  overflow-x: hidden;
}

.bg-orbs .orb {
  position: absolute;
  filter: blur(40px);
  opacity: .35;
  border-radius: 999px;
  pointer-events: none;
}

.orb-1 {
  width: 420px;
  height: 820px;
  left: -120px;
  top: 140px;
  background: rgba(177, 76, 255, 0.3);
}

.orb-2 {
  width: 660px;
  height: 560px;
  right: -180px;
  top: -80px;
  background: rgba(255, 138, 42, 0.2);
}

.orb-3 {
  width: 620px;
  height: 720px;
  right: 10%;
  bottom: 0px;
  background: rgba(92, 228, 255, 0.1);
}

.glass {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
}

.card {
  border-radius: var(--radius);
  padding: 34px 22px;
}

.pill {
  border-radius: 999px;
  padding: 10px 14px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.pill-strong {
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.topbar {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 18px 8px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(255, 138, 42, .22), rgba(178, 76, 255, .22));
  border: 1px solid rgba(255, 255, 255, .14);
}

.top-title {
  font-weight: 800;
  letter-spacing: .5px;
  font-size: x-large;
}

.top-sub {
  font-size: 12px;
  margin-top: 2px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.shell {
  width: 100%;
  max-width: var(--max);
  margin: 14px auto 14px;
  padding: 0 8px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--gap);
}

.sidebar {
  border-radius: var(--radius);
  padding: 14px;
  height: calc(100vh - 120px);
  position: sticky;
  top: 92px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  padding: 12px 12px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .10);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255, 138, 42, .16), rgba(178, 76, 255, .12));
  border-color: rgba(255, 255, 255, .14);
}

.content {
  min-width: 0;
}

.content-html {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

h1 {
  font-size: 26px;
  font-weight: 600;
}

h2 {
  font-size: 21px;
  font-weight: 600;
}

.h1 {
  margin: 0 0 8px;
  font-size: 26px;
  letter-spacing: -.3px;
}

.h1-accent {
  color: var(--accent);
}

.h2 {
  margin: 0;
  font-size: 21px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 160px 1fr;
  gap: 12px;
  margin: 14px 0 18px;
}

.chips {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  font-size: 13px;
}

.input,
.select {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(10, 9, 24, .55);
  color: var(--text);
  outline: none;
}

.input:focus,
.select:focus {
  border-color: rgba(255, 138, 42, .55);
  box-shadow: 0 0 0 4px rgba(255, 138, 42, .12);
}

a,
.btn {
  -webkit-transition: all .4s ease-in-out;
  transition: all .4s ease-in-out;
}

.btn {
  padding: 11px 14px;
  border-radius: 14px;
  border: 0;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: rgb(178 0 179 / 10%);
}

.btn-primary {
  border-color: rgba(255, 138, 42, .35);
  background: linear-gradient(135deg, rgba(255, 138, 42, .22), rgba(178, 76, 255, .12));
}

.btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, .12);
}

.report-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-row {
  padding: 14px 14px;
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .03);
}

.report-row:hover {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .14);
}

.report-title {
  font-weight: 650;
}

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  color: #ffd6b5;
  background: rgba(255, 138, 42, .14);
  border: 1px solid rgba(255, 138, 42, .22);
}

/* Auth */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  text-align: center;
}

.auth-card {
  width: min(520px, 100%);
}

.auth .logo-home {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: 0 0 2rem 0;
}

.auth .logo-img {
  width: auto;
  height: 100px;
}

.auth .top-title {
  font-size: xx-large;
  margin: 1rem 0 0 0;
}

.auth input {
  text-align: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: radial-gradient(circle at 30% 30%, #ffd2b0, var(--accent));
  box-shadow: 0 0 0 6px rgba(255, 138, 42, .10);
}

.brand-name {
  font-weight: 800;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.form {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.label-title {
  font-size: 16px;
  font-weight: 700;
}

.hint {
  color: var(--muted);
}

.check {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}

.form-hint {
  font-size: 12px;
  margin-top: 6px;
}

/* Responsive */
@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    height: auto;
    position: relative;
    top: 0;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .shell-rightbar {
    grid-template-columns: 1fr;
  }

  .rightbar {
    height: auto;
    position: relative;
    top: 0;
  }

  .topbar {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .topbar-right {
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .topnav {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
}

@media (max-width: 768px) {

  .table--users .th,
  .table--companies .th {
    display: none;
  }

  .table--users .tr {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
  }

  .table--companies .tr--companies {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
  }

  body.theme-light .table--users .tr,
  body.theme-light .table--companies .tr--companies {
    border-color: rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.02);
  }
}

/* Shell: prawa kolumna (sidebar przeniesiony na prawo) */
.shell-rightbar {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--gap);
}

/* Prawy panel: najnowsze raporty */
.rightbar {
  border-radius: var(--radius);
  padding: 14px;
  height: calc(100vh - 120px);
  position: sticky;
  top: 92px;
  align-self: start;
  /* ważne przy sticky w grid */
}

.rightbar-head {
  margin-bottom: 12px;
}

.rightbar-title {
  font-weight: 800;
}

.rightbar-sub {
  font-size: 12px;
  margin-top: 4px;
}

.mini-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mini-item {
  text-decoration: none;
  color: var(--text);
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .03);
}

.mini-item:hover {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .14);
}

.mini-main {
  font-weight: 650;
}

.mini-sub {
  font-size: 12px;
  margin-top: 3px;
}

/* Logo */
.logo-wrap {
  height: 44px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 0;
}

.logo-wrap img {
  width: auto;
  height: 44px;
}

.logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Topnav (Raporty/Ustawienia/Wyloguj obok siebie) */
.topnav {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border-radius: 999px;
}

.topnav-link {
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 15px;
}

.topnav-link:hover {
  background: rgba(255, 255, 255, .06);
  border-color: rgba(255, 255, 255, .10);
}

.topnav-link.active {
  background: linear-gradient(135deg, rgba(255, 138, 42, .16), rgba(178, 76, 255, .12));
  border-color: rgba(255, 255, 255, .14);
}

.topnav-link.logout {
  background: rgba(255, 255, 255, .02);
  border-color: rgba(255, 255, 255, .10);
}

.mini-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mini-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 1px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  color: rgba(233, 231, 255, .78);
}

.badge2 {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  font-size: 12px;
  line-height: 1;
}

.badge[data-kind="country"] {
  border-color: rgba(92, 227, 255, .22);
  background: rgba(222, 234, 236, 0.815);
  color: rgba(40, 99, 109, 0.95);
  font-weight: 700;
}

.badge[data-kind="special"] {
  border-color: rgba(255, 138, 42, .22);
  background: rgba(255, 138, 42, .12);
  color: #ffd6b5;
}

.report-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.report-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 1px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.settings-tile {
  display: block;
  text-decoration: none;
  color: var(--text);
  padding: 16px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(255, 255, 255, .03);
}

.settings-tile:hover {
  background: rgba(255, 255, 255, .05);
  border-color: rgba(255, 255, 255, .14);
}

.settings-title {
  font-weight: 800;
  margin-bottom: 6px;
}

@media (max-width: 980px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

.row-50 {
  display: flex;
  gap: 20px;
}

.row-50 .box {
  flex: 1;
  /* zamiast width: 50% */
}

.table--users .tr {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 3fr 2fr;
  gap: 12px;
  align-items: center;
}

.table--sources .th,
.table--sources .tr {
  display: grid;
  grid-template-columns: 15fr 1fr 1fr 1fr 2fr;
  gap: 8px;
  align-items: center;
}

/* "Tabela" na DIV-ach: wiersz jako grid z 4 kolumnami */
.table--companies .tr--companies {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) minmax(120px, .7fr) minmax(70px, .35fr) minmax(180px, .55fr);
  gap: 12px;
  align-items: center;
}

.table--sources .th,
.table--users .th,
.table--companies .th {
  border-bottom: 1px solid #b08eff38;
}

.table--sources .tr,
.table--sources .th,
.table--users .tr,
.table--users .th,
.table--companies .tr,
.table--companies .th {
  padding: 5px;
}

.table .text-small {
  font-size: small;
}

/* Na małych ekranach można zwinąć do 1 kolumny (opcjonalnie) */
@media (max-width: 860px) {
  .table--companies .tr--companies {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.split {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 14px;
}

.split-col {
  padding: 0;
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.tr--sched {
  display: grid;
  grid-template-columns: 90px 110px 80px 1fr;
  gap: 12px;
  align-items: center;
}

@media (max-width: 980px) {
  .split {
    grid-template-columns: 1fr;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .tr--sched {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.tr--tokens {
  display: grid;
  grid-template-columns: 120px 100px 1fr 1fr 130px;
  gap: 12px;
  align-items: center;
}

@media (max-width: 980px) {
  .tr--tokens {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.tr--sources {
  display: grid;
  grid-template-columns: 1fr 80px 220px;
  gap: 12px;
  align-items: center;
}

@media (max-width: 980px) {
  .tr--sources {
    grid-template-columns: 1fr;
    gap: 6px;
  }
}

.prewrap {
  white-space: pre-wrap;
}

.bold {
  font-weight: 700;
}

.add-source {
  display: flex;
  justify-content: flex-start;
  margin: 0 0 10px 0;
  align-items: center;
}

.add-source input {
  margin-left: 12px;
}

.alert {
  padding: 12px;
  background-color: #8861c582;
  color: #ffffff;
  border-radius: 12px;
  margin: 0 0 21px 0;
  font-weight: 700;
  border: 1px solid #ffffff5e;
}

.table--companies,
.table--sources {
  counter-reset: row;
}

.table--companies .tr,
.table--sources .tr {
  counter-increment: row;
  position: relative;
  padding-left: 40px;
  /* miejsce na numer */
}

.table--sources .tr::before {
  content: counter(row) ".";
  position: absolute;
  left: 0;
  top: 34%;
  font-weight: 700;
  color: #666;
}

.table--companies .tr::before {
  content: counter(row) ".";
  position: absolute;
  left: 0;
  top: 30%;
  font-weight: 700;
  color: #666;
}

.flex-left {
  justify-content: flex-start;
  align-items: flex-start;
}

table td {
  padding: 5px;
}

tr:nth-child(even),
table thead {
  background-color: #ececec;
}

/* Scroll To Top Button */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: var(--text);
  cursor: pointer;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease-in-out;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: linear-gradient(135deg, rgba(255, 138, 42, .22), rgba(178, 76, 255, .12));
  border-color: rgba(255, 138, 42, .35);
  color: #fff;
}

h1 span {
  font-weight: 300;
}

.company-name {
  width: 70%;
}

.companies-search-form {
  display: flex;
  gap: 0.5rem;
}

.companies-head-options {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 1.5rem;
}

.companies-head-watchlist {
  display: flex;
}

.company-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

table.companies-list {
  width: 100%;
  text-align: left;
  border-collapse: collapse;
}

table.companies-list tr:hover {
  background-color: #ecbbff;
}

ul.note-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
}

@media (min-width: 768px) {
  ul.note-list {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 980px) {
  .company-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .last-news-date {
    font-size: 13px;
  }

  .companies-head-watchlist {
    margin-bottom: 0.5rem;
  }

  .companies-search-form {
    flex-direction: column;
  }

  .companies-head-options {
    flex-direction: column;
  }
}