:root {
  color-scheme: light;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #dbe2ed;
  --text: #182235;
  --muted: #68758a;
  --blue: #2364d2;
  --blue-soft: #e8f0ff;
  --green: #138a52;
  --orange: #b95f12;
  --shadow: 0 12px 34px rgba(23, 35, 57, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", sans-serif;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(2px);
}

.busy-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  min-width: 280px;
  max-width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.busy-card strong {
  display: block;
  margin-bottom: 4px;
}

.busy-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.busy-spinner {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border: 3px solid #d9e3f3;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: busy-spin 0.8s linear infinite;
}

.busy-progress {
  flex: 0 0 100%;
  display: grid;
  gap: 6px;
}

.busy-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef6;
}

.busy-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
  transition: width 0.18s ease;
}

.busy-progress-meta {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

@keyframes busy-spin {
  to {
    transform: rotate(360deg);
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, #f8fafc 0%, #eef3f8 45%, #e8f0ff 100%);
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  color: var(--text);
  margin-bottom: 22px;
}

.login-card h1 {
  margin-bottom: 6px;
}

.login-card p {
  color: var(--muted);
  margin-bottom: 20px;
}

.login-card .field {
  margin-top: 12px;
}

.login-button {
  width: 100%;
  margin-top: 16px;
  height: 40px;
}

.login-error {
  min-height: 20px;
  margin-top: 10px;
  color: #b42318;
  font-size: 13px;
}

.login-demo {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #101827;
  color: #fff;
  padding: 24px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.brand-title {
  font-size: 17px;
  font-weight: 700;
}

.brand-subtitle {
  margin-top: 3px;
  color: #a7b0c1;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-submenu {
  display: grid;
  gap: 4px;
  padding-left: 10px;
}

.nav-submenu.collapsed {
  display: none;
}

.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 22px;
  padding-top: 16px;
  color: #c9d3e5;
  font-size: 13px;
}

.sidebar-logout {
  border: 1px solid #465875;
  border-radius: 6px;
  background: transparent;
  color: #fff;
  padding: 5px 8px;
  cursor: pointer;
}

.nav-item {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #c9d3e5;
  text-align: left;
  padding: 0 12px;
  cursor: pointer;
}

.nav-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
}

.nav-parent .nav-caret {
  font-size: 11px;
  opacity: 0.8;
}

.nav-parent[aria-expanded="false"] .nav-caret {
  transform: rotate(-90deg);
}

.nav-child {
  height: 34px;
  padding-left: 14px;
  font-size: 14px;
}

.nav-item.active,
.nav-item:hover {
  background: #24324a;
  color: #fff;
}

.main {
  min-width: 0;
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
}

.topbar p,
.panel-heading p,
.flow-step p {
  color: var(--muted);
}

.top-actions,
.token-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sync-days {
  height: 34px;
  border: 1px solid #bdc8d8;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
}

.sync-progress-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border: 1px solid #d8e2ef;
  border-radius: 999px;
  background: #fff;
  color: #41506a;
  font-size: 13px;
  font-weight: 700;
  padding: 0 10px;
  white-space: nowrap;
}

.sync-progress-badge.active {
  border-color: rgba(47, 104, 215, 0.28);
  background: #eef4ff;
  color: var(--blue);
}

.button {
  min-height: 34px;
  border: 1px solid #bdc8d8;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  cursor: pointer;
}

.revenue-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 72px;
  min-height: 28px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 700;
  padding: 0 10px;
}

.revenue-badge.zero {
  background: #f3f6fa;
  border-color: #e1e7f0;
  color: #526077;
}

.revenue-badge.positive {
  background: #fff7df;
  border-color: #f1c15c;
  color: #8a4b00;
}

.flag-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  min-height: 24px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
}

.flag-badge.yes {
  background: #eef4ff;
  border-color: #c8d8ff;
  color: var(--blue);
}

.flag-badge.no {
  background: #f3f6fa;
  border-color: #e1e7f0;
  color: #526077;
}

.button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.button.ghost {
  background: transparent;
}

.button.danger {
  border-color: #f3b4ad;
  background: #fff7f6;
  color: #b42318;
}

.button.danger:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.mini-button {
  min-height: 28px;
  border: 1px solid #cbd5e4;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
  cursor: pointer;
  white-space: nowrap;
}

.mini-button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.mini-button.danger {
  color: #b42318;
  border-color: #f3b4ad;
  background: #fff7f6;
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.module-toggles,
.module-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #41506a;
  font-size: 12px;
}

.module-toggles label,
.module-checks label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.module-toggles input,
.module-checks input {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
}

.module-field {
  grid-column: span 2;
}

.module-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.compact-modal {
  max-width: 520px;
}

.module-config-list {
  display: grid;
  gap: 10px;
}

