﻿:root {
  --bg-body: #eef3fb;
  --bg-panel: rgba(255, 255, 255, 0.82);
  --bg-card: #ffffff;
  --bg-soft: #f5f8ff;
  --text: #172033;
  --muted: #627089;
  --line: #d7dfef;
  --accent: #1d4ed8;
  --accent-soft: #dbe7ff;
  --success: #177355;
  --warning: #aa7419;
  --danger: #b12d3b;
  --shadow-lg: 0 24px 60px rgba(20, 48, 106, 0.16);
  --shadow-sm: 0 12px 30px rgba(25, 53, 109, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(97, 147, 255, 0.22), transparent 28%),
    radial-gradient(circle at bottom right, rgba(20, 163, 122, 0.14), transparent 26%),
    linear-gradient(180deg, #f7faff 0%, var(--bg-body) 100%);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

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

button,
a {
  transition: 0.2s ease;
}

img {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
p,
pre,
ul {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  background: #fff;
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #7da2ff;
  box-shadow: 0 0 0 4px rgba(29, 78, 216, 0.12);
}

progress {
  width: 100%;
  height: 10px;
}

pre {
  white-space: pre-wrap;
  word-break: break-word;
}

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 8% 12%, rgba(123, 156, 255, 0.12), transparent 16%),
    radial-gradient(circle at 92% 84%, rgba(10, 129, 102, 0.12), transparent 14%);
}

.shell {
  position: relative;
  width: min(1440px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.sidebar {
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-self: start;
  gap: 18px;
  padding: 20px;
  border: 1px solid #213255;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #162543 0%, #1f3158 100%);
  box-shadow: 0 18px 40px rgba(12, 25, 53, 0.22);
  color: #eff4ff;
}

.brand {
  display: grid;
  gap: 8px;
}

.brand h1 {
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.05;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #90b2ff;
}

.muted {
  color: var(--muted);
}

.sidebar .muted {
  color: rgba(226, 235, 255, 0.72);
}

.sidebar-nav {
  display: grid;
  gap: 8px;
  align-content: start;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  color: #edf3ff;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(149, 180, 255, 0.2);
}

.nav-link.is-active {
  background: linear-gradient(135deg, rgba(53, 116, 255, 0.34), rgba(44, 175, 141, 0.2));
  border-color: rgba(147, 179, 255, 0.34);
  box-shadow: inset 0 0 0 1px rgba(168, 194, 255, 0.14);
}

.nav-link.is-disabled {
  opacity: 0.48;
}

.sidebar-foot {
  display: grid;
  gap: 10px;
}

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
  align-content: start;
}

.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  border: 1px solid #dbe4f2;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.workspace-head h2 {
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
}

.page {
  display: none;
}

.page.is-active {
  display: block;
}

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

.auth-grid,
.profile-grid,
.uploads-grid,
.metrics-grid,
.two-wide {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1100px) {
  .auth-grid,
  .two-wide,
  .uploads-grid,
  .profile-grid,
  .metrics-grid {
    grid-template-columns: minmax(320px, 0.92fr) minmax(0, 1.08fr);
  }
}

.card {
  display: grid;
  gap: 16px;
  padding: 20px;
  border: 1px solid #dbe4f2;
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.hero-card {
  background:
    linear-gradient(145deg, rgba(29, 78, 216, 0.12), rgba(20, 163, 122, 0.06)),
    var(--bg-panel);
}

.info-card {
  background: linear-gradient(180deg, rgba(241, 246, 255, 0.95), rgba(252, 253, 255, 0.95));
}

.stack {
  display: grid;
  gap: 12px;
}

.row,
.toolbar,
.section-head {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.section-head {
  justify-content: space-between;
}

.toolbar {
  justify-content: flex-start;
}

.actions-row {
  gap: 6px;
}

.check {
  display: flex;
  gap: 8px;
  align-items: center;
}

.check input {
  width: 18px;
  height: 18px;
}

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 42px;
  padding: 0 16px;
  background: linear-gradient(135deg, #2455c3 0%, #0d8f7d 100%);
  color: #fff;
  cursor: pointer;
}

.btn:hover {
  filter: brightness(1.04);
}

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

.btn.ghost {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}

.btn.danger {
  border-color: #f0c9cf;
  background: #fff8f8;
  color: var(--danger);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7ff;
}

.output {
  min-height: 64px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: #0f1728;
  color: #d6e4ff;
  overflow: auto;
}

.hint-list {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.dropzone {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 220px;
  border: 2px dashed #85a3ef;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  text-align: center;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: linear-gradient(180deg, #edf4ff 0%, var(--accent-soft) 100%);
}

.preview-card,
.chart-card {
  min-height: 100%;
}

.preview-wrap {
  min-height: 280px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #fbfcff 0%, #f3f7ff 100%);
  padding: 16px;
}

#uploadPreview {
  max-height: 420px;
  border-radius: var(--radius-sm);
}

.stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.stat {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f8fbff 0%, #f1f6ff 100%);
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat strong {
  font-size: 28px;
}

canvas {
  width: 100%;
}

.error-list {
  display: grid;
  gap: 12px;
}

.error-item {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid #f2c7cd;
  border-radius: var(--radius-md);
  background: #fff7f8;
}

.error-item strong {
  color: var(--danger);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tag.draft {
  color: #334155;
  background: #edf2f7;
}

.tag.active {
  color: var(--success);
  background: #def3ea;
}

.tag.paused {
  color: var(--warning);
  background: #fff0d3;
}

.tag.revoked {
  color: var(--danger);
  background: #fde4e8;
}

.toast-container {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100% - 36px));
}

.toast {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow-sm);
  animation: toast-in 0.18s ease-out;
}

.toast.success {
  border-color: #bfe5d4;
  background: #f5fff9;
}

.toast.error {
  border-color: #f0c4ca;
  background: #fff7f8;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 680px) {
  .shell {
    padding: 14px;
    gap: 14px;
  }

  .sidebar,
  .workspace-head,
  .card {
    padding: 18px;
  }

  .workspace-head h2 {
    font-size: 28px;
  }

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

  .nav-link {
    justify-content: center;
    text-align: center;
  }

  .section-head,
  .toolbar,
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .actions-row {
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}
