/*
 * Backend visual system rebuilt from the Dinghuo company-scripts template.
 * This file intentionally overrides layout and component presentation only.
 */
:root {
  color-scheme: light;
  --bg: #f3f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f4f8ff;
  --text: #172033;
  --muted: #718096;
  --line: #dfe5ee;
  --line-strong: #b7c2d2;
  --green: #0aa36c;
  --green-2: #087e55;
  --teal: #0aa36c;
  --blue: #2367ed;
  --blue-2: #1553c5;
  --amber: #f18a28;
  --red: #df3f45;
  --slate: #172033;
  --sidebar: #ffffff;
  --shadow: 0 16px 40px rgba(30, 50, 80, 0.09);
  --radius: 20px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

html {
  background: var(--bg);
}

body {
  min-width: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(35, 103, 237, 0.16);
  outline-offset: 2px;
}

h1,
h2,
h3,
h4,
strong,
.item-title {
  color: var(--text);
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 24px;
  line-height: 1.25;
}

h3 {
  font-size: 20px;
  line-height: 1.3;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

/* Dashboard frame */
.shell {
  width: 100%;
  max-width: 1680px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  gap: 18px;
}

.sidebar {
  position: sticky;
  top: 20px;
  height: calc(100vh - 40px);
  min-width: 0;
  overflow: auto;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  align-content: start;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar > .stack {
  gap: 14px;
}

.brand {
  gap: 13px;
}

.mark {
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(145deg, #ffd34d, #f1791b);
  color: #172033;
  box-shadow: 0 8px 18px rgba(241, 138, 40, 0.25);
  font-size: 13px;
  font-weight: 900;
}

.mark.has-logo {
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: none;
}

.brand strong {
  font-size: 18px;
  line-height: 1.22;
  font-weight: 850;
}

.brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.account-card {
  padding: 12px;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.account-copy strong {
  font-size: 14px;
  font-weight: 800;
}

.account-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.account-menu-button {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #eef2f7;
  color: #526279;
}

.account-menu-button:hover,
.account-card.menu-open .account-menu-button {
  background: #e1e7ef;
}

.account-actions {
  top: calc(100% + 8px);
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(30, 50, 80, 0.14);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.account-actions .ghost {
  min-height: 34px;
  border-radius: 10px;
}

nav {
  gap: 15px;
}

.nav-group {
  gap: 7px;
}

.nav-label {
  margin: 2px 8px 1px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.nav,
.nav-parent,
.site-browser-nav {
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 12px;
  color: #42506a;
  font-size: 14px;
  font-weight: 700;
}

.site-browser-nav {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.nav-parent {
  border: 0;
  background: transparent;
  color: #42506a;
  font-weight: 800;
}

.nav-parent:hover,
.nav:hover {
  background: #f5f8fc;
  color: var(--text);
}

.nav.active {
  background: #eaf2ff;
  color: #1553c5;
  font-weight: 800;
}

.nav-section {
  gap: 5px;
}

.sub-nav {
  min-height: 38px;
  padding-left: 22px;
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 0;
  display: grid;
  gap: 18px;
  align-content: start;
}

.topbar {
  position: sticky;
  top: 20px;
  z-index: 18;
  min-height: 86px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.topbar h2 {
  font-size: 24px;
  font-weight: 850;
}

.topbar .hint {
  margin-top: 3px;
  font-size: 14px;
}

.tab-view {
  min-width: 0;
}

.tab-view:not(.hidden) {
  display: grid;
  gap: 18px;
}

/* Shared cards and layout */
.panel,
.metrics article,
.item {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.panel {
  padding: 20px;
  gap: 16px;
  border-radius: var(--radius);
}

.panel-head {
  gap: 16px;
  align-items: flex-start;
}

.panel-head h3 {
  font-size: 20px;
  font-weight: 850;
}

.panel-head .hint {
  max-width: 55%;
  text-align: right;
}

.split {
  gap: 18px;
}

.metrics {
  gap: 10px;
}

#platformMetricGrid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.metrics article {
  min-height: 88px;
  padding: 14px;
  gap: 2px;
  border-color: #edf0f5;
  border-radius: 14px;
  background: #f8fafc;
  box-shadow: none;
}

.metrics span {
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
  font-weight: 850;
}

.metrics small,
.metrics em {
  color: var(--muted);
  font-size: 12px;
}

.list {
  gap: 11px;
}

.item {
  padding: 15px;
  gap: 10px;
  border-radius: 16px;
  box-shadow: none;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.item:hover {
  border-color: #aab8ca;
  box-shadow: 0 8px 24px rgba(30, 50, 80, 0.06);
  transform: translateY(-1px);
}

.item-title {
  font-size: 17px;
  line-height: 1.35;
  font-weight: 850;
}

.item small,
.item p,
.item pre {
  font-size: 13px;
}

.item small {
  color: var(--muted);
}

.actions {
  gap: 8px;
}

.badge {
  min-height: 24px;
  padding: 3px 8px;
  border: 0;
  border-radius: 999px;
  background: #eef3f9;
  color: #526279;
  font-size: 12px;
  font-weight: 750;
}

.badge.active,
.badge.approved,
.badge.pro,
.badge.owner,
.badge.completed,
.badge.live {
  background: #e7f7f0;
  color: #087e55;
}

.badge.pending,
.badge.awaiting_review,
.badge.starter,
.badge.setup {
  background: #fff6dd;
  color: #8e5b00;
}

.badge.suspended,
.badge.disabled,
.badge.rejected,
.badge.needs_revision,
.badge.cancelled {
  background: #fff0f0;
  color: #b72d33;
}

.badge.super_admin,
.badge.enterprise,
.badge.admin,
.badge.ops,
.badge.finance,
.badge.operator {
  background: #eaf2ff;
  color: #1553c5;
}

pre,
.result-box,
.quote-draft-total,
.quote-line-price-row {
  border: 1px solid #edf0f5;
  border-radius: 12px;
  background: #f8fafc;
  color: #526079;
}

/* Buttons and fields */
.primary,
.ghost,
.link-button {
  min-height: 40px;
  padding: 9px 15px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.2;
  box-shadow: none;
}

.primary {
  border: 1px solid #172033;
  background: #172033;
  color: #fff;
}

.primary:hover {
  border-color: #25314a;
  background: #25314a;
}

.ghost,
.link-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.ghost:hover,
.link-button:hover {
  border-color: #b7c2d2;
  background: #f8fafc;
}

.ghost.danger {
  border-color: #f2b9bc;
  background: #fff;
  color: var(--red);
}

.ghost.danger:hover {
  background: #fff5f5;
}

.primary.confirm-done,
.primary.confirm-done:disabled {
  border-color: var(--red);
  background: var(--red);
  box-shadow: none;
}

label {
  gap: 7px;
  color: #526279;
  font-size: 13px;
}

label > span,
.label {
  color: #42506a;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  box-shadow: none;
}

textarea {
  min-height: 120px;
  line-height: 1.6;
}

input::placeholder,
textarea::placeholder {
  color: #9aa7b8;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #6f9cf7;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(35, 103, 237, 0.1);
}

.form-grid {
  gap: 12px;
}

.divider {
  background: var(--line);
}

/* Feature areas that previously used independent color systems */
.merchant-architecture-board,
.merchant-operation-panel,
.moment-agent-system,
.merchant-report-hero,
.tracking-panel {
  border-color: var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

.merchant-architecture-board,
.merchant-operation-panel,
.moment-agent-system {
  border-radius: var(--radius);
}

.merchant-architecture-title,
.merchant-architecture-rail,
.merchant-architecture-layer,
.merchant-operation-panel .panel-head,
.moment-agent-hero,
.moment-agent-score,
.moment-agent-flow button,
.moment-agent-grid article {
  border-color: #edf0f5;
  background: #f8fafc;
  color: var(--text);
  box-shadow: none;
}

.merchant-architecture-layer h3 {
  background: #eaf2ff;
  color: #1553c5;
}

.merchant-architecture-rail span {
  color: #1553c5;
}

.merchant-architecture-chipgrid button {
  border-color: var(--line);
  background: #fff;
  color: var(--text);
  box-shadow: none;
}

.merchant-architecture-chipgrid button:hover {
  border-color: #6f9cf7;
  background: #f4f8ff;
}

#tab-merchant-overview .merchant-overview-metrics article {
  border-color: #edf0f5;
  background: #f8fafc;
  box-shadow: none;
}

#tab-merchant-overview .merchant-overview-metrics span,
.merchant-architecture-title h2,
.moment-agent-hero h2 {
  color: var(--text);
}

#tab-merchant-overview .merchant-overview-metrics small,
#tab-merchant-overview .merchant-overview-metrics em,
.merchant-architecture-title small,
.moment-agent-hero p {
  color: var(--muted);
}

.quote-description-field,
.media-picker,
.report-detail-profile-actions,
.report-detail-item,
.douyin-chat-card,
.douyin-lead-table-wrap {
  border-color: var(--line);
  background: #f8fafc;
}

/* Modals and feedback */
.report-detail-modal,
.quote-media-viewer-modal,
.platform-password-modal {
  background: rgba(16, 25, 41, 0.12);
}

.report-detail-backdrop,
.quote-media-viewer-backdrop,
.platform-password-backdrop {
  background: rgba(16, 25, 41, 0.45);
}

.report-detail-dialog,
.quote-media-viewer-dialog,
.platform-password-dialog {
  border: 0;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 28px 90px rgba(10, 20, 35, 0.32);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.report-detail-head,
.quote-media-viewer-head,
.platform-password-head {
  padding: 19px 22px;
  border-color: var(--line);
}

.report-detail-body,
.quote-media-viewer-body,
.platform-password-form {
  padding: 20px 22px;
}

.toast {
  bottom: 28px;
  max-width: min(460px, calc(100vw - 36px));
  padding: 11px 17px;
  border-radius: 11px;
  background: #172033;
  color: #fff;
  box-shadow: 0 12px 30px rgba(10, 20, 35, 0.25);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* Login and registration use the same paper, spacing and type scale. */
.login-view,
.login-view[data-view="register"],
.login-view[data-view="register-result"] {
  padding: 20px;
  background: var(--bg);
}

.login-split {
  width: min(1180px, 100%);
  min-height: calc(100vh - 40px);
  margin: auto;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  gap: 18px;
}

.login-showcase {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 12%, rgba(35, 103, 237, 0.1), transparent 34%),
    linear-gradient(145deg, #ffffff, #edf3fb);
  color: var(--text);
  box-shadow: var(--shadow);
}

.login-showcase-copy {
  width: min(440px, 72%);
  transform: none;
}

.login-showcase-copy p {
  margin-bottom: 14px;
  color: #1553c5;
  font-size: 14px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.login-showcase-copy h2 {
  color: var(--text);
  font-size: 32px;
  line-height: 1.35;
  font-weight: 850;
}

.login-view[data-view="login"] .login-panel,
.login-panel,
.register-panel {
  width: min(430px, 100%);
  min-height: 0;
  padding: 28px;
  gap: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.login-view[data-view="login"] .login-brand-title {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 28px;
  line-height: 1.25;
  font-weight: 850;
}

.login-view[data-view="login"] .login-brand-title span {
  color: #f18a28;
  -webkit-text-fill-color: #f18a28;
}

.login-view[data-view="login"] .login-brand-title::after {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.login-view[data-view="login"] .login-panel label {
  gap: 7px;
}

.login-view[data-view="login"] .login-panel input {
  height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

.login-view[data-view="login"] .login-panel input:focus {
  border-color: #6f9cf7;
  box-shadow: 0 0 0 3px rgba(35, 103, 237, 0.1);
}

.login-view[data-view="login"] .login-panel .primary {
  min-height: 44px;
  margin-top: 2px;
  border-radius: 12px;
  background: #172033;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.login-view[data-view="login"] .ghost,
.login-link {
  color: #2367ed;
  font-size: 13px;
  font-weight: 700;
}

.login-view[data-view="login"] #loginHint {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 1120px) {
  .shell {
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 14px;
    padding: 14px;
  }

  .sidebar {
    top: 14px;
    height: calc(100vh - 28px);
    padding: 14px;
  }

  .topbar {
    top: 14px;
  }
}

@media (max-width: 980px) {
  .shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 10px;
    z-index: 30;
    width: 100%;
    height: auto;
    max-height: none;
    margin-bottom: 14px;
    padding: 13px;
  }

  .sidebar > .stack {
    grid-template-columns: minmax(0, 1fr) minmax(240px, 0.7fr);
    align-items: center;
  }

  nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-group {
    min-width: 220px;
  }

  .main {
    gap: 14px;
  }

  .topbar {
    position: static;
  }

  .login-split {
    grid-template-columns: 1fr;
  }

  .login-showcase {
    display: none;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 13px;
  }

  .shell {
    padding: 10px;
  }

  .sidebar {
    top: 0;
    margin: -10px -10px 10px;
    width: calc(100% + 20px);
    padding: 10px;
    gap: 8px;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: 0 8px 20px rgba(30, 50, 80, 0.08);
  }

  .sidebar > .stack {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
  }

  .brand .mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 11px;
  }

  .brand strong {
    max-width: 142px;
    font-size: 14px;
  }

  .account-card {
    padding: 7px 8px;
    border-radius: 10px;
  }

  .nav,
  .nav-parent,
  .site-browser-nav,
  .sub-nav {
    width: auto;
    min-height: 32px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
    white-space: nowrap;
  }

  .sub-nav {
    padding-left: 14px;
  }

  .main {
    gap: 10px;
  }

  .topbar {
    min-height: auto;
    padding: 13px 15px;
    border-radius: 15px;
  }

  .topbar h2 {
    font-size: 21px;
  }

  .topbar .hint,
  .topbar .eyebrow {
    display: none;
  }

  .tab-view:not(.hidden) {
    gap: 10px;
  }

  .panel {
    padding: 15px;
    gap: 12px;
    border-radius: 16px;
  }

  .panel-head {
    gap: 5px;
    flex-direction: column;
  }

  .panel-head h3 {
    font-size: 18px;
  }

  .panel-head .hint {
    max-width: none;
    text-align: left;
  }

  .metrics.four,
  .metrics.six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #platformMetricGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #platformMetricGrid article:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .metrics article {
    min-height: 72px;
    padding: 10px;
  }

  .metrics span {
    font-size: 20px;
  }

  .item {
    padding: 12px;
    border-radius: 14px;
  }

  .item-title {
    font-size: 15px;
  }

  .primary,
  .ghost,
  .link-button {
    min-height: 36px;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 12px;
  }

  input,
  select,
  textarea {
    min-height: 40px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .login-view,
  .login-view[data-view="register"],
  .login-view[data-view="register-result"] {
    padding: 12px;
  }

  .login-split {
    min-height: calc(100vh - 24px);
  }

  .login-view[data-view="login"] .login-panel,
  .login-panel,
  .register-panel {
    width: 100%;
    padding: 22px;
    border-radius: 16px;
  }

  .login-view[data-view="login"] .login-brand-title {
    font-size: 24px;
  }

  .report-detail-dialog,
  .quote-media-viewer-dialog,
  .platform-password-dialog {
    border-radius: 16px;
  }
}
