:root {
  --red: #a90f17; --red-2: #d71920; --teal: #1a8f7a; --ink: #1f2a44; --muted: #6b7280;
  --line: #e3e8ef; --bg: #f4f6fa; --green: #2e9e6b; --amber: #d99019;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.4;
}
.hidden { display: none !important; }
a { color: var(--red); }

/* ---- top bar ---- */
.m-top {
  position: sticky; top: 0; z-index: 5; background: var(--red);
  color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 14px 10px; display: flex; align-items: center; gap: 10px;
}
.m-top .m-back { font-size: 22px; background: none; border: 0; color: #fff; padding: 0 4px; }
.m-top h1 { font-size: 17px; margin: 0; flex: 1; font-weight: 700; }
.m-net { font-size: 11px; padding: 3px 8px; border-radius: 20px; background: rgba(255,255,255,0.2); }
.m-net.off { background: var(--amber); }
.m-queue { font-size: 11px; padding: 3px 8px; border-radius: 20px; background: #fff; color: var(--red); font-weight: 700; }

/* ---- layout ---- */
.m-wrap { padding: 14px; max-width: 640px; margin: 0 auto; padding-bottom: 90px; }
.m-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 12px; }
.m-card h2 { margin: 0 0 8px; font-size: 15px; }
.m-sub { color: var(--muted); font-size: 13px; margin: 2px 0 0; }

/* ---- home tiles ---- */
.m-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-tile {
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 12px;
  text-align: center; font-weight: 600; cursor: pointer; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.m-tile .ic { font-size: 30px; }
.m-tile:active { background: #fbeaea; }

/* ---- forms ---- */
label.m-field { display: block; margin-bottom: 12px; font-size: 13px; color: var(--muted); }
label.m-field > span { display: block; margin-bottom: 4px; }
.m-field input, .m-field select, .m-field textarea {
  width: 100%; font-size: 16px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.m-field textarea { min-height: 80px; resize: vertical; }
.m-row { display: flex; gap: 10px; }
.m-row > * { flex: 1; }

.m-mp-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.m-mp-row input { flex: 1; }
.m-mp-row .qty { max-width: 88px; }
.m-mp-row .del { background: none; border: 0; color: var(--red); font-size: 20px; padding: 0 4px; }
.m-add { background: none; border: 1px dashed var(--line); border-radius: 10px; padding: 10px; width: 100%; color: var(--teal); font-weight: 600; }

.m-chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.m-chip { padding: 9px 12px; border: 1px solid var(--line); border-radius: 20px; background: #fff; font-size: 14px; }
.m-chip.on { background: var(--teal); color: #fff; border-color: var(--teal); }

/* ---- buttons ---- */
.m-submit-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(env(safe-area-inset-bottom) + 10px); background: rgba(255,255,255,0.96); border-top: 1px solid var(--line); }
.m-btn { width: 100%; font-size: 16px; font-weight: 700; padding: 14px; border-radius: 12px; border: 0; background: var(--red); color: #fff; }
.m-btn:active { background: var(--red-2); }
.m-btn.sec { background: #fff; color: var(--red); border: 1px solid var(--red); }

/* ---- login ---- */
.m-login { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 24px; max-width: 420px; margin: 0 auto; }
.m-login .logo { text-align: center; font-weight: 800; color: var(--red); font-size: 26px; margin-bottom: 4px; }
.m-login .tag { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 14px; }

/* ---- toast ---- */
.m-toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: 90%; text-align: center; }
.m-toast.err { background: var(--red); }
.m-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.m-thumb { position: relative; width: 78px; height: 78px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.m-thumb img { width: 100%; height: 100%; object-fit: cover; }
.m-thumb .del { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,0.6); color: #fff; font-size: 15px; line-height: 1; }
.m-list-item { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.m-note { color: var(--muted); font-size: 13px; }
