/* Tableside tokens: classic American diner / hospitality palette (navy, white, red, gold).
   Exposed as RGB channels so Tailwind / shadcn classes like bg-primary/90 work. */
:root{
  --background:246 247 250;      /* #f6f7fa crisp off-white */
  --foreground:15 30 61;         /* #0f1e3d navy ink */
  --card:255 255 255;
  --muted:233 237 244;           /* #e9edf4 */
  --muted-foreground:85 96 121;  /* #556079 */
  --border:214 220 232;          /* #d6dce8 */
  --input:200 208 223;
  --ring:168 132 28;             /* #a8841c gold focus ring (3:1 on white) */
  --primary:30 58 138;           /* #1e3a8a royal navy */
  --primary-foreground:255 255 255;
  --secondary:227 233 246;       /* #e3e9f6 */
  --secondary-foreground:30 58 138;
  --accent:230 236 248;          /* #e6ecf8 */
  --accent-foreground:30 58 138;
  --destructive:185 28 28;       /* #b91c1c diner red */
  --destructive-foreground:255 255 255;
  --destructive-soft:251 231 231;
  --warn:138 101 16;             /* #8a6510 antique gold (text-safe) */
  --warn-soft:248 239 212;       /* #f8efd4 */
  --gold:201 162 39;             /* #c9a227 metallic gold (graphics only) */
  --gold-foreground:26 20 5;
  --gold-soft:248 239 212;
  --guest:251 238 236;           /* #fbeeec red-tinted guest bubble */
  --guest-foreground:15 30 61;
  --guest-accent:185 28 28;
  --radius:0.75rem;
  color-scheme:light;
}
@media (prefers-color-scheme: dark){
  :root{
    --background:10 18 38;       /* #0a1226 deep navy */
    --foreground:232 236 245;
    --card:16 27 54;             /* #101b36 */
    --muted:24 37 70;            /* #182546 */
    --muted-foreground:152 165 194;
    --border:36 52 92;           /* #24345c */
    --input:48 66 110;
    --ring:222 188 84;           /* #debc54 */
    --primary:143 174 255;       /* #8faeff royal blue, lifted */
    --primary-foreground:10 18 38;
    --secondary:28 45 88;
    --secondary-foreground:191 208 255;
    --accent:27 42 82;
    --accent-foreground:191 208 255;
    --destructive:240 122 122;   /* #f07a7a */
    --destructive-foreground:26 10 10;
    --destructive-soft:58 26 34;
    --warn:227 192 99;           /* #e3c063 */
    --warn-soft:58 48 24;
    --gold:212 175 55;           /* #d4af37 */
    --gold-foreground:26 20 5;
    --gold-soft:58 48 24;
    --guest:44 30 46;            /* #2c1e2e */
    --guest-foreground:232 236 245;
    --guest-accent:240 122 122;
    color-scheme:dark;
  }
}

/* Base page rules (tailwind.css, linked after this file, adds Preflight and the utilities) */
html{-webkit-text-size-adjust:100%}
body{margin:0;background:rgb(var(--background));color:rgb(var(--foreground));font-family:"Schibsted Grotesk",system-ui,sans-serif;overflow-x:hidden}
[hidden]{display:none !important}
svg{flex:none}
.skip:not(:focus){top:-4rem}

/* ---------- Segmented control thumb (port of ddoemonn/segmented-control; spring approximated in CSS) ---------- */
.seg-thumb,.seg-mask{transition:transform .42s cubic-bezier(.34,1.42,.5,1)}

/* ---------- Message bubble rise-in (port of framecn/message-bubble state animation) ---------- */
.mb{opacity:0;transform:translateY(12px) scale(.94);transition:opacity .28s ease,transform .32s cubic-bezier(.2,.8,.2,1)}
.mb.in{opacity:1;transform:none}
.mb.out{transform-origin:bottom right}
.mb.inc{transform-origin:bottom left}

