:root {
  --ink: #07161c;
  --ink-2: #0b1c24;
  --stage: #0b1c24;
  --stage-2: #12303a;
  --bg: #edf3f5;
  --bg-deep: #dfe9ed;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --line: rgba(7, 22, 28, 0.08);
  --line-strong: rgba(7, 22, 28, 0.14);
  --primary: #0e7490;
  --primary-2: #0f5f75;
  --accent: #d97706;
  --ai: #0f766e;
  --text: #102028;
  --muted: #5a6b74;
  --warn: #b45309;
  --danger: #b42318;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 40px rgba(11, 28, 36, 0.06);
  --font: "Sora", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --hero-grad:
    radial-gradient(920px 540px at 8% -12%, rgba(14, 116, 144, 0.2), transparent 58%),
    radial-gradient(680px 420px at 96% 0%, rgba(15, 118, 110, 0.12), transparent 52%),
    linear-gradient(165deg, #f4f8fa 0%, #e7eff2 52%, #dde8ec 100%);
  --shell-grad:
    radial-gradient(700px 380px at 70% -8%, rgba(14, 116, 144, 0.14), transparent 55%),
    radial-gradient(520px 300px at 0% 100%, rgba(15, 118, 110, 0.08), transparent 50%),
    linear-gradient(180deg, #f3f7f9 0%, #e8f0f3 100%);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-2); }
button, input, select, textarea { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 2.55rem; padding: 0 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer; font-weight: 600;
  letter-spacing: 0.01em; transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(165deg, #12303a 0%, #0b1c24 100%);
  color: #f4fafb;
  box-shadow: 0 8px 20px rgba(11, 28, 36, 0.18);
}
.btn-primary:hover { background: linear-gradient(165deg, #184250 0%, #0f2430 100%); color: #fff; }
.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line-strong);
  color: var(--text);
  backdrop-filter: blur(10px);
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary-2); background: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--danger); }
.card {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.muted { color: var(--muted); }
.eyebrow {
  font-size: 0.7rem; letter-spacing: 0.18em; color: var(--primary);
  font-weight: 700; text-transform: uppercase; margin: 0;
}
.h1 {
  font-family: var(--serif); font-size: clamp(2rem, 5vw, 3.15rem);
  margin: 0.45rem 0; line-height: 1.18; letter-spacing: -0.02em; color: var(--ink);
}
.h2 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-weight: 600;
}
.pulse {
  width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--ai);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.14); animation: breathe 2.4s ease infinite;
}
@keyframes breathe { 50% { opacity: 0.4; transform: scale(0.92); } }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes bar-fill {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.28rem 0.7rem; border-radius: 999px;
  background: rgba(15, 118, 110, 0.1); color: #0f766e;
  font-size: 0.78rem; font-weight: 600;
}
.badge.warn { background: #fff7ed; color: #c2410c; }
.badge.err { background: #fef2f2; color: #b91c1c; }
.badge.gray { background: rgba(15, 23, 42, 0.06); color: #475467; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: left; padding: 0.75rem 0.6rem; border-bottom: 1px solid var(--line); }
.table th { color: var(--muted); font-weight: 600; }
.form { display: grid; gap: 0.75rem; }
.form label { display: grid; gap: 0.35rem; font-size: 0.88rem; color: var(--muted); font-weight: 600; }
.form input, .form select, .form textarea {
  min-height: 2.55rem; border: 1px solid var(--line-strong); border-radius: 12px; padding: 0.55rem 0.75rem;
  background: #fff; color: var(--text);
}
.form textarea { min-height: 6rem; resize: vertical; }
.err { color: var(--danger); font-size: 0.86rem; }
.ok { color: #067647; font-size: 0.86rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
@media (max-width: 900px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* shell */
.app-shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
  background: var(--shell-grad);
}
.side {
  position: relative;
  background:
    radial-gradient(420px 280px at 20% -10%, rgba(14, 116, 144, 0.35), transparent 60%),
    radial-gradient(360px 240px at 100% 90%, rgba(15, 118, 110, 0.22), transparent 55%),
    linear-gradient(180deg, #0d222b 0%, #07161c 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.15rem 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: #9eb4bd;
}
.side::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.025'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
  opacity: 0.9;
}
.side > * { position: relative; z-index: 1; }
.side .brand {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.35rem 0.55rem 1.15rem;
  color: #f4fafb;
}
.side .brand strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.2rem;
  letter-spacing: 0.02em;
  color: #f8fbfc;
}
.side .brand em {
  display: block;
  font-style: normal;
  color: #7f9aa5;
  font-size: 0.72rem;
  margin-top: 0.15rem;
  letter-spacing: 0.04em;
}
.mark {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 12px;
  flex-shrink: 0;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 45%),
    linear-gradient(145deg, #14b8a6 0%, #0e7490 48%, #0f766e 100%);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  position: relative;
}
.mark::after {
  content: "";
  position: absolute;
  inset: 28% 22% 22% 38%;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 40% 60% 55% 45%;
  border-left-width: 0;
  transform: rotate(-18deg);
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  flex: 1;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.68rem 0.8rem;
  border-radius: 11px;
  color: #8aa3ad;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #e8f4f7;
}
.nav a.active {
  background: linear-gradient(90deg, rgba(14, 116, 144, 0.35), rgba(14, 116, 144, 0.08));
  color: #f4fafb;
  box-shadow: inset 3px 0 0 #2dd4bf;
}
.side .side-foot {
  margin-top: auto;
  padding: 0.5rem 0.35rem 0.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 0.85rem;
}
.side .side-foot .btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
  color: #c5d6dc;
}
.side .side-foot .btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
}
.main {
  padding: 1.5rem 1.75rem 2.25rem;
  animation: rise 0.45s ease both;
  min-width: 0;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1.35rem;
}
.stat {
  padding: 1.05rem 1.1rem;
  display: grid;
  gap: 0.4rem;
  background: var(--panel-solid);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(14, 116, 144, 0.08), transparent 70%);
  pointer-events: none;
}
.stat span { color: var(--muted); font-size: 0.78rem; font-weight: 600; letter-spacing: 0.02em; }
.stat strong {
  font-size: 1.5rem;
  font-family: var(--serif);
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tab.active {
  background: var(--ink-2);
  color: #fff;
  border-color: var(--ink-2);
}
.panel { padding: 1.15rem 1.2rem; }
.panel + .panel { margin-top: 0.9rem; }
.hidden { display: none !important; }

/* workspace home */
.ws-hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--radius) + 4px);
  padding: 1.5rem 1.6rem 1.45rem;
  margin-bottom: 1.1rem;
  color: #e8f4f7;
  background:
    radial-gradient(600px 280px at 88% 10%, rgba(45, 212, 191, 0.18), transparent 55%),
    radial-gradient(480px 240px at 0% 100%, rgba(14, 116, 144, 0.35), transparent 50%),
    linear-gradient(135deg, #0b1c24 0%, #12303a 55%, #0f3d48 100%);
  box-shadow: 0 22px 48px rgba(11, 28, 36, 0.16);
  animation: rise 0.5s ease both;
}
.ws-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000 30%, transparent 100%);
  pointer-events: none;
}
.ws-hero > * { position: relative; z-index: 1; }
.ws-hero .eyebrow { color: #5eead4; }
.ws-hero h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  margin: 0.35rem 0 0.45rem;
  letter-spacing: -0.02em;
  color: #f8fbfc;
  font-weight: 600;
}
.ws-hero .lead {
  margin: 0;
  max-width: 36rem;
  color: #9eb8c2;
  font-size: 0.95rem;
  line-height: 1.55;
}
.ws-hero-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.2rem;
}
.ws-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.ws-actions .btn-primary {
  background: #2dd4bf;
  color: #042f2e;
  box-shadow: 0 10px 24px rgba(45, 212, 191, 0.25);
}
.ws-actions .btn-primary:hover { background: #5eead4; color: #042f2e; }
.ws-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.14);
  color: #e8f4f7;
}
.ws-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}
.health-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 600;
  color: #d7ebea;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}
