:root {
  color-scheme: light dark;
  --glass-bg: rgba(255, 255, 255, 0.28);
  --glass-border: rgba(255, 255, 255, 0.7);
  --text: #0a121a;
  --muted: #334b60;
  --accent: #1f6feb;
  --accent-dark: #1657b9;
  --shadow: 0 18px 50px rgba(12, 20, 32, 0.16);
  --surface: rgba(255, 255, 255, 0.78);
  --sidebar-bg: rgba(255, 255, 255, 0.75);
  --sidebar-border: rgba(255, 255, 255, 0.85);
}

html[data-theme="light"] {
  color-scheme: light;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --glass-bg: rgba(17, 25, 40, 0.35);
    --glass-border: rgba(148, 163, 184, 0.3);
    --text: #e5edf7;
    --muted: #9fb3c6;
    --accent: #6aa9ff;
    --accent-dark: #4d86db;
    --shadow: 0 22px 60px rgba(7, 12, 18, 0.6);
    --surface: rgba(18, 26, 40, 0.7);
    --sidebar-bg: rgba(15, 23, 36, 0.7);
    --sidebar-border: rgba(148, 163, 184, 0.25);
  }
}

html[data-theme="dark"] {
  --glass-bg: rgba(17, 25, 40, 0.35);
  --glass-border: rgba(148, 163, 184, 0.3);
  --text: #e5edf7;
  --muted: #9fb3c6;
  --accent: #6aa9ff;
  --accent-dark: #4d86db;
  --shadow: 0 22px 60px rgba(7, 12, 18, 0.6);
  --surface: rgba(18, 26, 40, 0.7);
  --sidebar-bg: rgba(15, 23, 36, 0.7);
  --sidebar-border: rgba(148, 163, 184, 0.25);
}

html[data-theme="light"] {
  --glass-bg: rgba(255, 255, 255, 0.28);
  --glass-border: rgba(255, 255, 255, 0.7);
  --text: #0a121a;
  --muted: #334b60;
  --accent: #1f6feb;
  --accent-dark: #1657b9;
  --shadow: 0 18px 50px rgba(12, 20, 32, 0.16);
  --surface: rgba(255, 255, 255, 0.78);
  --sidebar-bg: rgba(255, 255, 255, 0.75);
  --sidebar-border: rgba(255, 255, 255, 0.85);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Trebuchet MS", sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top left, #f9fbff 0%, rgba(249, 251, 255, 0) 55%),
    radial-gradient(circle at 80% 20%, #f1f8ff 0%, rgba(241, 248, 255, 0) 50%),
    linear-gradient(160deg, #f6f8fb 0%, #e9f0f8 45%, #f2f7fc 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.5) 1px, transparent 1px);
  background-size: 28px 28px;
  opacity: 0.3;
  pointer-events: none;
}

@media (prefers-color-scheme: dark) {
  body {
    background: radial-gradient(circle at top left, rgba(30, 58, 94, 0.7) 0%, rgba(30, 58, 94, 0) 55%),
      radial-gradient(circle at 80% 20%, rgba(17, 45, 65, 0.9) 0%, rgba(17, 45, 65, 0) 50%),
      linear-gradient(160deg, #0b1220 0%, #0f172a 40%, #111827 100%);
  }

  body::before {
    opacity: 0.15;
  }
}

html[data-theme="dark"] body {
  background: radial-gradient(circle at top left, rgba(30, 58, 94, 0.7) 0%, rgba(30, 58, 94, 0) 55%),
    radial-gradient(circle at 80% 20%, rgba(17, 45, 65, 0.9) 0%, rgba(17, 45, 65, 0) 50%),
    linear-gradient(160deg, #0b1220 0%, #0f172a 40%, #111827 100%);
}

html[data-theme="dark"] body::before {
  opacity: 0.15;
}

html[data-theme="light"] body {
  background: radial-gradient(circle at top left, #f9fbff 0%, rgba(249, 251, 255, 0) 55%),
    radial-gradient(circle at 80% 20%, #f1f8ff 0%, rgba(241, 248, 255, 0) 50%),
    linear-gradient(160deg, #f6f8fb 0%, #e9f0f8 45%, #f2f7fc 100%);
}

html[data-theme="light"] body::before {
  opacity: 0.3;
}

header,
footer {
  position: sticky;
  left: 0;
  right: 0;
  z-index: 2;
}

header {
  top: 0;
}

footer {
  bottom: 0;
}

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--shadow);
}

.shell {
  width: min(1400px, 96vw);
  margin: 0 auto;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  border: none;
  background: rgba(31, 111, 235, 0.12);
  border-radius: 999px;
  padding: 0.35rem 0.6rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid rgba(31, 111, 235, 0.25);
  color: var(--text);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: inline-flex;
}

.theme-toggle .icon-sun {
  display: none;
}

@media (prefers-color-scheme: dark) {
  .theme-toggle .icon-moon {
    display: none;
  }

  .theme-toggle .icon-sun {
    display: inline-flex;
  }
}

html[data-theme="dark"] .theme-toggle .icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle .icon-sun {
  display: inline-flex;
}

html[data-theme="light"] .theme-toggle .icon-moon {
  display: inline-flex;
}

html[data-theme="light"] .theme-toggle .icon-sun {
  display: none;
}

.user-menu {
  position: relative;
}

.user-menu summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: rgba(31, 111, 235, 0.12);
  border: 1px solid rgba(31, 111, 235, 0.25);
  font-weight: 600;
  color: var(--text);
}

.user-menu summary::-webkit-details-marker {
  display: none;
}

.user-menu summary::after {
  content: "▾";
  font-size: 0.8rem;
  color: var(--muted);
}

.user-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 10px rgba(31, 111, 235, 0.5);
}

.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  min-width: 200px;
  display: grid;
  gap: 0.4rem;
  padding: 0.8rem;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.3);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.2);
}