/* ---------- Typing (port of loading-ui/typing) ---------- */
@keyframes loading-ui-typing{0%,100%{transform:translateY(0);opacity:.5}50%{transform:translateY(-50%);opacity:1}}
.typing-dot{animation:loading-ui-typing var(--duration,1s) infinite}

/* ---------- Voice visualizer bars (port of kokonutd/ai-voice-input) ---------- */
.vbar{transition:height .3s ease,background-color .3s ease}

/* Speaking indicator on the guest avatar */
.ring-pulse{position:absolute;inset:-4px;border-radius:9999px;border:2px solid rgb(var(--primary));opacity:0;pointer-events:none}
.avatar.speaking .ring-pulse{animation:ring-pulse 1.4s ease-out infinite}
@keyframes ring-pulse{0%{opacity:.85;transform:scale(.92)}100%{opacity:0;transform:scale(1.28)}}
.speak-bars{opacity:0;transition:opacity .2s}
.speaking .speak-bars{opacity:1}
.speaking .speak-bars i{animation:speak-bar .9s ease-in-out infinite}
@keyframes speak-bar{0%,100%{transform:scaleY(.3)}50%{transform:scaleY(1)}}

/* Mic: listening state swaps icon for the spinning square, like the source component */
.mic{touch-action:none;-webkit-touch-callout:none;-webkit-user-select:none;user-select:none}
.mic[data-on="true"] .mic-icon{display:none}
.mic[data-on="true"] .mic-spin{display:block}
.mic[data-on="true"]{box-shadow:0 0 0 0 rgb(var(--destructive)/.45);animation:mic-ripple 1.2s ease-out infinite}
@keyframes mic-ripple{to{box-shadow:0 0 0 16px rgb(var(--destructive)/0)}}

/* Session layout height: fill the viewport under the header */
.sess{height:calc(100dvh - 57px - 40px);min-height:520px}
@media (max-width:639px){.sess{height:calc(100dvh - 53px - 20px)}}

/* Chat paper: faint guest-check ruling */
.chat{scroll-behavior:smooth;background-image:repeating-linear-gradient(to bottom,transparent 0 35px,rgb(var(--border)/.45) 35px 36px);background-attachment:local}

/* Score ring renders in gold (red stays red for low scores) */
.ring-val.stroke-primary,.ring-val.stroke-warn{stroke:rgb(var(--gold))}
.stroke-primary\/20,.stroke-warn\/20{stroke:rgb(var(--gold)/.2)}

/* Scorecard: guest-check perforated top edge */
.perf{height:14px;background:radial-gradient(circle at 9px -2px,rgb(var(--background)) 7px,transparent 7.5px) 0 0/18px 14px repeat-x}
.ring-val{transition:stroke-dashoffset 1.1s cubic-bezier(.2,.7,.2,1)}
.bar-val{transition:width 1s cubic-bezier(.2,.7,.2,1)}

/* Skeleton shimmer for generated scenarios */
.skel{background:linear-gradient(90deg,rgb(var(--muted)/.5) 0,rgb(var(--muted)) 40%,rgb(var(--muted)/.5) 80%);background-size:200% 100%;animation:skel 1.3s linear infinite}
@keyframes skel{to{background-position:-200% 0}}

@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:.001ms !important;animation-iteration-count:1 !important;transition-duration:.001ms !important;scroll-behavior:auto !important}
}

/* SaaS gating: app chrome hidden until signed in + business + active plan */
body[data-gate] .app-only{display:none !important}
body:not([data-gate]) #view-gate{display:none}
#acct[hidden]{display:none !important}
/* Read-only library for staff (writes are owner/manager only) */
#library[data-readonly] #drop,#library[data-readonly] #paste,#library[data-readonly] #clearDocs,#library[data-readonly] [data-remove]{display:none !important}
/* Clerk sign-in card sits on our card background */
.cl-rootBox{max-width:100%}
.toast-in{animation:toast .18s ease-out}
@keyframes toast{from{transform:translateY(8px);opacity:0}}
