/* =====================================================================
   "Midnight Kitchen" theme: dark glass, saffron glow, 3D depth
   ===================================================================== */
:root {
  --bg: #120a15;
  --bg2: #1d0f22;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-2: rgba(255, 255, 255, 0.09);
  --glass-line: rgba(255, 255, 255, 0.11);
  --ink: #f6eee8;
  --muted: #b3a2ad;
  --dim: #7f6d79;
  --saffron: #ffb547;
  --ember: #ff6a3d;
  --brand: #ff8a3d;
  --brand-dark: #e2561f;
  --grad: linear-gradient(135deg, #ffcb5c 0%, #ff8a3d 50%, #ff4f5e 100%);
  --ok: #3ddc97;
  --ok-soft: rgba(61, 220, 151, 0.14);
  --warn: #ffc24d;
  --warn-soft: rgba(255, 194, 77, 0.13);
  --bad: #ff6178;
  --bad-soft: rgba(255, 97, 120, 0.14);
  --radius: 18px;
  --shadow-3d: 0 1px 0 rgba(255,255,255,.08) inset, 0 18px 40px -12px rgba(0,0,0,.65), 0 4px 10px rgba(0,0,0,.35);
  --display: 'Fraunces', Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 15px; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
/* animated ambient background */
body::before {
  content: ''; position: fixed; inset: -20%; z-index: -2; pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 10%, rgba(255, 138, 61, .22), transparent 70%),
    radial-gradient(35% 35% at 90% 20%, rgba(155, 107, 255, .20), transparent 70%),
    radial-gradient(45% 40% at 60% 100%, rgba(255, 79, 94, .16), transparent 70%),
    linear-gradient(180deg, var(--bg2), var(--bg));
  animation: drift 26s ease-in-out infinite alternate;
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, black, transparent 85%);
}
@keyframes drift { to { transform: translate3d(3%, -2%, 0) rotate(3deg) scale(1.05); } }

h1 { font-family: var(--display); font-size: 2rem; font-weight: 800; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 14px; font-weight: 650; }
h3 { margin: 0; font-size: 1.05rem; }
a { color: var(--saffron); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.loading, .error { padding: 40px; text-align: center; color: var(--muted); }
.error { color: var(--bad); }
.row { display: flex; align-items: center; }
.gap { gap: 8px; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
::selection { background: rgba(255, 138, 61, .4); }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 22px; background: rgba(18, 10, 21, .72);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--glass-line);
}
.brand { font-family: var(--display); font-weight: 800; font-size: 1.25rem; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.brand .logo {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-size: 1.2rem;
  background: var(--grad); box-shadow: 0 6px 18px -4px rgba(255,106,61,.7), inset 0 1px 0 rgba(255,255,255,.5);
  transform: perspective(200px) rotateX(12deg);
}
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
#nav a {
  display: flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-weight: 550; white-space: nowrap; position: relative;
  transition: color .2s, background .2s, transform .2s;
}
#nav a:hover { color: var(--ink); background: var(--glass); transform: translateY(-1px); }
#nav a.active { color: #1b0d10; background: var(--grad); box-shadow: 0 6px 18px -6px rgba(255,106,61,.8), inset 0 1px 0 rgba(255,255,255,.45); }
#nav .badge {
  background: #fff; color: var(--brand-dark); border-radius: 99px; font-size: .7rem;
  padding: 1px 7px; font-weight: 800; box-shadow: 0 0 0 3px rgba(255,97,120,.35); animation: pulse 2s infinite;
}
#nav a:not(.active) .badge { background: var(--bad); color: #fff; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(255,97,120,0); } }
.user { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--glass-2); border: 1px solid var(--glass-line); }

.due-banner {
  display: block; text-align: center; padding: 10px 16px; text-decoration: none;
  color: #ffe2b0; background: linear-gradient(90deg, rgba(255,138,61,.0), rgba(255,138,61,.22), rgba(255,138,61,.0));
  border-bottom: 1px solid rgba(255,181,71,.25);
}
.due-banner .bell { display: inline-block; animation: ring 2.4s ease-in-out infinite; transform-origin: 50% 0; }
@keyframes ring { 0%,60%,100% { transform: rotate(0) } 65% { transform: rotate(18deg) } 75% { transform: rotate(-16deg) } 85% { transform: rotate(10deg) } 92% { transform: rotate(-6deg) } }
main#view { max-width: 1280px; margin: 0 auto; padding: 26px 22px 100px; }
main#view > * { animation: rise .55s cubic-bezier(.2,.8,.2,1) both; }
main#view > *:nth-child(2) { animation-delay: .05s } main#view > *:nth-child(3) { animation-delay: .1s }
main#view > *:nth-child(4) { animation-delay: .15s } main#view > *:nth-child(5) { animation-delay: .2s }
main#view > *:nth-child(n+6) { animation-delay: .25s }
@keyframes rise { from { opacity: 0; transform: translateY(18px) scale(.985); } }

