/* PeDelivery shared styles — earth tones shared with PeBooking/PeTech. No dark-brown fills. */
:root {
  --paper: #F7F2E9; --surface: #FDFBF6; --sand: #EFE5D5; --latte: #EADBC3; --line: #E2D4BE;
  --ink: #362B22; --inksoft: #6B5D4F; --ink3: #857462; --caramel: #A98260;
  --sage: #7C8F6E; --sagedeep: #56694C; --sagesoft: #DCE3D3; --moss: #6E9459;
  --honey: #C48D38; --honeysoft: #F6E8C9; --terra: #C1654B; --terrasoft: #F6DED4; --white: #FFFDF9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(54, 43, 34, .06), 0 8px 24px -12px rgba(54, 43, 34, .18);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'Prompt', sans-serif; font-size: 15px; line-height: 1.55; }
h1, h2, h3, h4, .font-heading { font-family: 'Kanit', sans-serif; font-style: normal; color: var(--ink); line-height: 1.25; }
a { color: var(--sagedeep); }
[x-cloak] { display: none !important; }
img { max-width: 100%; }

/* Grids and stacks must be allowed to shrink, or long names push content out of the card. */
.grid > *, .stack > *, .flex > * { min-width: 0; }
.stack { display: grid; gap: 16px; }
.truncate-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; font: 600 14.5px/1.2 'Prompt', sans-serif; cursor: pointer; text-decoration: none; transition: background .15s, border-color .15s, color .15s, transform .05s; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--sage); color: var(--white); }
.btn-primary:hover { background: var(--sagedeep); }
.btn-soft { background: var(--sand); color: var(--ink); border-color: var(--line); }
.btn-soft:hover { background: var(--latte); }
.btn-ghost { background: transparent; color: var(--ink); }
.btn-ghost:hover { background: var(--sand); }
.btn-danger { background: var(--terrasoft); color: #8D422F; border-color: #EDC2B1; }
.btn-danger:hover { background: #EDC2B1; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--inksoft); cursor: pointer; }
.icon-btn:hover { background: var(--sand); color: var(--ink); }

/* Cards & pills */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 18px; }
.card-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--sagesoft); color: var(--sagedeep); }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill-ok { background: #DFE9D5; color: #4C6A3D; }
.pill-wait { background: var(--honeysoft); color: #895D23; }
.pill-bad { background: var(--terrasoft); color: #8D422F; }
.pill-off { background: var(--sand); color: var(--inksoft); }
.note { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.note-ok { background: #EFF4EA; color: #3D5532; }
.note-wait { background: #FBF5E8; color: #6C491C; }
.note-bad { background: #FBF0EB; color: #713627; }
.note-info { background: #EEF4F3; color: #324B49; }

/* Forms */
.fld { display: grid; gap: 6px; align-content: start; }
.fld-label { font-weight: 600; font-size: 14px; color: var(--ink); }
.fld-help { font-size: 12.5px; color: var(--ink3); }
.fld-err { font-size: 12.5px; color: #AC533B; }
.inp { width: 100%; border: 1px solid var(--line); background: var(--white); color: var(--ink); border-radius: 10px; padding: 10px 12px; font: 400 15px/1.4 'Prompt', sans-serif; outline: none; transition: border-color .15s, box-shadow .15s; }
.inp:focus { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(124, 143, 110, .22); }
.inp.is-bad { border-color: #E1A08A; }
textarea.inp { resize: vertical; min-height: 84px; }
.inp-group { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 10px; background: var(--white); overflow: hidden; }
.inp-group:focus-within { border-color: var(--sage); box-shadow: 0 0 0 3px rgba(124, 143, 110, .22); }
.inp-group > span { display: flex; align-items: center; padding: 0 10px; background: var(--sand); color: var(--inksoft); font-size: 13px; white-space: nowrap; }
.inp-group > .inp { border: 0; box-shadow: none; border-radius: 0; min-width: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--sage); width: 17px; height: 17px; flex: none; }

/* Switch */
.switch { position: relative; display: inline-block; width: 44px; height: 26px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--latte); border-radius: 999px; transition: background .15s; cursor: pointer; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 20px; height: 20px; background: var(--white); border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.18); transition: transform .15s; }
.switch input:checked + span { background: var(--sage); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(124, 143, 110, .35); }

/* Toast */
#pd-toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; max-width: min(92vw, 420px); background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--sage); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 14px; }
#pd-toast.toast-error { border-left-color: var(--terra); }
@media (min-width: 1024px) { #pd-toast { bottom: 28px; } }

/* Modal: a bottom sheet on phones, a centred dialog from 640px */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-end; justify-content: center; }
.modal-scrim { position: absolute; inset: 0; background: rgba(54, 43, 34, .38); }
.modal { position: relative; width: 100%; max-height: 92vh; overflow: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 18px; flex: 1; }
.modal-foot { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
@media (min-width: 640px) {
  .modal-wrap { align-items: center; padding: 24px; }
  .modal { max-width: 560px; border-radius: 20px; padding: 24px; }
}

/* Owner app navigation */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar button { display: grid; justify-items: center; gap: 2px; padding: 8px 2px 9px; border: 0; background: none; color: var(--ink3); font: 500 11.5px 'Prompt', sans-serif; cursor: pointer; }
.tabbar button i { font-size: 18px; }
.tabbar button.is-active { color: var(--sagedeep); }
.sidenav a, .sidenav button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 0; background: none; color: var(--inksoft); font: 500 14.5px 'Prompt', sans-serif; text-align: left; cursor: pointer; text-decoration: none; }
.sidenav a:hover, .sidenav button:hover { background: var(--sand); color: var(--ink); }
.sidenav .is-active { background: var(--sagesoft); color: var(--sagedeep); font-weight: 600; }
.sidenav i { width: 18px; text-align: center; }

/* Small utilities */
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: pd-spin .7s linear infinite; }
@keyframes pd-spin { to { transform: rotate(360deg); } }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.kbd { font-family: ui-monospace, Consolas, monospace; background: var(--sand); border-radius: 6px; padding: 1px 6px; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
