:root {
      /* aligned to the site theme (navy/gold + Sarabun) */
      --primary: #1d2f6e;
      --primary-ink: #16255c;
      --bg: #f4f6fa;
      --line: #dde3ef;
      --muted: #5c6472;
      --ink: #20262f;
      --ring: rgba(29, 47, 110, .14);
      --ok: #1c7a43;
      --danger: #b42318;
      --gold: #b8912f;
      --serif: 'Bai Jamjuree', 'Sarabun', serif;
    }

    * { box-sizing: border-box }

    body {
      margin: 0;
      background: var(--bg);
      font-family: 'Sarabun', system-ui, sans-serif;
      color: var(--ink);
      line-height: 1.55;
    }

    .rh-title, .oc-code { font-family: var(--serif); color: var(--primary-ink) }

    svg { display: block }

    /* ===== Top bar ===== */
    .topbar { max-width: 1120px; margin: 18px auto 0; padding: 0 16px; }
    .tb-wrap {
      background: #fff; border: 1px solid var(--line); border-radius: 18px;
      display: flex; align-items: center; justify-content: space-between; gap: 14px;
      padding: 16px 22px; box-shadow: 0 6px 20px rgba(2, 6, 23, .04);
    }
    .tb-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
    .tb-icon {
      width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
      background: #eef2fb; color: var(--primary); display: grid; place-items: center;
    }
    .tb-icon svg { width: 26px; height: 26px; }
    .tb-text { display: flex; flex-direction: column; min-width: 0; }
    .tb-title { font-size: 20px; font-weight: 800; color: var(--ink); line-height: 1.2; }
    .tb-sub { font-size: 13px; color: var(--muted); }
    .btn-back {
      display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
      border: 1px solid var(--line); background: #fff; color: #334155;
      padding: 11px 18px; border-radius: 12px; font-weight: 700; text-decoration: none; font-size: 14px;
    }
    .btn-back svg { width: 18px; height: 18px; }
    .btn-back:hover { background: #f8fafc; border-color: #c7d2e5; }

    .wrap { max-width: 1120px; margin: 20px auto; padding: 0 16px; }

    /* ===== Toolbar ===== */
    .toolbar {
      background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px;
      box-shadow: 0 6px 20px rgba(2, 6, 23, .04); display: grid; gap: 14px;
    }
    .field { position: relative; }
    .field-icon {
      position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
      color: var(--muted); pointer-events: none;
    }
    .field-icon svg { width: 18px; height: 18px; }
    .field input, .field select {
      width: 100%; padding: 14px 16px 14px 46px; border: 1px solid var(--line);
      border-radius: 12px; font-size: 15px; font-family: inherit; color: var(--ink);
      background: #fff; outline: none;
    }
    .field input::placeholder { color: #94a3b8; }
    .field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
    .selectwrap select { appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 44px; }
    .chev { position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
    .chev svg { width: 18px; height: 18px; }
    .btn-refresh {
      justify-self: start; display: inline-flex; align-items: center; gap: 8px;
      border: 1px solid #dbe7fb; background: #eef4ff; color: var(--primary);
      padding: 12px 18px; border-radius: 12px; font-weight: 700; cursor: pointer;
      font-family: inherit; font-size: 14px;
    }
    .btn-refresh svg { width: 18px; height: 18px; }
    .btn-refresh:hover { background: #e0ecff; }

    /* ===== Results head ===== */
    .results-head { display: flex; align-items: center; gap: 10px; margin: 24px 2px 14px; }
    .rh-icon { color: var(--primary); }
    .rh-icon svg { width: 22px; height: 22px; }
    .rh-title { font-size: 18px; font-weight: 800; }
    .rh-count {
      background: var(--primary); color: #fff; min-width: 24px; height: 24px; padding: 0 8px;
      border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
      font-size: 12.5px; font-weight: 700;
    }

    /* ===== Orders ===== */
    .orders { display: grid; gap: 16px; }
    .order-card {
      background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 20px 22px;
      box-shadow: 0 6px 20px rgba(2, 6, 23, .04); display: flex; align-items: center; gap: 22px;
    }
    .oc-left { flex: 1; min-width: 0; display: flex; gap: 16px; align-items: flex-start; }
    .oc-avatar {
      width: 52px; height: 52px; border-radius: 14px; flex-shrink: 0;
      background: #eef2fb; color: var(--primary); display: grid; place-items: center;
    }
    .oc-avatar svg { width: 26px; height: 26px; }
    .oc-info { flex: 1; min-width: 0; }
    .oc-code-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
    .oc-code { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
    .oc-meta { margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
    .oc-mcol { display: grid; gap: 8px; align-content: start; }
    .oc-mrow { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #334155; min-width: 0; }
    .oc-mrow svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
    .oc-mrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    .oc-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; border-left: 1px solid var(--line); padding-left: 22px; }
    .oc-stat {
      display: flex; align-items: center; gap: 12px; background: #f8fafc;
      border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; min-width: 148px;
    }
    .st-icon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
    .st-icon svg { width: 22px; height: 22px; }
    .oc-stat.items .st-icon { background: #eef2fb; color: var(--primary); }
    .oc-stat.total .st-icon { background: #e9f9ef; color: var(--ok); }
    .st-label { font-size: 12px; color: var(--muted); }
    .st-value { font-size: 20px; font-weight: 800; line-height: 1.15; margin-top: 1px; }
    .st-sub { font-size: 11px; color: var(--muted); }
    .oc-detail {
      display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
      border: 1px solid #dbe7fb; background: #eef4ff; color: var(--primary);
      padding: 12px 16px; border-radius: 12px; font-weight: 700; cursor: pointer; font-family: inherit; font-size: 14px;
    }
    .oc-detail svg { width: 18px; height: 18px; }
    .oc-detail:hover { background: #e0ecff; }

    @media (max-width: 860px) {
      .order-card { flex-direction: column; align-items: stretch; gap: 16px; }
      .oc-right { border-left: none; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; flex-wrap: wrap; }
      .oc-stat { flex: 1 1 140px; }
      .oc-detail { flex: 1 1 100%; justify-content: center; }
    }

    /* ===== Badges ===== */
    .badge {
      display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
      padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line);
    }
    .badge svg { width: 14px; height: 14px; }
    .b-pending { background: #fffbeb; border-color: #fde68a; color: #92400e; }
    .b-review { background: #f5f3ff; border-color: #ddd6fe; color: #6d28d9; }
    .b-paid { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
    .b-prep { background: #f0f9ff; border-color: #bae6fd; color: #0369a1; }
    .b-shipped { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
    .b-cancelled { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

    /* ===== States ===== */
    .state {
      background: #fff; border: 1px dashed var(--line); border-radius: 16px;
      padding: 44px 20px; text-align: center; color: var(--muted); font-size: 14px;
    }
    .state.err { color: var(--danger); border-color: #fecaca; }

    /* ===== Pager ===== */
    .pager { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 26px 0 44px; }
    .pager-row { display: flex; align-items: center; gap: 8px; }
    .pg-btn {
      width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
      display: grid; place-items: center; cursor: pointer; color: #334155;
    }
    .pg-btn svg { width: 18px; height: 18px; }
    .pg-btn:hover:not(:disabled) { border-color: #c7d2e5; }
    .pg-btn:disabled { opacity: .45; cursor: default; }
    .pg-num {
      min-width: 42px; height: 42px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--primary);
      background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 700;
    }
    .pager-caption { font-size: 13px; color: var(--muted); }

    /* ===== Modal ===== */
    .modal {
      position: fixed; inset: 0; display: none; place-items: center; z-index: 40;
      background: rgba(15, 23, 42, .45); padding: 16px;
    }
    .modal.show { display: grid; }
    .sheet {
      width: min(460px, 96vw); background: #fff; border-radius: 16px; border: 1px solid var(--line);
      box-shadow: 0 20px 50px rgba(2, 6, 23, .25); overflow: hidden;
    }
    .sheet > header {
      display: flex; align-items: center; justify-content: space-between; gap: 10px;
      padding: 14px 18px; border-bottom: 1px solid var(--line);
    }
    .sheet > header b { font-size: 16px; }
    .sheet-body { padding: 18px; }
    .btn-ghost {
      border: 1px solid var(--line); background: #fff; color: #334155; padding: 8px 14px;
      border-radius: 10px; font-weight: 700; cursor: pointer; font-family: inherit;
    }
    .btn-ghost:hover { background: #f8fafc; }
    .md-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
    .md-row .mk { color: var(--muted); }
    .md-hr { height: 1px; background: var(--line); margin: 10px 0; }
    .md-total { font-weight: 800; font-size: 15px; }
