* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  background: #f5f5f5;
}

.app {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) minmax(0, 2.5fr) 140px;
  gap: 16px;
  padding: 16px;
  max-width: 1700px;
  margin: 0 auto;
  overflow-x: clip;
  position: relative;
}

.panel {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.panel h2 {
  margin: 0 0 12px 0;
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-header h2 {
  margin: 0;
}

.panel h3 {
  margin: 16px 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  color: #555;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 6px 8px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f9f9f9;
  font-weight: 500;
  color: #666;
}

input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

input[type="number"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: #4CAF50;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.2s;
}

.btn-primary {
  background: #4CAF50;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #43A047;
}

.btn-primary:disabled {
  background: #bdbdbd;
  color: #757575;
  cursor: not-allowed;
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-secondary:hover {
  background: #d0d0d0;
}

.btn-save {
  background: #2196F3;
  color: white;
}

.btn-save:hover {
  background: #1976D2;
}

.btn-saving {
  background: #bdbdbd;
  color: #757575;
  cursor: not-allowed;
}

.btn-danger {
  background: #f44336;
  color: white;
}

.btn-danger:hover {
  background: #e53935;
}

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #999;
}

.btn-icon:hover {
  color: #f44336;
}

/* Left column */
.left-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

/* Control points table */
.control-points-table {
  table-layout: fixed;
}

.control-points-table th,
.control-points-table td {
  padding: 2px 3px;
}

/* Column widths: Typical, I, U, Ф, calculate, delete */
.control-points-table th:nth-child(1),
.control-points-table td:nth-child(1) {
  width: 45px;
  text-align: center;
}

/* I, U, Ф - distribute evenly */
.control-points-table th:nth-child(2),
.control-points-table td:nth-child(2),
.control-points-table th:nth-child(3),
.control-points-table td:nth-child(3),
.control-points-table th:nth-child(4),
.control-points-table td:nth-child(4) {
  width: auto;
}

/* Calculate button */
.control-points-table th:nth-child(5),
.control-points-table td:nth-child(5) {
  width: 32px;
  text-align: center;
}

/* Delete button */
.control-points-table th:nth-child(6),
.control-points-table td:nth-child(6) {
  width: 30px;
  text-align: right;
}

.control-points-table input[type="number"] {
  width: 100%;
  box-sizing: border-box;
}

.typical-radio {
  cursor: pointer;
}

.btn-calculate {
  padding: 2px 4px;
  font-size: 14px;
}

.btn-calculate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Binnings table */
.binnings-table {
  table-layout: fixed;
}

.binnings-table th,
.binnings-table td {
  padding: 2px 3px;
}

/* Column widths: лм, CCT, CRI, Part Number, Бин, delete */
.binnings-table th:nth-child(1),
.binnings-table td:nth-child(1) {
  width: 65px;
}

.binnings-table th:nth-child(2),
.binnings-table td:nth-child(2) {
  width: 75px;
}

.binnings-table th:nth-child(3),
.binnings-table td:nth-child(3) {
  width: 65px;
}

.binnings-table th:nth-child(5),
.binnings-table td:nth-child(5) {
  width: 55px;
}

.binnings-table th:nth-child(6),
.binnings-table td:nth-child(6) {
  width: 30px;
  text-align: right;
}

/* Part Number column stretches */
.binnings-table input[type="number"] {
  width: 100%;
  box-sizing: border-box;
}

.binnings-table input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.binnings-table select {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 4px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  background: white;
}

.binnings-table select:focus {
  outline: none;
  border-color: #4CAF50;
}

.binnings-table select:disabled {
  background: #f5f5f5;
  color: #999;
}

/* Dataset manager */
.dataset-list {
  margin: 12px 0;
}

.dataset-filter {
  margin-bottom: 8px;
}

.dataset-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.filter-group label {
  font-size: 11px;
  color: #666;
  font-weight: 500;
}

.filter-group input,
.filter-group select {
  padding: 4px 6px;
  font-size: 12px;
}

.dataset-item {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
}

.dataset-item:hover {
  background: #f9f9f9;
}

.dataset-item input[type="radio"] {
  margin-right: 8px;
}

.dataset-item-name {
  flex: 1;
}

.dataset-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.dataset-lock {
  font-size: 13px;
  padding: 4px;
  opacity: 0.3;
  cursor: default;
}

.dataset-ai-badge {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 3px;
  border: 1.5px solid #999;
  border-radius: 3px;
  color: #666;
  user-select: none;
}

.dataset-flag-checkbox {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  font-size: 13px;
  opacity: 0.6;
  transition: opacity 0.15s;
}

.dataset-flag-checkbox:hover {
  opacity: 1;
}

.dataset-flag-checkbox input[type="checkbox"] {
  display: none;
}

.dataset-flag-checkbox input[type="checkbox"]:checked + span {
  opacity: 1;
}

.dataset-flag-checkbox input[type="checkbox"]:not(:checked) + span {
  opacity: 0.35;
}

.dataset-flag-checkbox.flag-verified span {
  color: #00C853;
  font-weight: bold;
  font-size: 15px;
}

/* Vendor groups */
.vendor-group {
  margin-bottom: 4px;
}

.vendor-group-header {
  display: flex;
  align-items: center;
  padding: 5px 8px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.vendor-group-header:hover {
  background: #e8e8e8;
}

.vendor-group-name {
  flex: 1;
}

.vendor-group-count {
  font-size: 12px;
  color: #888;
  font-weight: 400;
  margin-left: 6px;
}

.vendor-group-children {
  padding-left: 16px;
}

/* Dataset actions row */
.dataset-actions-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
}

.dataset-actions-sep {
  color: #ccc;
}

.dataset-actions-reset {
  margin-left: auto;
}

.btn-link {
  background: none;
  border: none;
  color: #1976D2;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.btn-link:hover {
  text-decoration: underline;
}

/* Dataset tree */
.dataset-tree-item {
  margin-bottom: 2px;
}

.dataset-hidden > .dataset-item,
.dataset-hidden .dataset-tree-binnings {
  opacity: 0.4;
}

.dataset-tree-toggle {
  font-size: 12px;
  color: #888;
  width: 16px;
  flex-shrink: 0;
  text-align: center;
  user-select: none;
}

.dataset-tree-count {
  font-size: 14px;
  color: #4CAF50;
  font-weight: 600;
  flex-shrink: 0;
}

.dataset-tree-binnings {
  padding-left: 24px;
  margin-bottom: 4px;
}

.dataset-tree-binnings .binning-select-item {
  padding: 4px 8px;
  font-size: 12px;
}

.dataset-rename-input {
  flex: 1;
  padding: 2px 4px;
  border: 1px solid #4CAF50;
  border-radius: 3px;
  font-size: 13px;
  outline: none;
  min-width: 0;
}

.new-dataset-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.new-dataset-form input {
  flex: 1;
}

/* Middle column - Results */
.results-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.equations {
  background: #f9f9f9;
  padding: 12px;
  border-radius: 4px;
  font-family: monospace;
}

.equations p {
  margin: 4px 0;
}

.voltage-model-selector {
  display: flex;
  gap: 16px;
  margin: 12px 0;
}

.voltage-model-selector label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.chart-wrapper {
  padding: 12px;
  border-radius: 4px;
}

.chart-wrapper h4 {
  margin: 0 0 8px 0;
  font-size: 12px;
  color: #666;
}

/* Converter */
.converter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.converter-group label {
  font-size: 12px;
  color: #666;
}

.converter-group input {
  width: 100%;
}

.converter-result {
  padding: 8px;
  background: #f0f0f0;
  border-radius: 4px;
  font-weight: 500;
}

/* Module results table */
.module-results-table {
  margin-top: 8px;
}

.module-results-table th {
  background: #4CAF50;
  color: white;
  font-size: 11px;
  padding: 8px 4px;
  text-align: center;
}

.module-results-table td {
  text-align: center;
  padding: 8px 4px;
  font-size: 12px;
}

/* Right column - Module params */
.right-column .panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.module-params-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-mode-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-row-pair {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.form-row-pair .form-group {
  flex: 1;
  min-width: 0;
}

.pair-sep {
  color: #888;
  font-size: 16px;
  flex-shrink: 0;
  padding-bottom: 6px;
}

.topology-toggle {
  color: #1976D2;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  display: inline-block;
  margin-top: 4px;
}

.topology-toggle:hover {
  text-decoration: underline;
}

.topology-collapsible {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.topology-collapsible.expanded {
  max-height: 120px;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.range-row input {
  flex: 1;
  min-width: 0;
}

.range-dash {
  color: #888;
  font-size: 16px;
  flex-shrink: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feature-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: not-allowed;
}

.form-group label {
  font-size: 12px;
  color: #666;
}

.dataset-metadata {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.form-group select {
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
}

.tj-slider {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  background: color-mix(in srgb, var(--tj-color) 10%, white);
  border: 1px solid color-mix(in srgb, var(--tj-color) 40%, white);
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 8px;
}

.tj-slider input[type="range"] {
  width: 100%;
  cursor: pointer;
  accent-color: var(--tj-color);
}

.tj-label {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: var(--tj-color);
  font-weight: 500;
}

.tj-sublabel {
  font-size: 11px;
  font-weight: 400;
  color: var(--tj-color);
  opacity: 0.8;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #999;
}

/* Scrollable */
.scrollable {
  max-height: 200px;
  overflow-y: auto;
}

.scrollable.binning-list {
  max-height: 300px;
}


.binning-select-item {
  display: flex;
  align-items: center;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  margin-bottom: 4px;
  cursor: pointer;
}

.binning-select-item:hover {
  background: #f9f9f9;
}

.binning-select-item.selected {
  border-color: #4CAF50;
  background: #E8F5E9;
}

.no-results {
  font-size: 12px;
  color: #999;
  padding: 8px;
}

/* Binning filters */
.binning-filters-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.filter-dropdown {
  position: relative;
  flex: 1;
}

.filter-dropdown-summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  color: #333;
  font-size: 13px;
  user-select: none;
  width: 100%;
  text-align: left;
}

.filter-dropdown-summary::after {
  content: ' ▾';
  opacity: 0.6;
}

.filter-dropdown-content {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: white;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 6px;
  min-width: 100%;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.filter-check-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
  white-space: nowrap;
}

.filter-check-item:hover {
  background: #f5f5f5;
}

.filter-check-item input[type="checkbox"] {
  width: auto;
  margin: 0;
  accent-color: #4CAF50;
}

/* Lumen range slider */
.lumen-range-wrap {
  margin-top: 4px;
}

.lumen-range-wrap:has(input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}

.lumen-range-wrap:has(input:disabled) input {
  pointer-events: none;
}

.lumen-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.lumen-range-track {
  position: relative;
  height: 28px;
}

.lumen-range-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 4px;
  background: #ddd;
  border-radius: 2px;
  pointer-events: none;
}

.lumen-range-input {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  margin: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}

.lumen-range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4CAF50;
  cursor: pointer;
  pointer-events: all;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.lumen-range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #4CAF50;
  cursor: pointer;
  pointer-events: all;
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.lumen-range-input::-webkit-slider-runnable-track {
  background: transparent;
}

.lumen-range-input::-moz-range-track {
  background: transparent;
}

.efficacy-range-wrap {
  margin-top: 4px;
}

.efficacy-range-wrap.feature-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.efficacy-range-wrap.feature-locked input {
  pointer-events: none;
}

.efficacy-range-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.efficacy-current-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.efficacy-current-label {
  font-size: 11px;
  color: #888;
  white-space: nowrap;
}

.efficacy-current-group .efficacy-current-input {
  width: 38px;
  font-size: 12px;
  padding: 2px 2px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  text-align: center;
  -moz-appearance: textfield;
}

.efficacy-current-input::-webkit-inner-spin-button,
.efficacy-current-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.efficacy-current-input:focus {
  outline: none;
  border-color: #4CAF50;
}

.binning-filter-count {
  font-size: 12px;
  color: #999;
  margin-top: 6px;
}

/* Actions row */
.actions-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

/* Add row button */
.add-row-btn {
  width: 100%;
  margin-top: 8px;
  padding: 8px;
  background: #f5f5f5;
  border: 1px dashed #ccc;
  border-radius: 4px;
  cursor: pointer;
  color: #666;
}

.add-row-btn:hover {
  background: #eee;
  border-color: #999;
}

/* Loading */
.loading {
  text-align: center;
  padding: 20px;
  color: #999;
}

/* Sidebar */
.app-sidebar {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  height: fit-content;
  position: sticky;
  top: 16px;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
  color: #4CAF50;
  text-align: center;
}

.sidebar-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-align: center;
}

.sidebar-company {
  font-weight: 500;
  color: #333;
  font-size: 13px;
}

.sidebar-tariff {
  color: #555;
  font-size: 12px;
}

.sidebar-expires {
  color: #666;
  font-size: 12px;
}

.sidebar-expires.unlimited {
  color: #4CAF50;
}

.sidebar-admin {
  color: #2196F3;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 2px 6px;
  background: #e3f2fd;
  border-radius: 4px;
}

.btn-admin {
  display: block;
  text-align: center;
  text-decoration: none;
  background: #e3f2fd;
  color: #1565C0;
  padding: 6px 12px;
  width: 100%;
  box-sizing: border-box;
}

.btn-admin:hover {
  background: #bbdefb;
}

.btn-logout {
  background: #f5f5f5;
  color: #666;
  padding: 6px 12px;
  width: 100%;
}

.btn-logout:hover {
  background: #e0e0e0;
}

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  background: white;
  padding: 48px;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  text-align: center;
  max-width: 400px;
  width: 90%;
}

.login-container h1 {
  margin: 0 0 8px 0;
  font-size: 32px;
  color: #333;
}

.login-subtitle {
  color: #666;
  margin: 0 0 32px 0;
}

.login-form {
  text-align: left;
}

.login-form .form-group {
  margin-bottom: 20px;
}

.login-form label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: #333;
}

.login-form input {
  width: 100%;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.login-form input:focus {
  outline: none;
  border-color: #667eea;
}

.btn-large {
  width: 100%;
  padding: 14px;
  font-size: 16px;
}

.error-message {
  background: #e53935;
  color: white;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
}

.login-hint {
  color: #999;
  font-size: 13px;
  margin: 24px 0 0 0;
  text-align: center;
}

/* Loading Screen */
.loading-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: #666;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #4CAF50;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Admin Page */
.admin-page {
  min-height: 100vh;
  background: #f5f5f5;
}
.admin-page--authed {
  display: grid;
  grid-template-columns: 1fr 140px;
  gap: 16px;
  padding: 16px;
  max-width: 80%;
  margin: 0 auto;
}
.admin-page--authed .admin-container {
  min-width: 0;
  max-width: none;
  margin: 0;
  padding: 0;
}

.admin-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-login-form {
  background: white;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  width: 300px;
}

.admin-login-form h2 {
  margin: 0 0 24px 0;
  text-align: center;
}

.admin-login-form .form-group {
  margin-bottom: 16px;
}

.admin-login-form label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.admin-login-form input {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.admin-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.admin-header h1 {
  margin: 0;
  color: #333;
}

.admin-panel {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th,
.admin-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.admin-table th {
  background: #f9f9f9;
  font-weight: 600;
}

.admin-table .key-cell {
  font-family: monospace;
  font-size: 12px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.active {
  background: #E8F5E9;
  color: #2E7D32;
}

.status-badge.expired {
  background: #FFEBEE;
  color: #C62828;
}

.status-badge.not-activated {
  background: #FFF3E0;
  color: #E65100;
}

.status-badge.unlimited {
  background: #E3F2FD;
  color: #1565C0;
}

.status-badge.pending {
  background: #FFF8E1;
  color: #F9A825;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: 8px;
  padding: 24px;
  width: 500px;
  max-width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-edit {
  width: 1200px;
  overflow-y: hidden;
  display: flex;
  flex-direction: column;
}

.modal-edit-body {
  display: flex;
  gap: 24px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.modal-edit-form {
  flex: 0 0 450px;
  overflow-y: auto;
}

.modal-edit-charts {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-edit-charts .modal-actions {
  margin-top: auto;
}

.modal h3 {
  margin: 0 0 20px 0;
}

.modal .form-group {
  margin-bottom: 16px;
}

.modal label {
  display: block;
  margin-bottom: 4px;
  font-weight: 500;
}

.modal input,
.modal textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.modal textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.btn-group {
  display: flex;
  gap: 4px;
}

/* Export button */
.export-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 12px;
}

.btn-export {
  background: #2196F3;
  color: white;
  padding: 10px 20px;
  font-weight: 500;
}

.btn-export:hover {
  background: #1976D2;
}

/* Button wrapper with tooltip */
.btn-wrapper {
  position: relative;
  display: inline-block;
}

.btn-wrapper.has-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 10px;
  background: #333;
  color: white;
  font-size: 12px;
  border-radius: 4px;
  white-space: nowrap;
  margin-bottom: 6px;
  z-index: 100;
}

.btn-wrapper.has-tooltip:hover::before {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #333;
  z-index: 100;
}

/* Save popup overlay */
.save-popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.save-popup {
  background: white;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  min-width: 400px;
  max-width: 600px;
}

.save-popup-title {
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 14px;
}

.save-popup-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 13px;
  box-sizing: border-box;
}

.save-popup-input:focus {
  outline: none;
  border-color: #4CAF50;
}

.save-popup-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

/* Views slider */
.views-slider {
  overflow-x: clip;
}

.views-slider-inner {
  display: flex;
  transition: transform 0.4s ease;
}

.views-slider-page {
  min-width: 100%;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 300px;
  gap: 16px;
}

/* Navigation arrow */
.view-arrows {
  position: fixed;
  right: 16px;
  top: 16px;
  cursor: pointer;
  z-index: 50;
}

.view-arrow {
  width: 84px;
  height: 168px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: rgba(255,255,255,0.8);
  cursor: pointer;
  font-size: 28px;
  color: #aaa;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.view-arrows:hover .view-arrow {
  background: rgba(76,175,80,0.08);
  color: #4CAF50;
  border-color: #4CAF50;
}

/* Admin tabs layout */
.admin-tabs-layout {
  display: flex;
  gap: 0;
  min-height: 600px;
}

.admin-tab-nav {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  background: #fff;
  border-radius: 8px 0 0 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.admin-tab-btn {
  padding: 14px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  text-align: left;
  border-left: 3px solid transparent;
  transition: all 0.15s;
  white-space: nowrap;
}

.admin-tab-btn:hover {
  background: #f5f5f5;
  color: #333;
}

.admin-tab-btn.active {
  border-left: 3px solid #4CAF50;
  background: #E8F5E9;
  color: #2E7D32;
}

.admin-tab-content {
  flex: 1;
  background: #fff;
  border-radius: 0 8px 8px 0;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  min-width: 0;
}

/* Tariff plans layout */
.plans-layout {
  display: flex;
  gap: 20px;
  min-height: 400px;
}

.plans-list {
  flex: 0 0 280px;
  border-right: 1px solid #eee;
  padding-right: 20px;
}

.plans-detail {
  flex: 1;
  min-width: 0;
}

.plan-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s, transform 0.3s ease;
}

.plan-reorder-buttons {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}

.btn-reorder {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  font-size: 15px;
  font-weight: bold;
  line-height: 1;
  color: #888;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}

.btn-reorder:hover:not(:disabled) {
  color: #333;
  background: rgba(0, 0, 0, 0.06);
}

.btn-reorder:disabled {
  opacity: 0.25;
  cursor: default;
}

.plan-item:hover {
  background: #f5f5f5;
}

.plan-item.selected {
  background: #E8F5E9;
  border-left: 3px solid #4CAF50;
  padding-left: 9px;
}

.feature-checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  cursor: pointer;
}

.feature-checklist-item input[type="checkbox"] {
  width: auto;
  margin: 0;
}

/* Plans view toggle */
.plans-view-toggle {
  background: none;
  border: none;
  color: #1976D2;
  cursor: pointer;
  font-size: 12px;
  padding: 0;
  margin-top: 2px;
}

.plans-view-toggle:hover {
  text-decoration: underline;
}

/* Plans table view */
.plans-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.plans-table th,
.plans-table td {
  border: 1px solid #e0e0e0;
  padding: 6px 10px;
}

.plans-table th {
  background: #f5f5f5;
  font-weight: 500;
  white-space: nowrap;
  text-align: center;
}

.plans-table th:first-child {
  text-align: left;
}

.plans-table td:first-child {
  white-space: nowrap;
}

.plans-table input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

.drag-handle {
  cursor: grab;
  color: #aaa;
  margin-right: 6px;
  font-size: 14px;
  vertical-align: middle;
  user-select: none;
}

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

.plans-table tr.drag-active {
  opacity: 0.5;
  background: #E8F5E9;
}

.plans-table tr.drag-active td {
  border-color: #4CAF50;
}

/* Progress bar */
.progress-bar-container {
  height: 4px;
  background: #e0e0e0;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: #4CAF50;
  transition: width 0.2s;
}
.payment-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.payment-card {
  background: white;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 40px;
  width: 100%;
  max-width: 600px;
}

.payment-logo {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  color: #333;
  margin-bottom: 24px;
}

.payment-divider {
  height: 1px;
  background: #e0e0e0;
  margin: 0 -40px 24px;
}

.payment-service {
  text-align: center;
  margin-bottom: 8px;
}

.payment-service-name {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.payment-service-period {
  font-size: 14px;
  color: #888;
  margin-top: 4px;
}

/* Tariff toggle */
.payment-tariff-toggle {
  display: flex;
  gap: 0;
  margin: 0 0 8px;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
}

.payment-tariff-btn {
  flex: 1;
  padding: 10px;
  background: #f5f5f5;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.payment-tariff-btn.active {
  background: #FFDD2D;
  color: #333;
  font-weight: 600;
}

/* Period toggle */
.payment-period-toggle {
  display: flex;
  gap: 0;
  margin: 16px 0 8px;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow: hidden;
}

.payment-period-btn {
  flex: 1;
  padding: 10px;
  background: #f5f5f5;
  border: none;
  font-size: 15px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.payment-period-btn.active {
  background: #FFDD2D;
  color: #333;
  font-weight: 600;
}

.payment-discount-badge {
  display: inline-block;
  background: #4CAF50;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.payment-amount-old {
  font-size: 16px;
  color: #bbb;
  text-decoration: line-through;
  margin-top: 4px;
}

.payment-amount-section {
  text-align: center;
  margin: 24px 0;
}

.payment-amount-label {
  font-size: 14px;
  color: #888;
  margin-bottom: 4px;
}

.payment-amount {
  font-size: 36px;
  font-weight: 700;
  color: #333;
}

.payment-amount-currency {
  font-size: 24px;
  font-weight: 400;
  margin-left: 4px;
}

.payment-form-group {
  margin-bottom: 20px;
}

.payment-form-group label {
  display: block;
  font-size: 14px;
  color: #666;
  margin-bottom: 6px;
}

.payment-form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.payment-form-group input:focus {
  border-color: #FFDD2D;
}

.payment-btn {
  width: 100%;
  padding: 14px;
  background: #FFDD2D;
  color: #333;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.payment-btn:hover {
  background: #FCC521;
}

.payment-btn:disabled {
  background: #e0e0e0;
  color: #999;
  cursor: not-allowed;
}

.payment-error {
  color: #e53935;
  font-size: 14px;
  text-align: center;
  margin-top: 12px;
}

.payment-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
  color: #aaa;
}

.payment-systems {
  margin-top: 8px;
  font-size: 11px;
  color: #ccc;
  letter-spacing: 2px;
}

/* Success page */
.payment-success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #4CAF50;
  color: white;
  font-size: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.payment-success-title {
  text-align: center;
  font-size: 22px;
  font-weight: 600;
  color: #333;
  margin-bottom: 24px;
}

.payment-key-label {
  font-size: 14px;
  color: #888;
  text-align: center;
  margin-bottom: 8px;
}

.payment-key-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.payment-key-value {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  word-break: break-all;
  color: #333;
}

.payment-key-copy {
  background: none;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  color: #666;
  white-space: nowrap;
}

.payment-key-copy:hover {
  background: #f0f0f0;
}

.payment-key-hint {
  text-align: center;
  font-size: 13px;
  color: #888;
  margin-bottom: 24px;
}

.payment-pending {
  text-align: center;
  padding: 40px 0;
  color: #888;
  font-size: 16px;
}

.payment-spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #e0e0e0;
  border-top-color: #FFDD2D;
  border-radius: 50%;
  animation: payment-spin 0.8s linear infinite;
  margin-bottom: 12px;
}

@keyframes payment-spin {
  to { transform: rotate(360deg); }
}

.payment-goto-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: #FFDD2D;
  color: #333;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
  box-sizing: border-box;
}

.payment-goto-btn:hover {
  background: #FCC521;
}
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 360px;
}

.toast {
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 12px 16px;
  animation: toast-slide-in 0.3s ease-out;
  border-left: 4px solid #f44336;
}

.toast-error {
  border-left-color: #f44336;
}

.toast-success {
  border-left-color: #4caf50;
}

.toast-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.toast-code {
  font-weight: 600;
  font-size: 14px;
}

.toast-code-error {
  color: #f44336;
}

.toast-code-success {
  color: #4caf50;
}

.toast-icon-success {
  font-weight: 700;
  font-size: 16px;
  color: #4caf50;
}

.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  color: #666;
}

.toast-message {
  font-size: 13px;
  color: #333;
  word-break: break-word;
}

@keyframes toast-slide-in {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
/* Saved modules list */
.saved-modules-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}

.saved-module-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid #eee;
  border-radius: 4px;
  cursor: pointer;
  gap: 8px;
}

.saved-module-item:hover {
  background: #f9f9f9;
}

.saved-module-item.selected {
  border-color: #4CAF50;
  background: #E8F5E9;
}

.saved-module-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.saved-module-check input[type="checkbox"] {
  width: auto;
  accent-color: #4CAF50;
  cursor: pointer;
}

.saved-module-info {
  flex: 1;
  min-width: 0;
  cursor: pointer;
}

.saved-module-name {
  font-size: 13px;
  font-weight: 500;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.saved-module-meta {
  font-size: 11px;
  color: #888;
}

.saved-module-delete {
  flex-shrink: 0;
  opacity: 0.4;
}

.saved-module-delete:hover {
  opacity: 1;
}

/* Luminaire results table */
.luminaire-results-table th,
.luminaire-results-table td {
  white-space: nowrap;
}

.luminaire-results-table td.module-name-cell {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Tree view */
.tree-group-row td {
  background: #f5f5f5;
  padding: 8px 6px !important;
}

.tree-group-row:hover td {
  background: #eee;
}

.tree-toggle {
  width: 24px;
  text-align: center;
  font-size: 10px;
  color: #666;
}

.tree-detail-header > td {
  padding: 0 !important;
  border: none !important;
}

.luminaire-detail-table {
  width: 100%;
  margin: 0;
  border-top: none !important;
}

.luminaire-detail-table th {
  font-size: 11px;
}

.luminaire-detail-table td {
  font-size: 12px;
}

/* LEDs parsed hint */
.leds-parsed-hint {
  font-size: 11px;
  color: #888;
  margin-top: 2px;
}
:root {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color-scheme: light;
  color: #333;
  background-color: #f5f5f5;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
}

#root {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
}
