/* Formify app shell: warm paper, deep forest, clay accent. Loaded after style.css. */
:root {
  --forest: #1f4d3a; --forest-2: #2e6b52; --forest-ink: #0f2a1f;
  --clay: #d4673a; --sun: #f2c14e; --paper: #fffaf2; --cream: #f5efe4; --sand: #ece2d0;
  --shadow: 0 1px 0 rgba(29,42,36,.04), 0 10px 30px -12px rgba(29,42,36,.18);
  --ease: cubic-bezier(.2,.8,.2,1);
}
html { scroll-behavior: smooth; }
body.app {
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 92% -10%, rgba(242,193,78,.22), transparent 60%),
    radial-gradient(700px 500px at -10% 30%, rgba(46,107,82,.12), transparent 60%),
    var(--cream);
  -webkit-font-smoothing: antialiased;
}
/* paper grain */
body.app::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.35  0 0 0 0 0.3  0 0 0 0 0.22  0 0 0 .18 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.shell { position: relative; z-index: 1; }

/* Brand */
.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; color: var(--forest-ink); }
.brand .mark { font-family: var(--serif); font-size: 26px; letter-spacing: -.02em; }
.brand .mark i { font-style: normal; color: var(--clay); }
.brand .tag { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }

/* Top bar + tabs */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px clamp(16px, 4vw, 40px); max-width: 1240px; margin: 0 auto; }
.tabs { display: flex; gap: 4px; background: rgba(255,250,242,.7); border: 1px solid var(--line); border-radius: 999px; padding: 4px; backdrop-filter: blur(8px); }
.tabs button { background: transparent; color: var(--ink); font-weight: 650; font-size: 15px; padding: 9px 18px; border-radius: 999px; }
.tabs button:hover { background: var(--sand); filter: none; }
.tabs button.on { background: var(--forest); color: #fff; }
.biz-link { font-size: 14px; font-weight: 650; color: var(--forest); text-decoration: none; border-bottom: 1.5px solid currentColor; }
@media (max-width: 720px) {
  .topbar .tabs { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 30; justify-content: space-around; box-shadow: var(--shadow); background: rgba(255,250,242,.94); }
  .topbar .tabs button { flex: 1; padding: 11px 8px; }
  .page { padding-bottom: 110px !important; }
  .brand .tag { display: none; }
}

.page { max-width: 1240px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 40px) 60px; }
.view { animation: rise .5s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 32px; align-items: end; margin: 18px 0 26px; }
.hero h1 { font-size: clamp(40px, 6.5vw, 76px); line-height: .98; letter-spacing: -.03em; margin: 0; color: var(--forest-ink); }
.hero h1 em { font-style: normal; color: var(--clay); }
.hero p { font-size: 18px; color: var(--muted); max-width: 440px; margin: 0; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; gap: 14px; } }

.searchbar { position: relative; display: flex; align-items: center; background: var(--paper); border: 1.5px solid var(--ink); border-radius: 999px; padding: 6px 6px 6px 22px; box-shadow: 5px 5px 0 var(--forest); transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.searchbar:focus-within { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--forest); }
.searchbar input { border: 0; background: transparent; font-size: 19px; padding: 12px 0; outline: none; flex: 1; min-width: 0; }
.searchbar button { border-radius: 999px; padding: 13px 22px; background: var(--forest); }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 28px; }
.chiprow button { background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 8px 15px; font-weight: 600; font-size: 14px; transition: all .15s var(--ease); }
.chiprow button:hover { border-color: var(--forest); color: var(--forest); filter: none; }
.chiprow button.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Business cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.bcard { position: relative; display: flex; flex-direction: column; gap: 6px; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 20px 20px 18px; text-decoration: none; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s var(--ease); animation: rise .5s var(--ease) both; overflow: hidden; }
.bcard:hover { transform: translateY(-4px) rotate(-.3deg); box-shadow: 0 18px 40px -18px rgba(29,42,36,.35); }
.bcard::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--b, var(--forest)); opacity: .12; transition: transform .3s var(--ease); }
.bcard:hover::after { transform: scale(1.4); }
.bcard h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0; line-height: 1.15; }
.bcard .meta { color: var(--muted); font-size: 14px; text-transform: capitalize; }
.bcard .foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 14px; }
.score { display: flex; align-items: baseline; gap: 6px; }
.score b { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1; color: var(--b, var(--forest)); }
.score span { font-size: 12px; color: var(--muted); font-weight: 600; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--sun); color: var(--forest-ink); }
.waitpill { font-size: 13px; font-weight: 650; color: var(--forest); background: rgba(46,107,82,.1); padding: 5px 10px; border-radius: 999px; }