.user-dropdown a {
  text-decoration: none;
  color: var(--text);
  padding: 0.4rem 0.5rem;
  border-radius: 10px;
  font-weight: 600;
}

.user-dropdown a:hover {
  background: rgba(31, 111, 235, 0.12);
}

.user-meta {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
  margin-bottom: 0.3rem;
}

.user-primary {
  font-weight: 700;
}

.user-secondary {
  color: var(--muted);
  font-size: 0.85rem;
}

.layout {
  display: grid;
  grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
  gap: clamp(1.5rem, 3vw, 2.5rem);
  align-items: start;
}

.sidebar {
  padding: 1.5rem;
  border-radius: 24px;
  background: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  position: sticky;
  top: 6.5rem;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.menu-item,
.menu-sub a {
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  display: block;
}

.menu-item {
  padding: 0.6rem 0.8rem;
  border-radius: 14px;
  background: rgba(31, 111, 235, 0.08);
  border: 1px solid rgba(31, 111, 235, 0.15);
}

.menu-item.active {
  background: rgba(31, 111, 235, 0.18);
  border-color: rgba(31, 111, 235, 0.35);
  color: var(--text);
}

.menu-group summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  padding: 0.4rem 0.2rem;
}

.menu-group summary::-webkit-details-marker {
  display: none;
}

.menu-group summary::after {
  content: "+";
  float: right;
  font-weight: 700;
  color: var(--muted);
}

.menu-group[open] summary::after {
  content: "–";
}

.menu-group[open] summary {
  color: var(--text);
}

.menu-sub {
  margin-top: 0.6rem;
  padding-left: 0.6rem;
  border-left: 1px solid rgba(148, 163, 184, 0.4);
  display: grid;
  gap: 0.4rem;
}

.menu-sub a {
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  color: var(--text);
}

.menu-sub a:hover {
  background: rgba(31, 111, 235, 0.12);
}

.menu-sub a.active {
  background: rgba(31, 111, 235, 0.18);
  color: var(--text);
}

.menu-user {
  display: block;
  padding: 0.35rem 0.4rem;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  background: rgba(148, 163, 184, 0.12);
}

.menu-empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0.3rem 0.4rem;
}

.content {
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand-badge {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(31, 111, 235, 0.18);
  border: 1px solid rgba(31, 111, 235, 0.3);
  color: var(--accent);
  font-weight: 700;
}

main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4.5rem 0 5.5rem;
  position: relative;
  z-index: 1;
}

.container {
  width: min(1400px, 96vw);
}

.card {
  padding: clamp(1.5rem, 3vw, 2.75rem);
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.2);
}

