:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-soft: #f8fbff;
  --ink: #101828;
  --text: #344054;
  --muted: #667085;
  --line: #d8e0ea;
  --line-soft: #e8edf4;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --green: #0f9f7a;
  --green-soft: #e9f8f3;
  --red: #d92d20;
  --red-soft: #fff1f0;
  --amber: #b7791f;
  --amber-soft: #fff7df;
  --shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 88% 8%, rgba(37, 99, 235, 0.08), transparent 28rem),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

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

button,
input,
select {
  font: inherit;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  width: 256px;
  flex-direction: column;
  gap: 14px;
  padding: 8px;
  overflow-y: auto;
  background: rgba(248, 251, 255, 0.96);
  border-right: 1px solid var(--line);
}

.brand,
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar .brand {
  min-height: 72px;
  padding: 12px;
  background: linear-gradient(135deg, #f8fbff, #eef8f5);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(16, 24, 40, 0.04);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--green));
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  font-size: 12px;
  font-weight: 800;
}

.logo-mark {
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(7, 18, 80, 0.12);
  box-shadow: 0 8px 18px rgba(7, 18, 80, 0.08);
}

.logo-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand strong,
.brand span,
.logout span {
  display: block;
}

.brand strong {
  font-size: 16px;
  line-height: 1.2;
}

.brand span,
.logout small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.nav-menu {
  display: grid;
  gap: 2px;
  padding: 2px 0 8px;
}

.nav-menu p {
  margin: 14px 8px 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-menu a {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  color: var(--text);
  border-radius: 7px;
  font-weight: 500;
}

.nav-menu a:hover {
  color: var(--ink);
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--line-soft);
}

.nav-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #dbe6ff;
  border-radius: 6px;
}

.nav-icon::before {
  width: 7px;
  height: 7px;
  content: "";
  background: currentColor;
  border-radius: 2px;
}

.logout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.logout strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout button {
  min-height: 30px;
  padding: 5px 9px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #dbe6ff;
  border-radius: 7px;
  cursor: pointer;
}

.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #dbe6ff;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.content {
  min-height: 100vh;
  margin-left: 256px;
  padding: 8px 16px 36px;
}

.topbar {
  position: sticky;
  top: 8px;
  z-index: 5;
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.topbar-title,
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-title {
  color: var(--ink);
  font-weight: 700;
}

.topbar-icon {
  width: 18px;
  height: 18px;
  border: 1px solid var(--ink);
  border-radius: 5px;
  box-shadow: inset 5px 0 0 transparent, inset 6px 0 0 var(--ink);
}

.topbar-user {
  color: var(--muted);
  font-size: 13px;
}

.workspace {
  width: 100%;
  max-width: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 8px 0 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 14px;
  font-size: 17px;
  line-height: 1.3;
}

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

.metric,
.panel,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(16, 24, 40, 0.04);
}

.metric {
  min-height: 118px;
  padding: 18px;
}