/* Sheet (business detail, check-in) */
.sheet { background: var(--paper); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); overflow: hidden; }
.sheet-head { padding: 28px clamp(20px, 4vw, 36px) 22px; background: var(--b, var(--forest)); color: #fff; position: relative; overflow: hidden; }
.sheet-head::after { content: ""; position: absolute; right: -60px; bottom: -80px; width: 240px; height: 240px; border-radius: 50%; background: rgba(255,255,255,.08); }
.sheet-head h2 { font-size: clamp(30px, 4.5vw, 46px); margin: 6px 0 4px; line-height: 1; }
.sheet-head .meta { opacity: .85; text-transform: capitalize; }
.sheet-body { padding: 24px clamp(20px, 4vw, 36px) 30px; }
.back { background: transparent; color: var(--forest); padding: 6px 0; font-weight: 650; }
.back:hover { filter: none; text-decoration: underline; }
.statrow { display: flex; gap: 28px; flex-wrap: wrap; margin: 4px 0 22px; }
.statrow .v { font-family: var(--serif); font-size: 36px; line-height: 1; }
.statrow .l { font-size: 13px; color: var(--muted); margin-top: 4px; }
.cta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .cta { grid-template-columns: 1fr; } }
.btn-big { font-size: 17px; padding: 16px 18px; border-radius: 14px; }
.btn-alt { background: var(--paper); color: var(--forest); border: 1.5px solid var(--forest); }
.btn-clay { background: var(--clay); }

