:root {
  --bg: #0b1220;
  --panel: #0f1a2b;
  --panel-2: #0d1626;
  --text: #e5eefc;
  --muted: #9fb2cc;
  --brand: #3b82f6;
  --brand-2: #60c0ba;
  --line: #1c2a42;
  --chip: #15233a;
  --ok: #22c55e;
  --warn: #eab308;
  --bad: #ef4444;
  --mid: #94a3b8;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font:
    500 20px/1.45 system-ui,
    Segoe UI,
    Roboto,
    Inter,
    Arial;
}
h1,
h2 {
  margin: 0 0 12px;
}
.container {
  max-width: none;
  width: 100%;
  min-height: 100vh;
  margin: 0;
  padding: 16px 24px;
}

header .toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.applyBtnDiv {
  display: flex;
  justify-items: center;
  padding-top: 3rem;
}
.badge {
  background: #102038;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: #9fb2cc;
}
.btn {
  border: 1px solid var(--line);
  background: #0e1b2f;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.2);
}
.btn.ghost {
  background: transparent;
}
.btn.small {
  padding: 6px 10px;
  font-size: 20px;
}
.btn.save {
  background: var(--ok);
  border-color: #1f9d55;
  color: #0b1220;
  font-weight: 700;
  box-shadow:
    0 0 0 2px rgba(34, 197, 94, 0.25),
    0 10px 20px rgba(34, 197, 94, 0.2);
}
.btn.save:hover {
  filter: brightness(1.05);
}

.filters {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 16px 0;
}
.filterLocalWrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.btn-apply {
  background: var(--brand);
  border-color: #2a6fdf;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}
.filters.collapsed {
  display: none;
}
.filters label {
  display: block;
  font-size: 20px;
  color: var(--muted);
  margin: 0 0 6px;
}
select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: #fff;
  padding: 9px 28px 9px 10px;
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23e5eefc' d='M0 0l5 6 5-6z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 6px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}
select[multiple] {
  min-height: 120px;
  padding-right: 10px;
  background-image: none;
}

.select2-container--default .select2-selection--multiple {
  background: var(--panel-2);
  border: 1px solid var(--line);
  min-height: 42px;
  border-radius: 10px;
  color: #fff;
  padding: 5px 28px 5px 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.select2-selection__choice__remove {
  background-color: #12223b;
}
.select2-selection__choice__display {
  background-color: #12223b;
}
.select2-container--default .select2-selection--single {
  background: var(--panel-2);
  border: 1px solid var(--line);
  min-height: 42px;
  border-radius: 10px;
  color: #fff;
  padding: 5px 28px 5px 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  display: flex;
  align-items: center;
}
.select2-container--default
  .select2-selection--single
  .select2-selection__rendered {
  color: #fff;
  line-height: 1.2;
  padding-left: 0;
  padding-right: 0;
  margin: 0;
}
.select2-container--default
  .select2-selection--single
  .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 8px;
}
.select2-container--default
  .select2-selection--single
  .select2-selection__arrow
  b {
  margin-top: -2px;
}
.select2-container--default
  .select2-selection--single
  .select2-selection__placeholder {
  color: #9fb2cc;
}
.select2-container--default.select2-container--focus
  .select2-selection--multiple,
.select2-container--default.select2-container--open
  .select2-selection--multiple {
  background: var(--panel-2);
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__rendered {
  background: transparent;
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background: #12223b;
  border: 1px solid #1c2a42;
  color: #e5eefc;
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice__remove {
  color: #e5eefc;
}
.select2-container--default
  .select2-selection--multiple
  .select2-search--inline
  .select2-search__field {
  background: transparent;
  color: #fff;
}

.select2-search input {
  background: #12223b;
  border: 1px solid #1c2a42;
  color: #e5eefc;
}
.select2-container--default .select2-selection--multiple:focus,
.select2-container--default.select2-container--focus
  .select2-selection--multiple {
  border-color: #2a3b57;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice {
  background: #12223b;
  border: 1px solid #1c2a42;
  color: #e5eefc;
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__choice__remove {
  color: #e5eefc;
}
.select2-container--default .select2-search--inline .select2-search__field {
  color: #fff;
}
.select2-container--default
  .select2-selection--multiple
  .select2-selection__rendered {
  padding: 0;
}
.select2-container--default .select2-dropdown {
  background: #0b1526;
  border: 1px solid #1c2a42;
  color: #fff;
}
.select2-container--default .select2-results__option--selected {
  background: #12223b;
}
.select2-container--default
  .select2-results__option--highlighted.select2-results__option--selectable {
  background: #1a2b4a;
  color: #fff;
}
select:focus {
  outline: none;
  border-color: #2a3b57;
  box-shadow:
    0 0 0 2px rgba(59, 130, 246, 0.2),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
select option {
  background: #0b1526;
  color: #fff;
  padding: 6px 10px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin: 0 0 16px;
  position: relative;
}
.chartLegend {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 4px 0 8px;
}
.legendItem {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9fb2cc;
}
.legendSwatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}
.swatchPrev {
  background: var(--brand);
}
.swatchReal {
  background: var(--brand-2);
}
#chart {
  height: 50vh;
  min-height: 320px;
}

.chart-meta {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 20px;
  color: var(--muted);
  display: inline-flex;
  gap: 10px;
  align-items: center;
  text-align: right;
}
.chart-meta .badge {
  background: #0f1a2b;
  border: 1px solid var(--line);
  color: #cfe3ff;
  padding: 4px 10px;
  border-radius: 999px;
}

.paneHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0;
}
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  color: #cfe3ff;
}
tbody td,
tbody th {
  padding: 12px 10px;
  border-bottom: 1px dashed #132238;
}
tbody tr:hover td {
  background: #0e1a2d;
}
td.right {
  text-align: right;
}
.empty {
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

select.notaSel {
  min-width: 64px;
  text-align: center;
}
.r0 {
  border: 1px solid var(--line);
}
.r1,
.r2 {
  border: 1px solid var(--bad);
  background: #1a0f12;
}
.r3 {
  border: 1px solid var(--warn);
  background: #17160b;
}
.r4,
.r5 {
  border: 1px solid var(--ok);
  background: #0f1a14;
}

.cellInput {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  outline: none;
}
.obsInput {
  width: 100%;
  max-width: 100%;
  min-height: 72px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 8px;
  outline: none;
  resize: none;
  overflow: auto;
  font: inherit;
}
.th-col {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-del-col {
  border: 1px solid var(--line);
  background: #0e1b2f;
  color: #9fb2cc;
  border-radius: 8px;
  padding: 2px 6px;
  cursor: pointer;
  font-size: 20px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 10, 20, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal-backdrop.show {
  display: flex;
}
.modal {
  width: min(420px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.modal header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.modal .content {
  padding: 16px;
}
.modal .content label {
  display: block;
  font-size: 20px;
  color: var(--muted);
  margin: 0 0 6px;
}
.modal .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}

#chart:fullscreen {
  width: 100vw;
  height: 100vh;
}
:fullscreen {
  background: #0b1220;
}
