:root {
  --bg: #f5f6f8; --card: #fff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #1f6feb; --accent-ink: #fff; --good: #1a7f37; --bad: #c62828; --warn: #9a6700;
  --radius: 8px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 24px 0 10px; }
.card h2 { margin-top: 0; }
code { background: #eef0f4; padding: 1px 5px; border-radius: 4px; font-size: 13px; }
small, .muted { color: var(--muted); }
.bad { color: var(--bad); } .good { color: var(--good); }

.top { display: flex; align-items: center; gap: 20px; background: #161b26; color: #fff; padding: 0 20px; flex-wrap: wrap; }
.brand { color: #fff; font-weight: 700; padding: 14px 0; }
.brand span { font-weight: 400; color: #9aa4b8; }
.top nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.top nav a { color: #c8cfdc; padding: 14px 10px; border-bottom: 2px solid transparent; }
.top nav a.on, .top nav a:hover { color: #fff; text-decoration: none; border-bottom-color: #6ea8fe; }
.top .logout .btn { color: #c8cfdc; border-color: #3a4356; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }
main.narrow { max-width: 420px; padding-top: 12vh; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.head h1 { margin: 0; }
.actions { display: flex; gap: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.narrow-card { max-width: 560px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 .card { margin-bottom: 0; }
.grid2 + * { margin-top: 16px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.banner-preview { max-width: 100%; border-radius: 6px; border: 1px solid var(--line); margin-bottom: 12px; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 2px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { font-size: 22px; }

.table { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tr.dim td { color: var(--muted); }
tr.dim td a { color: #5b7fbf; }

label { display: block; margin-bottom: 12px; font-weight: 500; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
input, select, textarea { display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; border: 1px solid #cdd2db; border-radius: 6px; background: #fff; color: var(--text); }
input[type=checkbox] { width: auto; margin: 0; }
input[type=file] { border: 0; padding: 4px 0; }
textarea { resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9ec5fe; border-color: var(--accent); }

.btn { display: inline-block; padding: 8px 14px; font: inherit; font-weight: 500; border: 1px solid #cdd2db; border-radius: 6px; background: #fff; color: var(--text); cursor: pointer; }
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #1a5fcc; }
.btn.danger { color: var(--bad); border-color: #e8b4b4; }
.btn.danger:hover { background: #fdf0f0; }
.btn.ghost { background: transparent; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.wide { width: 100%; }
form.inline { display: inline; }
.card form + form { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { width: auto; flex: 1; min-width: 200px; margin: 0; }
.chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--text); font-size: 13px; }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }
.chip:hover { text-decoration: none; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; background: #eef0f4; white-space: nowrap; }
.s-completed { background: #dcf3e2; color: var(--good); }
.s-refunded, .s-cancelled { background: #fbe4e4; color: var(--bad); }
.s-on_hold, .s-manual_pending { background: #fff1c7; color: var(--warn); }
.s-processing, .s-submitting, .s-paid { background: #e1ecfd; color: #1a4fa0; }

.switch { width: 40px; height: 22px; border-radius: 999px; border: 0; background: #cdd2db; position: relative; cursor: pointer; padding: 0; }
.switch i { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s; }
.switch.on { background: var(--good); }
.switch.on i { left: 21px; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 12px; }
dt { color: var(--muted); }
dd { margin: 0; }
details { margin-top: 10px; }
summary { cursor: pointer; color: var(--accent); }
.pre { white-space: pre-wrap; font-size: 14px; }
.payline { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash.ok { background: #dcf3e2; color: #11522a; }
.flash.err { background: #fbe4e4; color: #8a1c1c; }

.login h1 { text-align: center; }
.login p { font-size: 13px; margin-bottom: 0; }

@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
  .top { padding: 0 12px; gap: 6px; }
  .top nav a { padding: 10px 8px; }
  main { padding: 16px 12px 40px; }
  dl { grid-template-columns: 1fr; gap: 0; }
  dd { margin-bottom: 8px; }
}

/* shop order */
.arrange { list-style: none; padding: 0; margin: 0; }
.arrange > li { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 8px; padding: 8px 12px; }
.arrange > li.grp { border-left: 4px solid var(--accent); }
.arrange li:target { box-shadow: 0 0 0 2px var(--accent); }
.arow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.arow .pos { min-width: 26px; height: 26px; border-radius: 50%; background: #eef0f4; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; }
.arow .aname { flex: 1; min-width: 180px; }
.mover { display: flex; gap: 4px; margin: 0; }
.mover .btn[disabled] { opacity: .35; cursor: default; }
.plans { list-style: none; margin: 8px 0 2px 36px; padding: 0; }
.plans li { padding: 5px 0; border-top: 1px dashed var(--line); }
