* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #e8eaf6 0%, #f5f7ff 100%);
  min-height: 100vh;
}

/* Header */
.header {
  background: #fff;
  padding: 16px 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.logo strong {
  color: #1a56db;
  font-size: 1.2em;
}
.logo small {
  color: #888;
}

.mode-switch {
  display: flex;
  gap: 12px;
}

.mode-btn {
  border: 1.5px solid #dbe3ff;
  background: #f5f7ff;
  color: #1a56db;
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 0.95em;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.mode-btn:hover {
  background: #e0e7ff;
}

.mode-btn.active {
  background: linear-gradient(90deg, #1a56db 0%, #38bdf8 100%);
  border-color: #1a56db;
  color: #fff;
}

/* Layout */
.layout {
  display: flex;
  padding: 32px;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
}

.layout.hidden-layout {
  display: none;
}

/* Sidebar */
.sidebar {
  background: #fff;
  border-radius: 16px;
  padding: 24px 16px;
  min-width: 220px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar h2 {
  font-size: 1em;
  margin-bottom: 8px;
  color: #333;
}
.menu-btn {
  background: #f5f7ff;
  border: 1.5px solid #dbe3ff;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.95em;
  color: #1a56db;
  cursor: pointer;
  text-align: left;
  transition: background 0.2s, border 0.2s;
}
.menu-btn:hover {
  background: #e0e7ff;
}
.menu-btn.active {
  background: #dbe3ff;
  border-color: #1a56db;
  font-weight: bold;
}
.menu-btn:disabled {
  color: #aaa;
  border-color: #e0e0e0;
  background: #f9f9f9;
  cursor: not-allowed;
}

/* Main */
#main-content {
  flex: 1;
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

#centralized-main-content {
  flex: 1;
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

/* Vistas */
.view {
  display: none;
}
.view.active-view {
  display: block;
}

/* Form */
.query-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 520px;
  margin-top: 16px;
}
.query-form label {
  font-weight: 600;
  color: #333;
}
.query-form select,
.query-form input[type="text"],
.query-form input[type="number"],
.query-form input[type="date"] {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #dbe3ff;
  border-radius: 10px;
  font-size: 1em;
  outline: none;
  transition: border 0.2s;
}
.query-form select:focus,
.query-form input[type="text"]:focus,
.query-form input[type="number"]:focus,
.query-form input[type="date"]:focus {
  border-color: #1a56db;
}

.btn-primary {
  background: linear-gradient(90deg, #1a56db 0%, #38bdf8 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  width: 100%;
  padding: 14px;
  font-size: 1em;
  font-weight: bold;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.autocomplete-list {
  display: none;
  width: 100%;
  border: 1.5px solid #cdeeed;
  border-radius: 10px;
  background: #f0fdfa;
  max-height: 220px;
  overflow-y: auto;
}

.autocomplete-list.active {
  display: block;
}

.autocomplete-item {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.autocomplete-item:hover {
  background: #ccfbf1;
}

.autocomplete-alias {
  font-weight: 600;
  color: #115e59;
}

.autocomplete-code {
  font-family: 'Fira Mono', 'Consolas', monospace;
  color: #0f766e;
  font-size: 0.9rem;
}

/* Results */
.result-box {
  margin-top: 24px;
  padding: 16px;
  border: 1.5px solid #dbe3ff;
  border-radius: 12px;
  min-height: 60px;
  background: #f9faff;
}
.result-box h3 {
  color: #1a56db;
  margin-bottom: 12px;
}
.result-box .error {
  color: #e53e3e;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}
.result-table th {
  background: #e0e7ff;
  color: #1a56db;
  padding: 8px 12px;
  text-align: left;
  border-bottom: 2px solid #dbe3ff;
}
.result-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
}
.result-table tr:hover td {
  background: #f0f4ff;
}

.label-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}

.label-list li {
  background: #23272e;
  border: 1px solid #35394a;
  border-radius: 6px;
  padding: 8px 16px;
  margin-bottom: 6px;
  color: #e0e0e0;
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 1rem;
}

.label-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
}

.label-list li {
  padding: 4px 0;
  color: #e0e0e0;
  font-size: 1rem;
}

/* Dependencies list */
.deps-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.deps-list li {
  background: #fff;
  border: 1px solid #dbe3ff;
  border-radius: 6px;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}

.deps-code {
  font-family: 'Fira Mono', 'Consolas', monospace;
  font-size: 0.95rem;
  font-weight: bold;
  color: #1a56db;
  white-space: nowrap;
}

.deps-desc {
  font-size: 0.9rem;
  color: #444;
  min-width: 0;
  overflow-wrap: anywhere;
}

.deps-percent {
  min-width: 78px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  opacity: 0.95;
  justify-self: end;
}

.deps-list li.deps-executed {
  border-color: #22c55e;
  background: #22c55e;
  color: #ffffff;
}

.deps-list li.deps-executed .deps-code,
.deps-list li.deps-executed .deps-desc,
.deps-list li.deps-executed .deps-percent {
  color: #ffffff;
}

.deps-list li.deps-not-executed {
  border-color: #ef4444;
  background: #ef4444;
  color: #ffffff;
}

.deps-list li.deps-not-executed .deps-code,
.deps-list li.deps-not-executed .deps-desc,
.deps-list li.deps-not-executed .deps-percent {
  color: #ffffff;
}

.deps-list li.deps-partial {
  border-color: #f59e0b;
  background: #f59e0b;
  color: #ffffff;
}

.deps-list li.deps-partial .deps-code,
.deps-list li.deps-partial .deps-desc,
.deps-list li.deps-partial .deps-percent {
  color: #ffffff;
}

.deps-list li.deps-unknown {
  border-color: #d1d5db;
  background: #f9fafb;
}

/* Remove dependencies list */
.remove-deps-list {
  list-style: none;
  padding: 0;
  margin: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.remove-deps-list li {
  background: #fff;
  border: 1px solid #dbe3ff;
  border-radius: 6px;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 26px auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  transition: background 0.15s;
}

.remove-deps-list li input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #e74c3c;
  flex-shrink: 0;
}

.remove-deps-list li input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.remove-deps-list li.deps-executed {
  border-color: #22c55e;
  background: #f0fdf4;
}

.remove-deps-list li.deps-executed .deps-code {
  color: #16a34a;
}

.remove-deps-list li.deps-not-executed {
  border-color: #ef4444;
  background: #fef2f2;
}

.remove-deps-list li.deps-not-executed .deps-code {
  color: #dc2626;
}

.remove-deps-list li.deps-partial {
  border-color: #f59e0b;
  background: #fffbeb;
}

.remove-deps-list li.deps-partial .deps-code {
  color: #d97706;
}

.remove-deps-list li.deps-unknown {
  border-color: #d1d5db;
  background: #f9fafb;
}

.deps-status-tag {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  white-space: nowrap;
  min-width: 210px;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  justify-self: end;
}

.deps-tag-ok {
  background: #22c55e;
  color: #fff;
}

.deps-tag-pending {
  background: #ef4444;
  color: #fff;
}

.deps-tag-partial {
  background: #f59e0b;
  color: #fff;
}

.centralized-main {
  width: 100%;
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.centralized-main h1 {
  margin-bottom: 12px;
}

.centralized-main p {
  color: #444;
  margin-bottom: 8px;
}

@media (max-width: 900px) {
  .header {
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px;
  }

  .mode-switch {
    width: 100%;
    flex-wrap: wrap;
  }

  .mode-btn {
    flex: 1;
    min-width: 160px;
  }

  .layout {
    flex-direction: column;
    padding: 20px;
    gap: 20px;
  }

  .sidebar {
    width: 100%;
    min-width: 0;
    padding: 16px;
  }

  #main-content,
  #centralized-main-content {
    width: 100%;
    padding: 24px;
  }

  .query-form {
    max-width: 100%;
  }

  .deps-status-tag {
    min-width: auto;
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
    justify-self: stretch;
  }

  .deps-percent {
    min-width: auto;
    width: 100%;
    text-align: left;
    margin-top: 2px;
  }

  .deps-list li {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .remove-deps-list li {
    grid-template-columns: 26px minmax(0, 1fr) auto;
  }

  .deps-percent {
    grid-column: 2;
    grid-row: 1;
  }

  .remove-deps-list li .deps-percent {
    grid-column: 3;
    grid-row: 1;
  }

  .deps-status-tag {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

@media (max-width: 640px) {
  .header {
    gap: 16px;
  }

  .layout {
    padding: 12px;
    gap: 12px;
  }

  .sidebar {
    padding: 12px;
  }

  .menu-btn {
    padding: 10px 12px;
    font-size: 0.92em;
  }

  #main-content,
  #centralized-main-content {
    padding: 16px;
  }

  .query-form {
    gap: 10px;
  }

  .query-form select,
  .query-form input[type="text"],
  .query-form input[type="number"],
  .query-form input[type="date"],
  .btn-primary {
    padding: 11px 12px;
    font-size: 0.95em;
  }
}