:root {
  --bg: #f6f6f4; --panel: #fff; --text: #1f2328; --muted: #6b7280; --line: #e5e7eb;
  --accent: #f1641e; --accent-soft: #fdeee6; --ok: #15803d; --ok-soft: #e7f6ec;
  --warn: #b45309; --warn-soft: #fef3e2; --bad: #b91c1c; --bad-soft: #fdecec; --info: #1d4ed8; --info-soft: #e8efff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--text); background: var(--bg); display: flex; min-height: 100vh; }
.side { width: 200px; flex: none; background: #1f2328; color: #d1d5db; padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; }
.brand { color: #fff; font-weight: 700; font-size: 18px; padding: 0 10px 18px; }
.brand::before { content: ""; display: inline-block; width: 10px; height: 10px; background: var(--accent); border-radius: 3px; margin-right: 8px; }
nav a { display: flex; justify-content: space-between; align-items: center; color: inherit; text-decoration: none; padding: 9px 10px; border-radius: 6px; margin-bottom: 2px; }
nav a:hover { background: #2d333b; }
nav a.on { background: #2d333b; color: #fff; }
.pill { background: var(--accent); color: #fff; font-size: 11px; border-radius: 10px; padding: 0 7px; }
.pill:empty { display: none; }
.mode:empty { visibility: hidden; }
.mode { margin-top: auto; font-size: 12px; padding: 8px 10px; border-radius: 6px; background: #2d333b; }
main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
h1 { font-size: 22px; margin: 0; }
.head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head .grow { flex: 1; }
.sub { color: var(--muted); font-size: 13px; }
button, .btn { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 7px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
button:hover { border-color: #c7cbd1; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(.95); }
button:disabled { opacity: .5; cursor: default; }
button.link { border: 0; background: none; color: var(--info); padding: 0; }
input, select, textarea { font: inherit; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: #fff; color: var(--text); }
textarea { width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi .label { color: var(--muted); font-size: 12px; }
.kpi .val { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi.alert .val { color: var(--bad); }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
.card h2 { font-size: 15px; margin: 0 0 12px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { border-radius: 20px; padding: 5px 12px; }
.tabs button.on { background: var(--text); color: #fff; border-color: var(--text); }
.tabs .n { opacity: .7; margin-left: 4px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.tablewrap { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafafa; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafaf8; }
tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.chk, th.chk { width: 34px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: #f0f0ee; margin: 0 4px 3px 0; }
.st { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.st.paid { background: var(--warn-soft); color: var(--warn); }
.st.late { background: var(--bad-soft); color: var(--bad); }
.st.shipped { background: var(--info-soft); color: var(--info); }
.st.delivered, .st.active { background: var(--ok-soft); color: var(--ok); }
.st.canceled, .st.inactive { background: #eee; color: var(--muted); }
.st.draft { background: var(--accent-soft); color: var(--accent); }
.warn { color: var(--warn); font-size: 12px; }
.bulkbar { position: sticky; top: 0; z-index: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--text); color: #fff; padding: 8px 12px; border-radius: 8px; margin-bottom: 10px; }
.bulkbar select, .bulkbar input { padding: 5px 8px; }
.bulkbar button { padding: 5px 10px; }
.bars { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.bars div { flex: 1; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.bars div:hover { filter: brightness(.9); }
.bars div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; font-size: 11px; padding: 3px 6px; border-radius: 4px; white-space: nowrap; margin-bottom: 4px; z-index: 3; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }
.meter { height: 6px; background: #f0f0ee; border-radius: 3px; overflow: hidden; min-width: 80px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 10; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.2); }
.modal h2 { margin: 0 0 14px; font-size: 18px; }
.actions { display: flex; gap: 8px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.form .full { grid-column: 1 / -1; }
.shopgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.shopgrid label { display: flex; flex-direction: row; gap: 6px; align-items: center; color: var(--text); font-size: 13px; }
.override { display: grid; grid-template-columns: 160px 1fr 1fr 90px; gap: 6px; align-items: center; margin-bottom: 6px; }
.results { margin-top: 12px; max-height: 240px; overflow-y: auto; font-size: 13px; }
.results div { padding: 3px 0; }
.ok { color: var(--ok); } .bad { color: var(--bad); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 20; max-width: 90vw; }
.items { margin: 0; padding-left: 16px; }
.empty { text-align: center; padding: 40px; color: var(--muted); }
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0 0 12px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.notice { background: var(--info-soft); color: var(--info); padding: 10px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.pf { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .02em; padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }
.pf.etsy { background: var(--accent-soft); color: var(--accent); }
.pf.shopify { background: #e6f4ea; color: #2e7d32; }
.card.split { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.card.split .label { font-size: 12px; color: var(--muted); }
.card.split .val { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.splitbar { flex: 1; min-width: 160px; height: 10px; border-radius: 5px; overflow: hidden; display: flex; background: #f0f0ee; }
.splitbar i.etsy { background: var(--accent); }
.splitbar i.shopify { background: #43a047; }
.shopgrid .grp { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; margin-top: 4px; font-size: 12px; }
.ver { font-size: 11px; color: #8b949e; padding: 6px 10px 0; }
.steps { padding-left: 18px; margin: 0 0 14px; font-size: 13px; line-height: 1.6; }
.steps li { margin-bottom: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.warnbox { background: var(--warn-soft); color: var(--warn); }
.badbox { background: var(--bad-soft); color: var(--bad); }
.notice a { color: inherit; }
.drop { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 90px; border: 2px dashed #d1d5db; border-radius: 10px; color: var(--muted); cursor: pointer; padding: 12px; font-size: 13px; }
.drop.over, .drop:hover { border-color: var(--accent); background: var(--accent-soft); }
.previews { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.pv { position: relative; width: 92px; height: 92px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fafafa; }
.pv img { width: 100%; height: 100%; object-fit: cover; }
.pv button { position: absolute; top: 3px; right: 3px; padding: 0 6px; font-size: 12px; border-radius: 10px; }
.pv .star { right: auto; left: 3px; color: #e8a400; }
.pv em { position: absolute; left: 4px; bottom: 2px; font-style: normal; font-size: 11px; color: #fff; text-shadow: 0 0 3px #000; }
.pv span + em { display: none; }
.pv { cursor: grab; }
.pv.dragging { opacity: .4; }
.pv.dropto { outline: 2px solid var(--accent, #f1641e); }
.daterange input { padding: 6px 8px; }
.pv span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; text-align: center; }
.count { font-size: 11px; margin-left: 4px; }
.pershop { display: grid; gap: 10px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.ps { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: grid; gap: 6px; }
.ps label { display: flex; flex-direction: column; gap: 3px; }
.ps-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ps-head b { flex: 1; }
.ps-head select { max-width: 200px; }
.ps-head input { width: 100px; }
.thumbcell { width: 52px; padding-right: 0; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
@media (max-width: 760px) {
  body { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 12px; overflow-x: auto; }
  .brand { padding: 0 10px 0 0; }
  nav { display: flex; }
  .mode { display: none; }
  main { padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .override { grid-template-columns: 1fr; }
}
.form .row { display: flex; flex-wrap: wrap; }
.colrow { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 6px 0 2px; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; padding: 1px 4px 1px 9px; border-radius: 10px; background: #e8f0fb; color: #1d3f6e; }
.chip button { border: 0; background: none; padding: 0 4px; font-size: 14px; line-height: 1; cursor: pointer; color: inherit; }
.colrow input { width: 220px; font-size: 12px; padding: 3px 6px; }
.optgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.optbox { display: flex; flex-direction: column; gap: 6px; background: #fafaf8; border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.optbox textarea { font-family: inherit; }
.form label.check { flex-direction: row; align-items: center; gap: 6px; }
.vtp { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.vtp[hidden] { display: none !important; }
.vtp label { flex-direction: row !important; align-items: center; gap: 6px; }
.vtp #vtPIns { flex: 1; min-width: 240px; }
@media (max-width: 760px) { .optgrid { grid-template-columns: 1fr; } }
.quick { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; margin-bottom: 8px; }
.qf { display: inline-flex; gap: 4px; align-items: center; }
.qf input { width: 64px; padding: 3px 5px; font-size: 12px; }
.ptable { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.ptable table { width: 100%; }
.ptable th, .ptable td { padding: 3px 8px; font-size: 13px; }
.ptable input { width: 80px; padding: 3px 5px; text-align: right; }
.btnlike { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; font-size: 14px; color: var(--text); }

.taxlist{display:flex;flex-direction:column;align-items:flex-start;max-height:200px;overflow:auto;margin-top:4px}
.taxlist .taxhit{text-align:left;padding:3px 0}

.oitems{display:flex;flex-direction:column;gap:10px}
.oitem{display:flex;gap:12px;align-items:flex-start}
.oitem img{width:110px;height:110px;object-fit:cover;border-radius:8px;border:1px solid var(--line,#ddd);background:#fff}
.oitem .noimg{width:110px;height:110px;border-radius:8px;border:1px dashed #ccc;display:flex;align-items:center;justify-content:center;font-size:11px;color:#999;text-align:center}
.oitem .vline{font-weight:600}
.oitem label{display:block;margin-top:4px}
.oitem input{width:100%}
.olinei{display:flex;gap:6px;align-items:center;margin-top:3px}
.othumb{width:36px;height:36px;object-fit:cover;border-radius:4px;flex:none}

.fees{border-collapse:collapse;min-width:300px}
.fees td{padding:2px 12px 2px 0;border:0}
.fees .tot td{font-weight:700;border-top:1px solid #ddd;padding-top:4px}
.pv .fx { position: absolute; right: 3px; bottom: 3px; font-style: normal; font-size: 10px; background: #2b6cb0; color: #fff; padding: 0 4px; border-radius: 4px; }
.draftbox { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: #eef6ff; }
.dline select{max-width:100%;margin:2px 0}
.dline .dsrc{margin-top:2px}
.dtab{margin-top:10px;border:1px solid var(--line,#ddd);border-radius:8px;padding:6px 10px}
.dtab summary{cursor:pointer}
.dtable{width:100%;border-collapse:collapse;margin-top:6px}
.dtable td{padding:4px 6px;vertical-align:top;border-top:1px solid var(--line,#eee)}
.dtable td:first-child{width:40%;color:var(--text,#222)}
.dtable input{width:100%}
.dtable .dgroup td{font-weight:600;background:rgba(0,0,0,.03)}
.pill.warnpill{background:#d97706}
.health{font-size:12px;line-height:1.4;margin-bottom:4px}
.health.bad{color:#b91c1c}
.health.warn{color:#b45309}
.healthbox{margin-bottom:12px;border-left:4px solid #d97706}
.healthbox.bad{border-left-color:#dc2626;background:#fef2f2}
.healthbox div{margin-top:4px}
.linkrow{display:flex;gap:8px;align-items:flex-end}
.linkrow .grow{flex:1}
.linkrow button{margin-bottom:1px}
#aLinkOut div{margin-top:4px;line-height:1.5}
.portwarn{background:#fef3c7;color:#92400e;border:1px solid #f59e0b;border-radius:8px;padding:8px 10px;font-size:12px;line-height:1.4;margin:10px 0}
.form label.link{display:inline;margin:0;color:#1d4ed8;text-decoration:underline;cursor:pointer;font-size:inherit}
.bmk{display:inline-block;padding:1px 9px;border:1px solid var(--accent);border-radius:12px;color:var(--accent);background:var(--accent-soft);text-decoration:none;font-weight:600;cursor:grab}
.varimg { border: 1px solid var(--line, #ddd); border-radius: 8px; padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; }
.varimg select { width: auto; display: inline-block; margin-left: 6px; }
.virow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.virow b { min-width: 70px; }
.virow img { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; border: 2px solid transparent; cursor: pointer; opacity: .55; }
.virow img:hover { opacity: 1; }
.virow img.on { border-color: #2563eb; opacity: 1; }
.cRow { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.varimg select { max-width: 260px; }
/* Đăng nhập và tài khoản */
body.auth .side { display: none; }
.login { max-width: 360px; margin: 10vh auto; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0 0 4px; }
.login label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.who { margin-top: auto; padding: 10px 6px; border-top: 1px solid #374151; color: #e5e7eb; font-size: 13px; }
.who + .ver { margin-top: 6px; }
.who button.link { color: #93c5fd; }
label.chk { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-size: 13px; }
nav a[hidden] { display: none; }
