body { background: #f5eee9; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { background: var(--surface); width: 100%; max-width: 380px; padding: 32px 28px; border-radius: 20px; box-shadow: var(--shadow); text-align: center; }
.login-card .field { text-align: right; }
.login-brand { width: calc(100% + 56px); max-width: none; margin: -32px -28px 20px; aspect-ratio: 16 / 9; object-fit: cover; object-position: 50% 45%; }
.login-card { overflow: hidden; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-left: 44px; }
.pw-eye { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 18px; padding: 4px 6px; opacity: .6; }
.pw-eye.on { opacity: 1; }
.side-brand span { font-family: var(--serif); font-size: 26px !important; font-weight: 600; }
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p { color: var(--muted); margin: 0 0 20px; font-size: 14px; }

.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #e6ebeb; display: flex; flex-direction: column; padding: 18px 12px; position: sticky; top: 0; height: 100vh; }
.side-brand { padding: 4px 10px 18px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px; }
.side-brand span { display: block; font-weight: 700; font-size: 17px; color: #fff; }
.side-brand small { color: #9aa6a7; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav button { display: flex; align-items: center; gap: 10px; background: none; border: 0; color: inherit; text-align: right; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 500; }
.nav button i { font-style: normal; width: 22px; text-align: center; }
.nav button:hover { background: rgba(255,255,255,.06); }
.nav button.on { background: rgba(255,255,255,.12); color: #fff; }
.nb { margin-inline-start: auto; background: var(--accent); color: #fff; font-size: 11px; border-radius: 999px; padding: 1px 8px; }
.side-foot { display: flex; flex-direction: column; gap: 6px; }
.side-foot .btn.ghost { color: #e6ebeb; border-color: rgba(255,255,255,.18); }
.side-foot .btn.ghost:hover { background: rgba(255,255,255,.08); }

.main { padding: 28px 32px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 22px; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 16px 18px; border: 1px solid var(--line); }
.stat .k { color: var(--muted); font-size: 13px; }
.stat .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.stat.hl { background: var(--brand); color: #fff; border-color: var(--brand); }
.stat.hl .k, .stat.hl .v small { color: rgba(255,255,255,.8); }

.panel { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); overflow-x: auto; }
.tbl-wrap { overflow-x: auto; }
.tbl-wrap .tbl { min-width: 640px; }
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range input { width: auto; padding: 5px 8px; }
@media print {
  .side, .no-print, .toast { display: none !important; }
  .app { display: block; }
  .main { padding: 0; }
  body { background: #fff; }
  .panel, .stat { break-inside: avoid; border-color: #ccc; }
  .tbl-wrap { overflow: visible; }
}
.panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: 12.5px; color: var(--muted); font-weight: 600; background: #fbf9f5; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: #f1ece3; display: grid; place-items: center; }
.tbl .acts { display: flex; gap: 6px; justify-content: flex-end; }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); font-size: 13px; }
.pill { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.st-new { background: #fdeee0; color: #b1561c; }
.st-confirmed { background: #e3ecfb; color: #2b5bb5; }
.st-shipping { background: #f2e7fb; color: #7a3db0; }
.st-done { background: var(--brand-soft); color: var(--brand); }
.st-cancelled { background: #eeeeee; color: #777; }
.on-pill { background: var(--brand-soft); color: var(--brand); }
.off-pill { background: #eee; color: #777; }

.filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }

.orders { display: grid; gap: 12px; }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.order.is-new { border-color: #f1c39c; box-shadow: 0 0 0 3px #fdf3e9; }
.order-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.order-top h4 { margin: 0; font-size: 16px; }
.order-items { margin: 10px 0; padding: 10px 12px; background: #faf8f4; border-radius: 10px; font-size: 14px; }
.order-items div { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.order-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.order-acts select { width: auto; padding: 6px 10px; }

.uploader { display: flex; gap: 8px; flex-wrap: wrap; }
.up-img { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.up-img img { width: 100%; height: 100%; object-fit: cover; }
.up-img button { position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.up-img .main-tag { position: absolute; bottom: 0; inset-inline: 0; background: rgba(15,92,77,.85); color: #fff; font-size: 10px; text-align: center; }
.up-add { width: 84px; height: 84px; border-radius: 10px; border: 2px dashed var(--line); display: grid; place-items: center; cursor: pointer; color: var(--muted); font-size: 12px; text-align: center; }
.up-add:hover { border-color: var(--brand); color: var(--brand); }
.hint { font-size: 12.5px; color: var(--muted); margin: -6px 0 12px; }
.import-src { background: var(--brand-soft); color: var(--brand); border-radius: 10px; padding: 8px 12px; margin: 14px 0; font-size: 14px; }
.calc-box { display: flex; justify-content: space-between; align-items: center; background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 16px; margin: 4px 0 12px; }
.calc-box b { font-size: 20px; font-variant-numeric: tabular-nums; }
.calc-box small { color: rgba(255,255,255,.75); }
.form-err { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 8px 12px; font-size: 13.5px; margin-bottom: 10px; }
.fx-tbl td, .fx-tbl th { padding: 7px 10px; }
.pay-card { padding: 16px 18px; margin-bottom: 14px; }
.pay-head { font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.w-row { display: grid; grid-template-columns: 1fr 1fr 1.2fr auto; gap: 8px; margin-bottom: 8px; }
@media (max-width: 640px) { .w-row { grid-template-columns: 1fr 1fr; padding-bottom: 8px; border-bottom: 1px dashed var(--line); } }
.form-sec { font-weight: 600; margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line); }

@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: sticky; top: 0; height: auto; z-index: 10; flex-direction: row; flex-wrap: wrap; align-items: center; align-content: flex-start; padding: 8px 10px; gap: 6px; }
  .date-range { flex-wrap: wrap; width: 100%; }
  .date-range input { flex: 1; min-width: 0; }
  .side-brand { border: 0; margin: 0; padding: 0 6px; flex: 1; }
  .side-brand span { font-size: 22px !important; }
  .side-foot { flex-direction: row; width: auto; }
  .side-foot .btn.block { width: auto; }
  .nav { flex-direction: row; flex-wrap: nowrap; order: 3; width: 100%; overflow-x: auto; flex: none; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { white-space: nowrap; padding: 7px 10px; flex: none; }
  .main { padding: 16px 12px 50px; }
  .tbl .hide-sm { display: none; }
  .tbl th, .tbl td { padding: 9px 8px; }
  .tbl .acts { flex-direction: column; align-items: stretch; }
  .page-head h2 { font-size: 19px; }
}