.module-config-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid #dce4ef;
  border-radius: 8px;
  padding: 12px;
}

.module-config-item input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--blue);
}

.module-config-item strong,
.module-config-item small {
  display: block;
}

.module-config-item small {
  margin-top: 4px;
  color: var(--muted);
}

.chevron-button {
  width: 28px;
  height: 28px;
  border: 1px solid #cbd5e4;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.chevron-button.text-toggle {
  width: auto;
  min-width: 46px;
  padding: 0 8px;
  color: #41506a;
  font-size: 12px;
  white-space: nowrap;
}

.account-child-row {
  background: #fbfcfe;
}

.account-child-row.hidden {
  display: none;
}

.account-child-panel {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
}

.account-child-title {
  color: var(--muted);
  font-size: 12px;
}

.assigned-playlets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 170px;
  overflow: auto;
  padding-right: 4px;
}

.assigned-toggle {
  align-self: center;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.config-panel,
.table-panel,
.flow-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.playlet-upload-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
  color: #536278;
  font-size: 12px;
  white-space: nowrap;
}

.playlet-upload-stats span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #dce5f1;
  border-radius: 999px;
  background: #f8fbff;
  padding: 5px 9px;
}

.playlet-upload-stats strong {
  color: #10203a;
  font-size: 13px;
}

.playlet-tree-search {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
  border: 1px solid #dce5f1;
  border-radius: 999px;
  background: #fff;
  padding: 4px 10px;
}

.playlet-filter-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.playlet-tree-search span {
  color: var(--muted);
  font-size: 12px;
}

.playlet-tree-search input,
.playlet-tree-search select {
  width: 120px;
  min-width: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 13px;
}

.playlet-tree-search.compact-select {
  min-width: 116px;
}

.playlet-tree-search.compact-select select {
  width: 68px;
}

.panel-heading h2 {
  font-size: 17px;
}

.status-pill {
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.compact {
  grid-template-columns: minmax(240px, 360px);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid #c8d2e1;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  padding: 9px 10px;
  outline: none;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 100, 210, 0.12);
}

.field input:disabled {
  border-color: #d6dde8;
  background: #eef2f7;
  color: #8a95a8;
  cursor: not-allowed;
}

.query-action {
  align-self: end;
}

.query-action .button {
  width: 100%;
  height: 38px;
}

.checkbox-field {
  align-content: end;
}

.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
}

.check-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.token-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric-tile.emphasis {
  border-color: #b9c9e8;
  background: #fff;
}

.metric-tile.emphasis strong {
  color: var(--blue);
}

.metric-tile span {
  display: block;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
}

.metric-tile strong {
  display: block;
  font-size: 25px;
  margin-top: 8px;
}

.table-heading {
  align-items: flex-start;
}

.adjustment-tools {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.adjustment-panel {
  display: none;
}

.compact-date {
  min-width: 170px;
}

.date-range-field {
  min-width: 360px;
}

.date-range-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.date-range-inline input {
  width: 100%;
  height: 40px;
}

.date-range-inline span {
  color: var(--muted);
  font-size: 13px;
}

.date-range-inline input:disabled {
  background: #edf1f6;
  color: #8a94a6;
  cursor: not-allowed;
}

.date-range-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 40px;
  border: 1px solid #d8dde8;
  border-radius: 8px;
  background: #f4f4f4;
  color: var(--text);
  padding: 0 12px;
  text-align: left;
  cursor: pointer;
}

.date-range-trigger:disabled {
  color: #8a94a6;
  cursor: not-allowed;
  background: #edf1f6;
}

.date-range-trigger strong {
  font-size: 14px;
  font-weight: 600;
}

.date-range-icon {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  color: #667085;
  font-size: 13px;
}

.date-range-popover {
  position: fixed;
  z-index: 80;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.18);
  overflow: hidden;
}

.date-picker-head {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  height: 52px;
}

.date-picker-head strong {
  text-align: center;
  font-size: 16px;
}

.date-nav {
  border: 0;
  background: transparent;
  color: #111827;
  font-size: 30px;
  cursor: pointer;
}

.date-weekdays,
.date-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
  padding: 0 14px;
}

.date-weekdays span {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  padding: 8px 0;
}

.date-days {
  row-gap: 6px;
  padding-bottom: 14px;
}

.date-day {
  width: 100%;
  height: 36px;
  border: 0;
  background: transparent;
  color: #111827;
  font-weight: 700;
  cursor: pointer;
}

.date-day.blank {
  cursor: default;
}

.date-day.in-range {
  background: #ffe6ed;
}

.date-day.selected {
  border-radius: 999px;
  background: #ff2d5f;
  color: #fff;
}

.date-day.today:not(.selected) {
  border: 1px solid #d4dae5;
  border-radius: 999px;
}

.date-picker-actions {
  border-top: 1px solid #edf1f7;
  padding: 26px 14px 14px;
}

