
/* Modern workspace refinement */
:root {
  --soy-primary: #6767e9;
  --soy-primary-hover: #5758d8;
  --soy-primary-pressed: #494bc6;
  --soy-layout: #f3f5f9;
  --soy-text: #172033;
  --soy-text-2: #3b4557;
  --soy-text-3: #7f8898;
  --soy-border: #e1e5ec;
  --soy-divider: #eceff4;
  --soy-header-height: 66px;
  --soy-sider-width: 224px;
  --soy-radius: 9px;
  --soy-shadow-header: none;
  --soy-shadow-sider: none;
}
body { background: var(--soy-layout); }
.sidebar {
  padding: 12px 12px 14px;
  border-right: 0;
  background: linear-gradient(180deg, #171b2b 0%, #111522 100%);
  box-shadow: 8px 0 30px rgb(17 24 39 / 8%);
}
.sidebar-brand {
  height: 84px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 3px;
  margin: 0 0 14px;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
  border-radius: 0;
  padding: 5px 10px 9px;
  background: transparent;
}
.brand-mark { width: 64px; height: 34px; }
.brand-mark img { width: 64px; height: 34px; }
.brand-mark img { filter: drop-shadow(0 4px 8px rgb(0 0 0 / 24%)); object-fit: contain; }
.brand-copy strong {
  color: #fff;
  background: none;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .08em;
  line-height: 1.1;
  text-shadow: none;
}
.nav { gap: 2px; }
.nav-group-title {
  margin: 14px 12px 5px;
  color: #687186;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
}
.nav-group-overview { margin-top: 0; }
.nav-button {
  height: 42px;
  gap: 11px;
  border-radius: 8px;
  padding: 0 12px;
  color: #aab2c3;
  font-size: 13px;
  transition: color .16s, background .16s, box-shadow .16s, transform .16s;
}
.nav-button svg { width: 18px; height: 18px; }
.nav-button:hover { color: #fff; background: rgb(255 255 255 / 6%); transform: translateX(2px); }
.nav-button.active {
  color: #fff;
  background: linear-gradient(110deg, #6767e9, #5659d7);
  box-shadow: 0 8px 20px rgb(70 72 190 / 26%), inset 0 0 0 1px rgb(255 255 255 / 8%);
  font-weight: 650;
  transform: none;
}
.side-link {
  height: 36px;
  margin-inline: 2px;
  border: 1px solid rgb(255 255 255 / 9%);
  border-radius: 8px;
  background: rgb(255 255 255 / 4%);
  color: #7f899d;
}
.side-link:hover { color: #fff; background: rgb(255 255 255 / 8%); }
.sidebar-version {
  min-height: 62px;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  margin: auto 10px 0;
  border-top: 1px solid rgb(255 255 255 / 7%);
  padding: 11px 10px 2px;
  color: #697387;
  font-variant-numeric: tabular-nums;
}
.sidebar-version strong, .sidebar-version small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-version strong { max-width: 100%; color: #d2d7e0; font-size: 14px; font-weight: 730; letter-spacing: .01em; line-height: 1.25; }
.sidebar-version small { max-width: 100%; color: #828da0; font-size: 11px; font-weight: 560; line-height: 1.3; }
.runtime-metric { position: relative; }
@media (max-width: 980px) {
  .dashboard-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.topbar {
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid rgb(222 226 234 / 90%);
  background: rgb(255 255 255 / 92%);
  box-shadow: 0 5px 18px rgb(31 41 55 / 4%);
  backdrop-filter: blur(18px);
}
.title-copy h1 { font-size: 18px; font-weight: 720; letter-spacing: -.02em; }
.actions { gap: 8px; }
.service-state { height: 34px; border-color: #dcece5; border-radius: 8px; background: #f3faf7; color: #567266; }
.admin-chip { min-width: 220px; }
.content { padding: 22px 24px 36px; }
.page-heading { margin-bottom: 14px; }
.page-heading h2 { font-size: 18px; font-weight: 680; }
.field, .select, .section-control { height: 36px; border-color: #dfe3ea; border-radius: 7px; }
.field:focus, .select:focus, .section-control:focus { border-color: var(--soy-primary); box-shadow: 0 0 0 3px rgb(91 97 230 / 11%); }
.list-tools, .task-tools {
  margin-bottom: 14px;
  border: 1px solid #e1e5ec;
  border-radius: 12px;
  padding: 15px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(31 41 55 / 5%);
}
.result-summary {
  min-height: 56px;
  border: 1px solid #e1e5ec;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: linear-gradient(180deg, #fff, #fdfdfe);
}
.table-wrap { border-right: 1px solid #e1e5ec; border-left: 1px solid #e1e5ec; }
#tasksView .table-wrap,
#feedbackView .table-wrap { border-top: 1px solid #e1e5ec; border-radius: 12px 12px 0 0; }
.pager {
  border: 1px solid #e1e5ec;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  box-shadow: 0 8px 24px rgb(31 41 55 / 4%);
}
th { height: 44px; background: #f7f8fb; color: #677185; font-size: 11px; font-weight: 650; letter-spacing: .02em; }
td { height: 52px; }
tbody tr:hover { background: #f6f7ff; }
#usersTableWrap th:first-child, #usersTableWrap th:last-child,
#ordersTableWrap th:first-child, #ordersTableWrap th:last-child { background: #f8f9fb; }
.section,
.module-panel,
.detail-card {
  border-color: #e1e5ec;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgb(31 41 55 / 5%);
}
.section-head { min-height: 54px; border-bottom-color: #edf0f4; }
.section-head h2, .flat-head h2 { font-size: 14px; font-weight: 650; }
.module-tabs { height: 48px; border: 1px solid #e1e5ec; border-bottom: 0; border-radius: 12px 12px 0 0; padding-inline: 8px; box-shadow: 0 5px 18px rgb(31 41 55 / 4%); }
.module-tab { height: 48px; padding-inline: 16px; }
.module-tab.active::after { left: 15px; right: 15px; height: 3px; }
.detail-item, .relation-stat { border-radius: 8px; }
.relation-row { border-radius: 8px; }
.modal { background: rgb(17 24 39 / 42%); backdrop-filter: blur(4px); }
.modal-panel { border-radius: 12px; box-shadow: 0 24px 64px rgb(16 24 40 / 18%); }
.modal-head { height: 60px; }
.modal-body { padding: 18px; }
.analytics-row { gap: 12px; margin-top: 12px; }
.analytics-card { border-radius: 12px; }
.primary { background: linear-gradient(135deg, #6f6ff0, #5759d7); box-shadow: 0 5px 12px rgb(87 89 215 / 22%); }
.primary:hover:not(:disabled) { background: linear-gradient(135deg, #6263e2, #4e51ca); box-shadow: 0 7px 16px rgb(87 89 215 / 28%); }
.badge { border-radius: 6px; }
.empty { color: #9aa2af; }
.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: #c7ccd6; background-clip: padding-box; }
.auth-card { border-radius: 14px; box-shadow: 0 20px 56px rgb(31 35 48 / 12%); }
.toast { border-radius: 8px; }

@media (max-width: 1180px) {
  .service-state { display: none; }
  .admin-chip { min-width: 194px; }
  .admin-identity span { max-width: 126px; }
  #usersView .list-tools { grid-template-columns: minmax(190px, 1fr) 110px 110px 126px auto auto; }
  #ordersView .list-tools { grid-template-columns: minmax(190px, 1fr) 126px repeat(3, 110px) auto auto; }
  #ordersView .list-tools select:nth-of-type(3), #ordersView .list-tools select:nth-of-type(4) { display: none; }
}

@media (max-width: 840px) {
  :root { --soy-sider-width: 64px; }
  .sidebar { padding-inline: 8px; }
  .sidebar-brand { width: 48px; height: 52px; justify-content: center; margin: 8px 0 2px; border-radius: 2px; padding: 0; }
  .brand-mark { width: 44px; height: 36px; }
  .brand-mark img { width: 44px; height: 30px; }
  .brand-copy, .nav-label, .nav-group-title, .nav-button span, .side-link, .sidebar-version { display: none; }
  .nav-button { justify-content: center; padding: 0; }
  .topbar { padding-inline: 12px; }
  .title-copy h1 { font-size: 14px; }
  .service-state, .admin-chip { display: none; }
  .content { padding: 12px; }
  .list-tools, .task-tools, #usersView .list-tools, #ordersView .list-tools, #feedbackView .list-tools, #systemView .list-tools { grid-template-columns: 1fr; }
  #systemView .session-tools, #systemView .system-audit-tools { grid-template-columns: 1fr; }
  #ordersView .list-tools select:nth-of-type(3), #ordersView .list-tools select:nth-of-type(4) { display: block; }
  .dashboard-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-flow { grid-template-columns: 1fr; }
  .detail-grid, .action-form { grid-template-columns: 1fr; }
  .action-form .wide { grid-column: auto; }
  .relation-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .payment-verification-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .role-toolbar { grid-template-columns: 1fr; }
  .role-filters { grid-template-columns: 1fr; }
  .role-page-actions { justify-content: flex-end; }
}

@media (max-width: 520px) {
  .actions #refreshButton { display: inline-flex; width: 36px; height: 36px; }
  .dashboard-summary-grid { grid-template-columns: 1fr; }
  .page-heading h2 { font-size: 16px; }
  .result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 0; padding-block: 12px; }
  #ordersView .result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tasksView .result-summary, #feedbackView .result-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .result-summary-item { padding-inline: 10px; }
  .result-summary-item:nth-child(3)::before { display: none; }
  .modal { padding: 8px; }
  .relation-row { grid-template-columns: minmax(0, 1fr) auto; }
  .relation-row .relation-value { display: none; }
  .audit-change-grid, .task-data-grid { grid-template-columns: 1fr; }
  .rights-history-row { grid-template-columns: 1fr; gap: 5px; }
  .feedback-history-row { grid-template-columns: 1fr; gap: 5px; }
  .device-session-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .device-session-time { grid-column: 1 / -1; text-align: left; }
  .payment-verification-grid { grid-template-columns: 1fr; }
}

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

@media (forced-colors: active) {
  button:focus-visible,
  a:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  [tabindex]:focus-visible {
    outline: 2px solid Highlight !important;
    outline-offset: 2px;
    box-shadow: none !important;
  }
  .badge,
  .service-state,
  .dashboard-summary-panel,
  .section,
  .module-panel,
  .detail-card { border: 1px solid CanvasText; }
  .state-dot,
  .system-service-metric i { forced-color-adjust: none; background: Highlight; }
}

@media (pointer: coarse) {
  .primary,
  .ghost-button,
  .danger-button,
  .pager button { height: 40px; }
  .table-link { min-height: 40px; }
  .cell-action .table-link { height: 40px; }
  .json-view-link { width: 40px; height: 40px; }
  .modal .modal-close { width: 40px; height: 40px; flex-basis: 40px; }
}

/* Unified summary panels: same layout and placement as the user list. */
.result-summary {
  min-height: 66px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid #e1e5ec;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 8px 24px rgb(31 41 55 / 5%);
}
.result-summary .result-summary-item {
  --summary-color: #5575df;
  --summary-border: rgb(85 117 223 / 19%);
  --summary-bg: #fafbff;
  width: max-content;
  min-width: 154px;
  max-width: 250px;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  position: relative;
  border: 1px solid var(--summary-border);
  border-radius: 999px;
  padding: 0 13px 0 10px;
  background: var(--summary-bg);
  box-shadow: 0 2px 7px rgb(31 41 55 / 4%);
}
.result-summary .result-summary-item::before {
  content: "";
  position: static;
  width: 18px;
  height: 18px;
  display: block;
  flex: 0 0 18px;
  border: 0;
  border-radius: 50%;
  background: var(--summary-color);
}
.result-summary .result-summary-item::after { display: none; }
.result-summary .result-summary-item + .result-summary-item { border-left: 1px solid var(--summary-border); }
.result-summary .result-summary-item span {
  overflow: hidden;
  color: #596579;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-summary .result-summary-item strong {
  margin: 0 0 0 auto;
  color: var(--summary-color);
  font-size: 15px;
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.result-summary .result-summary-item:nth-child(2) {
  --summary-color: #17a673;
  --summary-border: rgb(23 166 115 / 20%);
  --summary-bg: #f9fdfa;
}
.result-summary .result-summary-item:nth-child(3) {
  --summary-color: #e69524;
  --summary-border: rgb(230 149 36 / 22%);
  --summary-bg: #fffdf8;
}
.result-summary .result-summary-item:nth-child(4) {
  --summary-color: #7a5bea;
  --summary-border: rgb(122 91 234 / 20%);
  --summary-bg: #fbfaff;
}
#tasksView .result-summary-item:nth-child(4),
#systemBlocksPanel .result-summary-item:nth-child(2),
#systemAuditPanel .result-summary-item:nth-child(3),
#systemStoragePanel .result-summary-item:nth-child(4) {
  --summary-color: #d54855;
  --summary-border: rgb(213 72 85 / 19%);
  --summary-bg: #fffafb;
}
#usersView .result-summary-item:nth-child(4),
#systemSessionsPanel .result-summary-item:nth-child(4),
#systemBlocksPanel .result-summary-item:nth-child(4) {
  --summary-color: #65748b;
  --summary-border: rgb(101 116 139 / 20%);
  --summary-bg: #fbfcfd;
}
#feedbackView .result-summary-item:nth-child(4),
#systemBlocksPanel .result-summary-item:nth-child(3) {
  --summary-color: #17a673;
  --summary-border: rgb(23 166 115 / 20%);
  --summary-bg: #f9fdfa;
}
#usersResultSummary .filter-summary-item[hidden] { display: none; }
.result-summary .result-summary-item.filter-summary-item {
  --summary-color: #65748b;
  --summary-border: rgb(101 116 139 / 20%);
  --summary-bg: #fbfcfd;
  margin-left: auto;
}
.result-summary .filter-summary-item[hidden] { display: none; }
.count-link { padding-inline: 2px; border-radius: 0; color: #4f5fd5; font-weight: 650; }
.count-link:hover { background: transparent; color: #383fb6; }
.chevron-link::after { content: "›"; margin-left: 5px; color: currentColor; font-size: 17px; font-weight: 500; line-height: 1; transition: transform .18s; }
.chevron-link:hover::after { transform: translateX(2px); }
.json-view-link { display: inline-grid; width: 30px; height: 30px; place-items: center; border: 1px solid #dfe4f0; border-radius: 9px; background: #f7f8ff; color: #5364d9; line-height: 1; cursor: pointer; box-shadow: 0 2px 7px rgb(75 88 184 / 8%); transition: border-color .18s, background .18s, box-shadow .18s, transform .18s; }
.json-view-link svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.json-view-link:hover { border-color: #b8c1ec; background: #eef1ff; box-shadow: 0 4px 10px rgb(75 88 184 / 14%); transform: translateY(-1px); }
.json-view-link:disabled { border-color: #e8ebf1; background: #fafbfc; color: #c2c7d0; box-shadow: none; cursor: default; transform: none; }
.table-actions { display: inline-flex; align-items: center; gap: 12px; white-space: nowrap; }
.danger-link { color: #d54855; }
.danger-link:hover { color: #bb2f3e; background: #fff2f3; }
.json-detail-large { min-height: 260px; max-height: 60vh; white-space: pre; }
.task-payload-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.task-payload-card { min-width: 0; min-height: 68px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid #e7eaf1; border-radius: 11px; background: linear-gradient(135deg, #fbfcff, #f7f8fc); }
.task-payload-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: #e9edff; color: #5262d5; }
.task-payload-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.task-payload-info { min-width: 0; display: grid; gap: 3px; }
.task-payload-info strong { color: #283246; font-size: 12px; font-weight: 700; }
.task-payload-info span { overflow: hidden; color: #8b94a4; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.task-payload-open { height: 30px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 8px; padding: 0 9px; background: #fff; color: #5262d5; font: inherit; font-size: 11px; font-weight: 650; box-shadow: 0 1px 5px rgb(31 41 55 / 8%); cursor: pointer; }
.task-payload-open span { font-size: 17px; line-height: 1; transition: transform .18s; }
.task-payload-open:hover span { transform: translateX(2px); }
.task-payload-open:disabled { color: #aab1bd; box-shadow: none; cursor: default; }

/* Task payload viewer: local tree renderer, independent from external CDNs. */
.modal .modal-panel.json-viewer-modal { width: min(880px, 96vw); }
.modal .json-viewer-modal .modal-body { padding: 0 22px 22px; }
.json-viewer { padding-top: 16px; }
.json-viewer-meta { min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; padding: 0 14px; border: 1px solid #e8ebf2; border-radius: 11px; background: #f8f9fc; }
.json-viewer-meta > div { min-width: 0; display: flex; align-items: center; gap: 9px; }
.json-viewer-meta span { color: #5262d5; font-size: 12px; font-weight: 700; }
.json-viewer-meta strong { color: #8b94a4; font-size: 11px; font-weight: 560; }
.json-viewer-meta code { max-width: 48%; overflow: hidden; color: #7a8496; font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }
.json-viewer-toolbar { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.json-viewer-tabs { display: inline-flex; gap: 3px; padding: 3px; border-radius: 9px; background: #f0f2f6; }
.json-viewer-tabs button { min-width: 58px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: #778195; font: inherit; font-size: 11px; font-weight: 650; cursor: pointer; }
.json-viewer-tabs button.active { background: #fff; color: #4f5fd5; box-shadow: 0 1px 5px rgb(31 41 55 / 10%); }
.json-viewer-actions { display: flex; align-items: center; gap: 4px; }
.json-viewer-actions button { height: 30px; display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 7px; padding: 0 8px; background: transparent; color: #7b8494; font: inherit; font-size: 10px; font-weight: 600; cursor: pointer; }
.json-viewer-actions button:hover { background: #f3f5f8; color: #4f5fd5; }
.json-viewer-actions .json-copy-button { margin-left: 3px; padding-inline: 10px; background: #5665d8; color: #fff; }
.json-viewer-actions .json-copy-button:hover, .json-viewer-actions .json-copy-button.copied { background: #4655c5; color: #fff; }
.json-copy-button svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.json-viewer-body { min-height: 330px; max-height: min(62vh, 620px); overflow: auto; border: 1px solid #e5e9f0; border-radius: 12px; background: #fbfcfe; scrollbar-color: #cdd3df transparent; scrollbar-width: thin; }
.json-tree-panel { min-width: max-content; padding: 14px 16px 18px; color: #596273; font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.json-tree-branch { min-width: 0; }
.json-tree-branch > summary { min-height: 25px; display: flex; align-items: center; gap: 6px; padding-left: calc(var(--json-depth) * 18px); border-radius: 5px; list-style: none; cursor: pointer; }
.json-tree-branch > summary::-webkit-details-marker { display: none; }
.json-tree-branch > summary::before { content: ""; width: 6px; height: 6px; flex: 0 0 6px; border-right: 1.5px solid #9aa3b2; border-bottom: 1.5px solid #9aa3b2; transform: rotate(-45deg); transition: transform .15s; }
.json-tree-branch[open] > summary::before { transform: rotate(45deg) translate(-1px, -1px); }
.json-tree-branch > summary:hover, .json-tree-leaf:hover { background: #f1f3f8; }
.json-tree-branch[open] > summary .json-branch-close { display: none; }
.json-tree-branch:not([open]) > .json-tree-children, .json-tree-branch:not([open]) > .json-tree-ending { display: none; }
.json-tree-ending { min-height: 22px; padding-left: calc((var(--json-depth) * 18px) + 12px); color: #7a8494; }
.json-tree-leaf { min-height: 25px; display: flex; align-items: baseline; gap: 6px; padding: 2px 8px 2px calc((var(--json-depth) * 18px) + 12px); border-radius: 5px; white-space: pre-wrap; }
.json-key { color: #3348a6; font-weight: 650; }
.json-colon, .json-bracket { color: #7a8494; }
.json-count { padding: 1px 6px; border-radius: 9px; background: #eef1f6; color: #8a93a2; font-family: inherit; font-size: 9px; line-height: 16px; }
.json-string { color: #148260; }
.json-number { color: #a552d1; }
.json-boolean { color: #d36b28; font-weight: 650; }
.json-null { color: #9aa2af; font-style: italic; }
.json-source-panel { min-height: 100%; margin: 0; padding: 17px 19px; color: #39445a; font: 12px/1.75 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.json-source-panel[hidden], .json-tree-panel[hidden] { display: none; }
.confirm-message { margin: 16px 0 0; color: #6b7280; font-size: 13px; line-height: 1.7; }