.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }

/* ---------- glass cards ---------- */
.card, .stat, .table-wrap, .menu-card, .modal {
  background: linear-gradient(160deg, rgba(255,255,255,.085), rgba(255,255,255,.03));
  border: 1px solid var(--glass-line); border-radius: var(--radius);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow-3d);
}
.card { padding: 20px; margin-bottom: 20px; }
.card h2 { display: flex; align-items: center; gap: 8px; }

/* 3D tilt cards (JS sets --rx/--ry) */
.tilt { transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateZ(0); transition: transform .25s ease, box-shadow .25s; transform-style: preserve-3d; will-change: transform; }
.tilt:hover { box-shadow: 0 1px 0 rgba(255,255,255,.1) inset, 0 30px 50px -18px rgba(0,0,0,.75), 0 0 0 1px rgba(255,181,71,.25); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat { padding: 18px 20px; position: relative; overflow: hidden; }
.stat::after { content: ''; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(255,181,71,.22), transparent 70%); }
.stat .lbl { color: var(--muted); font-size: .82rem; font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.stat .val { font-family: var(--display); font-size: 1.9rem; font-weight: 800; margin-top: 6px; transform: translateZ(30px); }
.stat.alert { border-color: rgba(255,97,120,.45); background: linear-gradient(160deg, rgba(255,97,120,.2), rgba(255,97,120,.04)); }
.stat.alert .val { color: #ffb0bd; }
.stat.warn { border-color: rgba(255,194,77,.4); background: linear-gradient(160deg, rgba(255,194,77,.18), rgba(255,194,77,.03)); }
.stat.warn .val { color: #ffe0a3; }
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.span2 { grid-column: span 2; }
.span3 { grid-column: 1 / -1; }

/* ---------- hero (Today page) ---------- */
.hero {
  position: relative; display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; min-height: 250px;
  padding: 26px 30px; margin-bottom: 22px; overflow: hidden; border-radius: 26px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(255,138,61,.35), transparent 55%), linear-gradient(135deg, rgba(255,255,255,.1), rgba(255,255,255,.02));
  border: 1px solid rgba(255,181,71,.25); box-shadow: var(--shadow-3d);
}
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.05; }
.hero p { color: var(--muted); margin: 10px 0 18px; font-size: 1.02rem; }
.hero .chef-stage { position: absolute; right: 0; top: 0; bottom: 0; width: 46%; }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 550; color: var(--muted); }
input, select, textarea {
  font: inherit; color: var(--ink); background: rgba(0,0,0,.28); border: 1px solid var(--glass-line); border-radius: 12px;
  padding: 10px 12px; width: 100%; min-width: 0; transition: border-color .2s, box-shadow .2s, background .2s;
  box-shadow: inset 0 2px 6px rgba(0,0,0,.35);
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--saffron); background: rgba(0,0,0,.4); box-shadow: inset 0 2px 6px rgba(0,0,0,.35), 0 0 0 4px rgba(255,181,71,.18); }
input:disabled { opacity: .6; }
select option, select optgroup { background: #22122a; color: var(--ink); }
input[type=date], input[type=datetime-local], input[type=month] { color-scheme: dark; }
.filters { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: 12px; align-items: end; }
.hint { font-size: .78rem; color: var(--dim); font-weight: 400; }

/* ---------- 3D buttons ---------- */
.btn {
  --edge: rgba(0,0,0,.45);
  font: inherit; font-weight: 650; border: 1px solid var(--glass-line); background: var(--glass-2); color: var(--ink);
  padding: 10px 16px; border-radius: 12px; cursor: pointer; text-decoration: none; position: relative;
  display: inline-flex; align-items: center; gap: 7px; justify-content: center; white-space: nowrap;
  box-shadow: 0 4px 0 var(--edge), 0 8px 18px -6px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12);
  transition: transform .12s, box-shadow .12s, filter .2s;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); box-shadow: 0 6px 0 var(--edge), 0 14px 24px -8px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.15); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge), 0 4px 8px -4px rgba(0,0,0,.6); }
