:root {
  --bg: #07111f;
  --bg-elevated: #0d1728;
  --surface: rgba(12, 21, 36, 0.88);
  --surface-strong: rgba(18, 30, 48, 0.96);
  --surface-soft: rgba(13, 23, 40, 0.72);
  --line: rgba(133, 156, 192, 0.16);
  --line-strong: rgba(133, 156, 192, 0.3);
  --text: #edf3ff;
  --muted: #96a8c5;
  --primary: #37c7a0;
  --primary-strong: #1c9c7b;
  --secondary: #ffb44d;
  --danger: #ff6b6b;
  --danger-strong: #ff4f64;
  --success: #48d597;
  --warning: #ffd166;
  --info: #6db8ff;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius-lg: 24px;
  --radius-md: 16px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(62, 160, 255, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(55, 199, 160, 0.12), transparent 24%),
    linear-gradient(180deg, #050c16 0%, #091321 100%);
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 28px 32px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  background: linear-gradient(135deg, #123c35, #2dd4a5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.brand h1,
.hero-card h2 {
  margin: 0;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-copy {
  margin: 0;
  max-width: 460px;
  color: var(--muted);
}

.version-badge {
  border: 1px solid var(--line);
  background: rgba(18, 30, 48, 0.92);
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 700;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 24px;
  padding: 0 32px 32px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel,
.hero-card,
.upload-card,
.results-card {
  border: 1px solid var(--line);
  background: var(--surface);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.panel {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.panel-soft {
  background: rgba(9, 17, 31, 0.92);
}

.section-label {
  margin: 0 0 14px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  gap: 12px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: rgba(16, 27, 43, 0.9);
}

.accent-blue {
  border-color: rgba(109, 184, 255, 0.28);
}

.accent-red {
  border-color: rgba(255, 107, 107, 0.24);
}

.accent-green {
  border-color: rgba(72, 213, 151, 0.24);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.accent-blue .stat-value {
  color: var(--info);
}

.accent-red .stat-value {
  color: var(--danger);
}

.accent-green .stat-value {
  color: var(--success);
}

.stat-label,
.status-text,
.hero-copy,
.drop-sub,
.empty-state,
.help-box p,
.help-box li,
.gleba-meta {
  color: var(--muted);
}

.actions {
  display: grid;
  gap: 10px;
}

.btn {
  width: 100%;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn:hover:not(:disabled),
.btn:focus-visible:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.24);
}

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

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
}

.btn-success {
  color: #fff;
  background: linear-gradient(135deg, #1c8d66, var(--success));
}

.btn-secondary {
  color: #101723;
  background: linear-gradient(135deg, #ffcc73, var(--secondary));
}

.btn-muted {
  color: var(--text);
  background: #152234;
}

.content {
  display: grid;
  gap: 18px;
}

.hero-card {
  border-radius: 30px;
  padding: 24px 26px;
  background:
    radial-gradient(circle at top right, rgba(55, 199, 160, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(12, 21, 36, 0.96), rgba(10, 17, 30, 0.94));
}

.hero-copy {
  margin: 10px 0 0;
  max-width: 760px;
  line-height: 1.6;
}

.upload-card,
.results-card {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.drop-zone {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
  border-radius: 22px;
  padding: 24px;
  border: 2px dashed var(--line-strong);
  background:
    linear-gradient(135deg, rgba(18, 30, 48, 0.94), rgba(13, 23, 40, 0.92));
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.is-hover {
  border-color: var(--primary);
  transform: translateY(-1px);
}

.drop-zone.is-loaded {
  border-style: solid;
  border-color: var(--success);
  background: linear-gradient(135deg, rgba(14, 44, 37, 0.95), rgba(9, 35, 29, 0.92));
}

.drop-kicker,
.badge,
.version-badge,
.tab-btn {
  border-radius: 999px;
}

.drop-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  background: rgba(55, 199, 160, 0.12);
  color: #87f0d1;
  font-size: 0.82rem;
  font-weight: 700;
}

.drop-title {
  font-size: 1.1rem;
}

.progress-bar {
  margin-top: 14px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.3s ease, background 0.3s ease;
}

.progress-fill.indeterminate {
  width: 32%;
  animation: loading-slide 1.1s linear infinite;
}

@keyframes loading-slide {
  from {
    transform: translateX(-120%);
  }
  to {
    transform: translateX(360%);
  }
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tab-btn {
  padding: 10px 14px;
  background: rgba(20, 32, 51, 0.84);
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.tab-btn.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
}

.tab-panel {
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(8, 15, 27, 0.92);
  min-height: 420px;
  overflow: hidden;
}

.report-layout,
.glebas-list,
.help-box {
  margin: 0;
  padding: 22px;
  height: 100%;
  overflow: auto;
}

.report-layout {
  display: grid;
  gap: 18px;
  align-content: start;
}

.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.report-stat {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.report-stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.report-stat-value {
  font-size: 1.9rem;
  line-height: 1;
}

.report-stat-neutral {
  border-color: rgba(109, 184, 255, 0.18);
}

.report-stat-danger {
  border-color: rgba(255, 107, 107, 0.24);
}

.report-stat-danger .report-stat-value {
  color: var(--danger);
}

.report-stat-success {
  border-color: rgba(72, 213, 151, 0.24);
}

.report-stat-success .report-stat-value {
  color: var(--success);
}

.report-stat-warning {
  border-color: rgba(255, 209, 102, 0.24);
}

.report-stat-warning .report-stat-value {
  color: var(--warning);
}

.report-panel {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(13, 23, 40, 0.86);
  overflow: hidden;
}

.report-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 20px 0;
}

.report-panel-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.report-panel-title {
  margin: 0;
  font-size: 1.05rem;
}

.report-overview-list,
.report-groups {
  display: grid;
  gap: 12px;
  padding: 20px;
}

.report-overview-item,
.report-group-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(9, 17, 31, 0.78);
}

.report-overview-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
}

.report-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.report-icon-success {
  color: #091711;
  background: rgba(72, 213, 151, 0.9);
}

.report-icon-danger {
  color: #22080c;
  background: rgba(255, 107, 107, 0.92);
}

.report-icon-warning {
  color: #2a1d00;
  background: rgba(255, 209, 102, 0.92);
}

.report-overview-title,
.report-group-title {
  margin: 0 0 4px;
  font-size: 1rem;
}

.report-overview-text,
.report-group-meta,
.report-item-text {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.report-group-card {
  padding: 18px;
}

.report-group-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}

.report-group-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.report-group-danger {
  color: #ffd7db;
  background: rgba(255, 79, 100, 0.18);
}

.report-group-warning {
  color: #ffe9b0;
  background: rgba(255, 209, 102, 0.14);
}

.report-group-success {
  color: #b8f7df;
  background: rgba(72, 213, 151, 0.14);
}

.report-items {
  display: grid;
  gap: 10px;
}

.report-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(18, 30, 48, 0.86);
  border: 1px solid rgba(133, 156, 192, 0.12);
}

.report-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 6px;
}

.report-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(109, 184, 255, 0.12);
  color: #bcdcff;
  font-size: 0.74rem;
  font-weight: 700;
}

.report-box {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.7;
  white-space: pre-wrap;
}

.glebas-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

.gleba-card {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(13, 23, 40, 0.84);
  overflow: hidden;
}

.gleba-card.err {
  border-color: rgba(255, 107, 107, 0.24);
  background: rgba(42, 16, 24, 0.72);
}

.gleba-card.ok {
  border-color: rgba(72, 213, 151, 0.22);
  background: rgba(14, 41, 34, 0.7);
}

.gleba-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: transparent;
  cursor: pointer;
}

.gleba-title {
  margin: 0;
  font-size: 1rem;
}

.gleba-body {
  display: none;
  padding: 0 18px 18px;
}

.gleba-card.open .gleba-body {
  display: block;
}

.gleba-toggle {
  color: var(--muted);
  font-size: 1.2rem;
  transition: transform 0.2s ease;
}

.gleba-card.open .gleba-toggle {
  transform: rotate(180deg);
}

.error-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding-top: 12px;
  border-top: 1px solid rgba(74, 58, 39, 0.12);
  color: var(--text);
}

.error-item + .error-item {
  margin-top: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 10px;
  font-size: 0.73rem;
  font-weight: 700;
}

.badge-red {
  color: #ffd7db;
  background: rgba(255, 79, 100, 0.18);
}

.badge-amber {
  color: #ffe9b0;
  background: rgba(255, 209, 102, 0.16);
}

.badge-yellow {
  color: #fff0b7;
  background: rgba(255, 209, 102, 0.12);
}

.ok-label {
  margin: 12px 0 0;
  color: var(--success);
  font-weight: 700;
}

.help-box {
  line-height: 1.7;
}

.help-box h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.help-box ul {
  margin: 0;
  padding-left: 20px;
}

.help-sep {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.format-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(13, 23, 40, 0.82);
}

.format-table th,
.format-table td {
  padding: 10px 12px;
  border: 1px solid rgba(133, 156, 192, 0.12);
  text-align: left;
}

.format-table th {
  background: rgba(55, 199, 160, 0.08);
}

:focus-visible {
  outline: 3px solid rgba(109, 184, 255, 0.44);
  outline-offset: 2px;
}

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

  .report-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-header,
  .layout {
    padding-left: 18px;
    padding-right: 18px;
  }

  .app-header,
  .header-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-card,
  .upload-card,
  .results-card,
  .panel {
    border-radius: 20px;
  }

  .drop-zone {
    padding: 18px;
  }

  .format-table {
    display: block;
    overflow-x: auto;
  }

  .report-summary-grid {
    grid-template-columns: 1fr;
  }

  .report-item,
  .report-overview-item {
    grid-template-columns: 1fr;
  }

  .report-group-head {
    flex-direction: column;
  }
}
