:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #16202a;
  --muted: #647282;
  --faint: #8b98a7;
  --border: #dde4ec;
  --border-strong: #c8d3df;
  --teal: #0f766e;
  --teal-soft: #dff7f3;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --green: #15803d;
  --green-soft: #e7f7ec;
  --amber: #b7791f;
  --amber-soft: #fff4da;
  --red: #b42318;
  --red-soft: #fee7e4;
  --shadow: 0 14px 40px rgba(21, 32, 43, 0.08);
  --radius: 8px;
  font-family:
    "Segoe UI",
    "Microsoft YaHei",
    system-ui,
    sans-serif;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

code {
  color: #334155;
  font-family: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #14212d;
  color: #d7e2ee;
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-height: 100vh;
  padding: 22px 16px;
  position: sticky;
  top: 0;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  padding: 6px 8px;
  text-decoration: none;
}

.brand strong,
.login-brand h1 {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
  margin: 0;
}

.brand small,
.login-brand p {
  color: #91a4b8;
  display: block;
  font-size: 0.78rem;
  line-height: 1.35;
  margin: 2px 0 0;
}

.brand-mark {
  align-items: center;
  background: linear-gradient(135deg, #2dd4bf, #3b82f6);
  border-radius: var(--radius);
  color: white;
  display: inline-flex;
  flex: 0 0 38px;
  font-weight: 800;
  height: 38px;
  justify-content: center;
  width: 38px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.side-nav a {
  align-items: center;
  border-radius: var(--radius);
  color: #b9c6d4;
  display: flex;
  gap: 10px;
  min-height: 40px;
  padding: 10px 12px;
  text-decoration: none;
}

.side-nav a:hover,
.side-nav a.active {
  background: #223242;
  color: white;
}

.side-nav a.active .nav-dot {
  background: #2dd4bf;
}

.muted-link {
  opacity: 0.58;
}

.nav-dot {
  background: #536577;
  border-radius: 999px;
  display: inline-block;
  height: 7px;
  width: 7px;
}

.sidebar-footer {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: #b9c6d4;
  display: flex;
  gap: 9px;
  margin-top: auto;
  padding: 12px;
}

.status-dot,
.health-pill span {
  background: #22c55e;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
  display: inline-block;
  height: 8px;
  width: 8px;
}

.workspace {
  min-width: 0;
}

.pagebar {
  align-items: center;
  background: rgba(245, 247, 250, 0.92);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  min-height: 82px;
  padding: 18px 28px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.pagebar h1 {
  font-size: 1.48rem;
  line-height: 1.2;
  margin: 0;
}

.pagebar p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 6px 0 0;
}

.page-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.content {
  display: grid;
  gap: 20px;
  padding: 24px 28px 40px;
}

.primary-button,
.secondary-button,
.ghost-button {
  align-items: center;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 38px;
  padding: 9px 14px;
  text-decoration: none;
}

.primary-button {
  background: #0f766e;
  border: 1px solid #0f766e;
  color: white;
}

.primary-button:hover {
  background: #115e59;
}

.secondary-button,
.ghost-button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: #334155;
}

.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--border-strong);
}

.full-width {
  width: 100%;
}

.health-pill,
.user-pill,
.status-chip {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  font-size: 0.82rem;
  font-weight: 700;
  gap: 8px;
  min-height: 30px;
  padding: 6px 10px;
  white-space: nowrap;
}

.health-pill {
  background: var(--green-soft);
  color: var(--green);
}

.user-pill {
  background: var(--blue-soft);
  color: #1d4ed8;
}

.status-chip {
  background: #edf2f7;
  color: #475569;
}

.status-chip.is-active {
  background: var(--green-soft);
  color: var(--green);
}

.status-chip.is-disabled,
.status-chip.is-inactive {
  background: #eef2f6;
  color: #64748b;
}

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

.metric-card,
.panel,
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 138px;
  padding: 18px;
  position: relative;
}

