/* =========================================================
   云枢设备云 · Base
   ========================================================= */
:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f4f9;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --muted-2: #98a2b3;
  --line: #e7ebf1;
  --line-strong: #d7dee8;
  --brand: #2f6bff;
  --brand-deep: #1d4ed8;
  --brand-soft: #eef4ff;
  --mint: #12b76a;
  --mint-soft: #eafaf2;
  --amber: #f79009;
  --amber-soft: #fff7e8;
  --red: #f04438;
  --red-soft: #fef1f0;
  --purple: #7a5af8;
  --purple-soft: #f2efff;
  --sidebar: #091321;
  --sidebar-w: 252px;
  --topbar-h: 68px;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .03), 0 10px 30px rgba(16, 24, 40, .035);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, .16);
  --font: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(47, 107, 255, .055), transparent 60%),
    radial-gradient(620px 380px at 10% 0%, rgba(18, 183, 106, .035), transparent 60%);
  z-index: -1;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }
::selection { background: rgba(47, 107, 255, .2); }
:focus-visible { outline: 3px solid rgba(47, 107, 255, .28); outline-offset: 2px; }
[hidden] { display: none !important; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.text-mint { color: var(--mint) !important; }
.text-amber { color: var(--amber) !important; }
.text-red { color: var(--red) !important; }
.text-brand { color: var(--brand) !important; }
.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ============ App shell ============ */
.app-shell { display: flex; min-height: 100vh; }
.main-shell {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  transition: margin-left .28s cubic-bezier(.2, .8, .2, 1);
}
.content {
  width: 100%;
  max-width: 1540px;
  margin: 0 auto;
  padding: 30px 32px 64px;
}
.page { display: none; }
.page.is-active { display: block; animation: pageIn .34s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ============ Sidebar ============ */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 50;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  overflow: visible;
  color: #aebbd0;
  background:
    radial-gradient(520px 280px at 6% -4%, rgba(47, 107, 255, .26), transparent 64%),
    radial-gradient(360px 260px at 105% 52%, rgba(18, 183, 106, .09), transparent 60%),
    linear-gradient(180deg, #0b1729 0%, #08111f 100%);
  transition: width .28s cubic-bezier(.2, .8, .2, 1), transform .28s cubic-bezier(.2, .8, .2, 1);
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .32;
  background-image:
    linear-gradient(rgba(148, 175, 220, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 175, 220, .05) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, #000, transparent 75%);
}
.sidebar-glow {
  position: absolute;
  top: 40px;
  left: 22px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(47, 107, 255, .22);
  filter: blur(46px);
  pointer-events: none;
}
.brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 9px 24px;
  color: #fff;
  min-height: 58px;
}
.brand-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 8px 18px rgba(0, 0, 0, .18);
}
.brand-mark svg { width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; min-width: 0; }
.brand-text strong { font-size: 19px; letter-spacing: .18em; font-weight: 700; white-space: nowrap; }
.brand-text small {
  margin-top: 6px;
  font-size: 8.5px;
  letter-spacing: .24em;
  color: #6f85a4;
  font-weight: 600;
  white-space: nowrap;
}
.sidebar-collapse {
  position: absolute;
  top: 84px;
  right: -12px;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14);
  background: #12233b;
  color: #93a6c1;
  z-index: 4;
  box-shadow: 0 4px 10px rgba(0, 0, 0, .2);
  opacity: 0;
  transition: opacity .18s, color .18s, background .18s;
}
.sidebar:hover .sidebar-collapse,
.sidebar-collapse:focus-visible { opacity: 1; }
.sidebar-collapse .ico { width: 13px; height: 13px; transform: rotate(180deg); transition: transform .25s; }
.sidebar-collapse:hover { color: #fff; background: #1a3151; }

.side-nav {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 0 18px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.12) transparent;
}
.nav-caption {
  margin: 15px 10px 7px;
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: #586c87;
  white-space: nowrap;
}
.nav-caption:first-child { margin-top: 4px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 42px;
  margin: 2px 0;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 13.5px;
  font-weight: 500;
  color: #9fb0c7;
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.nav-item .ico { width: 19px; height: 19px; color: #7489a6; transition: color .15s; }
.nav-item:hover { color: #e6edf7; background: rgba(255, 255, 255, .045); }
.nav-item:hover .ico { color: #b7c8df; }
.nav-item.is-active {
  color: #fff;
  font-weight: 600;
  background: linear-gradient(90deg, rgba(47, 107, 255, .26), rgba(47, 107, 255, .045));
  box-shadow: inset 0 0 0 1px rgba(120, 165, 255, .12);
}
.nav-item.is-active .ico { color: #8eb7ff; }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #6ee7d0, #5b8cff);
  box-shadow: 0 0 14px rgba(110, 231, 208, .55);
}
.nav-count {
  margin-left: auto;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: #7e93b0;
  font-size: 10px;
  font-style: normal;
  font-weight: 600;
}
.nav-dot {
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-radius: 50%;
  background: #f7b955;
  box-shadow: 0 0 0 4px rgba(247, 185, 85, .1);
}

.sidebar-foot { position: relative; z-index: 1; flex: none; }
.system-health {
  padding: 12px 13px;
  margin-bottom: 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: rgba(255, 255, 255, .035);
}
.health-top { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: #9cafc8; }
.health-top strong { margin-left: auto; color: #6ee7b7; font-weight: 600; font-size: 10.5px; }
.health-meta { display: flex; justify-content: space-between; margin-top: 7px; font-size: 9.5px; color: #58708e; letter-spacing: .02em; }
.user-mini {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px 2px;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.user-mini-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.user-mini-text strong { color: #e7edf6; font-size: 12.5px; font-weight: 600; }
.user-mini-text small { margin-top: 3px; color: #657b97; font-size: 10px; }
.user-mini .icon-btn { margin-left: auto; }

body.sidebar-collapsed .sidebar { width: 84px; }
body.sidebar-collapsed .main-shell { margin-left: 84px; }
body.sidebar-collapsed .brand { padding-left: 8px; padding-right: 8px; justify-content: center; }
body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-caption,
body.sidebar-collapsed .nav-item span,
body.sidebar-collapsed .nav-count,
body.sidebar-collapsed .nav-dot,
body.sidebar-collapsed .system-health,
body.sidebar-collapsed .user-mini-text,
body.sidebar-collapsed .user-mini .icon-btn { display: none; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 0; }
body.sidebar-collapsed .nav-item.is-active::before { left: -14px; }
body.sidebar-collapsed .user-mini { justify-content: center; padding-left: 0; padding-right: 0; }
body.sidebar-collapsed .sidebar-collapse .ico { transform: rotate(0deg); }
body.sidebar-collapsed .side-nav { padding-top: 4px; }

.sidebar-scrim { display: none; }

/* ============ Topbar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 30px;
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid rgba(226, 232, 240, .8);
  backdrop-filter: blur(18px) saturate(160%);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted-2); white-space: nowrap; }
.crumbs strong { color: var(--ink-2); font-weight: 600; }
.crumb-sep { width: 12px; height: 12px; stroke-width: 2; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.global-search {
  width: 268px;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: #f4f6fa;
  color: var(--muted-2);
  transition: border .15s, background .15s, box-shadow .15s;
}
.global-search:focus-within {
  background: #fff;
  border-color: rgba(47, 107, 255, .38);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .08);
}
.global-search .ico { width: 17px; height: 17px; }
.global-search input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; font-size: 12.5px; color: var(--ink); }
.global-search input::placeholder { color: #a3adbd; }
.global-search kbd {
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #e0e5ee;
  background: #fff;
  font-family: var(--font);
  font-size: 10px;
  color: #98a2b3;
}
.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #1d3557, #2f6bff);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .03em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.avatar-sm { width: 30px; height: 30px; font-size: 10px; flex: none; }
.avatar-btn { border: 0; padding: 0; cursor: pointer; }
.avatar-btn:hover { box-shadow: 0 0 0 4px rgba(47, 107, 255, .13); }

/* ============ Buttons ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 12.8px;
  font-weight: 600;
  letter-spacing: .005em;
  white-space: nowrap;
  transition: transform .15s, box-shadow .15s, background .15s, border-color .15s;
}
.btn .ico { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #3674ff, #1f57e6);
  border-color: rgba(29, 78, 216, .4);
  box-shadow: 0 7px 16px rgba(47, 107, 255, .22), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { box-shadow: 0 9px 22px rgba(47, 107, 255, .3); }
.btn-secondary {
  color: var(--ink-2);
  background: #fff;
  border-color: var(--line-strong);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .03);
}
.btn-secondary:hover { background: #f9fbfd; border-color: #c7d0dc; }
.btn-ghost { color: var(--muted); background: transparent; }
.btn-ghost:hover { color: var(--ink-2); background: #f3f6fa; }
.btn-sm { height: 34px; padding: 0 11px; font-size: 12px; border-radius: 9px; }
.btn-sm .ico { width: 15px; height: 15px; }
.btn-icon { width: 40px; padding: 0; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn .ico { width: 19px; height: 19px; }
.icon-btn:hover { background: #f2f5fa; color: var(--ink-2); }
.icon-btn-dark { color: #7890ad; }
.icon-btn-dark:hover { color: #d8e2f0; background: rgba(255, 255, 255, .06); }
.has-dot { position: relative; }
.has-dot::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f04438;
  border: 2px solid #fff;
  box-sizing: content-box;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand);
  font-size: 12px;
  font-weight: 600;
}
.link-btn .ico { width: 13px; height: 13px; }
.link-btn:hover { color: var(--brand-deep); }
.copy-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 7px;
  background: rgba(255, 255, 255, .05);
  color: #8fa0b7;
}
.copy-btn .ico { width: 14px; height: 14px; }
.copy-btn:hover { color: #fff; background: rgba(255, 255, 255, .1); }

/* ============ Typography / page head ============ */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8491a5;
}
.eyebrow-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(18, 183, 106, .1); }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 25px;
}
.page-head-copy { min-width: 0; }
.page-head h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.035em;
  line-height: 1.2;
  color: #0c1424;
}
.page-subtitle { margin-top: 7px; font-size: 13px; color: var(--muted); }
.page-actions { display: flex; align-items: center; gap: 9px; flex: none; flex-wrap: wrap; }

/* ============ Cards ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 22px 0;
}
.card-head h2 { font-size: 14.5px; font-weight: 650; letter-spacing: -.01em; color: #172033; }
.card-sub { margin-top: 4px; font-size: 11.5px; color: var(--muted-2); }
.title-with-live { display: flex; align-items: center; gap: 9px; }
.soft-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 25px;
  padding: 0 9px;
  border-radius: 7px;
  background: #f3f6fb;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
}
.soft-chip .ico { width: 13px; height: 13px; color: var(--brand); }

/* ============ Badges / statuses ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 23px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
}
.badge-mint { color: #067647; background: var(--mint-soft); }
.badge-blue { color: #1d4ed8; background: #edf3ff; }
.badge-amber { color: #b54708; background: var(--amber-soft); }
.badge-red { color: #b42318; background: var(--red-soft); }
.badge-gray { color: #475467; background: #f2f4f7; }
.badge-purple { color: #5925dc; background: var(--purple-soft); }

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, .14);
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(18, 183, 106, .14); }
  50% { box-shadow: 0 0 0 5px rgba(18, 183, 106, .04); }
}
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: #ebfaf2;
  color: #067647;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: .08em;
}
.live-pill-lg { height: 30px; padding: 0 12px; font-size: 10.5px; }
.pulse-soft {
  width: 7px; height: 7px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 0 4px rgba(247, 144, 9, .1); flex: none;
}

.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 550; color: var(--ink-2); white-space: nowrap; }
.status i { width: 6px; height: 6px; border-radius: 50%; background: #98a2b3; flex: none; }
.status-online i { background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, .1); }
.status-offline i { background: #98a2b3; }
.status-upgrading i { background: #2f6bff; box-shadow: 0 0 0 3px rgba(47, 107, 255, .1); animation: livePulse 1.6s infinite; }
.status-error i { background: #f04438; box-shadow: 0 0 0 3px rgba(240, 68, 56, .1); }
.status-online { color: #067647; }
.status-offline { color: #667085; }
.status-upgrading { color: #1d4ed8; }
.status-error { color: #b42318; }

/* ============ Tables ============ */
.table-scroll { width: 100%; overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.data-table th {
  height: 38px;
  padding: 0 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .04em;
  color: #7d899b;
  white-space: nowrap;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.data-table th:first-child { padding-left: 22px; }
.data-table th:last-child { padding-right: 22px; }
.data-table td {
  padding: 13px 12px;
  border-bottom: 1px solid #f0f3f7;
  vertical-align: middle;
}
.data-table td:first-child { padding-left: 22px; }
.data-table td:last-child { padding-right: 22px; }
.data-table tbody tr { transition: background .12s; }
.data-table tbody tr:hover { background: #fafcff; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .check-cell { width: 42px; padding-right: 0; }
.data-table input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; }
.data-table.compact th { background: transparent; height: 34px; }
.data-table.compact td { padding-top: 11px; padding-bottom: 11px; }
.data-table.compact th:first-child, .data-table.compact td:first-child { padding-left: 22px; }
.data-table.compact th:last-child, .data-table.compact td:last-child { padding-right: 22px; }
.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 9px 20px;
  border-top: 1px solid #f0f3f7;
}
.table-count { font-size: 11.5px; color: var(--muted-2); }
.pagination { display: flex; align-items: center; gap: 5px; }
.page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
}
.page-btn:hover { background: #f3f6fa; color: var(--ink-2); }
.page-btn.is-active { color: var(--brand); background: var(--brand-soft); font-weight: 650; }
.page-btn .ico { width: 14px; height: 14px; }
.page-btn[disabled] { opacity: .35; pointer-events: none; }
.selection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 20px;
  background: #f4f8ff;
  border-bottom: 1px solid #dfe9ff;
  font-size: 12px;
  color: #344054;
}
.selection-bar strong { color: var(--brand); }
.selection-bar > div { display: flex; gap: 7px; }

/* ============ Forms ============ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 14px; }
.form-grid-1 { grid-template-columns: 1fr; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #4a5568;
}
.field > span em { margin-left: 5px; font-style: normal; font-weight: 400; font-size: 10px; color: #98a2b3; }
.field input, .field select, .field textarea, .form-control {
  width: 100%;
  height: 39px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  font-size: 12.5px;
  color: var(--ink);
  outline: 0;
  transition: border .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 10px 11px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus, .form-control:focus {
  border-color: rgba(47, 107, 255, .58);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .08);
}
.field input::placeholder { color: #aab4c2; }
.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}
.input-with-icon .ico { position: absolute; left: 11px; width: 16px; height: 16px; color: #98a2b3; }
.input-with-icon input { padding-left: 34px; }
.field-hint { font-size: 10.5px; color: var(--muted-2); }
.form-row { display: flex; gap: 10px; align-items: center; }
.form-divider { height: 1px; background: var(--line); margin: 4px 0; }
.field-span-2 { grid-column: span 2; }

.search-field {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 260px;
  height: 36px;
  padding: 0 11px;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--muted-2);
}
.search-field .ico { width: 16px; height: 16px; }
.search-field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 12px; }
.search-field:focus-within { border-color: rgba(47, 107, 255, .5); box-shadow: 0 0 0 3px rgba(47, 107, 255, .07); }
.search-field-sm { min-width: 0; width: 100%; height: 34px; }
.select-field {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  min-width: 118px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
}
.select-field select {
  width: 100%;
  height: 100%;
  padding: 0 30px 0 11px;
  border: 0;
  outline: 0;
  background: transparent;
  appearance: none;
  font-size: 12px;
  color: #475467;
  cursor: pointer;
}
.select-field .ico { position: absolute; right: 9px; width: 14px; height: 14px; color: #98a2b3; pointer-events: none; }
.select-field:focus-within { border-color: rgba(47, 107, 255, .5); }
.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: #eef2f7;
  border: 1px solid #e6ebf2;
}
.segmented button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 550;
}
.segmented button.is-active { background: #fff; color: var(--ink-2); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }

/* ============ Code ============ */
.code-block {
  margin: 0;
  padding: 16px 18px;
  overflow: auto;
  border-radius: 12px;
  background: #0d1829;
  color: #c6d4e6;
  font-family: var(--mono);
  font-size: 11.3px;
  line-height: 1.75;
  tab-size: 2;
  white-space: pre;
}
.code-block::-webkit-scrollbar { height: 7px; width: 7px; }
.code-block::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 10px; }
.code-block .j-key { color: #8eb7ff; }
.code-block .j-str { color: #8be3c3; }
.code-block .j-num { color: #f8c77e; }
.code-block .j-bool { color: #c7a7ff; }
.code-block .j-null { color: #7f8ea4; }
.code-sample { margin-top: 16px; border: 1px solid #1a2b42; border-radius: 13px; overflow: hidden; background: #0d1829; }
.code-sample .code-block { border-radius: 0; background: transparent; }
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 6px 12px 6px 16px;
  background: #111f33;
  border-bottom: 1px solid #1b2c44;
  color: #8194ad;
  font-size: 10.5px;
  font-weight: 550;
  letter-spacing: .03em;
}

/* ============ Drawer ============ */
.drawer-layer, .modal-layer {
  position: fixed;
  inset: 0;
  z-index: 100;
  visibility: hidden;
  pointer-events: none;
}
.drawer-layer.is-open, .modal-layer.is-open { visibility: visible; pointer-events: auto; }
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 17, 31, .48);
  opacity: 0;
  transition: opacity .24s;
  backdrop-filter: blur(2px);
}
.drawer-layer.is-open .overlay, .modal-layer.is-open .overlay { opacity: 1; }
.drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(632px, 100vw);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -24px 0 60px rgba(16, 24, 40, .16);
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.drawer-layer.is-open .drawer { transform: none; }
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 17px;
  border-bottom: 1px solid var(--line);
}
.drawer-head h2 { font-size: 20px; letter-spacing: -.025em; }
.drawer-content { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }

/* ============ Modal ============ */
.modal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  transform: translate(-50%, calc(-50% + 14px)) scale(.985);
  opacity: 0;
  transition: transform .24s cubic-bezier(.2, .8, .2, 1), opacity .2s;
  overflow: hidden;
}
.modal.is-wide { width: min(760px, calc(100vw - 32px)); }
.modal-layer.is-open .modal { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 17px;
  border-bottom: 1px solid var(--line);
}
.modal-head h2 { font-size: 19px; letter-spacing: -.02em; }
.modal-subtitle { margin-top: 5px; font-size: 12px; color: var(--muted); }
.modal-body { padding: 20px 24px; overflow-y: auto; }
.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 15px 24px;
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}
.modal-foot .modal-hint { margin-right: auto; font-size: 11px; color: var(--muted-2); }

/* ============ Toasts ============ */
.toast-stack {
  position: fixed;
  top: 82px;
  right: 22px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(16, 24, 40, .14);
  font-size: 12px;
  color: var(--ink-2);
  animation: toastIn .28s cubic-bezier(.2, .8, .2, 1) both;
  pointer-events: auto;
}
.toast .toast-icon {
  width: 26px;
  height: 26px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--mint-soft);
  color: var(--mint);
}
.toast .toast-icon .ico { width: 15px; height: 15px; }
.toast.is-error .toast-icon { background: var(--red-soft); color: var(--red); }
.toast.is-info .toast-icon { background: var(--brand-soft); color: var(--brand); }
.toast strong { display: block; font-size: 12px; color: var(--ink); margin-bottom: 1px; }
.toast p { font-size: 11px; color: var(--muted); line-height: 1.45; }
.toast.is-out { animation: toastOut .22s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(16px); } }

/* ============ Misc ============ */
.mobile-only { display: none; }
.hide-sm { display: inline-flex; }
.divider { height: 1px; background: var(--line); }
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 20px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
}
.empty-state .ico { width: 34px; height: 34px; color: #c7d0dd; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d6deea; border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #c1ccdc; background-clip: content-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
