﻿:root {
      color-scheme: light;
      --bg: #f4f6f6;
      --surface: #ffffff;
      --surface-soft: #f8faf9;
      --line: #d9e1df;
      --line-strong: #b8c8c4;
      --text: #1f2a2f;
      --muted: #667579;
      --brand: #167d72;
      --brand-2: #239485;
      --ok: #24734d;
      --warn: #a85c15;
      --danger: #b63f3f;
      --sidebar: #1f2b2f;
      --focus: rgba(22, 125, 114, 0.22);
      --shadow: 0 14px 36px rgba(31, 42, 47, 0.08);
      font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      min-width: 320px;
      background: var(--bg);
      color: var(--text);
    }

    button, input, select, textarea { font: inherit; }

    button {
      min-height: 34px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: #fff;
      color: var(--text);
      padding: 7px 11px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 7px;
      cursor: pointer;
      white-space: nowrap;
    }

    button:hover {
      border-color: var(--line-strong);
      background: #f9fbfb;
    }

    button:disabled,
    button[data-busy="1"] {
      cursor: wait;
      opacity: 0.68;
    }

    button.primary {
      color: #fff;
      background: var(--brand);
      border-color: var(--brand);
    }

    button.primary:hover {
      background: var(--brand-2);
      border-color: var(--brand-2);
    }

    button:active {
      transform: scale(0.95);
      opacity: 0.8;
    }

    button.primary:active {
      background: #0f5c54;
      transform: scale(0.95);
    }

    button:disabled {
      opacity: 0.5;
      cursor: not-allowed;
      transform: none;
    }

    button.loading {
      pointer-events: none;
      opacity: 0.7;
    }

    button.danger {
      color: #fff;
      background: var(--danger);
      border-color: var(--danger);
    }

    button.secondary {
      min-height: 30px;
      padding: 5px 9px;
      font-size: 13px;
      color: var(--muted);
      background: var(--surface-soft);
    }

    button.linklike {
      border-color: transparent;
      background: transparent;
      color: var(--brand);
      padding-left: 0;
      padding-right: 0;
    }

    input, select, textarea {
      width: 100%;
      min-height: 36px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: #fff;
      color: var(--text);
      padding: 8px 10px;
      outline: none;
    }

    textarea {
      min-height: 108px;
      resize: vertical;
      line-height: 1.55;
    }

    input:focus, select:focus, textarea:focus, button:focus-visible {
      border-color: var(--brand);
      box-shadow: 0 0 0 3px var(--focus);
    }

    .hidden { display: none !important; }
    .danger-text { color: var(--danger) !important; }

    .login-view {
      min-height: 100vh;
      display: grid;
      place-items: center;
      padding: 22px;
    }

    .login-card {
      width: min(380px, 100%);
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      box-shadow: var(--shadow);
      padding: 28px;
      display: grid;
      gap: 22px;
    }

    .brand-row {
      display: flex;
      align-items: center;
    }

    .brand-row img {
      width: 156px;
      height: auto;
      border: 0;
      border-radius: 0;
      background: transparent;
      object-fit: contain;
    }

    .login-card .brand-row {
      justify-content: center;
    }

    .login-card .brand-row img {
      width: min(220px, 82%);
    }

    .field {
      display: grid;
      gap: 7px;
      color: var(--muted);
      font-size: 13px;
    }

    .field-label {
      color: var(--muted);
      font-size: 13px;
    }

    .field-hint {
      color: #8a9799;
      font-size: 12px;
      line-height: 1.45;
    }

    .checkbox-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }

    .checkbox-option {
      display: flex;
      align-items: flex-start;
      gap: 8px;
      min-height: 34px;
      padding: 7px 9px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-soft);
      color: var(--text);
      font-size: 13px;
    }

    .checkbox-option input {
      width: auto;
      margin: 2px 0 0;
    }

    .checkbox-option-text {
      display: grid;
      gap: 2px;
      line-height: 1.3;
    }

    .checkbox-option-text small {
      color: #8a9799;
      font-size: 11px;
      line-height: 1.35;
    }

    .code-row {
      display: grid;
      grid-template-columns: minmax(0, 1fr) auto;
      gap: 8px;
      align-items: end;
    }

    .profile-flow {
      display: grid;
      gap: 10px;
      padding-top: 2px;
    }

    .profile-flow-row {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }

    .profile-flow-row button.primary {
      min-width: 108px;
    }

    .admin-shell {
      height: 100vh;
      display: grid;
      grid-template-columns: 248px minmax(0, 1fr);
      overflow: hidden;
    }

    .sidebar {
      position: sticky;
      top: 0;
      height: 100vh;
      background: var(--sidebar);
      color: #eef6f5;
      padding: 18px 14px;
      display: flex;
      flex-direction: column;
      gap: 18px;
    }

    .sidebar .brand-row {
      padding: 0 8px 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .sidebar .brand-row img {
      width: 166px;
    }

    .side-nav {
      display: grid;
      gap: 6px;
    }

    .side-nav button {
      width: 100%;
      justify-content: flex-start;
      min-height: 38px;
      border-color: transparent;
      background: transparent;
      color: #dbe8e6;
    }

    .side-nav button.active,
    .side-nav button:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }

    .badge {
      margin-left: auto;
      min-width: 24px;
      padding: 2px 7px;
      border-radius: 999px;
      background: rgba(255, 255, 255, 0.14);
      font-size: 12px;
      text-align: center;
    }

    .sidebar-footer {
      margin-top: auto;
      display: grid;
      gap: 8px;
      padding: 10px 8px 0;
      border-top: 1px solid rgba(255, 255, 255, 0.12);
      color: #b7c7c4;
      font-size: 12px;
    }

    .sidebar-footer button {
      justify-content: flex-start;
      color: #dbe8e6;
      border-color: rgba(255, 255, 255, 0.16);
      background: rgba(255, 255, 255, 0.06);
    }

    .main {
      min-width: 0;
      min-height: 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .topbar {
      position: sticky;
      top: 0;
      z-index: 5;
      min-height: 76px;
      border-bottom: 1px solid var(--line);
      background: rgba(244, 246, 246, 0.92);
      backdrop-filter: blur(10px);
      padding: 16px 24px;
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .topbar h1 {
      margin: 0;
      font-size: 23px;
      line-height: 1.2;
      letter-spacing: 0;
    }

    .breadcrumb {
      margin-top: 5px;
      color: var(--muted);
      font-size: 13px;
    }

    .timezone-control {
      display: grid;
      gap: 7px;
      min-width: 0;
      padding: 0 8px 12px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .timezone-field {
      display: grid;
      gap: 6px;
      color: #b7c7c4;
      font-size: 12px;
    }

    .timezone-field select,
    .timezone-custom {
      width: 100%;
      min-height: 32px;
      border-color: rgba(255, 255, 255, 0.16);
      background: rgba(255, 255, 255, 0.06);
      color: #eef6f5;
      padding-top: 6px;
      padding-bottom: 6px;
    }

    .timezone-field select option {
      color: var(--text);
      background: var(--surface);
    }

    .timezone-custom::placeholder {
      color: rgba(238, 246, 245, 0.45);
    }

    .timezone-current {
      color: #8fa39f;
      font-size: 11px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .topbar-actions {
      margin-left: auto;
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      justify-content: flex-end;
    }

    .content {
      flex: 1;
      min-height: 0;
      overflow: auto;
      padding: 20px 24px 28px;
      display: grid;
      grid-template-rows: auto minmax(0, 1fr);
      gap: 16px;
    }

    #pageContent {
      min-height: 0;
    }

    .subnav {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
    }

    .subnav button.active {
      color: var(--brand);
      border-color: rgba(22, 125, 114, 0.4);
      background: #edf7f5;
    }

    .stats-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
    }

    .metric, .panel {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      box-shadow: 0 4px 18px rgba(31, 42, 47, 0.04);
    }

    .metric {
      min-height: 104px;
      padding: 15px;
      display: grid;
      align-content: space-between;
      gap: 6px;
    }

    .metric span,
    .metric small {
      color: var(--muted);
      font-size: 13px;
    }

    .metric strong {
      font-size: 28px;
      line-height: 1.1;
      letter-spacing: 0;
    }

    .split {
      display: grid;
      grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.85fr);
      gap: 16px;
      align-items: start;
    }

    .panel-head {
      min-height: 60px;
      padding: 15px 16px;
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 12px;
    }

    .panel-head h2 {
      margin: 0;
      font-size: 17px;
      line-height: 1.25;
      letter-spacing: 0;
    }

    .panel-head p {
      margin: 6px 0 0;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.55;
    }

    .panel-body { padding: 16px; }

    .toolbar, .form-grid {
      display: grid;
      grid-template-columns: repeat(4, minmax(0, 1fr));
      gap: 12px;
      align-items: end;
      margin-bottom: 14px;
    }

    .form-grid {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      align-items: start;
      margin-bottom: 0;
    }

    .form-wide { grid-column: 1 / -1; }

    .form-row {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 12px;
      align-items: start;
    }

    .form-section {
      padding-top: 4px;
      border-top: 1px solid var(--line);
    }

    .form-section:first-child {
      padding-top: 0;
      border-top: 0;
    }

    .form-section h3 {
      margin: 0;
      font-size: 15px;
      line-height: 1.35;
      letter-spacing: 0;
    }

    .form-grid input[readonly],
    .form-grid textarea[readonly] {
      background: var(--surface-soft);
      color: var(--muted);
    }

    .pricing-boundaries-field {
      display: grid;
      gap: 6px;
      margin-top: 8px;
      color: var(--text);
      font-size: 13px;
      font-weight: 600;
    }

    .pricing-tier-table {
      display: grid;
      gap: 8px;
      margin-top: 10px;
      overflow-x: auto;
    }

    .pricing-tier-header,
    .pricing-tier-row {
      display: grid;
      grid-template-columns: minmax(110px, 0.9fr) repeat(4, minmax(96px, 1fr));
      gap: 8px;
      align-items: start;
      min-width: 620px;
    }

    .pricing-tier-header {
      color: var(--muted);
      font-size: 12px;
      font-weight: 600;
    }

    .pricing-tier-title {
      min-height: 36px;
      display: flex;
      align-items: center;
      padding: 7px 10px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: var(--surface-soft);
      color: var(--text);
      font-size: 13px;
      font-weight: 600;
      line-height: 1.35;
    }

    .pricing-tier-field {
      display: grid;
      gap: 5px;
      color: var(--muted);
      font-size: 12px;
    }

    .pricing-tier-field input {
      min-width: 0;
    }

    .model-logo-editor {
      display: grid;
      gap: 10px;
    }

    .logo-upload-panel {
      display: grid;
      grid-template-columns: 128px minmax(0, 1fr);
      gap: 12px;
      align-items: start;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-soft);
      padding: 12px;
    }

    .logo-canvas-wrap {
      width: 128px;
      height: 128px;
      border: 1px solid var(--line);
      border-radius: 8px;
      overflow: hidden;
      background:
        linear-gradient(45deg, #e9eeee 25%, transparent 25%),
        linear-gradient(-45deg, #e9eeee 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9eeee 75%),
        linear-gradient(-45deg, transparent 75%, #e9eeee 75%);
      background-color: #fff;
      background-position: 0 0, 0 8px, 8px -8px, -8px 0;
      background-size: 16px 16px;
    }

    .logo-canvas-wrap canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    .market-logo-preview-wrap {
      display: grid;
      place-items: center;
    }

    .market-logo-current,
    .market-logo-empty {
      width: 100%;
      height: 100%;
      display: grid;
      place-items: center;
      color: var(--muted);
      font-size: 12px;
    }

    .market-logo-current img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .logo-upload-controls {
      min-width: 0;
      display: grid;
      gap: 10px;
    }

    .about-qr-uploader {
      display: grid;
      gap: 8px;
    }

    .about-qr-row {
      display: grid;
      grid-template-columns: 108px minmax(0, 1fr);
      gap: 12px;
      align-items: start;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-soft);
      padding: 12px;
    }

    .about-qr-preview {
      display: grid;
      width: 108px;
      height: 108px;
      place-items: center;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: #fff;
      color: var(--muted);
      font-size: 12px;
      overflow: hidden;
    }

    .about-qr-preview img {
      display: block;
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .about-qr-controls {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      align-items: center;
    }

    .about-qr-controls .field-hint {
      flex-basis: 100%;
    }

    .file-button {
      position: relative;
      min-height: 34px;
      border: 1px solid var(--line);
      border-radius: 6px;
      background: #fff;
      color: var(--text);
      padding: 7px 11px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      overflow: hidden;
      white-space: nowrap;
      font-size: 14px;
    }

    .file-button:hover {
      border-color: var(--line-strong);
      background: #f9fbfb;
    }

    .file-button input {
      position: absolute;
      width: 1px;
      height: 1px;
      opacity: 0;
      pointer-events: none;
    }

    .table-wrap { overflow-x: auto; }

    .scroll-box {
      max-height: calc(100vh - 280px);
      overflow: auto;
    }

    .scroll-box .table-wrap {
      overflow: visible;
    }

    .attention-scroll {
      flex: 1;
      min-height: 320px;
      overflow: auto;
    }

    .attention-scroll .table-wrap {
      overflow: visible;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      min-width: 760px;
    }

    th, td {
      border-bottom: 1px solid var(--line);
      padding: 11px 10px;
      text-align: left;
      vertical-align: top;
      font-size: 14px;
      line-height: 1.45;
    }

    th {
      color: var(--muted);
      font-weight: 600;
      background: var(--surface-soft);
    }

    tr:last-child td { border-bottom: 0; }
    .muted { color: var(--muted); }

    .model-logo {
      width: 36px;
      height: 36px;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      background: linear-gradient(135deg, rgba(22, 125, 114, 0.18), rgba(35, 148, 133, 0.26));
      color: var(--brand);
      font-weight: 700;
      font-size: 12px;
    }

    .model-logo img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    .market-logo {
      width: 40px;
      height: 40px;
      border-radius: 8px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      overflow: hidden;
      border: 1px solid var(--line);
      background: var(--surface-soft);
      color: var(--brand);
      font-weight: 700;
      font-size: 12px;
    }

    .market-logo img {
      width: 100%;
      height: 100%;
      object-fit: contain;
    }

    .package-upload-panel {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-soft);
      padding: 12px;
    }

    .package-upload-main {
      min-width: 0;
      display: grid;
      gap: 4px;
    }

    .package-upload-main strong,
    .package-upload-main span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .package-upload-main span {
      color: var(--muted);
      font-size: 12px;
    }

    .mono {
      font-family: "Cascadia Mono", Consolas, monospace;
      font-size: 12px;
    }

    .status {
      display: inline-flex;
      align-items: center;
      min-height: 24px;
      border-radius: 999px;
      padding: 2px 8px;
      font-size: 12px;
      background: #eef3f2;
      color: var(--muted);
      white-space: nowrap;
    }

    .status.ok { background: #e8f5ef; color: var(--ok); }
    .status.warn { background: #fff2df; color: var(--warn); }
    .status.danger { background: #fdecec; color: var(--danger); }

    .order-id {
      display: inline-block;
      min-width: 230px;
      white-space: nowrap;
    }

    .amount-input {
      width: 92px;
      min-height: 34px;
    }

    .error-message {
      display: block;
      min-width: 460px;
      max-width: 760px;
      white-space: normal;
    }

    .error-payload {
      margin: 14px 0 0;
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-soft);
      padding: 12px;
      overflow: auto;
      font-family: "Cascadia Mono", Consolas, monospace;
      font-size: 12px;
      line-height: 1.6;
      white-space: pre-wrap;
    }

    .row-actions, .inline-actions {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    .detail {
      position: sticky;
      top: 96px;
    }

    .dashboard-page {
      min-height: calc(100vh - 140px);
      display: grid;
      grid-template-rows: auto minmax(340px, 1fr);
      gap: 16px;
    }

    .dashboard-page .panel {
      min-height: 0;
      display: flex;
      flex-direction: column;
    }

    .dashboard-page .panel-body {
      min-height: 0;
      flex: 1;
      display: flex;
    }

    .detail-list {
      display: grid;
      gap: 9px;
    }

    .detail-item {
      display: grid;
      grid-template-columns: 104px minmax(0, 1fr);
      gap: 12px;
      align-items: baseline;
      padding-bottom: 9px;
      border-bottom: 1px solid var(--line);
    }

    .detail-item span {
      color: var(--muted);
      font-size: 13px;
    }

    .detail-item strong {
      font-size: 14px;
      line-height: 1.5;
      word-break: break-word;
    }

    .cards {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 12px;
    }

    .small-card {
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface-soft);
      padding: 13px;
      display: grid;
      gap: 8px;
      min-height: 124px;
    }

    .small-card h3 {
      margin: 0;
      font-size: 15px;
      letter-spacing: 0;
    }

    .small-card p {
      margin: 0;
      color: var(--muted);
      font-size: 13px;
      line-height: 1.5;
    }

    .note-list {
      margin: 0;
      padding-left: 18px;
      color: var(--muted);
      line-height: 1.7;
      font-size: 13px;
    }

    .toast {
      position: fixed;
      right: 18px;
      bottom: 18px;
      z-index: 20;
      max-width: min(420px, calc(100vw - 36px));
      border: 1px solid rgba(22, 125, 114, 0.32);
      border-radius: 8px;
      background: #eff9f7;
      color: #164b45;
      box-shadow: var(--shadow);
      padding: 12px 14px;
      font-size: 14px;
      line-height: 1.45;
    }

    .modal-backdrop {
      position: fixed;
      inset: 0;
      z-index: 15;
      display: grid;
      place-items: center;
      padding: 24px;
      background: rgba(20, 29, 32, 0.48);
    }

    .modal {
      width: min(920px, 100%);
      max-height: calc(100vh - 48px);
      border: 1px solid var(--line);
      border-radius: 8px;
      background: var(--surface);
      box-shadow: var(--shadow);
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    .modal-head {
      min-height: 60px;
      padding: 15px 16px;
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 12px;
    }

    .modal-head h2 {
      margin: 0;
      font-size: 17px;
      line-height: 1.25;
      letter-spacing: 0;
    }

    .modal-body {
      min-height: 0;
      overflow: auto;
      padding: 16px;
    }

    .segmented {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
      margin: 14px 0;
    }

    .segmented button.active {
      color: var(--brand);
      border-color: rgba(22, 125, 114, 0.4);
      background: #edf7f5;
    }

    @media (max-width: 1120px) {
      .admin-shell { grid-template-columns: 1fr; }
      .sidebar { position: static; height: auto; max-height: 40vh; overflow: auto; }
      .side-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
      .stats-grid, .split, .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
      .detail { position: static; }
      .admin-shell { overflow: auto; }
      .main { overflow: visible; }
    }

    @media (max-width: 760px) {
      .topbar {
        align-items: flex-start;
        flex-direction: column;
      }

      .topbar-actions { margin-left: 0; }
      .timezone-control { width: 100%; }
      .stats-grid, .split, .toolbar, .form-grid, .side-nav, .cards { grid-template-columns: 1fr; }
      .logo-upload-panel { grid-template-columns: 1fr; }
      .form-row { grid-template-columns: 1fr; }
      .content, .topbar { padding-left: 14px; padding-right: 14px; }
      .panel-head { flex-direction: column; }
      .code-row { grid-template-columns: 1fr; }
      .modal-backdrop { padding: 12px; }
      .modal { max-height: calc(100vh - 24px); }
    }

.flow-icon { display:inline-block; margin-left:8px; font-size:16px; font-weight:700; }
.flow-ok { color:var(--ok); }
.flow-fail { color:var(--danger); cursor:pointer; }
.profile-detail-panel { background:var(--surface-soft); border:1px solid var(--line); border-radius:6px; padding:10px 14px; margin:4px 0 8px; font-size:13px; }
.profile-detail-ok { border-color:rgba(36,115,77,.2); }
.flow-error-list { margin:0; padding:0 0 0 16px; }
.flow-err { color:var(--danger); margin:2px 0; }
.flow-warn { color:var(--warn); margin:2px 0; }
.flow-detail-line { margin:2px 0; color:var(--text); }
