: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;
  }
}

/* Obserwowane */
.watchlist-page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.watchlist-add-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.watchlist-toolbar {
  min-height: 24px;
  display: flex;
  align-items: center;
  margin: 0 0 8px;
}

.watchlist-status-error {
  color: #d32f2f;
}

.watchlist-alert {
  margin-bottom: 14px;
}

.watchlist-alert-success {
  background-color: rgba(32, 137, 83, .18);
  color: #1f7a4b;
  border-color: rgba(32, 137, 83, .28);
}

.watchlist-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.watchlist-tile,
.watchlist-placeholder {
  border-radius: 8px;
}

.watchlist-tile {
  position: relative;
  min-width: 0;
  padding: 14px 44px 14px 14px;
  overflow: hidden;
}

.watchlist-tile-title {
  margin: 0 0 8px;
  padding-right: 100px;
  font-size: 16px;
  line-height: 1.25;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.watchlist-tile-content {
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.watchlist-tile-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 4px;
  z-index: 2;
}

.watchlist-icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: rgba(255, 255, 255, .06);
  color: var(--text);
  cursor: pointer;
}

.watchlist-icon-btn:hover {
  border-color: rgba(255, 138, 42, .35);
  background: rgba(255, 138, 42, .12);
}

.watchlist-icon-danger {
  color: #d04444;
}

.watchlist-drag-handle {
  cursor: grab;
  touch-action: none;
}

.watchlist-drag-handle:active {
  cursor: grabbing;
}

.watchlist-tile.is-dragging {
  z-index: 3000;
  opacity: .95;
  pointer-events: none;
  box-shadow: 0 22px 50px rgba(0, 0, 0, .18);
}

.watchlist-placeholder {
  border: 1px dashed rgba(255, 138, 42, .6);
  background: rgba(255, 138, 42, .08);
}

.watchlist-expand {
  display: none;
  position: absolute;
  left: 14px;
  bottom: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #7d3cc8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
}

.watchlist-tile.has-overflow .watchlist-expand {
  display: inline-flex;
}

.watchlist-tile.has-overflow::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 36px;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--panel2) 70%);
  pointer-events: none;
}

.watchlist-tile.has-overflow .watchlist-expand {
  z-index: 1;
}

.watchlist-modal-open {
  overflow: hidden;
}

.watchlist-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 2500;
}

.watchlist-modal.is-open {
  display: flex;
}

.watchlist-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .48);
}

