:root {
  --bg: #edf3f8;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-alt: #f5f8fb;
  --line: #d5dfeb;
  --line-strong: #b7c7db;
  --text: #132033;
  --muted: #5b6d83;
  --brand: #0d5bd7;
  --brand-dark: #0a45a1;
  --brand-soft: rgba(13, 91, 215, 0.12);
  --accent: #0891b2;
  --success: #166534;
  --warning: #9a6700;
  --danger: #b42318;
  --shadow: 0 20px 55px rgba(19, 32, 51, 0.1);
  --shadow-soft: 0 10px 28px rgba(19, 32, 51, 0.08);
  --radius: 22px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(8, 145, 178, 0.12), transparent 25rem),
    radial-gradient(circle at top right, rgba(13, 91, 215, 0.12), transparent 28rem),
    linear-gradient(180deg, #f9fbfd 0%, var(--bg) 100%);
}

a {
  color: var(--brand);
  text-decoration: none;
  transition: color 140ms ease, opacity 140ms ease;
}
a:hover { color: var(--brand-dark); }
code {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 30px 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 24%),
    linear-gradient(180deg, #0f1724 0%, #0a1320 100%);
  color: #e7eef8;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #0d5bd7, #0891b2);
  color: white;
  font-weight: 800;
  box-shadow: 0 14px 30px rgba(8, 145, 178, 0.22);
}
.brand-title { font-size: 1.2rem; font-weight: 700; }
.brand-subtitle { color: #9fb1c8; font-size: 0.9rem; }
.nav {
  display: grid;
  gap: 10px;
  padding: 14px 0;
}
.nav a {
  display: block;
  padding: 13px 15px;
  border-radius: 14px;
  color: #dce7f5;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.08);
}
.sidebar-footer { margin-top: auto; display: grid; gap: 16px; }
.user-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.user-name { font-weight: 700; }
.user-role { font-size: 0.8rem; color: #9fb1c8; }

.main {
  min-width: 0;
  padding: 34px clamp(22px, 3vw, 42px);
}
.main-auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.page-header,
.panel-heading,
.toolbar,
.actions-inline,
.list-item,
.url-row {
  display: flex;
  gap: 14px;
}

.page-header,
.panel-heading,
.toolbar,
.actions-inline,
.list-item {
  align-items: flex-start;
}

.page-header,
.panel,
.auth-card { animation: fadeIn 240ms ease; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.page-header > * { min-width: 0; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: var(--brand);
  margin-bottom: 8px;
  font-weight: 700;
}
h1, h2 { margin: 0; }
h1 {
  font-size: clamp(2rem, 2.4vw, 2.7rem);
  line-height: 1.04;
  letter-spacing: -0.04em;
}
h2 {
  font-size: 1.15rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.muted { color: var(--muted); }
.text-right { text-align: right; }
.grow { flex: 1; }

.panel,
.auth-card,
.stat-card {
  background: var(--panel);
  border: 1px solid rgba(19, 32, 51, 0.08);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.panel {
  padding: 28px;
  margin-bottom: 24px;
}
.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.panel-grid-2,
.panel-grid-3 {
  display: grid;
  align-items: stretch;
  gap: 24px;
}
.panel-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}
.stat-card {
  padding: 22px;
  box-shadow: var(--shadow-soft);
}
.stat-card span { color: var(--muted); font-size: 0.92rem; display: block; margin-bottom: 8px; }
.stat-card strong { font-size: 1.8rem; }

.form-grid { display: grid; gap: 18px; }
.form-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
label { display: grid; gap: 8px; font-weight: 600; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.95);
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}
.checkbox input { width: auto; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: 14px;
  padding: 11px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 140ms ease, box-shadow 140ms ease, background-color 140ms ease, color 140ms ease;
}
.button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(19, 32, 51, 0.12);
}
.button-primary {
  background: linear-gradient(135deg, var(--brand), var(--accent));
  color: white;
}
.button-primary:hover { background: linear-gradient(135deg, var(--brand-dark), #0c7394); }
.button-secondary {
  background: #eef4fa;
  color: var(--text);
  border: 1px solid rgba(19, 32, 51, 0.07);
}
.button-danger {
  background: #fff2f2;
  color: var(--danger);
  border: 1px solid rgba(180, 35, 24, 0.08);
}
.button-small { padding: 8px 12px; font-size: 0.9rem; }
.button-block { width: 100%; }

.flash-stack { display: grid; gap: 10px; margin-bottom: 24px; }
.flash {
  padding: 14px 16px;
  border-radius: 16px;
  font-weight: 600;
  border: 1px solid rgba(19, 32, 51, 0.06);
}
.flash-success { background: #ecfdf3; color: var(--success); }
.flash-error { background: #fff1f2; color: var(--danger); }

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(19, 32, 51, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}
.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}
.data-table th, .data-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.data-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(245, 248, 251, 0.9);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.badge-success { background: #ecfdf3; color: var(--success); }
.badge-warning { background: #fff7e5; color: var(--warning); }
.badge-danger { background: #fff1f2; color: var(--danger); }
.badge-muted { background: #eef3f8; color: var(--muted); }

.list { display: grid; }
.list-condensed { gap: 10px; }
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.list-item > * {
  min-width: 0;
  flex: 1 1 220px;
}
.list-item:last-child { border-bottom: 0; }
.list-item-compact { align-items: center; }
.empty-state {
  padding: 28px 0;
  text-align: center;
  color: var(--muted);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding: 10px 0;
}
.info-grid > div {
  min-width: 0;
  padding: 16px 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(245, 248, 251, 0.96), rgba(255, 255, 255, 0.92));
  border: 1px solid rgba(19, 32, 51, 0.06);
}
.info-grid span { display: block; font-size: 0.82rem; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.08em; }
.info-grid strong { display: block; overflow-wrap: anywhere; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.toolbar input, .toolbar select { max-width: 280px; }

.dropzone {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(13, 91, 215, 0.12);
  border-radius: 24px;
  padding: 20px;
  background:
    radial-gradient(circle at top right, rgba(8, 145, 178, 0.12), transparent 12rem),
    linear-gradient(180deg, #f8fbff, white);
  box-shadow: inset 0 0 0 1px rgba(13, 91, 215, 0.1);
}
.dropzone > span {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.dropzone-display {
  min-height: 150px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  border: 1px dashed rgba(13, 91, 215, 0.22);
  background: rgba(243, 247, 251, 0.85);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
}

.progress {
  width: 100%;
  height: 12px;
  background: #e9eff5;
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #0c5adb, #33a3ff);
  transition: width 150ms ease;
}

.auth-shell { width: min(520px, 100%); }
.auth-card { padding: 36px; }
.centered-panel {
  max-width: 560px;
  margin: 8vh auto 0;
  text-align: center;
}

.actions-inline {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.actions-inline > * { flex: 0 0 auto; }
.url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}
.copy-source {
  display: block;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--panel-alt);
  border: 1px solid rgba(19, 32, 51, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

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

@media (max-width: 1080px) {
  .stats-grid,
  .panel-grid-2,
  .panel-grid-3,
  .info-grid {
    grid-template-columns: 1fr 1fr;
  }
  .form-columns {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .layout { display: block; }
  .sidebar {
    position: static;
    height: auto;
    width: auto;
  }
  .main { padding: 20px; }
  .stats-grid,
  .panel-grid-2,
  .panel-grid-3,
  .info-grid {
    grid-template-columns: 1fr;
  }
  .page-header,
  .toolbar,
  .actions-inline {
    flex-direction: column;
    align-items: stretch;
  }
  .url-row {
    grid-template-columns: 1fr;
  }
  .data-table {
    min-width: 760px;
  }
}
