:root {
  --bg: #0b0b0c;
  --bg-soft: #111214;
  --sidebar: #171819;
  --sidebar-2: #1d1f21;
  --surface: #1b1c1f;
  --surface-2: #202226;
  --surface-3: #282b30;
  --line: #36383d;
  --line-soft: #2a2c31;
  --text: #f4f4f4;
  --muted: #c7c8cc;
  --muted-2: #8f9299;
  --blue: #0078d4;
  --blue-2: #2899f5;
  --green: #57c278;
  --yellow: #f5c542;
  --red: #ff5d5d;
  --orange: #ff8d3a;
  --shadow: 0 20px 48px rgba(0, 0, 0, .38);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-shell {
  min-height: 100%;
  display: grid;
  grid-template-rows: 48px minmax(0, 1fr);
  background: var(--bg);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(260px, 470px) minmax(280px, .8fr);
  align-items: center;
  gap: 18px;
  padding: 0 16px;
  background: #111;
  border-bottom: 1px solid #191919;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-actions {
  justify-content: flex-end;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  gap: 3px;
  border: 0;
  border-radius: 3px;
  color: #fff;
  background: transparent;
}

.icon-btn span {
  width: 17px;
  height: 1px;
  background: #d8d8d8;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.app-grid {
  width: 18px;
  height: 18px;
  display: grid;
  grid-template-columns: repeat(3, 4px);
  grid-auto-rows: 4px;
  gap: 3px;
}

.app-grid span {
  background: var(--blue-2);
}

.topbar-search {
  position: relative;
}

.topbar-search input {
  width: 100%;
  height: 32px;
  border: 1px solid #2c2c2c;
  border-radius: 3px;
  padding: 0 12px 0 38px;
  color: #eee;
  background: #202124;
  outline: none;
}

.topbar-search input:focus {
  border-color: var(--blue-2);
  box-shadow: 0 0 0 1px rgba(40, 153, 245, .35);
}

.search-mark {
  position: absolute;
  left: 15px;
  top: 50%;
  width: 12px;
  height: 12px;
  border: 2px solid var(--blue-2);
  border-radius: 50%;
  transform: translateY(-54%);
}

.search-mark::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 2px;
  right: -6px;
  bottom: -4px;
  background: var(--blue-2);
  transform: rotate(-45deg);
}

.topbar-btn,
.secondary-btn,
.primary-btn {
  border: 0;
  min-height: 32px;
  padding: 7px 13px;
  text-decoration: none;
  font-weight: 600;
}

.topbar-btn {
  color: #fff;
  background: transparent;
  border-radius: 3px;
}

.topbar-btn:hover,
.icon-btn:hover {
  background: rgba(255, 255, 255, .08);
}

.profile-badge {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
}

.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar);
  border-right: 1px solid #202124;
}

.sidebar.is-collapsed {
  display: none;
}

.sidebar-handle {
  height: 1px;
  margin: 0 16px;
  background: transparent;
}

.nav-list {
  overflow: auto;
  padding: 16px 16px 22px 0;
}

.nav-section {
  margin-top: 18px;
}

.nav-section-title {
  padding: 6px 16px 6px 48px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nav-link {
  width: 100%;
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  border-left: 4px solid transparent;
  padding: 8px 14px;
  color: #f4f4f4;
  background: transparent;
  text-align: left;
}

.nav-link:hover {
  background: rgba(255, 255, 255, .06);
}

.nav-link.is-active {
  border-left-color: var(--blue-2);
  background: rgba(255, 255, 255, .04);
}

.nav-link.subtle {
  min-height: 34px;
  color: var(--muted);
  border-left-color: transparent;
}

.nav-icon {
  width: 18px;
  color: var(--blue-2);
  text-align: center;
  font-weight: 800;
}

.nav-label {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.nav-label strong {
  font-size: 14px;
}

.nav-label span {
  color: var(--muted-2);
  font-size: 12px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 14px 0 16px;
  border-top: 1px solid var(--line-soft);
}

.main {
  min-width: 0;
  min-height: calc(100vh - 48px);
  overflow: auto;
  background:
    radial-gradient(circle at 85% 6%, rgba(0, 120, 212, .12), transparent 26%),
    #0d0e10;
}

.auth-panel {
  min-height: calc(100vh - 48px);
  display: grid;
  place-items: start center;
  padding: 84px 24px;
}

.auth-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #1d1f23, #15171a);
  box-shadow: var(--shadow);
  padding: 30px;
}

.auth-card h1 {
  margin: 8px 0 8px;
  font-size: 28px;
}

.auth-card p,
.hint,
#pageDescription {
  color: var(--muted);
  line-height: 1.55;
}

