:root {
  --primary: #C6813A;
  --primary-dark: #A5672A;
  --cream: #FBF6EE;
  --ink: #2B2118;
  --muted: #8A7A68;
  --border: #E8DCC8;
  --green: #4C8B5F;
  --red: #E05C5C;
  --blue: #3E7CB1;
  --card: #FFFFFF;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ── LOGIN ── */
.login-screen {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, var(--cream), #F0E4CE);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border-radius: 20px;
  padding: 2rem 1.75rem;
  box-shadow: 0 12px 40px rgba(43,33,24,0.12);
  text-align: center;
}
.login-logo { font-size: 1.6rem; font-weight: 800; color: var(--primary-dark); }
.login-sub { color: var(--muted); font-size: 0.85rem; margin: 0.25rem 0 1.5rem; }
.field { text-align: left; margin-bottom: 1rem; }
.field label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-bottom: 0.35rem; }
.field input {
  width: 100%; padding: 0.85rem 1rem; font-size: 1rem;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: var(--cream); color: var(--ink); outline: none;
}
.field input:focus { border-color: var(--primary); }
.login-error {
  color: var(--red); font-size: 0.82rem; margin-bottom: 0.75rem; min-height: 1em;
}
.btn-primary {
  background: var(--primary); color: #fff; border: none;
  padding: 0.9rem 1.5rem; border-radius: 12px; font-weight: 700; font-size: 1rem;
}
.btn-primary:active { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; }
.btn-block { width: 100%; }
.login-footnote { margin-top: 1.25rem; font-size: 0.78rem; color: var(--muted); }

/* ── APP SHELL ── */
.app { min-height: 100vh; padding-bottom: 2rem; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.1rem; background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { display: flex; align-items: center; gap: 0.6rem; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }
.logo-mark { font-size: 1.4rem; }
.biz-brand { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; color: var(--primary); line-height: 1.3; }
.biz-name { font-weight: 700; font-size: 1rem; line-height: 1.25; }
.biz-sub { font-size: 0.72rem; color: var(--green); font-weight: 600; }
.biz-sub.offline { color: var(--muted); }
.icon-btn {
  background: var(--cream); border: none; width: 38px; height: 38px;
  border-radius: 50%; font-size: 1.1rem; color: var(--muted);
}
.install-btn { color: var(--primary-dark); background: #FFF1DC; }

.ios-install-hint {
  background: #FFF1DC; color: var(--primary-dark); font-size: 0.78rem;
  padding: 0.6rem 2.2rem 0.6rem 1rem; position: relative; line-height: 1.5;
}
.ios-hint-close {
  position: absolute; right: 0.6rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--primary-dark); font-size: 0.9rem; padding: 0.3rem;
}

.tabs { display: flex; gap: 0.5rem; padding: 0.75rem 1rem 0; background: var(--card); }
.tab {
  flex: 1; padding: 0.6rem 0.5rem; border: none; background: var(--cream);
  border-radius: 10px 10px 0 0; font-weight: 600; font-size: 0.88rem; color: var(--muted);
}
.tab.active { background: var(--cream); color: var(--primary-dark); box-shadow: inset 0 -3px 0 var(--primary); }
.tab-badge {
  display: inline-block; margin-left: 0.35rem; background: var(--red); color: #fff;
  font-size: 0.68rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 999px;
}

.order-list { padding: 1rem; display: flex; flex-direction: column; gap: 0.9rem; }

.empty-state { text-align: center; padding: 3.5rem 1rem; color: var(--muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.empty-sub { font-size: 0.82rem; margin-top: 0.35rem; max-width: 280px; margin-left: auto; margin-right: auto; }

/* ── ORDER CARD ── */
.order-card {
  background: var(--card); border-radius: 16px; padding: 1rem 1.1rem;
  box-shadow: 0 2px 10px rgba(43,33,24,0.06); border: 1px solid var(--border);
}
.order-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.order-ref { font-weight: 800; color: var(--primary-dark); font-size: 0.95rem; }
.order-status-pill {
  font-size: 0.68rem; font-weight: 700; padding: 0.25rem 0.6rem; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap;
}
.st-assigned { background: #FFF1DC; color: #A5672A; }
.st-accepted { background: #E3EEFB; color: var(--blue); }
.st-preparing { background: #FDEFD9; color: #B8842A; }
.st-ready { background: #E7F3E9; color: var(--green); }
.st-out_for_delivery { background: #E3F0FB; color: #2D6EA3; }
.st-delivered { background: #E7F3E9; color: var(--green); }

.order-customer { margin-top: 0.6rem; font-weight: 700; font-size: 0.95rem; }
.order-line { font-size: 0.85rem; color: var(--muted); margin-top: 0.15rem; display: flex; gap: 0.4rem; align-items: flex-start; }
.order-line a { color: var(--blue); text-decoration: none; font-weight: 600; }
.order-items { font-size: 0.82rem; color: var(--ink); margin-top: 0.5rem; line-height: 1.5; }
.order-amount { font-weight: 700; margin-top: 0.4rem; color: var(--primary-dark); }

.order-actions { display: flex; gap: 0.5rem; margin-top: 0.9rem; }
.btn-action {
  flex: 1; padding: 0.7rem 0.5rem; border-radius: 10px; border: none;
  font-weight: 700; font-size: 0.85rem; background: var(--primary); color: #fff;
}
.btn-action.secondary { background: var(--cream); color: var(--ink); border: 1px solid var(--border); }
.btn-action:disabled { opacity: 0.5; }

/* ── DETAIL SHEET ── */
.sheet-overlay {
  position: fixed; inset: 0; background: rgba(43,33,24,0.45);
  display: none; align-items: flex-end; z-index: 100;
}
.sheet-overlay.open { display: flex; }
.sheet {
  background: var(--card); width: 100%; max-height: 88vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 0.75rem 1.25rem 2rem;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 999px; margin: 0.25rem auto 1rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%) translateY(100px);
  background: var(--ink); color: #fff; padding: 0.75rem 1.25rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 600; z-index: 200; transition: transform 0.25s ease;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (min-width: 640px) {
  .order-list { max-width: 560px; margin: 0 auto; }
  .topbar-title, .tabs { max-width: 560px; margin: 0 auto; width: 100%; }
  .sheet-overlay { align-items: center; justify-content: center; }
  .sheet { max-width: 480px; border-radius: 20px; max-height: 85vh; }
}
