/* Unovet Delivery — follows DESIGN.md (Unovet OS): grey ground, white tiles, one blue. */
:root {
  --ground: #f5f5f7; --tile: #ffffff; --well: #f0f0f2; --chrome: rgba(251, 251, 253, 0.8);
  --ink: #1d1d1f; --ink2: #6e6e73; --ink3: #8e8e93;
  --blue: #0071e3; --blue-text: #0071e3; --wash: rgba(0, 113, 227, 0.1); --focus: rgba(0, 113, 227, 0.45);
  --red: #d70015; --orange: #b25000; --green: #1b7a32;
  --smoke: rgba(0, 0, 0, 0.05); --smoke2: rgba(0, 0, 0, 0.09);
  --hair: rgba(0, 0, 0, 0.08); --stroke: rgba(0, 0, 0, 0.16);
  --c-network: #0066cc; --c-petfood: #9a5b13; --c-ulove: #c4114f;
  --rest: 0 1px 2px rgba(0, 0, 0, 0.04);
  --overlay: 0 20px 60px rgba(0, 0, 0, 0.16), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
  --fs-xs: 12.5px; --fs-sm: 13.5px; --fs-body-sm: 14.5px; --fs-body: 15.5px; --fs-title: 17px; --fs-head: 19px; --fs-display: 40px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Sukhumvit Set", "Noto Sans Thai", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #000; --tile: #1c1c1e; --well: #2c2c2e; --chrome: rgba(22, 22, 23, 0.8);
    --ink: #f5f5f7; --ink2: #a1a1a6; --ink3: #8e8e93; --blue-text: #2997ff;
    --wash: rgba(41, 151, 255, 0.16); --focus: rgba(41, 151, 255, 0.55);
    --red: #ff453a; --orange: #ff9f0a; --green: #30d158;
    --smoke: rgba(255, 255, 255, 0.08); --smoke2: rgba(255, 255, 255, 0.14);
    --hair: rgba(255, 255, 255, 0.1); --stroke: rgba(255, 255, 255, 0.2);
    --c-network: #64a8ff; --c-petfood: #e0a96b; --c-ulove: #ff6b8e;
    --rest: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
    color-scheme: dark;
  }
}
@media (max-width: 760px) {
  :root { --fs-xs: 13px; --fs-sm: 14px; --fs-body-sm: 15px; --fs-body: 16px; --fs-title: 17.5px; --fs-head: 20px; --fs-display: 34px; }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--font); font-size: var(--fs-body); line-height: 1.47; letter-spacing: -0.005em; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blue-text); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink2); }
.small { font-size: var(--fs-sm); }
.cap { font-size: var(--fs-xs); color: var(--ink2); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.right { margin-left: auto; }
.stack > * + * { margin-top: 12px; }

/* Shell */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-right: 1px solid var(--hair); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--ink); color: var(--tile); display: grid; place-items: center; font-weight: 700; }
.brand b { font-size: var(--fs-title); letter-spacing: -0.02em; display: block; line-height: 1.2; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink); font-size: var(--fs-body-sm); cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.nav-item:hover { background: var(--smoke); text-decoration: none; }
.nav-item.on { background: var(--smoke2); font-weight: 600; }
.nav-item svg { color: var(--blue-text); flex: none; }
.side-foot { margin-top: auto; padding: 8px 10px; font-size: var(--fs-sm); color: var(--ink2); }
.main { min-width: 0; }
.top { position: sticky; top: 0; height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 20px; background: var(--chrome); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--hair); z-index: 20; }
.top-title { font-weight: 600; font-size: var(--fs-title); }
.top .menu-btn { display: none; }
.page { padding: 28px 36px 96px; max-width: 1600px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: var(--fs-display); line-height: 1.12; letter-spacing: -0.03em; margin: 0; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--ink2); }
.scrim { display: none; }
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; background: var(--tile); transform: translateX(-100%); transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); box-shadow: none; }
  .side.open { transform: none; box-shadow: var(--overlay); }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, 0.2); z-index: 25; }
  .top .menu-btn { display: inline-grid; }
  .page { padding: 18px 16px 96px; }
}
@media (max-width: 760px) { .page { padding: 12px 16px 96px; } }