.metric {
  padding: 1.15rem 1.2rem 1.2rem;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: rise 0.55s ease both;
}
.metric:nth-child(2) { animation-delay: 0.05s; }
.metric:nth-child(3) { animation-delay: 0.1s; }
.metric:nth-child(4) { animation-delay: 0.12s; }
.metric:nth-child(5) { animation-delay: 0.16s; }
.metric:nth-child(6) { animation-delay: 0.2s; }
.metric .label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin-bottom: 0.55rem;
}
.metric .value {
  display: block;
  font-family: var(--serif);
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}
.metric .sub {
  display: block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.metric .bar {
  margin-top: 0.75rem;
  height: 4px;
  border-radius: 999px;
  background: rgba(14, 116, 144, 0.12);
  overflow: hidden;
}
.metric .bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0e7490, #2dd4bf);
  transform-origin: left center;
  animation: bar-fill 0.7s ease both;
}
.ws-split {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 0.9rem;
}
.ws-panel {
  padding: 1.2rem 1.25rem;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  animation: rise 0.6s ease both;
}
.ws-panel h2 {
  font-family: var(--serif);
  font-size: 1.05rem;
  margin: 0 0 0.85rem;
  color: var(--ink);
}
.alert-list { display: grid; gap: 0.55rem; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(237, 243, 245, 0.8);
  border: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 550;
  color: var(--text);
}
.alert-item.ok { background: rgba(15, 118, 110, 0.06); border-color: rgba(15, 118, 110, 0.12); }
.alert-item.warn { background: #fff7ed; border-color: #ffedd5; }
.alert-item.err { background: #fef2f2; border-color: #fecaca; }
.quick-list { display: grid; gap: 0.45rem; }
.quick-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-weight: 600;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.quick-link:hover {
  border-color: rgba(14, 116, 144, 0.35);
  background: rgba(14, 116, 144, 0.04);
  color: var(--primary-2);
  transform: translateX(2px);
}
.quick-link span {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 0.15rem;
}
.quick-link em {
  font-style: normal;
  color: var(--primary);
  font-size: 0.9rem;
}

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-split { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .side {
    position: sticky;
    top: 0;
    z-index: 5;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.65rem 0.75rem 0.55rem;
  }
  .side .brand {
    padding: 0.15rem 0.25rem;
    flex: 1;
    min-width: 0;
  }
  .side .brand strong { font-size: 1.05rem; }
  .nav {
    display: flex;
    flex-direction: row;
    gap: 0.2rem;
    overflow: auto;
    width: 100%;
    flex: none;
    padding-bottom: 0.15rem;
    -webkit-overflow-scrolling: touch;
  }
  .nav a { white-space: nowrap; padding: 0.5rem 0.65rem; font-size: 0.86rem; }
  .nav a.active { box-shadow: inset 0 -3px 0 #2dd4bf; background: rgba(14, 116, 144, 0.22); }
  .side .side-foot {
    width: auto;
    margin-top: 0;
    border-top: 0;
    padding: 0;
    order: 2;
  }
  .side .side-foot .btn {
    width: auto;
    min-height: 2.1rem;
    padding: 0 0.75rem;
    font-size: 0.8rem;
  }
  .metrics { grid-template-columns: 1fr; }
  .main { padding: 1rem 1rem 1.75rem; }
  .ws-hero { padding: 1.2rem 1.15rem 1.15rem; }
  .ws-hero h1 { font-size: 1.45rem; }
}