.date-picker-actions .button {
  width: 100%;
  height: 44px;
  border-radius: 8px;
  background: #ff2d5f;
  border-color: #ff2d5f;
}

.adjustment-total {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.adjustment-total strong {
  color: var(--text);
}

.cache-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 13px;
  white-space: nowrap;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.dot.warn {
  background: var(--orange);
}

.table-wrap {
  overflow-x: auto;
}

.account-split {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  gap: 16px;
  align-items: start;
}

.account-card,
.playlet-card {
  min-width: 0;
}

.compact-table {
  min-width: 0;
  font-size: 13px;
}

.compact-table th,
.compact-table td {
  white-space: nowrap;
  padding: 10px 8px;
}

.compact-table th:nth-child(2),
.compact-table td:nth-child(2) {
  min-width: 76px;
}

.compact-table th:nth-child(3),
.compact-table td:nth-child(3) {
  min-width: 76px;
}

.compact-table .tag {
  min-width: 0;
  padding: 4px 8px;
  font-size: 12px;
}

.compact-table .mini-button {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 12px;
}

.compact-table .chevron-button.text-toggle {
  min-width: 38px;
  height: 28px;
  padding: 0 6px;
  font-size: 12px;
}

.tree-list {
  display: grid;
  gap: 10px;
}

.tree-node {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  overflow: visible;
  background: #fff;
}

.tree-parent {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  border: 0;
  background: #fbfcfe;
  padding: 0 12px;
  color: var(--text);
  cursor: pointer;
}

.tree-parent-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  min-width: 0;
}

.tree-name {
  cursor: text;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-failed-text {
  color: #c81e1e !important;
}

.sync-failed-node .tree-count,
.sync-failed-node .publisher-title-actions {
  color: #c81e1e;
}

.playlet-name.sync-failed-text {
  font-weight: 600;
}

.tree-name-input {
  width: min(280px, 42vw);
  height: 30px;
  border: 1px solid var(--blue);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  padding: 0 8px;
  outline: none;
  box-shadow: 0 0 0 3px rgba(47, 104, 215, 0.12);
}

.tree-chevron {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 5px;
  background: #eef3f8;
  color: #41506a;
  transition: transform 0.18s ease;
}

.tree-node.collapsed .tree-chevron {
  transform: rotate(-90deg);
}

.tree-count {
  color: var(--muted);
  font-size: 12px;
}

.tree-parent-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.tree-action-button {
  display: inline-flex;
  align-items: center;
}

.action-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-more-button {
  display: inline-grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid #c9d6e8;
  border-radius: 7px;
  background: #fff;
  color: #41506a;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.icon-more-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.action-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  display: grid;
  min-width: 116px;
  overflow: hidden;
  border: 1px solid #d8e2ef;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(18, 30, 50, 0.14);
  padding: 4px;
}

.action-menu-panel[hidden] {
  display: none;
}

.action-menu-panel button {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.action-menu-panel button:hover {
  background: #eef4ff;
}

.action-menu-panel button.danger {
  color: #d92d20;
}

.action-menu-panel button.danger:hover {
  background: #fff1f0;
}

.tree-children {
  display: grid;
}

.tree-node.collapsed .tree-children {
  display: none;
}

.tree-empty {
  border: 1px dashed #d8e2ef;
  border-radius: 8px;
  color: var(--muted);
  padding: 28px 16px;
  text-align: center;
}

.tree-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.3fr) 74px minmax(160px, 1.1fr) 70px 80px 120px;
  gap: 10px;
  align-items: center;
  border-top: 1px solid #e8edf5;
  padding: 11px 12px;
}

.flag-select {
  width: 58px;
  height: 30px;
  border: 1px solid #c9d6e8;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 6px;
}

.tree-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.role-group {
  border-top: 1px solid #e8edf5;
}

.role-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #f4f7fb;
  color: #41506a;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
}

.publisher-group {
  border-top: 1px solid #e8edf5;
}

.publisher-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: #fbfcfe;
  color: #182235;
  font-size: 13px;
  font-weight: 700;
  padding: 9px 12px 9px 32px;
  cursor: pointer;
}

.publisher-title-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.publisher-chevron {
  display: inline-grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 5px;
  background: #eef3f8;
  color: #41506a;
  transition: transform 0.18s ease;
}

.publisher-group.collapsed .publisher-chevron {
  transform: rotate(-90deg);
}

.publisher-children:empty {
  display: none;
}

.publisher-title-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.publisher-title-actions > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.sync-progress {
  position: relative;
  display: block;
  width: 96px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.sync-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: var(--blue);
  animation: progress-slide 1.05s ease-in-out infinite;
}

.sync-progress-text {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

@keyframes progress-slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(240%);
  }
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e5ebf3;
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
}

