:root {
  color-scheme: light;
  --soy-primary: #646cff;
  --soy-primary-hover: #7c82ff;
  --soy-primary-pressed: #4f57e8;
  --soy-info: #2080f0;
  --soy-success: #52c41a;
  --soy-warning: #faad14;
  --soy-error: #f5222d;
  --soy-layout: rgb(247, 250, 252);
  --soy-container: #fff;
  --soy-text: rgb(31, 31, 31);
  --soy-text-2: #333639;
  --soy-text-3: #767c82;
  --soy-placeholder: #b2b7bd;
  --soy-border: #e5e7eb;
  --soy-divider: #efeff5;
  --soy-header-height: 68px;
  --soy-sider-width: 220px;
  --soy-radius: 2px;
  --soy-shadow-header: 0 1px 2px rgb(0 21 41 / 8%);
  --soy-shadow-sider: 2px 0 8px 0 rgb(29 35 41 / 5%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; min-width: 320px; min-height: 100%; margin: 0; }
body { overflow: hidden; color: var(--soy-text); background: var(--soy-layout); font-size: 14px; }
.skip-link {
  position: fixed;
  z-index: 500;
  top: 8px;
  left: 8px;
  border: 2px solid var(--soy-primary);
  border-radius: 8px;
  padding: 9px 14px;
  background: #fff;
  color: var(--soy-primary);
  font-weight: 700;
  transform: translateY(calc(-100% - 16px));
  transition: transform .16s;
}
.skip-link:focus { outline: 2px solid #fff; outline-offset: -4px; transform: translateY(0); }
button, input, select, textarea { margin: 0; font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }

/* App shell */
.shell {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: var(--soy-sider-width) minmax(0, 1fr);
  grid-template-rows: var(--soy-header-height) minmax(0, 1fr);
}
.sidebar {
  grid-column: 1;
  grid-row: 1 / -1;
  z-index: 20;
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 0 12px 16px;
  border-right: 1px solid #f0f0f0;
  background: var(--soy-container);
  box-shadow: var(--soy-shadow-sider);
}
.sidebar::after { display: none; }
.sidebar-brand {
  position: relative;
  height: 92px;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  margin: 10px 0 4px;
  border-radius: 2px;
  padding: 10px 8px 11px;
  background: linear-gradient(145deg, #0756d8 0%, #1677ff 55%, #56b4ff 100%);
  box-shadow: none;
}
.sidebar-brand::before, .sidebar-brand::after { display: none; }
.brand-mark {
  z-index: 1;
  width: 68px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.brand-mark img { width: 68px; height: 34px; display: block; object-fit: contain; filter: drop-shadow(0 4px 7px rgb(0 36 99 / 22%)); }
.brand-copy strong {
  position: relative;
  z-index: 1;
  color: transparent;
  background: linear-gradient(180deg, #fff, #e9f5ff 55%, #bedcff);
  background-clip: text;
  -webkit-background-clip: text;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 2.6px;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 4px 14px rgb(0 45 126 / 20%);
}
.brand-copy span { display: none; }
.nav-label { margin: 14px 12px 8px; color: #a3a8ae; font-size: 11px; }
.nav { min-height: 0; display: grid; align-content: start; gap: 4px; overflow: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-group-title { margin: 14px 12px 5px; color: #a3a8ae; font-size: 11px; line-height: 18px; }
.nav-group-overview { order: 10; margin-top: 8px; }
.nav-button[data-view="dashboard"] { order: 11; }
.nav-group-customer { order: 20; }
.nav-button[data-view="users"] { order: 21; }
.nav-button[data-view="orders"] { order: 22; }
.nav-button[data-view="prices"] { order: 23; }
.nav-group-business { order: 30; }
.nav-button[data-view="tasks"] { order: 31; }
.nav-button[data-view="feedback"] { order: 33; }
.nav-group-access { order: 40; }
.nav-button[data-view="roles"] { order: 41; }
.nav-button[data-view="system"] { order: 42; }
.nav-button[data-page="certificates"] { order: 43; text-decoration: none; }
.nav-button {
  position: relative;
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: var(--soy-radius);
  padding: 0 13px;
  background: transparent;
  color: #51565c;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  transition: color .18s, background .18s;
}
.nav-button::before { display: none; }
.nav-button svg { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 1.8; }
.nav-button:hover { color: var(--soy-primary); background: rgb(100 108 255 / 8%); }
.nav-button.active { color: var(--soy-primary); background: rgb(100 108 255 / 12%); font-weight: 600; }
.side-link {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: auto;
  border-radius: var(--soy-radius);
  background: #f7f7fa;
  color: var(--soy-text-3);
  font-size: 12px;
  text-decoration: none;
  transition: color .18s, background .18s;
}
.side-link::before { display: none; }
.side-link:hover { color: var(--soy-primary); background: rgb(100 108 255 / 9%); }

/* Header */
.topbar {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  z-index: 10;
  height: var(--soy-header-height);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 0 16px;
  background: var(--soy-container);
  color: var(--soy-text);
  box-shadow: var(--soy-shadow-header);
}
.title { height: var(--soy-header-height); display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar .top-logo, .title-divider { display: none; }
.title-copy h1 { margin: 0; color: var(--soy-text); font-size: 15px; font-weight: 600; }
.title-copy span { display: none; }
.actions { height: var(--soy-header-height); display: flex; align-items: center; gap: 9px; }
.service-state, .admin-chip {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #e4e6ed;
  border-radius: 6px;
  padding: 0 10px;
  background: #fafafd;
  color: var(--soy-text-3);
  font-size: 12px;
}
.admin-chip {
  position: relative;
  min-width: 232px;
  height: 44px;
  gap: 10px;
  border: 0;
  border-radius: 8px;
  padding: 5px 8px 5px 14px;
  background: transparent;
  box-shadow: none;
}
.admin-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 1px;
  height: 24px;
  background: #e5e7ed;
}
.admin-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #7479ff, #555bd9);
  box-shadow: 0 3px 8px rgb(84 90 215 / 20%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}
.admin-identity { min-width: 0; flex: 1; display: grid; gap: 2px; line-height: 1.1; }
.admin-identity strong, .admin-identity span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-identity strong { color: var(--soy-text); font-size: 12px; font-weight: 600; }
.admin-identity span { max-width: 164px; color: var(--soy-text-3); font-size: 10px; font-weight: 400; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: #b8bdc3; }
.state-dot.ok { background: var(--soy-success); box-shadow: 0 0 0 3px rgb(82 196 26 / 12%); }
.state-dot.bad { background: var(--soy-error); box-shadow: 0 0 0 3px rgb(245 34 45 / 12%); }

/* Main */
.main { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; overflow: hidden; }
.content { height: 100%; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 16px; }
.view { display: none; }
.view.active { display: block; animation: soy-fade-slide .22s ease-out; }
@keyframes soy-fade-slide { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-heading { min-height: 32px; display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
.page-heading h2 { margin: 0; color: var(--soy-text); font-size: 18px; font-weight: 600; }
.page-heading p, .page-heading .eyebrow { display: none; }

/* Buttons and form controls */
.primary, .ghost-button, .danger-button, .pager button {
  height: 36px;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 500;
  transition: border-color .16s, color .16s, background .16s, box-shadow .16s, transform .12s;
}
.primary { border: 1px solid var(--soy-primary); background: var(--soy-primary); color: #fff; box-shadow: 0 2px 6px rgb(100 108 255 / 18%); }
.primary:hover:not(:disabled) { border-color: var(--soy-primary-hover); background: var(--soy-primary-hover); box-shadow: 0 4px 10px rgb(100 108 255 / 22%); }
.primary:active:not(:disabled) { border-color: var(--soy-primary-pressed); background: var(--soy-primary-pressed); transform: translateY(1px); }
.ghost-button, .pager button { border: 1px solid #d9d9df; background: #fff; color: var(--soy-text-2); }
.ghost-button:hover:not(:disabled), .pager button:hover:not(:disabled) { border-color: #b9bbc8; background: #fafafd; color: var(--soy-text); }
.danger-button { border: 1px solid rgb(245 34 45 / 35%); background: #fff; color: var(--soy-error); }
.danger-button:hover:not(:disabled) { border-color: var(--soy-error); background: rgb(245 34 45 / 6%); }
button:focus-visible, .table-link:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgb(100 108 255 / 16%); }
#logoutButton:hover:not(:disabled) { border-color: rgb(245 34 45 / 35%); background: rgb(245 34 45 / 5%); color: var(--soy-error); }
.field, .select {
  width: 100%;
  height: 34px;
  border: 1px solid #dedee6;
  border-radius: var(--soy-radius);
  padding: 0 11px;
  outline: 0;
  background: #fff;
  color: var(--soy-text-2);
  font-size: 13px;
  transition: border-color .18s, box-shadow .18s;
}
.select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23768092' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 14px 14px;
}
textarea.field { height: auto; padding-block: 8px; resize: vertical; }
.field::placeholder { color: var(--soy-placeholder); }
.field:hover, .select:hover { border-color: #b9bac5; }
.field:focus, .select:focus { border-color: var(--soy-primary); box-shadow: 0 0 0 2px rgb(100 108 255 / 12%); }

/* Standard Soybean cards */
.data-workspace { overflow: visible; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.list-tools, .task-tools {
  display: grid;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  padding: 16px;
  border: 0;
  border-radius: var(--soy-radius);
  background: #fff;
  box-shadow: none;
}
#usersView .list-tools { grid-template-columns: minmax(210px, 1fr) 112px 112px 122px auto auto; gap: 10px; }
#ordersView .list-tools { grid-template-columns: minmax(160px, 1fr) 88px 88px 92px 100px 122px 88px auto auto; gap: 8px; }
#feedbackView .list-tools { grid-template-columns: minmax(190px, 1fr) 118px 126px 116px auto auto; gap: 8px; }
.task-tools { grid-template-columns: minmax(190px, 1fr) 118px 126px 116px auto auto; gap: 8px; }
.result-summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(4, max-content);
  align-items: center;
  gap: 0;
  padding: 0 16px;
  border-radius: var(--soy-radius) var(--soy-radius) 0 0;
  background: #fff;
  box-shadow: none;
}
.result-summary-item { position: relative; display: flex; align-items: baseline; gap: 8px; padding: 0 22px; }
.result-summary-item:first-child { padding-left: 0; }
.result-summary-item + .result-summary-item::before { content: ""; position: absolute; left: 0; top: 1px; width: 1px; height: 18px; background: var(--soy-divider); }
.result-summary-item span { color: var(--soy-text-3); font-size: 12px; }
.result-summary-item strong { color: var(--soy-text-2); font-size: 16px; font-weight: 600; }
.result-summary-item:first-child strong { color: var(--soy-primary); }
.result-summary-item.summary-warning strong { color: #c47412; }
#ordersView .result-summary { grid-template-columns: repeat(5, max-content); }
#tasksView .result-summary, #feedbackView .result-summary { grid-template-columns: repeat(4, max-content); }

/* Data table */
.table-wrap { position: relative; overflow: auto; background: #fff; box-shadow: none; scrollbar-color: #c8cad0 transparent; scrollbar-width: thin; }
.result-summary + .table-wrap { box-shadow: none; }
table { width: max-content; min-width: 100%; border-collapse: separate; border-spacing: 0; table-layout: auto; }
th, td { height: 50px; padding: 0 14px; overflow: hidden; border-bottom: 1px solid var(--soy-divider); text-align: left; text-overflow: ellipsis; white-space: nowrap; }
th { position: sticky; top: 0; z-index: 2; height: 44px; background: #fafafa; color: #51565c; font-size: 13px; font-weight: 500; }
td { color: var(--soy-text-2); font-size: 13px; }
tbody tr { background: #fff; transition: background .15s; }
tbody tr:hover { background: rgb(100 108 255 / 5%); }
tbody tr:last-child td { border-bottom: 0; }
.table-primary { color: var(--soy-text); font-weight: 550; }
.cell-muted { color: var(--soy-text-3); }
.cell-action { text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; }
.item-title, .item-meta, .json-cell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td > * { max-width: 100%; }
td .item-meta { display: inline; margin: 0; color: var(--soy-text-3); font-size: 11px; }
td .item-meta::before { content: " · "; }
.json-cell { max-height: 22px; margin: 0; color: #63676d; font-size: 11px; }
.table-link { min-height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: 5px; padding: 0 7px; background: transparent; color: var(--soy-primary); font-size: 13px; font-weight: 500; white-space: nowrap; transition: color .16s, background .16s, border-color .16s, box-shadow .16s; }
.table-link:hover { background: rgb(100 108 255 / 8%); color: var(--soy-primary-hover); }
.relation-link { display: inline-flex; align-items: center; gap: 6px; }
.relation-link span { font-size: 11px; transition: transform .18s; }
.relation-link:hover span { transform: translateX(2px); }
.cell-action .table-link { height: 28px; border: 1px solid rgb(100 108 255 / 16%); border-radius: 5px; padding: 0 9px; background: rgb(100 108 255 / 8%); }
.cell-action .table-link:hover { border-color: rgb(100 108 255 / 30%); background: rgb(100 108 255 / 13%); }
.badge { height: 22px; display: inline-flex; align-items: center; justify-content: center; border-radius: 4px; padding: 0 7px; background: #f1f2f5; color: #666b71; font-size: 11px; font-weight: 500; }
.badge.active, .badge.succeeded, .badge.ready, .badge.paid, .badge.resolved { background: rgb(82 196 26 / 11%); color: #389e0d; }
.badge.processing, .badge.queued, .badge.pending { background: rgb(32 128 240 / 10%); color: var(--soy-info); }
.badge.failed, .badge.disabled, .badge.cancelled { background: rgb(245 34 45 / 9%); color: var(--soy-error); }
.badge.refunded, .badge.closed, .badge.expired { background: rgb(250 173 20 / 12%); color: #d48806; }
#usersTableWrap th:first-child, #usersTableWrap td:first-child,
#ordersTableWrap th:first-child, #ordersTableWrap td:first-child { position: sticky; left: 0; z-index: 1; box-shadow: 1px 0 var(--soy-divider); }
#usersTableWrap th:last-child, #usersTableWrap td:last-child,
#ordersTableWrap th:last-child, #ordersTableWrap td:last-child { position: sticky; right: 0; z-index: 1; box-shadow: -1px 0 var(--soy-divider); }
#usersTableWrap th:first-child, #usersTableWrap th:last-child,
#ordersTableWrap th:first-child, #ordersTableWrap th:last-child { z-index: 3; background: #fafafa; }
#usersTableWrap td:first-child, #usersTableWrap td:last-child,
#ordersTableWrap td:first-child, #ordersTableWrap td:last-child { background: #fff; }
#usersTableWrap tr:hover td:first-child, #usersTableWrap tr:hover td:last-child,
#ordersTableWrap tr:hover td:first-child, #ordersTableWrap tr:hover td:last-child { background: #f8f8ff; }
#usersTableWrap th:nth-child(7), #usersTableWrap td:nth-child(7),
#usersTableWrap th:nth-child(8), #usersTableWrap td:nth-child(8),
#usersTableWrap th:nth-child(9), #usersTableWrap td:nth-child(9),
#usersTableWrap th:nth-child(10), #usersTableWrap td:nth-child(10) { text-align: center; }
#usersTableWrap th:nth-child(11), #usersTableWrap td:nth-child(11),
#ordersTableWrap th:nth-child(6), #ordersTableWrap td:nth-child(6) { text-align: right; }
.pager { height: 52px; display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 16px; border-top: 1px solid var(--soy-divider); border-radius: 0; background: #fff; color: var(--soy-text-3); font-size: 12px; box-shadow: none; }
.pager span { margin-right: auto; }
.pager .select { width: 104px; height: 32px; flex: 0 0 104px; border-radius: 6px; padding: 0 36px 0 10px; background-color: #fff; background-position: right 13px center; font-size: 12px; }
.empty { min-height: 150px; display: grid; place-items: center; color: var(--soy-text-3); font-size: 13px; }

/* Dashboard */
.dashboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  padding-top: 4px;
}
.dashboard-summary-panel {
  --panel-accent: #6268dc;
  --panel-soft: #f1f2ff;
  min-width: 0;
  min-height: 216px;
  overflow: hidden;
  border: 1px solid #e5e8ef;
  border-radius: 16px;
  padding: 17px;
  background: #fff;
  box-shadow: 0 10px 28px rgb(31 42 68 / 5%);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.dashboard-summary-panel:hover { border-color: color-mix(in srgb, var(--panel-accent) 24%, #e5e8ef); box-shadow: 0 14px 34px rgb(31 42 68 / 8%); transform: translateY(-2px); }
.panel-business { --panel-accent: #645fd8; --panel-soft: #f1f0ff; }
.panel-order { --panel-accent: #168866; --panel-soft: #edf8f4; }
.panel-task { --panel-accent: #3476ad; --panel-soft: #eef6fb; }
.panel-system { --panel-accent: #238692; --panel-soft: #edf7f8; }
.dashboard-panel-head { height: 38px; display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dashboard-panel-head h2 { margin: 0; color: #252c38; font-size: 15px; font-weight: 720; letter-spacing: -.015em; }
.dashboard-panel-icon { width: 36px; height: 36px; display: grid; flex: 0 0 36px; place-items: center; border-radius: 50%; background: var(--panel-soft); color: var(--panel-accent); }
.dashboard-panel-icon svg { width: 19px; height: 19px; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.dashboard-micro-ring,
.runtime-donut {
  --dashboard-percent: 0%;
  --runtime-percent: var(--dashboard-percent);
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--panel-accent) 0 var(--runtime-percent), color-mix(in srgb, var(--panel-accent) 14%, #eef0f4) var(--runtime-percent) 100%);
}
.dashboard-micro-ring { width: 10px; height: 10px; }
.dashboard-micro-ring::after { content: ""; position: absolute; inset: 2.5px; border-radius: 50%; background: #fff; }
.dashboard-panel-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.dashboard-panel-metric { min-width: 0; height: 62px; display: flex; flex-direction: column; justify-content: center; gap: 7px; border-radius: 11px; padding: 10px 11px; background: #f7f8fa; }
.dashboard-panel-metric > span { min-width: 0; overflow: hidden; color: #788294; font-size: 11px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-panel-metric > strong { min-width: 0; overflow: hidden; color: #242c39; font-size: clamp(15px, 1.1vw, 18px); line-height: 1; font-weight: 790; font-variant-numeric: tabular-nums; letter-spacing: -.035em; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-panel-metric > small { display: none; }
.dashboard-panel-metric.metric-primary { grid-column: 1 / -1; background: var(--panel-soft); }
.dashboard-panel-metric.metric-primary > strong { color: var(--panel-accent); font-size: 24px; }
.business-metrics .dashboard-panel-metric:not(.metric-primary) > strong,
.panel-order .dashboard-panel-metric > strong { color: var(--panel-accent); }
.business-metrics .metric-member { background: var(--panel-soft); }
.panel-order .dashboard-panel-metric > strong { overflow: visible; font-size: clamp(12px, .9vw, 15px); }
.task-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.task-metrics .dashboard-panel-metric { height: 62px; gap: 7px; padding: 10px 11px; }
.task-metrics .dashboard-panel-metric > strong { overflow: visible; color: var(--panel-accent); font-size: 18px; }
.task-metric-value { min-width: 0; display: flex; align-items: baseline; gap: 7px; }
.task-metric-value strong { color: var(--panel-accent); font-size: 18px; line-height: 1; font-weight: 790; font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
.task-metric-value small { color: #7b8697; font-size: 10px; font-weight: 700; font-variant-numeric: tabular-nums; }
.metric-label-with-ring { display: flex; align-items: center; gap: 5px; }
.panel-task .dashboard-micro-ring { --panel-accent: #3476ad; }
.panel-task .dashboard-panel-metric:nth-child(2) .dashboard-micro-ring { --panel-accent: #1a9a70; }
.panel-task .dashboard-panel-metric:nth-child(3) .dashboard-micro-ring { --panel-accent: #377fba; }
.panel-task .dashboard-panel-metric:nth-child(4) .dashboard-micro-ring { --panel-accent: #d25260; }
.system-metrics .runtime-metric { position: relative; padding-right: 50px; }
.system-metrics .runtime-metric > strong { color: var(--panel-accent); }
.system-metrics .runtime-donut { width: 30px; height: 30px; position: absolute; top: 50%; right: 11px; transform: translateY(-50%); }
.system-metrics .runtime-donut::after { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #f7f8fa; }
.dashboard-flow { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: 16px; margin-top: 16px; }
.analytics-row { gap: 14px; margin-top: 14px; }
.analytics-card { border: 1px solid #ebedf2; box-shadow: none; }
.analytics-card .section-head { min-height: 52px; }
.revenue-analytics .analytics-card .section-head h2::before,
.user-analytics .analytics-card .section-head h2::before { content: ""; width: 7px; height: 7px; display: inline-block; margin-right: 8px; border-radius: 50%; vertical-align: 1px; }
.revenue-analytics .analytics-card .section-head h2::before { background: #1aaa7c; box-shadow: 0 0 0 4px rgb(26 170 124 / 10%); }
.user-analytics .analytics-card .section-head h2::before { background: #6c68ed; box-shadow: 0 0 0 4px rgb(108 104 237 / 10%); }
.section { overflow: hidden; border: 1px solid #ebedf2; border-radius: var(--soy-radius); background: #fff; box-shadow: none; }
.section-head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 18px; border-bottom: 1px solid #f3f3f6; }
.section-head h2, .flat-head h2 { margin: 0; color: var(--soy-text); font-size: 15px; font-weight: 600; }
.section-head .section-action { height: 30px; padding: 0 12px; font-size: 12px; }
.section-head span, .flat-head span { display: none; }
.section-body { padding: 16px 18px; }
.section-control { height: 32px; border: 1px solid #dedee6; border-radius: var(--soy-radius); padding: 0 10px; outline: 0; background: #fff; color: var(--soy-text-2); font-size: 12px; }
.timeline { position: relative; min-height: 218px; padding: 12px 14px 28px 48px; }
.trend-stage { position: absolute; inset: 12px 14px 32px 48px; }
.trend-axis { position: absolute; inset: 0 auto 0 -40px; width: 34px; z-index: 2; display: flex; flex-direction: column; justify-content: space-between; padding: 0 0 6px; color: #9ba0a8; font-size: 9px; text-align: right; }
.trend-svg { width: 100%; height: 100%; overflow: visible; }
.trend-svg line { stroke: #eef0f4; stroke-width: 1; vector-effect: non-scaling-stroke; }
.trend-area { fill: rgb(105 101 235 / 9%); }
.trend-line { fill: none; stroke: #6c68ed; stroke-width: 2.2; vector-effect: non-scaling-stroke; }
.trend-stage.money .trend-area { fill: rgb(24 168 121 / 10%); }
.trend-stage.money .trend-line { stroke: #18a879; }
.trend-points { position: absolute; inset: 0; }
.trend-points i { position: absolute; width: 8px; height: 8px; border: 2px solid #fff; border-radius: 50%; background: #6c68ed; box-shadow: 0 0 0 2px rgb(108 104 237 / 22%); transform: translate(-50%, -50%); }
.trend-stage.money .trend-points i { background: #18a879; box-shadow: 0 0 0 2px rgb(24 168 121 / 22%); }
.trend-labels { position: absolute; right: 14px; bottom: 7px; left: 48px; display: grid; align-items: center; }
.trend-labels span { overflow: hidden; color: #92979f; font-size: 9px; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.legend-row { display: flex; justify-content: flex-end; gap: 12px; margin-bottom: 6px; color: var(--soy-text-3); font-size: 11px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* System cards */
#systemView > .section + .section { margin-top: 16px !important; }
#systemView .list-tools { margin: 0; border-radius: 0; box-shadow: none; }
#systemView .list-tools { grid-template-columns: minmax(240px, 1fr) 160px 130px auto; }
#systemSessionsPanel .session-tools { grid-template-columns: minmax(220px, 1fr) 150px auto; }
#systemBlocksPanel .session-tools { grid-template-columns: minmax(220px, 1fr) 120px 150px auto; }
#systemView .system-audit-tools { grid-template-columns: minmax(160px, 1fr) 108px 108px 90px 126px 126px auto; }
.module-tabs { height: 44px; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; border-bottom: 1px solid var(--soy-divider); padding: 0 4px; background: #fff; border-radius: var(--soy-radius) var(--soy-radius) 0 0; }
.module-tabs-action { margin-left: auto; }
.module-tab { position: relative; height: 44px; border: 0; padding: 0 16px; background: transparent; color: var(--soy-text-3); font-size: 13px; }
.module-tab:hover { color: var(--soy-primary); }
.module-tab.active { color: var(--soy-primary); font-weight: 600; }
.module-tab.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 2px; border-radius: 2px; background: var(--soy-primary); }
.module-panel { display: none; min-height: 240px; overflow: hidden; border-radius: var(--soy-radius); background: #fff; box-shadow: none; }
.module-panel.active { display: block; }
.role-page-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 8px; }
.role-accounts-panel { overflow: hidden; border: 1px solid #e1e5ec; border-radius: 12px; background: #fff; box-shadow: 0 8px 24px rgb(31 41 55 / 5%); }
.role-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 14px; border-bottom: 1px solid #edf0f4; background: #fff; }
.role-filters { min-width: 0; display: grid; grid-template-columns: minmax(220px, 1fr) 140px 120px auto; align-items: center; gap: 8px; }
#rolesView .result-summary { border-right: 0; border-left: 0; border-radius: 0; }
#rolesView .table-wrap { border-right: 0; border-left: 0; }
#rolesView .pager { border-right: 0; border-bottom: 0; border-left: 0; border-radius: 0; }
.system-status-body { padding: 16px; }
.system-audit-tools { margin: 0; border-radius: 0; box-shadow: none; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.detail-item { min-width: 0; padding: 12px 14px; border-radius: var(--soy-radius); background: #f7f8fb; }
.detail-item span { display: block; color: var(--soy-text-3); font-size: 11px; }
.detail-item strong { display: block; margin-top: 6px; overflow: hidden; color: var(--soy-text-2); font-size: 13px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }

/* Modal details */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgb(0 0 0 / 42%); backdrop-filter: blur(2px); }
.modal-panel { width: min(820px, 96vw); max-height: 90vh; overflow: hidden; display: grid; grid-template-rows: auto minmax(0, 1fr); border-radius: 2px; background: #fff; box-shadow: 0 12px 36px rgb(0 0 0 / 18%); }
.modal-head { height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--soy-divider); }
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-close { width: 32px; height: 32px; display: inline-grid; flex: 0 0 32px; place-items: center; border: 0; border-radius: 50%; padding: 0; background: transparent; color: #7b8492; font: 400 25px/1 Arial, sans-serif; cursor: pointer; transition: color .16s, background .16s; }
.modal-close:hover { background: #f1f3f6; color: #252b36; }
.modal-close:focus-visible { outline: 2px solid rgb(47 99 243 / 32%); outline-offset: 2px; }
.modal-body { overflow: auto; display: grid; gap: 14px; padding: 16px; background: var(--soy-layout); }
.detail-card { border: 1px solid #e8eaf0; border-radius: var(--soy-radius); padding: 18px; background: #fff; box-shadow: none; }
.detail-card h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; }
.section-title-row { display: flex; align-items: center; justify-content: space-between; }
.detail-quick-actions { display: flex; align-items: center; gap: 8px; }
.action-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.action-form label { display: grid; gap: 7px; color: var(--soy-text-3); font-size: 12px; }
.action-form .wide { grid-column: 1 / -1; }
.action-row { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.relation-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.relation-stat { padding: 12px; border: 1px solid #efeff5; border-radius: var(--soy-radius); background: #fafbff; }
.relation-stat span { display: block; color: var(--soy-text-3); font-size: 11px; }
.relation-stat strong { display: block; margin-top: 6px; font-size: 18px; font-weight: 600; }
.relation-list { display: grid; gap: 8px; }
.detail-card .relation-list > .empty, .detail-card > .empty { min-height: 72px; }
.detail-segmented { display: inline-flex; align-items: center; gap: 3px; margin-bottom: 14px; border: 1px solid #e5e7ec; border-radius: 5px; padding: 3px; background: #f7f8fa; }
.detail-segment { min-width: 92px; height: 32px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 3px; padding: 0 13px; background: transparent; color: var(--soy-text-3); font: inherit; font-size: 12px; cursor: pointer; }
.detail-segment strong { min-width: 18px; color: inherit; font-size: 11px; font-weight: 600; }
.detail-segment:hover { color: var(--soy-primary); }
.detail-segment.active { background: #fff; color: var(--soy-primary); box-shadow: 0 1px 4px rgb(31 35 48 / 9%); }
.user-business-panel { display: none; }
.user-business-panel.active { display: block; }
.user-business-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.rights-history-panel { display: none; }
.rights-history-panel.active { display: grid; gap: 8px; }
.rights-history-row { min-height: 54px; display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 1fr) 190px; align-items: center; gap: 16px; border-bottom: 1px solid var(--soy-divider); padding: 8px 2px; }
.rights-history-row:last-child { border-bottom: 0; }
.history-reason, .history-operator { overflow: hidden; color: var(--soy-text-3); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.device-session-panel { display: none; }
.device-session-panel.active { display: grid; }
.device-session-row { min-height: 54px; display: grid; grid-template-columns: minmax(0, 1fr) auto 190px; align-items: center; gap: 16px; border-bottom: 1px solid var(--soy-divider); padding: 8px 2px; }
.device-session-row:last-child { border-bottom: 0; }
.device-session-time { overflow: hidden; color: var(--soy-text-3); font-size: 11px; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.payment-verification-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--soy-divider); border-left: 1px solid var(--soy-divider); }
.payment-verification-grid .detail-item { border-right: 1px solid var(--soy-divider); border-bottom: 1px solid var(--soy-divider); border-radius: 0; background: #fff; }
.feedback-content { margin: 0 0 16px; color: var(--soy-text-2); font-size: 13px; line-height: 1.75; white-space: pre-wrap; }
.feedback-history-panel { display: grid; }
.feedback-history-row { min-height: 54px; display: grid; grid-template-columns: minmax(220px, 1.2fr) minmax(160px, 1fr) 190px; align-items: center; gap: 16px; border-bottom: 1px solid var(--soy-divider); padding: 8px 2px; }
.feedback-history-row:last-child { border-bottom: 0; }
.relation-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #efeff5; border-radius: var(--soy-radius); }
.document-page-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.storage-key, .audit-reason { margin-top: 14px; padding: 12px 14px; border: 1px solid #efeff5; background: #fafbfc; }
.storage-key span, .audit-reason span { display: block; margin-bottom: 6px; color: var(--soy-text-3); font-size: 11px; }
.storage-key code { display: block; overflow-wrap: anywhere; color: var(--soy-text-2); font-size: 12px; line-height: 1.55; }
.audit-reason p { margin: 0; color: var(--soy-text-2); line-height: 1.65; white-space: pre-wrap; }
.audit-change-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.task-data-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.audit-change-grid > div { min-width: 0; }
.task-data-grid > div { min-width: 0; }
.json-detail { min-height: 120px; max-height: 320px; overflow: auto; margin: 0; border: 1px solid #efeff5; padding: 12px; background: #f8f9fb; color: #4c5158; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.result-note { margin-top: 10px; color: var(--soy-text-3); font-size: 11px; text-align: right; }
.relation-main { min-width: 0; }
.relation-main strong, .relation-main span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-main strong { font-size: 13px; font-weight: 550; }
.relation-main span { margin-top: 4px; color: var(--soy-text-3); font-size: 10px; }
.relation-value { font-weight: 600; }
.line-list { display: grid; gap: 8px; }
.line-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--soy-divider); }
.line-item:last-child { border-bottom: 0; }
.item-title { font-size: 13px; font-weight: 550; }
.item-meta { margin-top: 4px; color: var(--soy-text-3); font-size: 11px; }

/* Authentication */
.auth-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 18% 12%, rgb(100 108 255 / 18%), transparent 30%), radial-gradient(circle at 82% 82%, rgb(86 205 243 / 17%), transparent 30%), var(--soy-layout); }
.auth-card { width: min(400px, 94vw); border: 1px solid #e2e5eb; border-radius: 2px; padding: 32px; background: #fff; box-shadow: 0 10px 30px rgb(31 35 48 / 9%); }
.auth-card .top-logo { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; margin: -18px -18px 24px; border-radius: 0; padding: 20px 18px 18px; background: linear-gradient(145deg, #0756d8 0%, #1677ff 55%, #56b4ff 100%); }
.auth-card .top-logo::before, .auth-card .top-logo::after { display: none; }
.auth-card .top-logo .login-brand-mark { z-index: 1; width: 96px; height: 48px; display: grid; place-items: center; }
.auth-card .top-logo .login-brand-mark img { width: 96px; height: 48px; display: block; object-fit: contain; filter: drop-shadow(0 5px 9px rgb(0 40 110 / 24%)); }
.auth-card .top-logo strong {
  z-index: 1;
  color: transparent;
  background: linear-gradient(180deg, #fff, #e9f5ff 55%, #bedcff);
  background-clip: text;
  -webkit-background-clip: text;
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 4px;
  line-height: 1;
  white-space: nowrap;
}
.auth-card .top-logo > span:last-child { z-index: 1; margin-top: 3px; color: rgb(255 255 255 / 72%); font-size: 11px; letter-spacing: 2px; }
.auth-card h1 { margin: 24px 0 20px; font-size: 22px; font-weight: 650; }
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 7px; color: var(--soy-text-3); font-size: 12px; }
.auth-field { display: grid; gap: 7px; }
.auth-form .field { height: 40px; }
.email-code-field { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 8px; }
.email-code-field .ghost-button { height: 40px; padding-inline: 12px; white-space: nowrap; }
.auth-form .primary { height: 40px; margin-top: 2px; }
.auth-link { justify-self: center; border: 0; padding: 2px 8px; background: transparent; color: var(--soy-primary); font-size: 12px; cursor: pointer; }
.auth-link:hover { color: var(--soy-primary-hover); }
.password-rule { margin-top: -6px; color: var(--soy-text-3); font-size: 11px; line-height: 1.6; }
#passwordResetForm { gap: 12px; }
#passwordResetForm .field, #passwordResetForm .email-code-field .ghost-button { height: 38px; }
.auth-error { min-height: 18px; color: var(--soy-error); font-size: 12px; }
.auth-error.success { color: #16845b; }

/* Feedback */
.toast { position: fixed; z-index: 200; left: 50%; top: 24px; max-width: min(460px, 88vw); padding: 10px 15px; border: 1px solid #e6e7ed; border-radius: var(--soy-radius); background: #fff; box-shadow: 0 8px 28px rgb(0 0 0 / 12%); color: var(--soy-text-2); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, -12px); transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
