/* Tytuł w jednym rzędzie: logo + blok 2-liniowy */
.site-title{
  display: flex;
  align-items: center;     /* logo w linii z 1. wierszem tekstu */
  gap: 3px;
  margin: 0;
  line-height: 1.2;
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 500;
  color: var(--color-text);
}

/* Dwuliniowy blok po prawej od logo */
.site-title .title-text{
  display: inline-flex;
  flex-direction: column;  /* zawsze dokładnie 2 linie */
  white-space: nowrap;     /* brak przypadkowych zawijań w obrębie linii */
  line-height: 1.1;
  margin-right: 30px;  /* kluczowy odstęp od przycisków */
}

/* (logo już masz wystylowane, to tylko upewnienie) */
.site-title .logo{
  color: var(--color-primary);
  font-weight: 700;
  font-size: 33px;
  letter-spacing: 0.5px;
}
    :root {
      /* LIGHT THEME */
      --color-bg: #f4f6f8;
      --color-section-bg: #ffffff;
      --color-surface: #eeeeee;
      --color-text: #000000;
      --color-muted-text: #666666;
      --color-primary: #2d6df6;
      --color-btn-bg: var(--color-primary);
      --color-btn-text: #ffffff;
      --color-btn-secondary-bg: #6c757d;
      --color-toggle-bg: #dddddd;
      --color-toggle-selected: #ffffff;
      --color-table-border: #dddddd;
      --color-input-bg: #ffffff;
      --color-input-border: #cccccc;
      --color-icon-btn-bg: #f0f0f0;
      --color-icon-btn-border: #ffffff;
      --color-icon-btn: #888888;
      --border-radius: 8px;
      --transition-speed: 0.2s;
      --info-bar-height: 19px;
    }

    body.dark-mode {
      /* DARK THEME OVERRIDES */
      --color-bg: #2b2b2b;
      --color-section-bg: #333333;
      --color-surface: #3a3a3a;
      --color-text: #eeeeee;
      --color-muted-text: #bbbbbb;
      --color-primary: #4e8cff;
      --color-btn-bg: var(--color-primary);
      --color-btn-text: #ffffff;
      --color-btn-secondary-bg: #555555;
      --color-toggle-bg: #555555;
      --color-toggle-selected: #777777;
      --color-table-border: #444444;
      --color-input-bg: #444444;
      --color-input-border: #666666;
      --color-icon-btn-bg: #444444;
      --color-icon-btn-border: #555555;
      --color-icon-btn: #cccccc;
    }

    *, *::before, *::after { box-sizing: border-box; }

    body {
      margin: 0;
      padding-bottom: var(--info-bar-height);
      font-family: 'Roboto', sans-serif;
      background: var(--color-bg);
      color: var(--color-text);
    }

    .navbar {
      width: 100%;
      background-color: var(--color-section-bg);
      padding: 6px 25px;
      box-shadow: 0 3px 3px -1px rgba(0,94,184,0.5);
      display: flex;
      align-items: center;
      justify-content: flex-start;
    }

    .navbar h1 {
      margin: 0;
      font-size: 15px;
      font-weight: 500;
      display: flex;
      align-items: center;
      line-height: 1.2;
      font-family: 'Poppins', sans-serif;
      color: var(--color-text);
    }

    .navbar .logo {
      color: var(--color-primary);
      font-family: 'Poppins', sans-serif;
      font-weight: 700;
      font-size: 33px;
      letter-spacing: 0.5px;
      margin-right: 8px;
    }

    .navbar-buttons {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-left: 16px;
      width: 100%;
    }

    #edit-message {
      margin-left: 20px;
      font-weight: bold;
      color: var(--color-text);
    }

    .data-source-toggle {
      display: flex;
      background-color: var(--color-toggle-bg);
      border-radius: 10px;
      padding: 3px;
      margin-right: 20px;
      margin-left: -20px;
      font-size: 14px;
      box-shadow: 0 2px 4px rgba(0,0,0,0.1);
      transition: background-color var(--transition-speed);
    }

    .data-source-toggle .source-option {
      flex: 1;
      text-align: center;
      padding: 6px 12px;
      cursor: pointer;
      color: var(--color-muted-text);
      background-color: transparent;
      border-radius: var(--border-radius);
      font-weight: 400;
      line-height: 1.2;
      transition: background-color var(--transition-speed), color var(--transition-speed);
    }

    .data-source-toggle .source-option.selected {
      background-color: var(--color-toggle-selected);
      color: var(--color-text);
      font-weight: 750;
      box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    }

    #info-bar {
      position: fixed;
      bottom: 0;
      left: 0;
      width: 100%;
      height: var(--info-bar-height);
      padding: 4px 12px;
      background-color: var(--color-surface);
      border-top: 1px solid var(--color-table-border);
      font-size: 11px;
      display: flex;
      align-items: center;
      gap: 16px;
      color: var(--color-muted-text);
      z-index: 1000;
    }
    #info-bar span strong { font-weight: bold; }

    .pagination-container {
      margin-left: auto;
      display: flex;
      align-items: center;
      gap: 4px;
      font-size: 14px;
    }

    .container {
      width: 100%;
      padding: 8px 8px;
    }

    .section {
      position: relative;
      background: var(--color-section-bg);
      padding: 20px;
      margin-bottom: 24px;
      border-radius: var(--border-radius);
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }

    .close-btn {
      position: absolute; top: 16px; right: 16px;
      background: none; border: none; color: var(--color-muted-text);
      font-size: 24px; font-weight: bold; border-radius: var(--border-radius);
      cursor: pointer; line-height: 1; padding: 4px 8px;
      transition: color var(--transition-speed), background var(--transition-speed);
    }
    .close-btn:hover {
      color: var(--color-text);
      background: rgba(0,0,0,0.05);
    }

    .btn {
      font-size: 14px; padding: 10px 16px; border: none;
      border-radius: var(--border-radius);
      background-color: var(--color-btn-bg);
      color: var(--color-btn-text);
      cursor: pointer;
      transition: transform var(--transition-speed), box-shadow var(--transition-speed);
    }
    .btn:disabled {
      background-color: #777777;
      cursor: not-allowed;
    }
    .btn:hover:not(:disabled) {
      transform: translateY(-2px);
      box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    }
    .btn.secondary {
      background-color: var(--color-btn-secondary-bg);
    }

    input[type="text"], select, textarea {
      width: 100%; padding: 10px 14px; margin-bottom: 12px;
      font-size: 14px;
      background: var(--color-input-bg);
      border: 1px solid var(--color-input-border);
      border-radius: var(--border-radius);
      outline: none;
      transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
      color: var(--color-text);
    }
    input:focus, select:focus, textarea:focus {
      border-color: var(--color-primary);
      box-shadow: 0 0 0 3px rgba(0,94,184,0.2);
    }

    input[type="checkbox"] {
      width: 18px; height: 18px;
      accent-color: var(--color-primary);
      margin-right: 8px;
    }

    #column-select .controls {
      display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 16px;
      background-color: var(--color-surface);
      padding: 8px; border-radius: var(--border-radius);
    }

    #column-select .checkbox-container {
      display: flex; flex-wrap: wrap; align-items: center;
      gap: 16px; margin-bottom: 16px;
    }

    #column-select .checkbox-column {
      flex: 1; min-width: 180px;
    }

    #column-select .checkbox-column label {
      display: flex; align-items: center; margin-bottom: 8px;
      font-size: 14px; color: var(--color-text);
    }

    #column-select .preset-section { display: flex; align-items: center; gap: 8px; }
    #column-select .preset-section span { font-weight: 500; color: var(--color-text); }

    #column-select .preset-container {
      background-color: var(--color-surface);
      padding: 4px 8px;
      border-radius: var(--border-radius);
      display: flex; flex-wrap: wrap; gap: 8px;
    }

    #column-select .preset-btn {
      background-color: var(--color-section-bg);
      color: var(--color-text);
      border: none;
      border-radius: var(--border-radius);
      padding: 6px 12px;
      cursor: pointer; font-size: 14px;
      position: relative;
    }
    #column-select .preset-btn.selected {
      background-color: var(--color-btn-bg);
      color: var(--color-btn-text);
    }
    #column-select .remove-x { display: none; margin-left: 6px; font-weight: bold; }
    #column-select .preset-btn.selected .remove-x { display: inline; }

    table.dataTable {
      width: 100% !important;
      border-collapse: collapse;
      background: var(--color-section-bg);
      border-radius: var(--border-radius);
      overflow: hidden;
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    }
    table.dataTable th, table.dataTable td {
      padding: 6px 8px;
      font-size: 13px;
      color: var(--color-text);
      border-right: 1px solid var(--color-table-border);
    }
    table.dataTable th:last-child, table.dataTable td:last-child {
      border-right: none;
    }
    table.dataTable thead th {
      background: var(--color-bg);
      border-bottom: 2px solid var(--color-primary);
      padding: 8px 10px;
      text-align: center;
      white-space: nowrap;
      position: relative;
    }
    table.dataTable thead th .filter-input {
      display: none; width: 100%; margin-top: 8px; box-sizing: border-box;
    }

    .filter-icon {
      cursor: pointer; margin-left: 6px; font-size: 14px;
      vertical-align: middle;
    }

    #placeholder {
      display: none;
      text-align: center; padding: 60px 20px;
      color: var(--color-muted-text);
      font-size: 18px;
      background: var(--color-section-bg);
      border-radius: var(--border-radius);
      box-shadow: 0 1px 3px rgba(0,0,0,0.1);
      margin-top: 24px;
    }
    #placeholder p:first-child {
      font-size: 22px; font-weight: 500; margin-bottom: 8px;
      color: var(--color-text);
    }

    .tab-btn {
      background: none;
      border: none;
      padding: 6px 12px;
      margin: 0 4px;
      font-size: 17px;
      font-weight: 400;
      color: var(--color-text);
      cursor: pointer;
      position: relative;
      transition: color var(--transition-speed), font-weight var(--transition-speed);
    }
    .tab-btn.active {
      font-weight: 790;
      color: var(--color-text);
    }
    .tab-btn.active::after {
      content: "";
      position: absolute;
      left: 0; right: 0; bottom: -10px;
      height: 4px;
      background: var(--color-primary);
      border-radius: 2px 2px 0 0;
    }

    .icon-btn {
      background-color: var(--color-icon-btn-bg);
      border: 1px solid var(--color-icon-btn-border);
      cursor: pointer;
      font-size: 16px;
      color: var(--color-icon-btn);
      transition: all 0.3s ease;
      padding: 5px;
      border-radius: var(--border-radius);
      margin-right: 12px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .icon-btn:last-child { margin-right: 0; }
    .icon-btn:hover {
      color: var(--color-text);
      background-color: var(--color-toggle-selected);
      border-color: var(--color-icon-btn-border);
    }

    /* query-builder tiles */
    .qb-container { display: flex; gap: 16px; margin-top: 16px; }
    .qb-form { flex: 0 0 33%; }
    .qb-tiles {
      flex: 1;
      display: flex; flex-wrap: wrap; gap: 12px;
      max-height: 300px; overflow-y: auto;
      padding: 12px;
      background: var(--color-surface);
      border-radius: 12px;
      border: 1px solid var(--color-table-border);
    }
    .query-tile {
      position: relative;
      background: var(--color-section-bg);
      padding: 16px 20px;
      border-radius: 16px;
      box-shadow: 0 4px 8px rgba(0,0,0,0.06);
      min-width: 140px; max-width: 200px;
      word-wrap: break-word; font-size: 13.5px;
      transition: transform 0.2s ease, box-shadow 0.2s ease;
    }
    .query-tile:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    }
    .query-tile .delete-query {
      position: absolute; top: 6px; right: 8px;
      cursor: pointer; font-size: 26px; font-weight: bold;
      color: var(--color-muted-text); padding-left: 6px;
      transition: color 0.25s ease, transform 0.2s ease;
    }
    .query-tile .delete-query:hover {
      color: var(--color-primary);
      transform: scale(1.2);
    }
    .query-tile .tile-values {
      font-size: 12.5px;
      color: var(--color-muted-text);
      margin-top: 8px;
      max-height: 3.6em;
      overflow: hidden;
    }

    /* reorder panel */
    .reorder-panel {
      position: fixed;
      top: 0;
      right: 0;
      height: 100%;
      width: 25%;
      max-width: 400px;
      background: var(--color-section-bg);
      box-shadow: -2px 0 5px rgba(0,0,0,0.1);
      transform: translateX(100%);
      transition: transform var(--transition-speed) ease;
      z-index: 2000;
      padding: 20px;
      overflow-y: auto;
    }
    .reorder-panel.open {
      transform: translateX(0);
    }
    .reorder-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
    }
    .reorder-list {
      list-style: none;
      padding: 0;
      margin: 0;
    }
    .reorder-list li {
      display: flex;
      align-items: center;
      padding: 10px;
      margin-bottom: 8px;
      background: var(--color-surface);
      border: 1px solid var(--color-table-border);
      border-radius: var(--border-radius);
      cursor: move;
    }
    .reorder-list li .material-icons.handle {
      margin: 0 8px;
    }
    .reorder-list li .index-label {
      font-weight: bold;
      margin-right: 8px;
    }
    .reorder-list li .remove-col {
      margin-left: auto;
      background: none;
      border: none;
      font-size: 24px;
      cursor: pointer;
    }

    body.dark-mode .reorder-list li .remove-col {
      color: var(--color-text);
    }

    /* Apply button full-width with margins */
    #apply-reorder {
      display: block;
      width: calc(100% - 40px);
      margin: 20px;
    }

    /* === TOASTS === */
    #toast-container {
      position: fixed;
      bottom: 40px;
      right: 20px;
      display: flex;
      flex-direction: column;
      gap: 10px;
      z-index: 3000;
    }

    .toast {
      display: flex;
      align-items: center;
      justify-content: space-between;
      min-width: 180px;
      max-width: 300px;
      padding: 12px 16px;
      background: var(--color-section-bg);
      color: var(--color-text);
      border-radius: var(--border-radius);
      box-shadow: 0 2px 6px rgba(0,0,0,0.2);
      opacity: 0;
      transform: translateY(20px);
      transition: opacity var(--transition-speed), transform var(--transition-speed);
    }

    .toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    .toast .close-toast {
      cursor: pointer;
      font-size: 16px;
      line-height: 1;
      margin-left: 12px;
    }

/* Match builder minor tweaks */
#match-values { min-height: 180px; }