.card h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 2.5vw, 2.4rem);
}

.card p {
  margin: 0 0 1.5rem;
  color: var(--muted);
  line-height: 1.6;
}

.steps {
  margin: 0 0 1.5rem;
  padding-left: 1.4rem;
  color: var(--text);
  line-height: 1.6;
}

.steps li {
  margin-bottom: 0.6rem;
}

.note {
  color: var(--muted);
  font-size: 0.95rem;
}

.search-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  margin-bottom: 1.5rem;
  align-items: end;
}

.search-bar label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.search-bar input {
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-family: inherit;
}

.search-bar select {
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-family: inherit;
}

html[data-theme="dark"] .search-bar input {
  background: rgba(15, 23, 36, 0.7);
}

html[data-theme="dark"] .search-bar select {
  background: rgba(15, 23, 36, 0.7);
}

.sort-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
}

.sort-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
}

.sort-arrow.asc {
  border-bottom: 6px solid var(--muted);
}

.sort-arrow.desc {
  border-top: 6px solid var(--muted);
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 0.1rem;
}

.link {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
}

.settings-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.settings-form label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.settings-form input {
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-family: inherit;
}

.settings-form select {
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-family: inherit;
}

.settings-form textarea {
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(255, 255, 255, 0.75);
  color: var(--text);
  font-family: inherit;
  resize: vertical;
}

html[data-theme="dark"] .settings-form input {
  background: rgba(15, 23, 36, 0.7);
}

html[data-theme="dark"] .settings-form select {
  background: rgba(15, 23, 36, 0.7);
}

html[data-theme="dark"] .settings-form textarea {
  background: rgba(15, 23, 36, 0.7);
}

.toggle-row {
  display: grid;
  gap: 0.8rem;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.95rem;
  color: var(--text);
}

.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.block-action.hidden {
  display: none;
}

.hidden {
  display: none;
}

.settings-form .hidden {
  display: none;
}

.settings-form [hidden] {
  display: none !important;
}

.code-block {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.12);
  color: var(--text);
  font-size: 0.85rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.alert {
  padding: 0.7rem 0.9rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.alert.success {
  background: rgba(34, 197, 94, 0.16);
  color: #15803d;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.alert.error {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
  font-size: 0.95rem;
}

.table th,
.table td {
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.table th {
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.cell-title {
  font-weight: 600;
}

.cell-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.cell-center {
  text-align: center;
}

.pager {
  margin-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.pager-info {
  color: var(--muted);
  font-size: 0.9rem;
}

.pager-actions {
  display: flex;
  gap: 0.6rem;
}

.pager-link,
.pager-disabled {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid rgba(31, 111, 235, 0.2);
  text-decoration: none;
}

.pager-link {
  color: var(--accent);
  background: rgba(31, 111, 235, 0.12);
}

.pager-disabled {
  color: var(--muted);
  border-color: rgba(148, 163, 184, 0.25);
}

.message-details {
  display: grid;
  gap: 0.35rem;
}

.message-details summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
}

.message-details summary::-webkit-details-marker {
  display: none;
}

.message-preview {
  display: inline-block;
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.message-details[open] .message-preview {
  display: none;
}

.message-toggle {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
}

.message-collapse {
  display: none;
}

.message-details[open] .message-expand {
  display: none;
}

.message-details[open] .message-collapse {
  display: inline;
}

.message-full {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  display: grid;
  gap: 0.4rem;
}

.message-collapse {
  cursor: pointer;
}

.login-widget {
  display: flex;
  justify-content: flex-start;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(31, 111, 235, 0.12);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.3rem;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 12px 26px rgba(31, 111, 235, 0.35);
  text-decoration: none;
}

.cta:hover {
  background: var(--accent-dark);
}

.footer-text {
  font-size: 0.85rem;
  color: var(--muted);
}

.footer-link {
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}

.footer-link:hover {
  color: var(--text);
}

@media (max-width: 720px) {
  .shell {
    flex-direction: column;
    align-items: flex-start;
    width: 92vw;
  }

  main {
    padding-top: 3.5rem;
  }

  .login-widget {
    justify-content: center;
  }

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

  .sidebar {
    position: static;
  }

  .container {
    width: 92vw;
  }
}
