:root {
  --bg: #f6f1ff;
  --surface: #ffffff;
  --soft: #f4efff;
  --line: #eee8fb;
  --text: #181823;
  --muted: #8a849b;
  --primary: #7c5cff;
  --primary-dark: #6549ea;
  --danger: #ef4444;
  --success: #16a34a;
  --shadow: 0 18px 55px rgba(66, 50, 112, .12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: linear-gradient(135deg, #e4dcff 0%, #fbfaff 42%, #f6f1ff 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.sidebar {
  position: fixed;
  inset: 24px auto 24px 28px;
  width: 230px;
  background: rgba(255, 255, 255, .78);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 30px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
}

.brand-logo,
.brand-mini span {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: #13101d;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar nav a {
  padding: 13px 14px;
  border-radius: 16px;
  color: #504a5f;
  font-weight: 600;
  font-size: 14px;
}

.sidebar nav a.active,
.sidebar nav a:hover {
  background: var(--primary);
  color: white;
}

.side-note {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  padding: 16px;
  border-radius: 20px;
  background: var(--soft);
  color: #4a405f;
}

.side-note p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.app {
  margin-left: 290px;
  padding: 50px 52px 60px 10px;
  max-width: 1260px;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -1.5px;
}

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

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

.stat-card,
.panel {
  background: rgba(255, 255, 255, .86);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}

.stat-card {
  min-height: 140px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  flex-direction: column;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 14px;
}

.stat-card strong {
  font-size: 28px;
  letter-spacing: -1px;
}

.stat-card small {
  display: inline-flex;
  width: fit-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: #f3f1f8;
  color: #777086;
}

.green {
  color: var(--success) !important;
  background: #ecfdf3 !important;
}

.red {
  color: var(--danger) !important;
  background: #fef2f2 !important;
}

.layout-2 {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 22px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 20px;
}

.panel-head h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -.5px;
}

.panel-head span {
  color: var(--muted);
  font-size: 13px;
}

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

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

label {
  display: grid;
  gap: 8px;
  color: #4e465d;
  font-weight: 700;
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfaff;
  border-radius: 16px;
  padding: 13px 14px;
  color: var(--text);
  font: inherit;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, .13);
}

.btn {
  border: 0;
  border-radius: 17px;
  padding: 13px 18px;
  font-weight: 800;
  cursor: pointer;
  font: inherit;
}

.btn.primary {
  background: var(--primary);
  color: white;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.ghost {
  background: white;
  color: var(--primary);
  border: 1px solid var(--line);
}

.btn.small {
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 12px;
}

.btn.danger {
  background: #fff1f2;
  color: #e11d48;
}

.list {
  display: grid;
  gap: 12px;
  max-height: 478px;
  overflow: auto;
  padding-right: 4px;
}

.item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  background: #fbfaff;
  border-radius: 20px;
  padding: 15px;
}

.item h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.item p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: #6d5bd0;
  font-size: 12px;
  font-weight: 800;
}

.badge.high {
  background: #fef2f2;
  color: #dc2626;
}

.badge.medium {
  background: #fff7ed;
  color: #ea580c;
}

.badge.low {
  background: #ecfdf5;
  color: #16a34a;
}

.actions {
  display: flex;
  gap: 7px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  background: #181823;
  color: white;
  padding: 14px 18px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  transform: translateY(120px);
  opacity: 0;
  transition: .25s ease;
  z-index: 20;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  background: #b91c1c;
}

.code-box {
  margin-top: 16px;
  background: #15131f;
  color: #e8e5ff;
  padding: 16px;
  border-radius: 16px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(450px, 100%);
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 28px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 20px 0 6px;
  font-size: 32px;
}

.brand-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 900;
}

.stack {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.center {
  text-align: center;
}

.alert {
  padding: 12px 14px;
  border-radius: 15px;
  margin-top: 16px;
}

.alert.danger {
  color: #b91c1c;
  background: #fef2f2;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    margin: 14px;
  }

  .side-note {
    position: static;
    margin-top: 18px;
  }

  .app {
    margin-left: 0;
    padding: 14px;
  }

  .topbar,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .cards-grid,
  .layout-2 {
    grid-template-columns: 1fr;
  }

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