/* Tiles, lists */
.tile { background: var(--tile); border-radius: 18px; box-shadow: var(--rest); }
.tile-pad { padding: 20px 22px; }
.tile-head { padding: 16px 20px; border-bottom: 1px solid var(--hair); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tile-head h2, .tile-head h3 { margin: 0; font-size: var(--fs-title); font-weight: 600; letter-spacing: -0.02em; }
.list > .li { padding: 12px 16px; display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.list > .li + .li { border-top: 1px solid var(--hair); }
.li-name { font-weight: 600; font-size: var(--fs-title); letter-spacing: -0.02em; }
.empty { padding: 28px 20px; text-align: center; color: var(--ink2); font-size: var(--fs-body-sm); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
@media (max-width: 1100px) { .grid3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-body-sm); }
table.t th { text-align: left; font-size: var(--fs-sm); font-weight: 600; color: var(--ink2); padding: 12px 16px; border-bottom: 1px solid var(--hair); }
table.t td { padding: 14px 16px; border-top: 1px solid var(--hair); font-variant-numeric: tabular-nums; vertical-align: top; }
table.t tr:first-child td { border-top: 0; }
.t-wrap { overflow-x: auto; }

/* Buttons, chips, segmented */
.btn { min-height: 36px; padding: 7px 16px; border-radius: 999px; border: 0; background: var(--smoke); font-size: var(--fs-body-sm); font-weight: 500; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { background: var(--smoke2); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 30px; padding: 4px 12px; font-size: var(--fs-sm); }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--smoke); display: inline-grid; place-items: center; cursor: pointer; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; background: var(--smoke); border-radius: 10px; }
.seg button { border: 0; background: none; border-radius: 8px; min-height: 30px; padding: 4px 12px; font-size: var(--fs-sm); cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--tile); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 0.5px rgba(0, 0, 0, 0.04); }
@media (prefers-color-scheme: dark) { .seg button[aria-checked="true"] { background: #636366; } }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button { width: 30px; height: 30px; border-radius: 50%; border: 0; background: var(--smoke); cursor: pointer; font-size: 17px; line-height: 1; }
.stepper span { min-width: 26px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: var(--fs-sm); font-weight: 600; color: var(--ink2); }
.input, .field input, .field select, .field textarea { min-height: 40px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--stroke); background: var(--tile); font-size: 16px; width: 100%; }
.field textarea { min-height: 84px; resize: vertical; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--wash); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--blue); }
.hint { font-size: var(--fs-xs); color: var(--ink2); }
.hint.warn { color: var(--orange); }
.hint.bad { color: var(--red); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: var(--fs-xs); font-weight: 600; font-variant-numeric: tabular-nums; color: var(--tone, var(--ink2)); background: color-mix(in srgb, var(--tone, var(--ink2)) 8%, transparent); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.muted { --tone: var(--ink2); background: var(--smoke); }
.badge.warn { --tone: var(--orange); }
.badge.bad { --tone: var(--red); }
.badge.ok { --tone: var(--green); }
.badge.info { --tone: var(--blue-text); }
.badge.network { --tone: var(--c-network); }
.badge.petfood { --tone: var(--c-petfood); }
.badge.ulove { --tone: var(--c-ulove); }

/* Shop picker */
.picker { position: relative; }
.picker-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--tile); border-radius: 14px; box-shadow: var(--overlay); max-height: 320px; overflow: auto; z-index: 40; }
.picker-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 14px; cursor: pointer; }
.picker-menu button:hover, .picker-menu button.hl { background: var(--wash); }
.picked { padding: 10px 12px; border-radius: 12px; background: var(--well); font-size: var(--fs-body-sm); }

/* Modal, toast */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.3); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--tile); border-radius: 18px; box-shadow: var(--overlay); width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--hair); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(29, 29, 31, 0.92); color: #fff; backdrop-filter: blur(20px); border-radius: 14px; padding: 12px 16px; font-size: var(--fs-body-sm); z-index: 60; max-width: calc(100vw - 32px); display: flex; gap: 10px; align-items: center; box-shadow: var(--overlay); }
.toast .disc { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; background: #1b7a32; }
.toast.err .disc { background: #d70015; }

/* Local test server banner */
.local-banner { position: sticky; top: 0; z-index: 70; background: var(--orange); color: #fff; text-align: center; padding: 6px 16px; font-size: var(--fs-sm); font-weight: 600; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .tile { width: min(400px, 100%); }

/* Board */
.ship { padding: 12px 16px; }
.ship + .ship { border-top: 1px solid var(--hair); }
.ship-top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.ship-addr { font-size: var(--fs-sm); color: var(--ink2); }
.ship-ctl { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.result-card { border-radius: 14px; padding: 14px 16px; background: var(--wash); }

/* Print */
.print-only { display: none; }
@media print {
  .no-print, .side, .top, .scrim, .toast { display: none !important; }
  .print-only { display: block; }
  .shell { display: block; }
  .page { padding: 0; max-width: none; }
  html, body { background: #fff; color: #000; }
  .print-area { display: block !important; padding: 0 !important; }
  .sheet { box-shadow: none !important; }
}
.sheet { box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12); }