.metric span,
.metric em,
.panel-title span,
td span {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.metric em {
  display: block;
  margin-top: 9px;
  font-size: 12px;
  font-style: normal;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(360px, 1fr);
  gap: 18px;
}

.panel {
  margin-bottom: 18px;
  padding: 18px;
  overflow-x: auto;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin-bottom: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

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

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

th {
  color: var(--muted);
  background: #fbfcfe;
  font-size: 12px;
  font-weight: 700;
}

td {
  color: var(--text);
}

td strong {
  color: var(--ink);
}

td span {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

.detail-row td {
  padding-top: 10px;
  background: #fbfcfe;
}

.health-grid {
  display: grid;
  gap: 13px;
}

.health {
  display: grid;
  gap: 8px;
}

.health div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

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

.quick-grid a {
  display: flex;
  min-height: 50px;
  align-items: center;
  padding: 12px 14px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-weight: 700;
}

.quick-grid a:hover {
  color: var(--primary);
  background: #fff;
  border-color: #bdd0ff;
}

.bar {
  height: 7px;
  overflow: hidden;
  background: #e9eef5;
  border-radius: 999px;
}

.bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: inherit;
}

code {
  padding: 2px 6px;
  color: #175cd3;
  background: #eef4ff;
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

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

.form-grid.compact {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

label.check {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  color: var(--text);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

label.check input {
  width: 16px;
  min-height: 16px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

input:focus,
select:focus {
  border-color: #9bb8ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.span-2 {
  grid-column: span 2;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}

.btn:hover {
  background: var(--surface-soft);
}

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

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

.btn.small {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 12px;
}

.btn.danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #ffd0cc;
}

.inline {
  display: inline-flex;
  gap: 6px;
  vertical-align: top;
}

.badge {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  color: var(--green);
  background: var(--green-soft);
}

.badge.bad {
  color: var(--red);
  background: var(--red-soft);
}

.badge.neutral {
  color: var(--amber);
  background: var(--amber-soft);
}

.alert {
  margin-bottom: 14px;
  padding: 11px 12px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #ffd0cc;
  border-radius: 8px;
}

.alert.success {
  color: var(--green);
  background: var(--green-soft);
  border-color: #b7ead8;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(15, 159, 122, 0.10)),
    var(--bg);
}

.login-panel {
  position: relative;
  width: min(440px, 100%);
  padding: 28px;
}

.login-panel::before {
  position: absolute;
  inset: -1px -1px auto;
  height: 4px;
  content: "";
  background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: 8px 8px 0 0;
}

.brand-lockup {
  margin-bottom: 24px;
}

.portal-wide-logo {
  display: flex;
  height: 48px;
  align-items: center;
  margin-bottom: 18px;
}

.portal-wide-logo img {
  display: block;
  max-width: min(100%, 320px);
  max-height: 48px;
  object-fit: contain;
}

.brand-lockup .brand-mark {
  width: 58px;
  height: 58px;
}

.brand-lockup p {
  margin-bottom: 5px;
  color: var(--green);
  font-weight: 800;
}

.brand-lockup h1 {
  font-size: 24px;
  line-height: 1.25;
}

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

.portal-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 72px minmax(0, 1fr);
  background: var(--bg);
}

.portal-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 14px 9px;
  background: #10233f;
}

.portal-side .brand-mark {
  width: 44px;
  height: 44px;
  font-size: 12px;
}

.portal-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  width: min(720px, 100%);
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.portal-main .portal-footer {
  flex-shrink: 0;
  justify-content: center;
  width: min(720px, 100%);
  margin: 24px auto 0;
  padding-top: 16px;
}

.portal-footer a {
  color: var(--muted);
}

.portal-footer a:hover {
  color: var(--primary);
}

.portal-logout {
  margin-top: auto;
}

.portal-logout button {
  width: 54px;
  min-height: 38px;
  color: #dbe6f7;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  cursor: pointer;
}

.portal-main {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: 24px 28px;
  overflow-x: hidden;
}

.portal-content {
  flex: 1 0 auto;
}

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

.portal-topbar h1 {
  font-size: 30px;
}

.portal-topbar span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.portal-search {
  display: grid;
  width: min(560px, 48vw);
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.portal-group {
  margin-top: 24px;
}

.portal-group h2 {
  padding-left: 10px;
  border-left: 4px solid var(--primary);
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 20px 26px;
  align-items: stretch;
}

.portal-card {
  display: grid;
  min-height: 134px;
  justify-items: center;
  align-content: start;
  gap: 9px;
  padding: 10px 8px;
  color: var(--ink);
  text-align: center;
  border-radius: 8px;
}

.portal-card:hover {
  background: #fff;
  box-shadow: var(--shadow);
}

.portal-card strong,
.portal-card em {
  width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.portal-card strong {
  min-height: 38px;
  font-size: 14px;
}

.portal-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.folder-icon {
  position: relative;
  display: block;
  width: 60px;
  height: 48px;
  background: #6aa4ff;
  border: 3px solid #2d6bf3;
  border-radius: 6px;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.18);
}

.folder-icon::before {
  position: absolute;
  top: -9px;
  left: 5px;
  width: 22px;
  height: 10px;
  content: "";
  background: #ffb21c;
  border-radius: 4px 4px 0 0;
}

.portal-empty {
  display: grid;
  gap: 8px;
  padding: 42px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.portal-empty strong {
  color: var(--ink);
  font-size: 18px;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .nav-menu p {
    grid-column: 1 / -1;
  }

  .content {
    margin-left: 0;
    padding: 10px;
  }

  .topbar {
    top: 0;
  }

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

  .span-2 {
    grid-column: span 1;
  }

  .portal-shell {
    grid-template-columns: 1fr;
  }

  .portal-side {
    position: sticky;
    top: 0;
    z-index: 2;
    flex-direction: row;
    justify-content: space-between;
  }

  .portal-logout {
    margin-top: 0;
  }

  .portal-main {
    padding: 18px;
  }

  .portal-topbar,
  .portal-search {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .portal-topbar {
    display: grid;
  }
}

@media (max-width: 680px) {
  .metrics {
    gap: 10px;
  }

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

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

  h1,
  .portal-topbar h1 {
    font-size: 25px;
  }
}