/* Assistant */
.assist { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
@media (max-width: 900px) { .assist { grid-template-columns: 1fr; } .assist aside { order: -1; } }
.chatcard { background: var(--paper); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 62vh; overflow: hidden; }
.chatlog { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; max-height: 62vh; }
.msg { max-width: 80%; padding: 13px 16px; border-radius: 18px; font-size: 16.5px; line-height: 1.45; animation: rise .35s var(--ease) both; white-space: pre-wrap; }
.msg.bot { background: var(--cream); border-bottom-left-radius: 6px; align-self: flex-start; }
.msg.me { background: var(--forest); color: #fff; border-bottom-right-radius: 6px; align-self: flex-end; }
.msg.typing { display: flex; gap: 5px; }
.msg.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); animation: pulse 1s infinite; }
.msg.typing i:nth-child(2) { animation-delay: .15s; } .msg.typing i:nth-child(3) { animation-delay: .3s; }
.pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; align-self: stretch; animation: rise .4s var(--ease) both; }
.pick button { text-align: left; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; border-left: 5px solid var(--b, var(--forest)); }
.pick button:hover { border-color: var(--forest); filter: none; transform: translateY(-2px); }
.pick b { display: block; font-family: var(--serif); font-weight: 400; font-size: 17px; }
.pick span { font-size: 13px; color: var(--muted); }
.confirm { align-self: stretch; background: #fff; border: 1.5px solid var(--forest); border-radius: 18px; padding: 18px; animation: rise .4s var(--ease) both; }
.confirm dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 10px 0 14px; font-size: 15px; }
.confirm dt { color: var(--muted); }
.confirm dd { margin: 0; font-weight: 600; }
.ticketcard { align-self: stretch; background: var(--forest); color: #fff; border-radius: 18px; padding: 20px; animation: rise .4s var(--ease) both; }
.ticketcard .t { font-family: var(--serif); font-size: 64px; line-height: 1; margin: 4px 0 8px; }
.ticketcard a { color: var(--sun); font-weight: 700; }
.composer { display: flex; gap: 8px; padding: 14px; border-top: 1px solid var(--line); background: var(--cream); }
.composer input { flex: 1; font-size: 17px; padding: 13px 16px; border-radius: 999px; border: 1px solid var(--line); background: #fff; }
.composer button { border-radius: 999px; padding: 0 20px; }
.composer .mic { background: var(--paper); color: var(--forest); border: 1.5px solid var(--forest); }
.composer .mic.rec { background: var(--clay); color: #fff; border-color: var(--clay); animation: pulse 1s infinite; }
.slotbar { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px 0; }
.side { background: var(--forest); color: #f3eee3; border-radius: 26px; padding: 26px; position: relative; overflow: hidden; }
.side h3 { font-family: var(--serif); font-weight: 400; font-size: 26px; color: #fff; }
.side p, .side li { color: #d9e4dc; font-size: 15px; }
.side ul { padding-left: 18px; margin: 0; }
.side li { margin: 6px 0; }
.side .try button { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; padding: 8px 13px; font-size: 14px; margin: 4px 4px 0 0; }

/* You */
.you { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 860px) { .you { grid-template-columns: 1fr; } }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); }
.panel h2 { font-size: 28px; margin-bottom: 6px; }
.panel .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .panel .row2 { grid-template-columns: 1fr; } }
.lock { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 650; color: var(--forest); background: rgba(46,107,82,.1); padding: 6px 12px; border-radius: 999px; }
.visit-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.visit-row b { font-family: var(--serif); font-weight: 400; font-size: 18px; }
.seg { display: inline-flex; background: var(--sand); border-radius: 999px; padding: 3px; margin-bottom: 14px; }
.seg button { background: transparent; color: var(--ink); padding: 8px 16px; border-radius: 999px; font-size: 14px; }
.seg button.on { background: var(--paper); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 999px; font-weight: 600; z-index: 50; animation: rise .3s var(--ease) both; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty b { display: block; font-family: var(--serif); font-weight: 400; font-size: 26px; color: var(--ink); margin-bottom: 6px; }

/* Kiosk renderer inside the app */
.app .kiosk { border-radius: 0; border: 0; min-height: 0; background: transparent; }
.app .kiosk .k-head { display: none; }
.app .kiosk .k-body { padding: 0; }
.app .kiosk h2 { font-size: 30px; }

/* ---------- Business app ---------- */
.biz { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; position: relative; z-index: 1; }
.sidebar { background: var(--forest-ink); color: #e9efe9; padding: 22px 16px; display: flex; flex-direction: column; gap: 18px; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; }
.sidebar .brand .tag { color: #9fb5a8; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav button { display: flex; justify-content: space-between; align-items: center; background: transparent; color: #cfdcd3; text-align: left; padding: 11px 12px; border-radius: 10px; font-weight: 600; }
.sidebar nav button:hover { background: rgba(255,255,255,.06); filter: none; }
.sidebar nav button.on { background: rgba(242,193,78,.16); color: #fff; }
.sidebar nav .count { background: var(--clay); color: #fff; font-size: 12px; border-radius: 999px; padding: 1px 8px; }
.sidebar select { background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.15); }
.sidebar select option { color: #000; }
.sidebar .who { margin-top: auto; font-size: 13px; color: #9fb5a8; }
.bizmain { padding: 26px clamp(16px, 3vw, 40px) 60px; min-width: 0; }
.bizmain h1 { font-size: clamp(30px, 4vw, 44px); margin-bottom: 2px; color: var(--forest-ink); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 20px 0; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.kpi .v { font-family: var(--serif); font-size: 38px; line-height: 1; color: var(--forest-ink); }
.kpi .l { font-size: 13px; color: var(--muted); margin-top: 6px; }
@media (max-width: 900px) {
  .biz { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .sidebar nav { flex-direction: row; overflow-x: auto; width: 100%; }
  .sidebar .who { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.qcard { background: var(--paper); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 14px; align-items: start; box-shadow: var(--shadow); animation: rise .35s var(--ease) both; }
.qcard + .qcard { margin-top: 10px; }
.qcard .tk { font-family: var(--serif); font-size: 30px; line-height: 1; }
.qcard .acts { display: flex; flex-direction: column; gap: 6px; align-items: stretch; min-width: 150px; }
.qcard.pending { opacity: .65; }
@media (max-width: 640px) { .qcard { grid-template-columns: 1fr; } .qcard .acts { flex-direction: row; flex-wrap: wrap; } }
.loccard { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); border-top: 6px solid var(--b, var(--forest)); }
.loccard h3 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 0 0 4px; }
.loccard .links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.loccard .links a, .loccard .links button { font-size: 13px; font-weight: 650; padding: 8px 12px; border-radius: 10px; background: var(--cream); color: var(--ink); text-decoration: none; border: 1px solid var(--line); }
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; position: relative; z-index: 1; }
.auth .pitch { background: var(--forest-ink); color: #eef3ee; padding: clamp(28px, 6vw, 70px); display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .pitch h1 { font-size: clamp(40px, 5.5vw, 72px); line-height: .98; color: #fff; margin: 40px 0 18px; }
.auth .pitch h1 em { font-style: normal; color: var(--sun); }
.auth .pitch::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 380px; height: 380px; border-radius: 50%; border: 60px solid rgba(242,193,78,.12); }
.auth .formside { display: flex; align-items: center; justify-content: center; padding: 30px 20px; }
.auth form { width: 100%; max-width: 380px; }
@media (max-width: 820px) { .auth { grid-template-columns: 1fr; } .auth .pitch h1 { margin-top: 10px; } }

/* ---------- Blue theme ---------- */
:root[data-theme="blue"] {
  --bg: #eef3fb; --card: #f8fbff; --ink: #0f1b33; --muted: #56637d; --line: #d5dfee; --brand: #1e40af;
  --forest: #1e40af; --forest-2: #2563eb; --forest-ink: #0a1736; --clay: #0284c7; --sun: #93c5fd;
  --paper: #f8fbff; --cream: #eef3fb; --sand: #dde7f5;
  --shadow: 0 1px 0 rgba(15,27,51,.04), 0 10px 30px -12px rgba(15,27,51,.2);
}
:root[data-theme="blue"] body.app {
  background:
    radial-gradient(900px 500px at 92% -10%, rgba(147,197,253,.38), transparent 60%),
    radial-gradient(700px 500px at -10% 30%, rgba(37,99,235,.12), transparent 60%),
    var(--cream);
}
:root[data-theme="blue"] body.app::before { opacity: .22; }
:root[data-theme="blue"] .sidebar nav button.on { background: rgba(147,197,253,.18); }
:root[data-theme="blue"] .lock, :root[data-theme="blue"] .waitpill { background: rgba(37,99,235,.1); color: var(--forest); }
:root[data-theme="blue"] .side p, :root[data-theme="blue"] .side li { color: #dbe6fb; }
:root[data-theme="blue"] .sidebar .brand .tag, :root[data-theme="blue"] .sidebar .who { color: #a9bce0; }
:root[data-theme="blue"] .auth .pitch::after { border-color: rgba(147,197,253,.14); }

/* Theme switch: a split dot showing both themes */
.theme-dot { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid var(--line); cursor: pointer;
  background: linear-gradient(135deg, #1f4d3a 0 50%, #1e40af 50% 100%); transition: transform .2s var(--ease); flex: none; }
.theme-dot:hover { transform: rotate(180deg); filter: none; }
.sidebar .theme-dot { border-color: rgba(255,255,255,.3); margin-top: 10px; }
.topbar .right { display: flex; align-items: center; gap: 14px; }

/* Business page */
.socrow { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; position: relative; z-index: 1; }
.soc { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 999px; background: rgba(255,255,255,.16); color: #fff; text-decoration: none; font-weight: 650; font-size: 14px; border: 1px solid rgba(255,255,255,.28); transition: background .15s var(--ease), transform .15s var(--ease); }
.soc:hover { background: rgba(255,255,255,.28); transform: translateY(-1px); }
.pageinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-top: 6px; }
.pageinfo > div { display: flex; flex-direction: column; gap: 3px; background: var(--cream); border-radius: 14px; padding: 12px 14px; }
.pageinfo a { color: var(--ink); font-weight: 600; }
.formlist { display: grid; gap: 10px; }
.formrow { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 16px 18px; border: 1px solid var(--line); border-left: 6px solid var(--b, var(--forest)); border-radius: 16px; background: #fff; animation: rise .4s var(--ease) both; transition: transform .15s var(--ease), box-shadow .15s var(--ease); }
.formrow:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.formrow b { font-family: var(--serif); font-weight: 400; font-size: 20px; }
.formacts { display: flex; gap: 8px; flex: none; }
@media (max-width: 620px) { .formrow { flex-direction: column; align-items: stretch; } .formacts { flex-direction: column; } .formacts button { width: 100%; } }
.pageedit .formrow { cursor: default; }
.pageedit .handle { display: flex; flex-direction: column; gap: 4px; }
.pageedit .handle button { padding: 4px 9px; font-size: 13px; background: var(--cream); color: var(--ink); border: 1px solid var(--line); }
.tabs button { position: relative; }
.tabdot { position: absolute; top: 2px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--clay); color: #fff; font-size: 11px; font-weight: 800; line-height: 18px; }
/* Business thread */
.bthread { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }
.bthread .tm { max-width: 90%; padding: 8px 11px; border-radius: 12px; font-size: 14px; margin: 4px 0; }
.bthread .tm.customer { background: var(--sand); margin-right: auto; }
.bthread .tm.business { background: var(--forest); color: #fff; margin-left: auto; }
.bthread .tm.system { color: var(--muted); font-size: 12.5px; padding: 2px 0; }
.bthread .tm.receipt { background: var(--cream); border: 1px dashed var(--line); font-weight: 650; }
.bthread .tml { display: flex; flex-direction: column; }
.bthread .send { display: flex; gap: 6px; margin-top: 8px; }
.bthread .send input { flex: 1; padding: 8px 10px; }
.bthread .quick { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.bthread .quick button { font-size: 12.5px; padding: 5px 10px; background: var(--cream); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; }
.unread { display: inline-block; background: var(--clay); color: #fff; font-size: 11.5px; font-weight: 800; border-radius: 999px; padding: 1px 8px; margin-left: 6px; }