.metric-card::before {
  border-radius: 999px;
  content: "";
  height: 34px;
  position: absolute;
  right: 18px;
  top: 18px;
  width: 5px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.metric-card strong {
  font-size: 2rem;
  line-height: 1.1;
}

.metric-card small {
  align-self: end;
  color: var(--faint);
  font-size: 0.84rem;
}

.accent-teal::before {
  background: var(--teal);
}

.accent-blue::before {
  background: var(--blue);
}

.accent-green::before {
  background: var(--green);
}

.accent-amber::before {
  background: var(--amber);
}

.accent-red::before {
  background: var(--red);
}

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

.stack,
.side-stack {
  display: grid;
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-header h2,
.compact-panel h2,
.product-profile h2,
.login-card h2 {
  font-size: 1rem;
  line-height: 1.3;
  margin: 0;
}

.panel-header p,
.product-profile p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 5px 0 0;
}

.text-link {
  color: var(--teal);
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

.data-table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--border);
  padding: 12px 12px;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.data-table tbody tr:hover {
  background: #fbfdff;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.product-link {
  display: grid;
  gap: 3px;
  text-decoration: none;
}

.product-link strong {
  color: var(--text);
  font-size: 0.94rem;
}

.product-link span {
  color: var(--muted);
  font-size: 0.82rem;
}

.activity-cell {
  align-items: center;
  display: grid;
  gap: 7px;
  min-width: 110px;
}

.mini-bar {
  background: #e7edf4;
  border-radius: 999px;
  display: block;
  height: 6px;
  overflow: hidden;
}

.mini-bar span {
  background: linear-gradient(90deg, #0f766e, #2563eb);
  border-radius: inherit;
  display: block;
  height: 100%;
  min-width: 0;
}

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

.compact-panel {
  display: grid;
  gap: 14px;
}

.info-list,
.details-grid {
  display: grid;
  gap: 10px;
  margin: 0;
}

.info-list div,
.details-grid div {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.info-list dt,
.details-grid dt {
  color: var(--muted);
  font-size: 0.86rem;
}

.info-list dd,
.details-grid dd {
  font-weight: 800;
  margin: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

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

.details-grid div {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: grid;
  gap: 8px;
  justify-content: stretch;
  min-height: 84px;
  padding: 14px;
}

.details-grid dd {
  font-size: 1.35rem;
  text-align: left;
}

.product-summary {
  align-items: stretch;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) 380px;
}

.product-profile {
  display: flex;
  gap: 22px;
  justify-content: space-between;
}

.product-profile h2 {
  font-size: 1.35rem;
  margin-top: 14px;
}

.form-layout {
  max-width: 760px;
}

.form-panel {
  padding: 22px;
}

.form {
  display: grid;
  gap: 16px;
}

.form label {
  color: var(--text);
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.form label span {
  font-size: 0.88rem;
}

input {
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  color: var(--text);
  min-height: 42px;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.form-actions {
  display: flex;
  justify-content: flex-start;
}

.error {
  background: var(--red-soft);
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  color: var(--red);
  font-weight: 700;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.auth-page {
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 32%),
    linear-gradient(315deg, rgba(37, 99, 235, 0.14), transparent 28%),
    var(--bg);
}

.auth-shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  box-shadow: var(--shadow);
  display: grid;
  gap: 20px;
  max-width: 420px;
  padding: 28px;
  width: 100%;
}

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

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

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

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

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

  .side-nav a {
    justify-content: center;
  }

  .nav-dot {
    display: none;
  }

  .sidebar-footer {
    display: none;
  }

  .pagebar {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    position: static;
  }

  .page-actions {
    justify-content: flex-start;
  }

  .content {
    padding: 18px;
  }

  .kpi-grid,
  .details-grid {
    grid-template-columns: 1fr;
  }

  .product-profile {
    display: grid;
  }
}