.eyebrow {
  color: var(--blue-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

label {
  display: block;
  margin: 14px 0 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 34px;
  border: 1px solid #4b4d52;
  border-radius: 0;
  padding: 7px 10px;
  color: #f6f6f6;
  background: #111214;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue-2);
  box-shadow: 0 0 0 1px rgba(40, 153, 245, .42);
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.primary-btn {
  color: #fff;
  background: var(--blue);
}

.primary-btn:hover {
  background: #106ebe;
}

.secondary-btn {
  color: #fff;
  background: #313338;
}

.oauth-area {
  margin-top: 22px;
}

.oauth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
}

.oauth-divider::before,
.oauth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line-soft);
}

.oauth-slot {
  min-height: 44px;
  margin-top: 14px;
}

.danger-btn {
  color: #fff;
  background: #7a2020;
}

.portal-panel {
  padding: 0 0 48px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding: 30px 48px 22px;
}

.breadcrumb {
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 13px;
}

.page-head h1 {
  margin: 0;
  font-size: 29px;
  font-weight: 800;
}

#pageDescription {
  max-width: 860px;
  margin: 10px 0 0;
}

.context-pill {
  border: 1px solid var(--line);
  padding: 7px 12px;
  color: #fff;
  background: #151719;
  font-weight: 700;
  white-space: nowrap;
}

.command-bar {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin: 0 48px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.command-btn {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  padding: 7px 11px;
  color: #fff;
  background: transparent;
}

.command-btn:hover {
  background: rgba(255, 255, 255, .07);
}

.command-icon {
  color: var(--blue-2);
  font-size: 19px;
  line-height: 1;
}

.status {
  min-height: 20px;
  margin: 12px 48px 0;
  color: var(--muted);
}

.auth-card .status {
  margin: 12px 0 0;
}

.status.ok {
  color: var(--green);
}

.status.err {
  color: var(--red);
}

.content-root {
  padding: 24px 48px 48px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .95fr);
  gap: 10px;
  align-items: start;
}

.surface {
  border: 1px solid var(--line-soft);
  background: var(--surface);
  box-shadow: 0 12px 26px rgba(0, 0, 0, .18);
}

.surface-head {
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.surface-title {
  margin: 0;
  font-size: 14px;
  font-weight: 800;
}

.surface-body {
  padding: 16px;
}

.hero-card {
  min-height: 226px;
  display: grid;
  align-content: center;
  gap: 20px;
  padding: 28px;
  background:
    radial-gradient(circle at right, rgba(0, 120, 212, .16), transparent 34%),
    #101113;
}

.hero-card h2 {
  margin: 0;
  font-size: 30px;
}

.hero-card p {
  max-width: 600px;
  margin: 0;
  color: #e7e7e7;
  line-height: 1.6;
}

.essentials {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.action-card {
  min-height: 166px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 20px;
}

.action-card h3 {
  margin: 0;
  font-size: 22px;
}

.action-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 6px;
  border: 1px solid var(--line-soft);
  background: #151719;
  padding: 15px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric strong {
  font-size: 24px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line-soft);
  background: #101113;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

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

th {
  color: #f4f4f4;
  font-size: 12px;
  font-weight: 800;
}

td {
  color: #f1f1f1;
}

tbody tr:hover {
  background: rgba(255, 255, 255, .035);
}

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

.link-btn {
  border: 0;
  padding: 0;
  color: var(--blue-2);
  background: transparent;
  font-weight: 700;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--line);
  padding: 3px 8px;
  color: #fff;
  background: #26282d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.pill.ok {
  border-color: rgba(87, 194, 120, .4);
  background: rgba(87, 194, 120, .12);
}

.pill.warn {
  border-color: rgba(245, 197, 66, .45);
  background: rgba(245, 197, 66, .12);
}

.pill.err {
  border-color: rgba(255, 93, 93, .45);
  background: rgba(255, 93, 93, .13);
}

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

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

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: 12px;
  align-items: start;
}

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

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  color: #fff;
  text-align: center;
}

.empty-state p {
  margin: 8px 0 0;
  color: var(--muted);
}

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

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
    height: auto;
    padding: 10px 14px;
  }

  .admin-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

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

  .sidebar {
    display: block;
    border-right: 0;
    border-bottom: 1px solid #202124;
  }

  .nav-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2px;
    padding-right: 0;
  }

  .nav-section {
    margin-top: 0;
  }

  .nav-section-title {
    padding-left: 18px;
  }

  .page-head,
  .content-root {
    padding-left: 20px;
    padding-right: 20px;
  }

  .command-bar,
  .status {
    margin-left: 20px;
    margin-right: 20px;
  }

  .dashboard-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .topbar-actions,
  .page-head,
  .essentials,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions,
  .page-head {
    flex-direction: column;
    align-items: stretch;
  }

  .essentials {
    display: grid;
  }

  .full-span {
    grid-column: auto;
  }

  .auth-panel {
    padding: 34px 14px;
  }
}