.sort-button:hover,
.sort-button.active {
  color: var(--blue);
}

.sort-indicator {
  min-width: 12px;
  font-size: 12px;
  line-height: 1;
}

td.numeric {
  font-variant-numeric: tabular-nums;
}

.empty-cell {
  height: 92px;
  color: var(--muted);
  text-align: center;
}

.daily-detail-row {
  background: #f8fafc;
}

.daily-detail-row > td {
  padding: 0 10px 14px;
}

.daily-detail-box {
  border: 1px solid #dce4ef;
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.daily-detail-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.daily-detail-table {
  min-width: 0;
}

.daily-detail-table th,
.daily-detail-table td {
  padding: 9px 8px;
}

.tag {
  display: inline-block;
  min-width: 44px;
  border-radius: 999px;
  background: #eef3f8;
  color: #3a4658;
  padding: 4px 9px;
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
}

.tag.danger {
  background: #fff1f0;
  color: #cf1322;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
}

.sort-button:hover,
.sort-button.active {
  color: var(--blue);
}

.sort-indicator {
  min-width: 12px;
  font-size: 12px;
  line-height: 1;
}

.failure-log-table {
  min-width: 960px;
}

.failure-log-table td:last-child {
  max-width: 520px;
  white-space: normal;
  word-break: break-word;
}


.flow-panel {
  margin-top: 16px;
}

.account-json {
  margin-top: 14px;
}

.optional-cookie-field {
  margin-top: 14px;
}

.optional-cookie-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.cookie-import-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hidden-file-input {
  display: none;
}

label.mini-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.cookie-param-list {
  display: grid;
  gap: 10px;
}

#cookieImportList:not(:empty),
#newAccountCookieList:has(.cookie-import-summary) {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid #dbe2ed;
  border-radius: 8px;
  background: #fbfcfe;
  padding: 10px;
}

.cookie-param-item {
  position: relative;
}

.cookie-param-item .remove-cookie-param {
  justify-self: end;
}

.cookie-param-hidden {
  display: none;
}

.cookie-import-summary {
  border: 1px solid #dbe2ed;
  border-radius: 6px;
  background: #fff;
  color: #41506a;
  padding: 10px 12px;
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 18, 32, 0.48);
  z-index: 20;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 22px 60px rgba(10, 18, 32, 0.28);
  padding: 18px;
}

.modal-actions {
  position: sticky;
  bottom: -18px;
  margin: 16px -18px -18px;
  padding: 14px 18px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), #fff 38%);
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.modal-header h2 {
  font-size: 18px;
  margin: 0 0 6px;
}

.modal-header p {
  color: var(--muted);
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 1px solid #cbd5e4;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.operation-log-modal {
  width: min(720px, 100%);
}

.operation-log-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.operation-log-stat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.operation-log-stat span,
.operation-log-meta {
  color: var(--muted);
  font-size: 12px;
}

.operation-log-stat strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 22px;
}

.operation-log-stat.danger strong {
  color: #b42318;
}

.operation-log-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.operation-log-list {
  max-height: 380px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.operation-log-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 38px;
  border-bottom: 1px solid #edf1f7;
  padding: 8px 12px;
}

.operation-log-item:last-child {
  border-bottom: 0;
}

.operation-log-item span {
  color: var(--muted);
  font-size: 12px;
}

.operation-log-item strong {
  font-weight: 500;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}

.select-actions {
  display: none;
  gap: 8px;
}

.select-actions.active {
  display: flex;
}

.playlet-card .panel-heading {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: start;
}

.playlet-card .panel-heading > .button {
  margin-left: auto;
}

.playlet-card .panel-heading .select-actions.active + .button {
  display: none;
}

.playlet-card .panel-heading .playlet-tree-search {
  grid-column: 3;
}

.playlet-card .panel-heading .select-actions.active {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.select-actions .button {
  min-width: 82px;
  white-space: nowrap;
}

#selectAllPlaylets {
  min-width: 118px;
}

.select-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.select-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.group-select {
  font-weight: 700;
}

.placeholder-view {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 28px;
  color: var(--muted);
}

.placeholder-view h1 {
  color: var(--text);
  margin-bottom: 8px;
}

.flow-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.flow-step {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  padding: 14px;
  background: #fbfcfe;
}

.flow-step span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: #17233a;
  color: #fff;
  font-weight: 700;
  margin-bottom: 10px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .form-grid,
  .summary-grid,
  .flow-grid,
  .account-split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .main {
    padding: 16px;
  }

  .topbar,
  .panel-heading,
  .token-box {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .form-grid,
  .summary-grid,
  .flow-grid,
  .nav-list,
  .account-split {
    grid-template-columns: 1fr;
  }
}

.pager-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}
.form-hint {
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}
#huaweiReportBody td,
#huaweiLogBody td {
  white-space: nowrap;
}
