
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #f4f6f9; --surface: #ffffff; --border: #e4e8ee;
    --primary: #005cbb; --primary-h: #004fa3;
    --danger: #d93025; --success: #1a8754; --warn: #c77a00;
    --text: #1e2328; --muted: #5f6c7b;
    --radius: 12px; --shadow: 0 2px 8px rgba(0,0,0,.07);
  }
  body { font-family: 'PingFang SC','Microsoft YaHei',system-ui,sans-serif;
         background: var(--bg); color: var(--text); font-size: 14px; }

  /* ── Layout ── */
  .app { display: flex; min-height: 100vh; }
  aside {
    width: 220px; flex-shrink: 0; background: var(--surface);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
  }
  .logo { padding: 24px 20px 16px; font-size: 16px; font-weight: 700; color: var(--primary);
          border-bottom: 1px solid var(--border); }
  .logo span { font-weight: 400; color: var(--muted); font-size: 12px; display: block; margin-top: 2px; }
  nav { padding: 12px 8px; flex: 1; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
              border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 14px;
              transition: background .15s, color .15s; }
  .nav-item:hover  { background: #f0f4ff; color: var(--primary); }
  .nav-item.active { background: #ebf1ff; color: var(--primary); font-weight: 600; }
  .nav-item svg    { width: 18px; height: 18px; flex-shrink: 0; }
  main { flex: 1; padding: 28px; overflow-y: auto; }

  /* ── Header ── */
  .page-header { margin-bottom: 24px; display: flex; align-items: flex-start; justify-content: space-between; }
  .page-header h1 { font-size: 22px; font-weight: 700; }
  .page-header p  { color: var(--muted); margin-top: 4px; font-size: 13px; }

  /* ── Stats ── */
  .stats { display: grid; grid-template-columns: repeat(auto-fill,minmax(170px,1fr)); gap: 16px; margin-bottom: 28px; }
  .stat-card { background: var(--surface); border-radius: var(--radius); padding: 20px;
               box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
  .stat-card .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
  .stat-card .value { font-size: 28px; font-weight: 700; }
  .stat-card.blue  .value { color: var(--primary); }
  .stat-card.green .value { color: var(--success); }
  .stat-card.warn  .value { color: var(--warn); }

  /* ── Card ── */
  .card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
          overflow: hidden; margin-bottom: 24px; }
  .card-header { padding: 16px 20px; border-bottom: 1px solid var(--border);
                 display: flex; align-items: center; justify-content: space-between; }
  .card-header h2 { font-size: 15px; font-weight: 600; }

  /* ── Table ── */
  table { width: 100%; border-collapse: collapse; }
  th, td { padding: 12px 16px; text-align: left; }
  th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase;
       letter-spacing: .05em; background: #f8f9fb; border-bottom: 1px solid var(--border); }
  tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
  tr:hover td { background: #fafbfd; }
  .mono { font-family: 'SF Mono',Consolas,monospace; font-size: 13px; }

  /* ── Badges ── */
  .badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px;
           border-radius: 999px; font-size: 12px; font-weight: 500; }
  .badge::before { content:''; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.7; }
  .badge.pending   { background:#fff3cd; color:#856404; }
  .badge.confirmed { background:#cfe2ff; color:#084298; }
  .badge.shipped   { background:#d1ecf1; color:#0c5460; }
  .badge.completed { background:#d1e7dd; color:#0a3622; }
  .badge.default   { background:#e8f4fd; color:#1565c0; }

  /* ── Buttons ── */
  .btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
         border-radius: 8px; border: none; font-size: 13px; font-weight: 500;
         cursor: pointer; transition: .15s; white-space: nowrap; }
  .btn svg { width: 14px; height: 14px; }
  .btn-primary { background: var(--primary); color: #fff; }
  .btn-primary:hover { background: var(--primary-h); }
  .btn-ghost   { background: transparent; color: var(--muted); border: 1px solid var(--border); }
  .btn-ghost:hover { background: #f0f4ff; color: var(--primary); border-color: var(--primary); }
  .btn-danger  { background: transparent; color: var(--danger); border: 1px solid transparent; }
  .btn-danger:hover { background: #fde8e8; border-color: #f9c0c0; }
  .btn-sm { padding: 4px 10px; font-size: 12px; }

  /* ── Breadcrumb ── */
  .breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px;
                color: var(--muted); margin-bottom: 20px; }
  .breadcrumb a { color: var(--primary); cursor: pointer; text-decoration: none; }
  .breadcrumb a:hover { text-decoration: underline; }
  .breadcrumb .sep { color: #c0c8d0; }

  /* ── User card ── */
  .user-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 16px; }
  .user-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
               padding: 20px; display: flex; flex-direction: column; gap: 10px; }
  .user-card-head { display: flex; align-items: center; gap: 14px; }
  .avatar { width: 44px; height: 44px; border-radius: 50%; background: #e8f0fe;
            display: flex; align-items: center; justify-content: center;
            font-size: 18px; font-weight: 700; color: var(--primary); flex-shrink: 0; }
  .user-name { font-weight: 700; font-size: 15px; }
  .user-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
  .user-stats { display: flex; gap: 16px; padding-top: 10px; border-top: 1px solid var(--border); }
  .user-stat { text-align: center; }
  .user-stat .n { font-size: 18px; font-weight: 700; color: var(--primary); }
  .user-stat .l { font-size: 11px; color: var(--muted); }
  .user-actions { display: flex; gap: 8px; }

  /* ── Product grid ── */
  .product-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(280px,1fr)); gap: 20px; }
  .product-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
  .product-card img { width:100%; height:160px; object-fit:contain; background:#f8f9fb; padding:16px; }
  .product-card .info { padding: 16px; }
  .product-card .pname { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
  .product-card .tagline { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
  .product-card .price { font-size: 20px; font-weight: 700; color: var(--primary); }
  .product-card .spec-list { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
  .product-card .spec-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); padding: 3px 0; }
  .product-card .spec-row span:last-child { color: var(--text); font-weight: 500; }
  .color-dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%;
               border: 2px solid rgba(0,0,0,.12); vertical-align: middle; margin-right: 6px; }

  /* ── Image upload ── */
  .upload-area { display: flex; align-items: center; gap: 12px; }
  .upload-preview { width: 72px; height: 72px; border-radius: 8px; object-fit: contain;
                    border: 1px solid var(--border); background: #f8f9fb; padding: 4px; flex-shrink: 0; }
  .upload-preview.hidden { display: none; }
  .btn-upload { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px;
                border-radius: 8px; border: 1.5px dashed var(--border); background: #fafbfd;
                font-size: 13px; color: var(--muted); cursor: pointer; transition: .15s; }
  .btn-upload:hover { border-color: var(--primary); color: var(--primary); background: #f0f4ff; }

  /* ── Color row table ── */
  .color-rows { width: 100%; border-collapse: collapse; }
  .color-rows th { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
                   letter-spacing: .04em; padding: 6px 8px; background: #f8f9fb;
                   border-bottom: 1px solid var(--border); }
  .color-rows td { padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .color-rows tr:last-child td { border-bottom: none; }
  .color-name-inp { width: 100%; padding: 5px 8px; border: 1px solid var(--border);
                    border-radius: 6px; font-size: 13px; outline: none; }
  .color-name-inp:focus { border-color: var(--primary); }
  .color-hex-inp { width: 36px; height: 30px; border: none; cursor: pointer; border-radius: 4px; padding: 0; }
  .color-img-preview { width: 36px; height: 36px; object-fit: contain; border-radius: 4px;
                        border: 1px solid var(--border); background: #f8f9fb; padding: 2px; }
  .color-img-preview.hidden { display: none; }

  /* ── Modal ── */
  .overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4);
             display: flex; align-items: center; justify-content: center; z-index: 100; }
  .overlay.hidden { display: none; }
  .modal { background: var(--surface); border-radius: 16px; width: 480px;
           max-width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.2); overflow: hidden; }
  .modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border);
                  display: flex; align-items: center; justify-content: space-between; }
  .modal-header h3 { font-size: 16px; font-weight: 700; }
  .modal-header button { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
  .modal-body { padding: 24px; }
  .modal-footer { padding: 16px 24px; border-top: 1px solid var(--border);
                  display: flex; justify-content: flex-end; gap: 10px; }
  .form-group { margin-bottom: 16px; }
  .form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  input[type=text], input[type=tel] { width: 100%; padding: 9px 12px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 14px; outline: none; transition: border-color .15s; }
  input:focus { border-color: var(--primary); }
  .checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
  .checkbox-label input { width: auto; cursor: pointer; }

  /* ── Order Detail Modal ── */
  .order-detail-modal { width: 640px; max-width: calc(100vw - 32px); }
  .od-top { display: flex; gap: 20px; padding: 20px 24px; border-bottom: 1px solid var(--border); background: #f8f9fb; }
  .od-img { width: 110px; height: 110px; object-fit: contain; background: #fff;
            border-radius: 10px; border: 1px solid var(--border); padding: 6px; flex-shrink: 0; }
  .od-img-placeholder { width: 110px; height: 110px; background: #eef0f4; border-radius: 10px;
                        display: flex; align-items: center; justify-content: center;
                        color: var(--muted); font-size: 12px; flex-shrink: 0; }
  .od-top-info { flex: 1; min-width: 0; }
  .od-product-name { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
  .od-meta { font-size: 12px; color: var(--muted); line-height: 2; }
  .od-section { padding: 14px 24px 4px; }
  .od-section-title { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .12em;
                      text-transform: uppercase; margin-bottom: 10px; }
  .od-spec-table { width: 100%; border-collapse: collapse; font-size: 13px; }
  .od-spec-table tr { border-bottom: 1px solid var(--border); }
  .od-spec-table tr:last-child { border-bottom: none; }
  .od-spec-table td:first-child { color: var(--muted); padding: 8px 0; width: 90px; }
  .od-spec-table td:last-child { font-weight: 600; color: #1d1d1f; padding: 8px 0; }
  .od-actions { display: flex; gap: 8px; flex-wrap: wrap; }

  /* ── Section / Loading ── */
  .section { display: none; }
  .section.active { display: block; }
  .empty { padding: 60px 20px; text-align: center; color: var(--muted); }
  .loading { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
  .dot-loading::after { content: ''; animation: dots 1.2s steps(3,end) infinite; }
  @keyframes dots { 0%,20%{content:'.'} 40%,60%{content:'..'} 80%,100%{content:'...'} }

  /* ── Toast ── */
  #toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
           background: #1e2328; color: #fff; padding: 10px 20px; border-radius: 8px;
           font-size: 13px; z-index: 200; opacity: 0; transition: opacity .25s; pointer-events: none; }
  #toast.show { opacity: 1; }

  /* ── Login screen ── */
  #login-screen {
    position: fixed; inset: 0; background: linear-gradient(135deg,#eef2ff 0%,#f4f6f9 100%);
    display: flex; align-items: center; justify-content: center; z-index: 300;
  }
  #login-screen.hidden { display: none; }
  .login-box {
    background: #fff; border-radius: 20px; width: 380px; padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,.12);
  }
  .login-logo { font-size: 20px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
  .login-sub  { font-size: 13px; color: var(--muted); margin-bottom: 32px; }
  .login-box .form-group label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
  .login-box input { width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px;
                     font-size: 14px; outline: none; transition: border-color .15s; margin-top: 6px; }
  .login-box input:focus { border-color: var(--primary); }
  .login-btn { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: none;
               border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; margin-top: 8px;
               transition: background .15s; }
  .login-btn:hover { background: var(--primary-h); }
  .login-err { margin-top: 12px; font-size: 13px; color: var(--danger); min-height: 20px; text-align:center; }

  /* ── Sidebar footer ── */
  .sidebar-footer { padding: 16px 12px; border-top: 1px solid var(--border); }
  .admin-info { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
  .btn-logout { width:100%; padding: 8px; background: transparent; border: 1px solid var(--border);
                border-radius: 8px; font-size: 13px; color: var(--muted); cursor: pointer;
                transition: .15s; display: flex; align-items: center; justify-content: center; gap: 6px; }
  .btn-logout:hover { background: #fde8e8; border-color: #f9c0c0; color: var(--danger); }

