/* 萬里進銷存 網頁版 —— 風格參考公司 SFIS 看板 */
:root {
  --navy: #0b1437; --indigo: #1f2f8f; --blue: #2f6bff; --cyan: #00c6ff; --violet: #7c4dff;
  --pink: #ff4d9d; --green: #00c48c; --orange: #ff9f43; --red: #ff4d6d;
  --bg: #f2f5fc; --card: #ffffff; --text: #1c2541; --muted: #6b7a99; --line: #e3e9f7;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(31, 64, 160, .10);
  --shadow-lg: 0 18px 40px rgba(31, 64, 160, .20);
  --grad: linear-gradient(135deg, #00c6ff 0%, #2f6bff 50%, #7c4dff 100%);
  --grad-dark: linear-gradient(120deg, #0b1437 0%, #16247a 50%, #3a2bd8 100%);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: Poppins, "Microsoft JhengHei", "PingFang TC", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 12%, rgba(0, 198, 255, .12), transparent 32%),
    radial-gradient(circle at 92% 18%, rgba(124, 77, 255, .12), transparent 30%),
    linear-gradient(rgba(47, 107, 255, .04) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(47, 107, 255, .04) 1px, transparent 1px) 0 0 / 28px 28px,
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 15px;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
[v-cloak] { display: none; }

/* ---------- 頂欄 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--grad-dark);
  padding: calc(10px + var(--safe-top)) 16px 10px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 6px 20px rgba(11, 20, 55, .35);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -3px; height: 3px;
  background: var(--grad); opacity: .9;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; letter-spacing: .5px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 0 0 2px rgba(255,255,255,.85), 0 0 18px rgba(0,198,255,.6);
  font-size: 18px;
}
.brand small { display: block; font-size: 10px; font-weight: 500; opacity: .7; letter-spacing: 1.5px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; border: 1.5px solid rgba(255,255,255,.55);
  background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.back-btn { border-color: transparent; background: transparent; margin-left: -8px; }

.menu {
  position: absolute; left: 16px; right: 16px; top: calc(100% + 8px);
  background: rgba(16, 26, 80, .97); border-radius: var(--radius); padding: 8px;
  box-shadow: var(--shadow-lg); max-width: 560px; margin: 0 auto;
}
.menu a, .menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px;
  color: #e6ecff; background: none; border: 0; border-radius: 10px; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover, .menu a.active { background: rgba(255,255,255,.1); }
.menu svg { width: 18px; height: 18px; opacity: .85; }
.menu .who { padding: 12px 14px 8px; color: #9fb0e8; font-size: 13px; border-top: 1px solid rgba(255,255,255,.1); margin-top: 6px; }

/* ---------- 版面 ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px calc(40px + var(--safe-bottom)); }
.hero {
  background: var(--grad-dark); color: #fff; border-radius: 20px; padding: 22px 20px;
  position: relative; overflow: hidden; box-shadow: var(--shadow-lg); margin-bottom: 18px;
}
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 22px 22px,
    linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px) 0 0 / 22px 22px;
  pointer-events: none;
}
.hero .tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; letter-spacing: 1.5px;
  background: rgba(0,198,255,.18); color: #7fe3ff; border: 1px solid rgba(0,198,255,.5);
  padding: 3px 10px; border-radius: 999px;
}
.hero h1 { margin: 10px 0 6px; font-size: 24px; letter-spacing: 1px; }
.hero p { margin: 0; opacity: .8; font-size: 13px; }
.hero .orb {
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  width: 64px; height: 64px; border-radius: 50%; background: var(--grad);
  display: grid; place-items: center; box-shadow: 0 0 0 8px rgba(255,255,255,.08), 0 0 30px rgba(0,198,255,.7);
}
.hero .orb svg { width: 30px; height: 30px; color: #fff; }

.title-card {
  background: var(--grad-dark); color: #fff; border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.title-card .ic { width: 46px; height: 46px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; flex: none; }
.title-card .ic svg { width: 24px; height: 24px; }
.title-card h2 { margin: 0; font-size: 19px; }
.title-card small { display: block; font-size: 10px; letter-spacing: 2px; opacity: .7; margin-top: 2px; }

/* ---------- 首頁功能卡 ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(6, 1fr); } }
.tile {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 6px 14px; text-align: center; position: relative; overflow: hidden; color: var(--text);
  transition: transform .15s, box-shadow .15s;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.tile::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--c); }
.tile .ic {
  width: 46px; height: 46px; margin: 0 auto 10px; border-radius: 13px; background: var(--c);
  display: grid; place-items: center; color: #fff; box-shadow: 0 8px 18px rgba(47,107,255,.25);
}
.tile .ic svg { width: 24px; height: 24px; }
.tile b { display: block; font-size: 14px; }
.tile small { display: block; font-size: 9px; letter-spacing: 1.5px; color: var(--muted); margin-top: 3px; }

/* ---------- 卡片、清單 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card-h { display: flex; align-items: center; gap: 10px; font-weight: 700; margin: 0 0 12px; font-size: 16px; }
.card-h .ic { width: 30px; height: 30px; border-radius: 9px; background: var(--grad); color: #fff; display: grid; place-items: center; }
.card-h .ic svg { width: 17px; height: 17px; }

.stat-row {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(47,107,255,.06), transparent); margin-bottom: 8px; color: var(--text);
}
.stat-row .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; }
.stat-row .ic svg { width: 19px; height: 19px; }
.stat-row .lbl { flex: 1; font-weight: 600; }
.stat-row .val { font-size: 20px; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat-row .val small { font-size: 11px; color: var(--muted); -webkit-text-fill-color: var(--muted); margin-left: 3px; }

/* ---------- 查詢表單 ---------- */
.form-grid { display: grid; grid-template-columns: 1fr; gap: 10px 16px; }
@media (min-width: 640px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.field { display: flex; align-items: center; gap: 10px; }
.field label { flex: none; width: 64px; font-weight: 600; color: var(--text); font-size: 14px; text-align: right; }
.field input, .field select, .field textarea {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1.5px solid var(--line);
  background: #f7f9ff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,107,255,.15); background: #fff; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  padding: 11px 28px; border-radius: 999px; font-weight: 700; color: #fff; background: var(--grad);
  box-shadow: 0 10px 22px rgba(47,107,255,.35);
}
.btn svg { width: 17px; height: 17px; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: #fff; color: var(--blue); border: 1.5px solid var(--line); box-shadow: none; }
.btn-row { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }

.seg { display: flex; background: #eef2fc; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--blue); box-shadow: 0 3px 10px rgba(31,64,160,.12); }

/* ---------- 結果清單（手機卡片） ---------- */
.list { display: grid; gap: 10px; }
@media (min-width: 760px) { .list { grid-template-columns: 1fr 1fr; } }
.item {
  display: block; background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 14px 12px 18px;
  position: relative; color: var(--text); overflow: hidden;
}
.item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.item .row1 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item .main { font-weight: 700; font-size: 15px; word-break: break-all; }
.item .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.item .kv { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; }
.item .kv span { color: var(--muted); }
.item .kv b { color: var(--text); font-weight: 600; }
.price { font-weight: 800; color: var(--blue); white-space: nowrap; }

.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.b-blue { background: rgba(47,107,255,.12); color: var(--blue); }
.b-green { background: rgba(0,196,140,.14); color: #00936a; }
.b-orange { background: rgba(255,159,67,.18); color: #c9690f; }
.b-red { background: rgba(255,77,109,.14); color: #d92b4b; }
.b-gray { background: #eef1f7; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 16px 0 4px; color: var(--muted); font-size: 13px; }
.pager button { width: 36px; height: 36px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; display: grid; place-items: center; }
.pager button:disabled { opacity: .4; cursor: default; }
.pager svg { width: 16px; height: 16px; }
.pager b { min-width: 30px; height: 30px; border-radius: 9px; background: var(--grad); color: #fff; display: grid; place-items: center; }

.empty, .loading { text-align: center; color: var(--muted); padding: 30px 10px; }
.err { background: rgba(255,77,109,.1); color: #c4203f; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; font-size: 14px; }
.spin { width: 26px; height: 26px; border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 明細 ---------- */
.dl { display: grid; grid-template-columns: 88px 1fr; gap: 8px 12px; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; word-break: break-all; }
.lines { width: 100%; border-collapse: collapse; font-size: 13px; }
.lines th { background: var(--grad-dark); color: #fff; padding: 9px 8px; text-align: left; font-weight: 600; white-space: nowrap; }
.lines th:first-child { border-radius: 10px 0 0 0; } .lines th:last-child { border-radius: 0 10px 0 0; }
.lines td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lines .num { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.total-bar {
  margin-top: 12px; background: var(--grad); color: #fff; border-radius: 12px; padding: 12px 16px;
  display: flex; justify-content: space-between; font-weight: 700;
}
.photos { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.photos img { width: 100%; border-radius: 12px; background: #eef1f7; aspect-ratio: 4/3; object-fit: cover; cursor: zoom-in; }
.lightbox { position: fixed; inset: 0; background: rgba(5,10,30,.9); z-index: 100; display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 90vh; border-radius: 10px; }

/* ---------- 登入 ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login { width: 100%; max-width: 380px; }
.login .hero { text-align: center; padding: 30px 20px; }
.login .hero .orb { position: static; transform: none; margin: 0 auto 14px; }
.login .field label { width: 44px; }
.demo-note { text-align: center; font-size: 13px; color: var(--muted); margin-top: 10px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 26px; }