.btn:disabled { opacity: .6; cursor: wait; transform: none; }
.btn.primary { --edge: #a8341a; background: var(--grad); color: #1d0b06; border-color: rgba(255,255,255,.25); text-shadow: 0 1px 0 rgba(255,255,255,.3); }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.ghost:hover { background: var(--glass); box-shadow: none; }
.btn.danger { color: #ffb0bd; border-color: rgba(255,97,120,.4); --edge: rgba(120,20,40,.6); }
.btn.ok { --edge: #13795a; background: linear-gradient(135deg, #5cf0b0, #22b47e); color: #04261a; border-color: rgba(255,255,255,.25); }
.btn.sm { padding: 6px 11px; font-size: .84rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.lg { padding: 14px 22px; font-size: 1.05rem; border-radius: 14px; }
.link { background: none; border: 0; color: var(--saffron); cursor: pointer; font: inherit; padding: 0; text-decoration: none; }
.icon-btn { background: none; border: 0; font-size: 1.1rem; cursor: pointer; color: var(--muted); padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: var(--glass-2); color: var(--ink); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 16px; }
.card .table-wrap { box-shadow: none; background: rgba(0,0,0,.18); backdrop-filter: none; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 11px 14px; border-bottom: 1px solid rgba(255,255,255,.06); text-align: left; vertical-align: top; }
th { background: rgba(255,255,255,.05); font-weight: 600; color: var(--muted); white-space: nowrap; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--saffron); }
td.num, th.num { text-align: right; white-space: nowrap; }
td.nowrap, td a[href^="#/order"] { white-space: nowrap; }
tbody tr { transition: background .15s, transform .15s; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: rgba(255,181,71,.07); }
tr.row-warn td { background: rgba(255,194,77,.08); }
tr.row-warn td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
tr.row-bad td { background: rgba(255,97,120,.09); }
tr.row-bad td:first-child { box-shadow: inset 3px 0 0 var(--bad); }
tr.row-good td { background: rgba(61,220,151,.08); }
tr.row-good td:first-child { box-shadow: inset 3px 0 0 var(--ok); }
tfoot td { font-weight: 700; background: rgba(255,255,255,.06); border-top: 1px solid var(--glass-line); }
td.empty { text-align: center; color: var(--dim); padding: 28px; }
.items-cell { min-width: 240px; max-width: 340px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 650; white-space: nowrap; text-transform: capitalize; border: 1px solid transparent; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }
.pill.paid, .pill.delivered, .pill.owner, .pill.staff { background: var(--ok-soft); color: var(--ok); border-color: rgba(61,220,151,.25); }
.pill.unpaid, .pill.cancelled, .pill.disabled { background: var(--bad-soft); color: var(--bad); border-color: rgba(255,97,120,.25); }
.pill.partial, .pill.pending { background: var(--warn-soft); color: var(--warn); border-color: rgba(255,194,77,.25); }
.pill.neutral { background: var(--glass-2); color: var(--muted); }

/* ---------- order form ---------- */
.line {
  display: grid; grid-template-columns: 2.2fr 1.6fr 1fr 1.3fr 1fr auto; gap: 10px; align-items: end;
  padding: 12px; margin-bottom: 10px; border-radius: 14px; background: rgba(0,0,0,.18); border: 1px solid rgba(255,255,255,.06);
  animation: rise .35s ease both;
}
.line .lt { font-family: var(--display); font-weight: 800; font-size: 1.1rem; text-align: right; padding-bottom: 8px; }
.qty { display: flex; }
.qty input { text-align: center; border-radius: 0; }
.qty button { border: 1px solid var(--glass-line); background: var(--glass-2); color: var(--ink); width: 38px; font-size: 1.1rem; cursor: pointer; }
.qty button:hover { background: rgba(255,181,71,.2); }
.qty button:first-child { border-radius: 12px 0 0 12px; border-right: 0; }
.qty button:last-child { border-radius: 0 12px 12px 0; border-left: 0; }
.totals { margin-left: auto; max-width: 340px; margin-top: 16px; }
.totals div { display: flex; justify-content: space-between; padding: 5px 0; }
.totals .grand { font-family: var(--display); font-size: 1.35rem; font-weight: 800; border-top: 1px solid var(--glass-line); padding-top: 10px; margin-top: 6px; }
.totals .bal { color: var(--bad); font-weight: 700; }
.sticky-actions {
  position: sticky; bottom: 12px; z-index: 5; margin-top: 10px;
  background: rgba(30,16,36,.82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-line); border-radius: 18px; padding: 12px 14px 14px 20px; box-shadow: var(--shadow-3d);
  display: flex; align-items: center; gap: 12px; justify-content: flex-end;
}
.sticky-actions .big-total { font-family: var(--display); font-size: 1.4rem; font-weight: 800; margin-right: auto; }
.cust-found { color: var(--ok); }

/* ---------- menu page ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.menu-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.menu-card::before { content: attr(data-emoji); position: absolute; right: -6px; top: -14px; font-size: 4.6rem; opacity: .16; transform: rotate(14deg); pointer-events: none; }
.menu-card.off { opacity: .5; filter: grayscale(.6); }
.menu-card .nm { font-family: var(--display); font-weight: 800; font-size: 1.15rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: rgba(255,181,71,.12); color: #ffd79a; border: 1px solid rgba(255,181,71,.22); padding: 4px 10px; border-radius: 99px; font-size: .8rem; font-weight: 550; }
.chip.btnchip { cursor: pointer; border-style: dashed; background: transparent; }
.chip.btnchip:hover { background: rgba(255,181,71,.15); }
.cat-title { margin: 26px 0 12px; font-size: .78rem; text-transform: uppercase; letter-spacing: .16em; color: var(--saffron); display: flex; align-items: center; gap: 10px; }
.cat-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, rgba(255,181,71,.35), transparent); }
.size-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 8px; margin-bottom: 8px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(8,4,10,.6); backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 6vh 16px; overflow-y: auto; animation: fade .2s; }
.modal { width: 100%; max-width: 480px; background: linear-gradient(160deg, rgba(48,26,56,.96), rgba(28,14,34,.96)); animation: pop .35s cubic-bezier(.2,1.3,.4,1); }
.modal.wide { max-width: 640px; }
.modal header, .modal footer { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; }
.modal header { border-bottom: 1px solid var(--glass-line); }
.modal header h3 { font-family: var(--display); font-size: 1.3rem; }
.modal footer { border-top: 1px solid var(--glass-line); justify-content: flex-end; gap: 10px; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
@keyframes fade { from { opacity: 0 } }
@keyframes pop { from { opacity: 0; transform: perspective(800px) rotateX(-14deg) translateY(30px) scale(.94); } }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #2f1a36, #1d0f22); color: var(--ink); border: 1px solid var(--glass-line); padding: 12px 20px; border-radius: 14px; z-index: 200; box-shadow: 0 20px 40px -10px rgba(0,0,0,.7); max-width: 90vw; animation: toastIn .4s cubic-bezier(.2,1.3,.4,1); }
.toast::before { content: '✓ '; color: var(--ok); font-weight: 800; }
.toast.err::before { content: '! '; color: var(--bad); }
.toast.err { border-color: rgba(255,97,120,.5); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 20px) scale(.9); } }
.alert { background: var(--warn-soft); color: #ffe0a3; border: 1px solid rgba(255,194,77,.3); padding: 10px 14px; border-radius: 12px; font-size: .9rem; }
.info-box { background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.2); border-radius: 16px; padding: 16px 18px; font-size: .92rem; line-height: 1.6; }

/* =====================================================================
   Sign-in page
   ===================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.auth-stage { position: relative; overflow: hidden; }
.auth-stage .chef-stage { position: absolute; left: 0; right: 0; bottom: 0; top: 24%; }
.auth-stage .tagline { position: absolute; left: 44px; top: 40px; right: 44px; z-index: 2; pointer-events: none; }
.auth-stage .tagline .kicker { color: var(--saffron); font-weight: 700; letter-spacing: .18em; text-transform: uppercase; font-size: .78rem; }
.auth-stage .tagline h1 { font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.02; margin-top: 10px; }
.auth-stage .floaters span { position: absolute; font-size: 1.8rem; opacity: .7; animation: floaty 7s ease-in-out infinite; filter: drop-shadow(0 8px 10px rgba(0,0,0,.4)); }
@keyframes floaty { 50% { transform: translateY(-22px) rotate(12deg); } }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 30px; }
.card.login { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 16px; padding: 34px; border-radius: 26px; }
.card.login h2 { font-family: var(--display); font-size: 2rem; font-weight: 800; margin: 0; }
.card.login .sub { color: var(--muted); margin-top: -8px; }
.card.login .brandline { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 800; font-size: 1.1rem; }
.auth-foot { text-align: center; color: var(--dim); font-size: .8rem; }

/* =====================================================================
   3D Welcome splash
   ===================================================================== */
.welcome {
  position: fixed; inset: 0; z-index: 500; overflow: hidden; display: flex; flex-direction: column; align-items: center;
  background: radial-gradient(60% 55% at 50% 42%, rgba(255,138,61,.35), transparent 70%), radial-gradient(80% 80% at 50% 100%, #2a1230, #0c060e 70%);
  animation: fade .4s ease;
}
.welcome.out { animation: wOut .8s cubic-bezier(.6,0,.4,1) forwards; }
@keyframes wOut { to { opacity: 0; transform: scale(1.15); filter: blur(6px); } }
.welcome .rays { position: absolute; left: 50%; top: 40%; width: 180vmax; height: 180vmax; transform: translate(-50%, -50%); opacity: .14;
  background: repeating-conic-gradient(from 0deg, #ffb547 0deg 6deg, transparent 6deg 18deg); animation: spin 40s linear infinite;
  mask-image: radial-gradient(circle, black 0%, transparent 45%); }
@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
.welcome .w-top { position: relative; z-index: 3; text-align: center; margin-top: 7vh; padding: 0 16px; perspective: 900px; }
.welcome .w-kicker { font-family: var(--display); font-style: italic; font-size: clamp(1.3rem, 3vw, 2.1rem); color: #ffe2b0; opacity: 0; animation: kick .8s .25s ease forwards; text-shadow: 0 4px 20px rgba(255,138,61,.6); }
@keyframes kick { from { opacity: 0; transform: translateY(20px) rotateX(60deg); } to { opacity: 1; transform: none; } }
.w3d { font-family: var(--display); font-weight: 900; font-size: clamp(2.6rem, 9vw, 7rem); line-height: 1; margin: 8px 0 0; letter-spacing: .01em;
  transform-style: preserve-3d; animation: sway 6s 2.4s ease-in-out infinite; }
@keyframes sway { 50% { transform: rotateY(-10deg) rotateX(6deg); } }
.w3d .word { display: inline-block; white-space: nowrap; margin: 0 .14em; }
.w3d .l {
  position: relative; display: inline-block; color: #6a2207; transform-origin: 50% 100%;
  text-shadow: 0 1px 0 #8a2d0a, 0 2px 0 #7f290a, 0 3px 0 #742509, 0 4px 0 #692108, 0 5px 0 #5e1d07, 0 6px 0 #531a06, 0 7px 0 #481605, 0 8px 0 #3d1304,
               0 14px 18px rgba(0,0,0,.55), 0 24px 40px rgba(0,0,0,.35);
  opacity: 0; animation: flipIn .9s cubic-bezier(.2,1.4,.4,1) forwards, bob 2.6s ease-in-out infinite;
  animation-delay: calc(.7s + var(--i) * .07s), calc(1.8s + var(--i) * .09s);
}
.w3d .l::before {
  content: attr(data-ch); position: absolute; inset: 0; transform: translateY(-1px);
  background: linear-gradient(180deg, #fff6d6 0%, #ffd36b 35%, #ff9a3c 70%, #ff5a4a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  text-shadow: none;
}
@keyframes flipIn { 0% { opacity: 0; transform: translateY(-80px) rotateX(-100deg) scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes bob { 50% { translate: 0 -8px; } }
.welcome .w-greet { margin-top: 18px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); opacity: 0; animation: kick .8s 2s ease forwards; }
.welcome .chef-stage { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(820px, 100vw); height: 62vh; z-index: 2; }
.welcome .w-actions { position: absolute; bottom: 5vh; z-index: 4; display: flex; flex-direction: column; align-items: center; gap: 12px; opacity: 0; animation: kick .7s 2.6s ease forwards; }
.welcome .w-bar { width: 200px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.12); overflow: hidden; }
.welcome .w-bar i { display: block; height: 100%; width: 100%; background: var(--grad); transform-origin: left; animation: bar 6s 1s linear forwards; transform: scaleX(0); }
@keyframes bar { to { transform: scaleX(1); } }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 2px; z-index: 1; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--r)); } }

.chef-stage { overflow: hidden; }
.chef-stage canvas { display: block; width: 100% !important; height: 100% !important; }
/* fallback if WebGL is unavailable */
.no-webgl::after { content: '👨‍🍳'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 9rem; animation: floaty 3s ease-in-out infinite; }

/* =====================================================================
   Invoice: real paper floating in 3D
   ===================================================================== */
.invoice { background: #fffdf9; color: #2a211c; border-radius: 16px; padding: 40px; max-width: 860px; margin: 0 auto 26px;
  box-shadow: 0 40px 80px -30px rgba(0,0,0,.8), 0 10px 30px rgba(0,0,0,.35); transform: perspective(1400px) rotateX(2deg); transform-origin: top; }
.invoice .muted { color: #7a6d64; }
.invoice a { color: #b4441f; }
.inv-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 3px solid; border-image: linear-gradient(90deg, #ffb547, #ff6a3d, #ff4f5e) 1; padding-bottom: 18px; }
.inv-head .rname { font-family: var(--display); font-size: 1.7rem; font-weight: 800; color: #c2471c; }
.inv-title { text-align: right; }
.inv-title .t { font-family: var(--display); font-size: 1.8rem; font-weight: 800; letter-spacing: .12em; color: #5d5049; }
.inv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin: 22px 0; }
.inv-meta dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; margin: 0; }
.inv-meta dt { color: #7a6d64; }
.inv-meta dd { margin: 0; font-weight: 500; }
.inv-meta .lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: #7a6d64; margin-bottom: 6px; }
.invoice .table-wrap { background: #fff; border: 1px solid #ece4dc; box-shadow: none; backdrop-filter: none; border-radius: 10px; }
.invoice th { background: #f6f1ec; color: #5d5049; }
.invoice th, .invoice td { border-bottom-color: #ece4dc; }
.invoice .totals .grand { border-top-color: #ece4dc; }
.invoice .totals .bal { color: #c0392b; }
.invoice .pill.pending { background: #fdf3e1; color: #b7791f; }
.stamp { display: inline-block; margin-top: 8px; padding: 4px 12px; border: 2px solid; border-radius: 6px; font-weight: 800; letter-spacing: .1em; font-size: .85rem; transform: rotate(-4deg); }
.stamp.paid { color: #2f7d4f; }
.stamp.due { color: #c0392b; }
.stamp.cancelled { color: #7a6d64; }
.inv-foot { margin-top: 28px; padding-top: 14px; border-top: 1px solid #ece4dc; color: #7a6d64; font-size: .9rem; text-align: center; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .filters .search { grid-column: 1 / -1; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .line { grid-template-columns: 1fr 1fr; }
  .line .lt { text-align: left; padding-bottom: 0; }
  .auth { grid-template-columns: 1fr; }
  .auth-stage { height: 46vh; min-height: 320px; }
  .auth-stage .tagline { left: 20px; top: 18px; }
  .auth-stage .tagline h1 { font-size: 1.8rem; }
  .auth-panel { padding: 0 16px 30px; margin-top: -30px; position: relative; z-index: 3; }
  .hero { grid-template-columns: 1fr; padding: 22px; min-height: 0; }
  .hero .chef-stage { position: relative; width: 100%; height: 220px; margin-top: 6px; }
}
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  #nav { order: 3; flex-basis: 100%; }
  #nav a { padding: 7px 11px; font-size: .9rem; }
  .user .muted { display: none; }
  main#view { padding: 18px 14px 100px; }
  h1 { font-size: 1.6rem; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .inv-meta { grid-template-columns: 1fr; }
  .invoice { padding: 22px; transform: none; }
  .card.login { padding: 24px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .val { font-size: 1.35rem; }
  .welcome .chef-stage { height: 50vh; bottom: 9vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition: none !important; }
  .w3d .l, .welcome .w-kicker, .welcome .w-greet, .welcome .w-actions { opacity: 1; }
}

/* ---------- printing: plain paper ---------- */
@media print {
  body { background: #fff; color: #000; font-size: 12px; }
  body::before, body::after { display: none; }
  .topbar, #dueBanner, .no-print, .toast { display: none !important; }
  main#view { padding: 0; max-width: none; }
  main#view > * { animation: none !important; }
  .invoice { box-shadow: none; padding: 0; max-width: none; transform: none; }
  @page { margin: 14mm; }
}

/* =====================================================================
   v4 additions: logo, settings, customer profile, reports, team
   ===================================================================== */
.brand { text-decoration: none; color: var(--ink); }
.brand .logo.has-img { background: #fff; padding: 3px; overflow: hidden; transform: none; }
.brand .logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.brand .bname { max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* hero logo tile */
.hero-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.hero-rname { font-family: var(--display); font-weight: 800; font-size: 1.15rem; margin-bottom: 2px; }
.logo-tile {
  position: relative; width: 74px; height: 74px; border-radius: 18px; flex: none; cursor: pointer; overflow: hidden;
  background: #fff; border: 1px solid rgba(255,255,255,.3); box-shadow: 0 10px 24px -8px rgba(0,0,0,.6);
  display: grid; place-items: center; padding: 6px; font: inherit; transition: transform .2s;
}
.logo-tile:hover { transform: translateY(-2px) rotate(-2deg); }
.logo-tile img { width: 100%; height: 100%; object-fit: contain; }
.logo-tile .edit { position: absolute; inset: auto 0 0 0; background: rgba(20,10,22,.78); color: #fff; font-size: .68rem; font-weight: 700; padding: 3px 0; opacity: 0; transition: opacity .2s; }
.logo-tile:hover .edit { opacity: 1; }
.logo-tile.empty { background: rgba(255,255,255,.04); border: 2px dashed rgba(255,181,71,.55); color: #ffd79a; font-size: .72rem; font-weight: 700; display: flex; flex-direction: column; gap: 2px; justify-content: center; }
.logo-tile.empty .plus { font-size: 1.5rem; line-height: 1; }

/* welcome logo */
.welcome .w-logo { width: 96px; height: 96px; object-fit: contain; background: #fff; border-radius: 24px; padding: 8px; margin: 0 auto 14px; display: block;
  box-shadow: 0 0 0 6px rgba(255,181,71,.25), 0 20px 50px -10px rgba(0,0,0,.7); opacity: 0; animation: kick .8s .1s ease forwards; }

/* sign-up */
.join-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: rgba(255,181,71,.1); border: 1px solid rgba(255,181,71,.3); }
.join-banner img, .join-banner span { width: 46px; height: 46px; border-radius: 12px; object-fit: contain; background: #fff; padding: 4px; display: grid; place-items: center; font-size: 1.5rem; }
.join-banner b { font-family: var(--display); font-size: 1.1rem; }
details.invite summary { cursor: pointer; color: var(--saffron); font-size: .88rem; list-style: none; }
details.invite summary::before { content: '＋ '; }
details.invite[open] summary::before { content: '− '; }

/* invoice logo */
.inv-brand { display: flex; align-items: center; gap: 16px; }
.inv-logo { width: 84px; height: 84px; object-fit: contain; flex: none; }

/* settings */
.profile-grid { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.logo-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.logo-preview { width: 150px; height: 150px; border-radius: 26px; background: #fff; display: grid; place-items: center; padding: 12px; box-shadow: var(--shadow-3d); }
.logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.logo-preview.empty { background: rgba(255,255,255,.04); border: 2px dashed rgba(255,181,71,.45); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; color: var(--muted); }
.logo-preview.empty span { font-size: 2.6rem; }
.switch { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; color: var(--ink); }
.switch input { display: none; }
.switch span { width: 48px; height: 28px; border-radius: 99px; background: rgba(255,255,255,.14); position: relative; transition: background .2s; box-shadow: inset 0 2px 4px rgba(0,0,0,.4); }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 6px rgba(0,0,0,.4); }
.switch input:checked + span { background: linear-gradient(135deg, #5cf0b0, #22b47e); }
.switch input:checked + span::after { transform: translateX(20px); }
.phone-preview { display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 20px; align-items: center; margin-top: 18px; padding: 16px; border-radius: 16px; background: rgba(0,0,0,.2); border: 1px solid rgba(255,255,255,.06); }
.phone-preview .bubble { background: #2b2433; border: 1px solid rgba(255,255,255,.1); border-radius: 18px 18px 18px 4px; padding: 12px 14px; font-size: .84rem; line-height: 1.55; color: #f1e9f3; box-shadow: 0 10px 24px -10px rgba(0,0,0,.7); }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--ink); font-size: .92rem; }
label.check input { width: auto; }

/* customer profile */
.cust-head { display: flex; gap: 22px; align-items: center; }
.cust-avatar { width: 84px; height: 84px; border-radius: 26px; flex: none; display: grid; place-items: center; font-family: var(--display); font-size: 2.4rem; font-weight: 800; color: #1d0b06; background: var(--grad); box-shadow: 0 14px 30px -10px rgba(255,106,61,.7); transform: perspective(300px) rotateX(10deg); }
.cust-info h1 { font-size: 1.9rem; }
.cust-contact { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 8px 0; color: var(--muted); }
.cust-notes { background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.2); padding: 8px 12px; border-radius: 10px; margin: 8px 0; font-size: .9rem; }

/* menu */
.sizes-card .chips { gap: 8px; }
.price-list { display: flex; flex-direction: column; gap: 6px; }
.price-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border-radius: 10px; cursor: pointer; font: inherit; color: var(--ink);
  background: rgba(255,181,71,.08); border: 1px solid rgba(255,181,71,.18); transition: background .15s, transform .15s; }
.price-row span { flex: 1; text-align: left; color: #ffe2b0; font-size: .9rem; }
.price-row b { font-family: var(--display); font-size: 1.05rem; }
.price-row i { font-style: normal; color: var(--dim); font-size: .85rem; opacity: 0; transition: opacity .15s; }
.price-row:hover { background: rgba(255,181,71,.18); transform: translateX(3px); }
.price-row:hover i { opacity: 1; }
.chip.btnchip { font: inherit; font-size: .82rem; color: #ffd79a; }
.chip.btnchip.on { background: rgba(61,220,151,.16); border: 1px solid rgba(61,220,151,.45); color: #9ff3cd; }
.size-row { align-items: center; }

/* reports */
.delta { display: inline-block; margin-top: 6px; font-size: .76rem; font-weight: 650; color: var(--muted); }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 22px; }
.insight { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: 18px; border: 1px solid rgba(255,181,71,.22);
  background: radial-gradient(120% 120% at 0% 0%, rgba(255,138,61,.2), transparent 60%), rgba(255,255,255,.04); box-shadow: var(--shadow-3d); }
.insight .ic { font-size: 1.9rem; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: rgba(0,0,0,.25); flex: none; }
.insight .lbl { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.insight .v { font-family: var(--display); font-weight: 800; font-size: 1.15rem; line-height: 1.2; }
.insight .s { font-size: .8rem; color: var(--muted); }
.chart svg { width: 100%; height: 200px; display: block; }
.chart rect { fill: url(#none); fill: #ff9a3c; opacity: .75; transition: opacity .15s; }
.chart rect.hi { fill: #ffd36b; opacity: 1; }
.chart rect:hover { opacity: 1; }
.chart line.grid { stroke: rgba(255,255,255,.07); stroke-width: .3; vector-effect: non-scaling-stroke; }
.chart-x { display: flex; font-size: .7rem; color: var(--dim); margin-top: 4px; }
.chart-x span { text-align: center; }
.grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.empty-state { text-align: center; padding: 50px 20px; }

/* team */
.invite-row { display: flex; gap: 10px; }
.invite-row input { font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }
.code { font-family: ui-monospace, Menlo, monospace; letter-spacing: .12em; color: var(--saffron); background: rgba(255,181,71,.1); padding: 2px 8px; border-radius: 6px; }
.pending-card { border-color: rgba(255,194,77,.4); }
.pending-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(255,255,255,.06); }
.pending-row:first-of-type { border-top: 0; }

@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
  .phone-preview { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .cust-head { flex-direction: column; align-items: flex-start; }
  .invite-row { flex-direction: column; }
  .inv-logo { width: 64px; height: 64px; }
  .brand .bname { max-width: 150px; }
}
@media print {
  .inv-logo { width: 70px; height: 70px; }
}

a[href^="tel:"] { white-space: nowrap; }
.menu-card .nm { padding-right: 56px; }
.menu-card::before { font-size: 3.6rem; opacity: .13; right: -4px; top: -10px; }
[hidden] { display: none !important; }
