:root {
  --navy: #0b2545; --navy-2: #13315c; --blue: #1d5fd1; --blue-2: #e8f0fe; --gold: #d4af37; --gold-2: #fff6d6;
  --pink: #d81b60; --bg: #f5f7fb; --card: #fff; --line: #e6e9f0; --text: #1b2333; --muted: #6b7486;
  --ok: #1e9e5a; --ok-2: #e5f6ec; --warn: #e08a00; --warn-2: #fff3dc; --bad: #d93838; --bad-2: #fdeaea;
  --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Poppins', 'Segoe UI', system-ui, -apple-system, Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: middle; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid transparent; background: var(--navy); color: #fff; padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; transition: .15s; }
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.ghost { background: #fff; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { background: #f3f5f9; filter: none; }
.btn.danger { background: var(--bad); }
.btn.soft-danger { background: var(--bad-2); color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; padding: 6px; border-radius: 8px; cursor: pointer; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: #eef1f6; color: var(--text); }
input, select, textarea { font: inherit; color: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; outline: none; transition: .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,95,209,.12); }
input[type=checkbox], input[type=radio] { width: auto; }
label.f { display: block; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-bottom: 5px; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 14px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { margin-left: auto; }
.hide { display: none !important; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #eef1f6; color: var(--muted); white-space: nowrap; }
.b-placed, .b-open, .b-pending { background: var(--warn-2); color: var(--warn); }
.b-confirmed, .b-packed, .b-in_progress, .b-out_for_delivery { background: var(--blue-2); color: var(--blue); }
.b-delivered, .b-completed, .b-resolved, .b-paid, .b-refunded, .b-available { background: var(--ok-2); color: var(--ok); }
.b-cancelled, .b-rejected, .b-offline { background: var(--bad-2); color: var(--bad); }
.b-busy { background: var(--warn-2); color: var(--warn); }
/* toggle switch */
.sw { position: relative; display: inline-block; width: 40px; height: 22px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw span { position: absolute; inset: 0; background: #cfd5e0; border-radius: 99px; cursor: pointer; transition: .2s; }
.sw span:before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + span { background: var(--blue); }
.sw input:checked + span:before { transform: translateX(18px); }
.sw.sm { width: 32px; height: 18px; } .sw.sm span:before { width: 12px; height: 12px; } .sw.sm input:checked + span:before { transform: translateX(14px); }
/* modal */
.modal-wrap { position: fixed; inset: 0; background: rgba(11,37,69,.45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 100; overflow-y: auto; animation: fade .15s; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.25); animation: pop .18s; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 8px; }
.modal-head h3 { font-size: 18px; }
.modal-body { padding: 10px 22px 6px; max-height: 70vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--line); margin-top: 8px; }
@keyframes fade { from { opacity: 0; } } @keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
#toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; box-shadow: var(--shadow); font-weight: 500; transition: .3s; }
.toast.err { background: var(--bad); } .toast.out { opacity: 0; transform: translateY(8px); }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty .ic { width: 42px; height: 42px; opacity: .45; margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab { border: 1px solid var(--line); background: #fff; padding: 6px 14px; border-radius: 99px; cursor: pointer; font: inherit; font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.tab.on { background: var(--blue-2); border-color: var(--blue); color: var(--blue); font-weight: 600; }
.tab .n { background: #eef1f6; border-radius: 99px; padding: 0 7px; font-size: 11px; }
.tab.on .n { background: var(--blue); color: #fff; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfd; }
table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #f8faff; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
