@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@500;600;700&display=swap');

:root {
  --bg: #f3f7ff;
  --bg-soft: #eef4ff;
  --surface: #ffffff;
  --surface-alt: #f9fbff;
  --surface-muted: #f2f6ff;
  --text: #0c1b33;
  --muted: #53637d;
  --border: #d8e3f5;
  --border-strong: #bfd0ea;
  --accent: #1a73e8;
  --accent-strong: #1456b4;
  --accent-soft: #e8f1ff;
  --success: #137f53;
  --warning: #b66b00;
  --danger: #c4332f;
  --radius-lg: 22px;
  --radius-md: 14px;
  --shadow-sm: 0 8px 20px rgba(14, 37, 73, 0.09);
  --shadow-lg: 0 20px 50px rgba(14, 37, 73, 0.14);
  --focus: 0 0 0 4px rgba(26, 115, 232, 0.18);
  --sidebar-width: 282px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI Variable Text", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1300px 600px at 0% -15%, rgba(26, 115, 232, 0.22), transparent 60%),
    radial-gradient(900px 520px at 92% 0%, rgba(18, 153, 201, 0.16), transparent 64%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 50%, #eef4ff 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image:
    linear-gradient(rgba(19, 88, 174, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 88, 174, 0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  z-index: -1;
}

h1,
h2,
h3,
summary {
  margin: 0;
  font-family: "Sora", "Manrope", sans-serif;
  letter-spacing: -0.02em;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

ol,
ul {
  margin-top: 8px;
  margin-bottom: 0;
}

.hidden {
  display: none !important;
}

.appShell {
  display: flex;
  min-height: 100%;
}

.sidebar {
  width: var(--sidebar-width);
  padding: 20px 16px;
  border-right: 1px solid rgba(191, 208, 234, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 250, 255, 0.84));
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.brandMark {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: linear-gradient(145deg, #1a73e8, #13a4cf);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 12px 26px rgba(20, 87, 180, 0.33);
}

.brandTitle {
  font-family: "Sora", "Manrope", sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brandSub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}

.nav {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  color: var(--text);
  font-weight: 600;
  transition: background-color 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.nav a:hover {
  text-decoration: none;
  transform: translateX(2px);
  background: var(--surface-alt);
  border-color: var(--border);
}

.nav .active {
  background: linear-gradient(180deg, #eff5ff, #e7f1ff);
  border-color: var(--border-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.nav small {
  color: var(--muted);
  font-weight: 500;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
}

.topbar h1 {
  font-size: 18px;
}

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

.page {
  width: 100%;
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px;
}

.page.pageStack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.page > * {
  animation: riseIn 0.35s ease both;
}

.page > *:nth-child(2) {
  animation-delay: 0.04s;
}

.page > *:nth-child(3) {
  animation-delay: 0.08s;
}

.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 16px;
}

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

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

.metricPanel.good {
  border-color: rgba(19, 127, 83, 0.34);
  background: linear-gradient(180deg, rgba(241, 253, 248, 0.98), rgba(233, 249, 242, 0.98));
}

.metricLabel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metricValue {
  font-family: "Sora", "Manrope", sans-serif;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--text);
}

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

.metricChip {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.listRow {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.listRow:last-child {
  border-bottom: 0;
}

.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(249, 252, 255, 0.97));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
  transition: box-shadow 0.22s ease, border-color 0.22s ease, transform 0.22s ease;
}

.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.cardHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cardHeader h2 {
  font-size: 17px;
}

.sub {
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row > * {
  flex: 1;
}

.row.tight > * {
  flex: 0 0 auto;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sep {
  margin: 14px 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--border) 12%, var(--border) 88%, transparent 100%);
}

label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  padding: 11px 12px;
  font: inherit;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input::placeholder,
textarea::placeholder {
  color: #8090ab;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--focus);
  background: #fcfeff;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

.btn {
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  color: var(--text);
  font-family: "Manrope", "Segoe UI Variable Text", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 10px 13px;
  box-shadow: 0 6px 14px rgba(16, 44, 88, 0.11);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  text-decoration: none;
}

.btn:active {
  transform: translateY(0);
}

.btn.primary {
  border-color: #2a78e8;
  color: #ffffff;
  background: linear-gradient(180deg, #2d80f4, #1a67d8);
  box-shadow: 0 10px 20px rgba(23, 92, 193, 0.33);
}

.btn.primary:hover {
  border-color: #1e64ce;
  box-shadow: 0 14px 24px rgba(23, 92, 193, 0.37);
}

.btn.danger {
  border-color: rgba(196, 51, 47, 0.45);
  color: #8b1d1a;
  background: linear-gradient(180deg, #fff3f2, #ffe6e5);
}

.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.btn.ghost:hover {
  background: var(--surface-muted);
  border-color: var(--border);
}

.btn.sm {
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.pill.ok {
  color: #0b6a44;
  border-color: rgba(19, 127, 83, 0.34);
  background: rgba(19, 127, 83, 0.09);
}

.pill.warn {
  color: #8b4f00;
  border-color: rgba(182, 107, 0, 0.34);
  background: rgba(182, 107, 0, 0.12);
}

.pill.bad {
  color: #8e1f1c;
  border-color: rgba(196, 51, 47, 0.35);
  background: rgba(196, 51, 47, 0.1);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid #e7eef9;
  font-size: 13px;
  vertical-align: top;
  text-align: left;
}

th {
  background: linear-gradient(180deg, #f8fbff, #f2f7ff);
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.01em;
}

tr:last-child td {
  border-bottom: 0;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  border-radius: 8px;
  border: 1px solid #d6e2f5;
  background: #f5f9ff;
  color: #23466f;
  padding: 2px 6px;
}

pre {
  margin: 0;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  color: #26415f;
  border: 1px solid #d9e5f8;
  border-radius: 12px;
  background: #f7fbff;
  padding: 12px;
  overflow: auto;
}

.toastHost {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  width: min(420px, calc(100vw - 32px));
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.toast.ok {
  border-color: rgba(19, 127, 83, 0.38);
}

.toast.warn {
  border-color: rgba(182, 107, 0, 0.42);
}

.toast.bad {
  border-color: rgba(196, 51, 47, 0.42);
}

.toastX {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f7faff;
  color: #33567f;
  font-size: 18px;
  line-height: 30px;
  cursor: pointer;
}

.toastX:hover {
  background: #edf4ff;
}

.toastTitle {
  font-weight: 800;
  font-size: 13px;
}

.toastMsg {
  margin-top: 2px;
  font-size: 13px;
  color: var(--muted);
}

.modalOverlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 27, 51, 0.48);
  backdrop-filter: blur(4px);
}

.modal {
  width: min(560px, 100%);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: 0 24px 54px rgba(12, 39, 79, 0.32);
  padding: 16px;
  animation: riseIn 0.25s ease both;
}

.modalHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modalTitle {
  font-size: 16px;
  font-weight: 700;
}

.modalBody {
  margin-top: 10px;
}

.modalFooter {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

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

.tile {
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.tile:hover {
  transform: translateY(-1px);
  border-color: #b7cdee;
  box-shadow: var(--shadow-lg);
}

.tileTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #e8eef8;
}

.tile video {
  width: 100%;
  height: 220px;
  display: block;
  object-fit: cover;
  background: #000;
}

.kbd {
  border-radius: 10px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: #ffffff;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 6px;
}

@media (max-width: 1080px) {
  .sidebar {
    display: none;
  }

  .page {
    padding: 14px;
  }

  .grid2 {
    grid-template-columns: 1fr;
  }

  .statsGrid {
    grid-template-columns: 1fr;
  }

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

  .topbar {
    padding: 12px 14px;
  }
}

@media (max-width: 900px) {
  .tiles {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .row {
    flex-wrap: wrap;
  }

  .row > * {
    flex: 1 1 100%;
  }

  .metricsRow {
    grid-template-columns: 1fr;
  }

  .topbarRight {
    width: 100%;
    justify-content: flex-start;
  }
}
