* { box-sizing: border-box; }

:root {
  --bg: #08101f;
  --bg2: #0d1730;
  --panel: #101b33;
  --panel2: #152443;
  --line: #24375f;
  --text: #eef4ff;
  --muted: #9db0d0;
  --primary: #3b82f6;
  --primary2: #2563eb;
  --danger: #ef4444;
  --ok: #16a34a;
}

body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg) 0%, #07101d 100%);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.hidden { display: none !important; }

.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.auth-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
}

.auth-brand h1,
.sidebar-brand h1 {
  margin: 0;
  font-size: 26px;
}

.auth-brand p,
.sidebar-brand p {
  margin: 4px 0 0;
  color: var(--muted);
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(5, 12, 26, 0.95);
  padding: 24px;
}

.sidebar-brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

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

.menu-btn {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 13px 14px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
}

.menu-btn:hover,
.menu-btn.active {
  background: var(--panel);
  border-color: var(--line);
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 0 0 6px;
  font-size: 34px;
}

.topbar p {
  margin: 0;
  color: var(--muted);
}

.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 24px;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 20px;
  font-size: 28px;
}

.grid {
  display: grid;
  gap: 14px;
}

.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.col-2 { grid-column: span 2; }

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

input,
.textarea {
  width: 100%;
  background: #0b1529;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
}

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

input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn {
  border: none;
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 700;
  cursor: pointer;
}

.primary-btn {
  background: linear-gradient(180deg, var(--primary), var(--primary2));
  color: white;
}

.secondary-btn {
  background: #374151;
  color: white;
}

.full {
  width: 100%;
}

.status {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 12px;
  background: #0c1a30;
  border: 1px solid var(--line);
}

.result-box {
  margin-top: 18px;
  background: #0b1529;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  overflow: auto;
  min-height: 80px;
}

.result-meta {
  margin-bottom: 14px;
  color: var(--muted);
}

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

.table th,
.table td {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--ok);
  font-size: 12px;
  font-weight: 700;
}

.badge.off {
  background: var(--danger);
}

.copy-box {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.key-value {
  word-break: break-all;
  font-family: monospace;
  background: #07101d;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  flex: 1;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: #0b1529;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.kpi .title {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.kpi .value {
  font-size: 28px;
  font-weight: 700;
}

pre {
  margin: 0;
  color: #dbeafe;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .cols-2,
  .cols-3,
  .cols-4,
  .kpis {
    grid-template-columns: 1fr;
  }

  .col-2 {
    grid-column: span 1;
  }
}

.company-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.company-field {
  background: #07101d;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.company-field.full {
  grid-column: 1 / -1;
}

.company-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.company-value {
  font-size: 16px;
  font-weight: 600;
  word-break: break-word;
}

.company-source {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.data-card {
  background: #07101d;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.data-card.full {
  grid-column: 1 / -1;
}

.data-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.data-value {
  font-size: 16px;
  font-weight: 700;
  word-break: break-word;
}

.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.mini-btn {
  background: #1d4ed8;
  border: none;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .data-grid {
    grid-template-columns: 1fr;
  }
}

.data-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.data-card {
  background: #07101d;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.data-card.full {
  grid-column: 1 / -1;
}

.data-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.data-value {
  font-size: 16px;
  font-weight: 700;
  word-break: break-word;
}

.action-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.mini-btn {
  background: #1d4ed8;
  border: none;
  color: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .data-grid {
    grid-template-columns: 1fr;
  }
}

.result-grid-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-company-card {
  background: #07101d;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
}

.result-company-card h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.result-company-card .meta {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.result-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.result-actions button {
  background: #1d4ed8;
  border: none;
  color: white;
  padding: 9px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.key-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.key-pill {
  background: #07101d;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: monospace;
  word-break: break-all;
  flex: 1;
}

@media (max-width: 1200px) {
  .result-grid-cards {
    grid-template-columns: 1fr;
  }
}

.results-table-wrap {
  overflow: auto;
  margin-top: 14px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1100px;
}

.results-table th,
.results-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  vertical-align: top;
  text-align: left;
}

.results-table th {
  color: var(--muted);
  font-size: 13px;
}

.pagination-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.job-status {
  display: inline-block;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.job-status.pending { background: #f59e0b; color: #111; }
.job-status.running { background: #3b82f6; color: white; }
.job-status.finished { background: #16a34a; color: white; }
.job-status.failed { background: #ef4444; color: white; }


.main {
  padding: 28px;
  overflow-x: hidden;
  min-width: 0;
}

.card,
.result-box,
.results-table-wrap {
  max-width: 100%;
  min-width: 0;
}

.results-table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 12px;
}

.results-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

.results-table th,
.results-table td {
  word-break: break-word;
}

.results-table th:nth-child(1),
.results-table td:nth-child(1) { width: 140px; }

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

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

.results-table th:nth-child(4),
.results-table td:nth-child(4) { width: 120px; }

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

.results-table th:nth-child(6),
.results-table td:nth-child(6) { width: 120px; }

.results-table th:nth-child(7),
.results-table td:nth-child(7) { width: 120px; }

.results-table th:nth-child(8),
.results-table td:nth-child(8) { width: 260px; }

.results-table th:nth-child(9),
.results-table td:nth-child(9) { width: 110px; }

.results-table th:nth-child(10),
.results-table td:nth-child(10) { width: 140px; }

.result-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 1200px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}
.pagination-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 16px;
}

.secondary-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}