.watchlist-modal-panel {
  position: relative;
  width: min(680px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border-radius: 8px;
}

.watchlist-delete-panel {
  width: min(520px, 100%);
}

.watchlist-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.watchlist-full-content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.watchlist-delete-entry-title {
  margin: 0 0 20px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.watchlist-danger-button {
  background: rgba(208, 68, 68, .16);
  color: #b92727;
}

.watchlist-danger-button:hover {
  background: rgba(208, 68, 68, .24);
}

body.theme-light .watchlist-icon-btn {
  border-color: rgba(0, 0, 0, .12);
  background: rgba(0, 0, 0, .04);
}

body.theme-light .watchlist-icon-btn:hover {
  background: rgba(255, 138, 42, .13);
}

body.theme-light .watchlist-placeholder {
  background: rgba(255, 138, 42, .12);
}

@media (min-width: 768px) {
  .watchlist-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .watchlist-tile {
    max-height: 200px;
    min-height: 200px;
    padding-bottom: 28px;
  }

  .watchlist-tile-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
    overflow: hidden;
  }

  .watchlist-tile-content {
    max-height: 182px;
    overflow: hidden;
  }
}

@media (max-width: 767px) {
  .watchlist-page-head {
    flex-direction: column;
  }

  .watchlist-add-button {
    width: 100%;
    justify-content: center;
  }

  .watchlist-tile {
    max-height: none;
  }

  .watchlist-tile-content {
    max-height: none;
  }

  .watchlist-expand,
  .watchlist-tile.has-overflow .watchlist-expand {
    display: none;
  }

  .watchlist-tile.has-overflow::after {
    display: none;
  }

  .watchlist-tile-actions {
    top: 10px;
    right: 10px;
  }
}

/* --------------------------------------------------------------------------
   Stock Journals — light theme and app-specific components
   -------------------------------------------------------------------------- */
body.theme-light {
  --bg0: #f4f5f8;
  --bg1: #ffffff;
  --panel: rgba(255,255,255,.88);
  --panel2: rgba(255,255,255,.96);
  --border: rgba(0,0,0,.10);
  --text: #2a2a35;
  --muted: rgba(42,42,53,.65);
  --shadow: 0 10px 40px rgba(0,0,0,.07);
}
body.theme-light .bg-orbs .orb { opacity: .15; }
body.theme-light .input,
body.theme-light .select { background: rgba(255,255,255,.78); border-color: rgba(0,0,0,.15); color: #2a2a35; }
body.theme-light .input:focus,
body.theme-light .select:focus { background: #fff; }
body.theme-light .btn { background: rgba(0,0,0,.055); color: #2a2a35; }
body.theme-light .btn:hover { background: rgba(0,0,0,.095); }
body.theme-light .btn-primary { background: linear-gradient(135deg, rgba(255,138,42,.72), rgba(178,76,255,.70)); color: #fff; }
body.theme-light .topnav-link:hover { background: rgba(0,0,0,.05); }
body.theme-light .glass { border-color: rgba(255,255,255,.95); }
body.theme-light .topnav-link.logout { border-color: rgba(0,0,0,.10); }
body.theme-light .badge-journal { border-color: rgba(0,0,0,.10); }

.stock-shell { grid-template-columns: 1fr !important; }
.stock-shell .content { width: 100%; }
.brand-link { color: inherit; text-decoration: none; }
.page-head { margin-bottom: 14px; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 7px 0 0; }
.form-card { margin-top: 14px; }
.narrow-card { max-width: 760px; }
.optional { font-weight: 400; color: var(--muted); }
.alert-success { background: rgba(40,150,85,.13); color: #1d7045; border-color: rgba(40,150,85,.25); }
.alert-error { background: rgba(200,50,50,.12); color: #9f2d2d; border-color: rgba(200,50,50,.24); }
.auth-links { margin-top: 18px; }
.auth-links a { color: #7c3fc3; }
.auth-form .btn { width: 100%; }

.journal-head { align-items: flex-start; }
.journal-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.instrument-search-form { display: flex; gap: 8px; align-items: center; }
.instrument-search-form .input { min-width: 190px; }
.calendar-card { padding-top: 24px; }
.calendar-title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.calendar-title-row h2 { margin: 0; }
.calendar-scroll { overflow-x: auto; padding-bottom: 3px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(96px,1fr)); min-width: 760px; }
.calendar-weekdays { font-weight: 700; color: var(--muted); text-align: center; margin-bottom: 6px; }
.calendar-weekdays > div { padding: 8px; }
.calendar-days { gap: 7px; }
.calendar-cell { min-height: 118px; border-radius: 14px; border: 1px solid rgba(0,0,0,.08); background: rgba(255,255,255,.56); padding: 10px; text-align: left; position: relative; color: var(--text); }
button.calendar-cell { cursor: default; font: inherit; }
.calendar-day.has-entries { cursor: pointer; background: linear-gradient(145deg, rgba(255,138,42,.09), rgba(178,76,255,.08)); }
.calendar-day.has-entries:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(80,60,100,.10); border-color: rgba(178,76,255,.22); }
.calendar-day.is-today { outline: 2px solid rgba(255,138,42,.45); }
.calendar-empty { border-color: transparent; background: transparent; }
.calendar-day-number { font-weight: 800; font-size: 17px; }
.calendar-count { position: absolute; top: 9px; right: 9px; min-width: 25px; height: 25px; padding: 0 7px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: rgba(178,76,255,.13); color: #7635ad; font-weight: 800; font-size: 12px; }
.calendar-tickers { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 16px; }
.calendar-tickers span { padding: 4px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; background: rgba(255,255,255,.72); border: 1px solid rgba(0,0,0,.07); }
.calendar-nav { margin-top: 18px; display: flex; justify-content: space-between; gap: 12px; }

/* Dzienny modal: szybka nawigacja po tickerach + powrót na górę */
.day-entries-panel { overflow: hidden; display: flex; flex-direction: column; }
.day-entries-head { flex: 0 0 auto; margin-bottom: 12px; }
.day-entries-heading { min-width: 0; flex: 1 1 auto; }
.day-ticker-nav { margin-top: 9px; max-width: 100%; display: flex; flex-direction: column; gap: 5px; overflow: visible; padding: 1px 0 5px; }
.day-ticker-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px; width: 100%; }
.day-ticker-link { display: inline; padding: 0; border: 0; background: transparent; color: #7c3fc3; font: inherit; font-weight: 750; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.day-ticker-link:hover { color: #9c4cda; }
.day-entries-scroll { min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 5px; padding-bottom: 62px; scroll-behavior: smooth; }
.day-scroll-top { position: absolute; right: 18px; bottom: 18px; width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); background: rgba(255,255,255,.94); color: #6e3aa4; box-shadow: 0 8px 24px rgba(35,20,55,.18); cursor: pointer; z-index: 5; }
.day-scroll-top:hover { background: linear-gradient(135deg, rgba(255,138,42,.14), rgba(178,76,255,.14)); border-color: rgba(178,76,255,.28); }

.entry-list { display: flex; flex-direction: column; gap: 10px; }
.entry-row { display: flex; justify-content: space-between; gap: 14px; border: 1px solid rgba(0,0,0,.08); border-radius: 14px; padding: 14px; background: rgba(255,255,255,.52); }
.entry-row-main { min-width: 0; }
.entry-title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 5px; }
.entry-row p { margin: 8px 0 0; line-height: 1.5; }
.entry-row-actions { display: flex; gap: 6px; align-items: flex-start; flex: 0 0 auto; }
.badge-journal { display: inline-flex; align-items: center; border: 1px solid var(--border); padding: 4px 8px; border-radius: 999px; font-size: 12px; background: rgba(178,76,255,.08); }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px; border: 1px solid rgba(0,0,0,.10); background: rgba(255,255,255,.70); cursor: pointer; color: var(--text); font-size: 16px; }
.icon-btn:hover { background: rgba(178,76,255,.10); border-color: rgba(178,76,255,.24); }
.icon-btn.danger { color: #b23434; }
.danger-button { background: rgba(200,50,50,.14) !important; color: #9f2d2d !important; }

.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 18px; z-index: 3000; }
.modal.is-open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,15,30,.52); }
.modal-panel { position: relative; width: min(680px,100%); max-height: calc(100vh - 36px); overflow: auto; padding: 22px; border-radius: 18px; background: rgba(255,255,255,.97); }
.modal-wide { width: min(880px,100%); }
.modal-form-panel { width: min(820px,100%); }
.modal-confirm { width: min(520px,100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-head h2 { margin: 0; }
.modal-close { border: 0; background: transparent; font-size: 30px; line-height: 1; cursor: pointer; color: var(--muted); padding: 0 3px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 16px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.trade-details { border: 1px solid rgba(178,76,255,.14); border-radius: 14px; padding: 14px; background: rgba(178,76,255,.035); }
.field-hint { display: block; margin-top: 2px; font-size: 12px; line-height: 1.4; color: var(--muted); }

.notes-head { align-items: center; }
.notes-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
.note-tile { min-height: 210px; border-radius: 16px; padding: 16px; display: flex; flex-direction: column; cursor: pointer; position: relative; }
.note-tile h2 { margin: 0 0 10px; font-size: 18px; }
.note-tile p { margin: 0; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.note-actions { margin-top: auto; padding-top: 14px; display: flex; gap: 6px; }
.drag-handle { cursor: grab; }
.note-tile.is-dragging { opacity: .58; transform: scale(.985); }
.note-full-content { white-space: pre-wrap; line-height: 1.65; overflow-wrap: anywhere; }
.note-editor { min-height: 300px; resize: vertical; }

@media (max-width: 1000px) {
  .notes-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .page-head { align-items: flex-start; }
  .journal-toolbar { justify-content: flex-start; }
}
@media (max-width: 767px) {
  .page-head, .journal-head, .notes-head { flex-direction: column; align-items: stretch; }
  .journal-toolbar, .instrument-search-form { flex-direction: column; align-items: stretch; }
  .instrument-search-form .input { min-width: 0; }
  .notes-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .calendar-nav { flex-direction: column; }
  .calendar-nav .btn { text-align: center; }
  .entry-row { flex-direction: column; }
  .entry-row-actions { justify-content: flex-end; }
  .modal { padding: 8px; }
  .modal-panel { max-height: calc(100vh - 16px); border-radius: 14px; padding: 17px; }
  .day-scroll-top { right: 13px; bottom: 13px; width: 40px; height: 40px; }
}


/* --------------------------------------------------------------------------
   Przeglądaj wg daty
   -------------------------------------------------------------------------- */
.date-browser-card { padding-top: 24px; }
.date-entry-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
}
.date-entry-tile {
  width: 100%;
  min-width: 0;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-radius: 13px;
  border: 1px solid rgba(0,0,0,.09);
  background: rgba(255,255,255,.60);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.date-entry-tile:hover {
  transform: translateY(-1px);
  border-color: rgba(178,76,255,.25);
  background: linear-gradient(145deg, rgba(255,138,42,.08), rgba(178,76,255,.08));
  box-shadow: 0 7px 18px rgba(70,45,95,.09);
}
.date-entry-status-yes { color: #26734b; }
.date-entry-status-no { color: #9b3a3a; }
.date-browser-empty { margin: 0; }

@media (max-width: 767px) {
  .date-entry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .date-entry-tile { min-height: 62px; padding: 10px 7px; font-size: 12px; }
}

/* --------------------------------------------------------------------------
   Mean Reversion dashboard + rejestr transakcji (v1.1.0)
   -------------------------------------------------------------------------- */
.discipline-hero {
  margin-bottom: 18px;
  text-align: center;
  padding: 34px 22px 30px;
  background:
    radial-gradient(600px 180px at 50% 0%, rgba(178,76,255,.10), transparent 70%),
    rgba(255,255,255,.90);
}
.discipline-label {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .16em;
  color: #6f3aa2;
}
.discipline-score {
  margin-top: 4px;
  font-size: clamp(54px, 9vw, 92px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.055em;
}
.discipline-breakdown {
  margin-top: 13px;
  color: var(--muted);
  font-weight: 650;
}
.discipline-breakdown span { margin-left: 6px; }

.dashboard-currency { margin-bottom: 18px; padding-top: 24px; }
.dashboard-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.dashboard-section-head > div { display: flex; align-items: center; gap: 12px; }
.dashboard-section-head h2 { margin: 0; }
.dashboard-currency-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: .08em;
  color: #693799;
  background: rgba(178,76,255,.10);
  border: 1px solid rgba(178,76,255,.17);
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}
.stat-card {
  min-height: 104px;
  border: 1px solid rgba(0,0,0,.075);
  border-radius: 15px;
  background: rgba(255,255,255,.60);
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.stat-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}
.stat-card strong {
  font-size: 21px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.oldest-open {
  margin-top: 18px;
  border-top: 1px solid rgba(0,0,0,.08);
  padding-top: 18px;
}
.oldest-open-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.oldest-open-head h3 { margin: 0; font-size: 17px; }
.oldest-open-list { display: flex; flex-direction: column; gap: 7px; }
.oldest-open-row {
  display: grid;
  grid-template-columns: 1fr 90px 150px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(0,0,0,.075);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255,255,255,.55);
}
.oldest-open-row:hover { background: rgba(178,76,255,.06); }
.oldest-open-row span:nth-child(2),
.oldest-open-row span:nth-child(3) { text-align: right; }

.trade-filters-card, .trade-list-card { margin-bottom: 14px; padding-top: 22px; }
.trade-filters { margin: 0; }
.trade-search-group {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  align-items: end;
  gap: 10px;
}
.trade-search-group .btn { min-height: 43px; }
.trade-filter-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 15px 0 12px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .12em;
}
.trade-filter-divider::before,
.trade-filter-divider::after {
  content: '';
  height: 1px;
  background: rgba(0,0,0,.08);
  flex: 1;
}
.trade-filter-divider span { padding: 0 10px; }
.trade-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 170px 150px auto auto;
  gap: 10px;
  align-items: end;
}
.filter-checkbox {
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid rgba(0,0,0,.12);
  border-radius: 14px;
  background: rgba(255,255,255,.65);
  cursor: pointer;
}
.filter-checkbox input { width: 16px; height: 16px; }
.trade-filters > .field-hint { margin-top: 10px; }

.trade-list-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.trade-table {
  border: 1px solid rgba(0,0,0,.075);
  border-radius: 15px;
  overflow: hidden;
  background: rgba(255,255,255,.48);
}
.trade-table-head,
.trade-table-row {
  display: grid;
  grid-template-columns: 130px 130px 90px minmax(100px, 1fr) 120px 185px 120px;
  gap: 10px;
  align-items: center;
}
.trade-table-head {
  min-width: 930px;
  padding: 11px 13px;
  background: rgba(0,0,0,.035);
  border-bottom: 1px solid rgba(0,0,0,.075);
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}
.trade-sort { color: inherit; text-decoration: none; }
.trade-sort:hover { color: #743ba8; }
.trade-table-row {
  min-width: 930px;
  width: 100%;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.55);
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background .18s ease, transform .18s ease;
}
.trade-table-row:last-child { border-bottom: 0; }
.trade-table-row:hover { background: rgba(178,76,255,.065); }
.trade-table-row.trade-row-open {
  background: rgba(73, 168, 105, .085);
}
.trade-table-row.trade-row-open:hover { background: rgba(73, 168, 105, .13); }
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
  border: 1px solid rgba(0,0,0,.08);
}
.status-open { color: #2f7248; background: rgba(73,168,105,.12); }
.status-closed { color: #686373; background: rgba(90,85,100,.07); }
.trade-empty { padding: 26px 14px; text-align: center; color: var(--muted); }
.trade-list-card { overflow-x: auto; }
.trade-list-card .trade-list-meta,
.trade-list-card .pagination { min-width: 0; }

.pagination {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}
.pagination-link {
  min-width: 36px;
  height: 36px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  background: rgba(0,0,0,.05);
  border: 1px solid rgba(0,0,0,.06);
}
.pagination-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(255,138,42,.85), rgba(178,76,255,.78));
}

.trade-form-panel { width: min(920px, 100%); }
.calculated-field { background: rgba(0,0,0,.045) !important; font-weight: 700; }
.field-required-highlight .label { color: #a33636; }
.field-required-highlight textarea { border-color: rgba(180,45,45,.30); }

.trade-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.trade-detail-item {
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid rgba(0,0,0,.075);
  background: rgba(255,255,255,.62);
}
.trade-detail-item span,
.trade-detail-text > span { color: var(--muted); font-size: 12px; }
.trade-detail-item strong { line-height: 1.3; overflow-wrap: anywhere; }
.trade-detail-text {
  margin-top: 11px;
  padding: 13px;
  border-radius: 13px;
  border: 1px solid rgba(0,0,0,.075);
  background: rgba(255,255,255,.62);
}
.trade-detail-text p { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.55; overflow-wrap: anywhere; }
.trade-detail-actions { justify-content: space-between; }
.trade-detail-actions-right { display: flex; gap: 8px; }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trade-filter-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 767px) {
  .discipline-hero { padding: 28px 16px 24px; }
  .discipline-breakdown span { display: block; margin: 5px 0 0; }
  .dashboard-section-head { align-items: flex-start; }
  .dashboard-section-head > div { align-items: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { min-height: 96px; }
  .stat-card strong { font-size: 18px; }
  .oldest-open-row { grid-template-columns: 1fr auto; }
  .oldest-open-row span:nth-child(3) { grid-column: 1 / -1; text-align: left; color: var(--muted); }
  .trade-search-group { grid-template-columns: 1fr; }
  .trade-filter-grid { grid-template-columns: 1fr 1fr; }
  .trade-filter-grid .btn { text-align: center; }
  .trade-detail-grid { grid-template-columns: 1fr 1fr; }
  .trade-detail-actions { flex-direction: column-reverse; }
  .trade-detail-actions-right { width: 100%; }
  .trade-detail-actions-right .btn,
  .trade-detail-actions > .btn { flex: 1; text-align: center; }
}

@media (max-width: 520px) {
  .stats-grid { grid-template-columns: 1fr; }
  .trade-filter-grid { grid-template-columns: 1fr; }
  .trade-detail-grid { grid-template-columns: 1fr; }
  .trade-detail-actions-right { flex-direction: column; }
}
