/* ===================================================================
   Kawa Lodge — Design System
   Signature element: the "key tag" — brass, punched hole, mono numerals.
   Grounded in the real object every guest and receptionist handles.
   =================================================================== */


:root {
  /* Palette */
  --ink:            #101828;
  --ink-soft:       #243044;
  --parchment:      #f3f5f9;
  --parchment-dim:  #e8ecf3;
  --parchment-flat: #fbfcfe;

  /* Primary — navy blue (2026 rebrand: navy / purple / light green).
     Kept the --brass* variable names as aliases below so every
     existing .btn-brass / .keytag / var(--brass) reference across the
     codebase updates automatically without touching those files.
     --primary is the sidebar's own dark shade; --primary-light (used
     for hover/active states) points straight at --accent-green, so
     "active nav item" and "primary button" read as one consistent
     brand family rather than two similar-but-different shades. */
  --primary:        #1b2a5b;
  --primary-light:  var(--accent-green);
  --primary-dark:   #101c42;
  --brass:          var(--primary);
  --brass-light:    var(--primary-light);
  --brass-dark:     var(--primary-dark);

  /* Light green — the energetic accent of the new palette: dashboard
     highlights, chart lines, positive/success states. Distinct token
     on purpose so --primary (navy) stays stable everywhere else
     (sidebar, buttons, nav) rather than drifting toward this. */
  --accent-green:      #3fa45b;
  --accent-green-dark: #2c8249;

  /* --clay* kept as the token name so every existing var(--clay) /
     var(--clay-light) reference (badges, nav hovers, highlights)
     updates automatically. Value moved from brass/gold to purple —
     the secondary brand accent sitting next to the navy. */
  --clay:           #6d4fc2;
  --clay-light:     #9277db;
  --clay-dark:      #4e3690;
  --clay-bg:        #eee9fa;

  /* Second accent - warm terracotta, kept as the warm complement for
     badges/highlights that shouldn't default to green or purple
     (e.g. bar & restaurant tags). */
  --terracotta:      #B85C38;
  --terracotta-dark:  #8A4327;
  --terracotta-bg:    #F5E4DB;

  --moss:           #3f7a5e;
  --moss-light:     #e5f0ea;
  --stone:          #667085;
  --stone-light:    #98a2b3;
  --white:          #fbfcfe;
  --line:           #d8dee9;
  --danger:         #A6342A;
  --danger-bg:      #F7E8E4;

  /* Type */
  --font-display: Georgia, 'Times New Roman', serif;
  --font-body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Courier New', monospace;

  /* Misc */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 18px;
  --shadow-tag: 0 8px 20px rgba(16, 24, 40, 0.16);
  --shadow-card: 0 2px 10px rgba(16, 24, 40, 0.07);
  --shadow-modal: 0 20px 60px rgba(16, 24, 40, 0.35);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

/* Several component classes (.overview-card, .stat-card, etc.) set
   their own `display`, which - since author CSS always overrides the
   browser's UA stylesheet - silently defeats the native `hidden`
   attribute on any element that also carries one of those classes.
   This guarantees `hidden` always wins, everywhere, no matter what
   display value some other rule declares. */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth;
text-decoration: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  margin: 0 0 0.4em;
  color: var(--ink);
  letter-spacing: -0.01em;
}

p { margin: 0 0 1em; color: var(--ink-soft); }
a { color: var(--clay-dark); text-decoration: none; }
a:hover { color: var(--clay-dark); }

code, .mono { font-family: var(--font-mono); }

:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

.container {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 32px;
}

/* -------------------------------------------------------------
   Typography + interaction baseline
   ------------------------------------------------------------- */
.text-stone { color: var(--stone); }
.small, small { font-size: .82rem; }

/* Operational screens should read as tools first, decoration second. */
.app-content h1 { font-size: clamp(1.55rem, 2.2vw, 2rem); }
.app-content h2 { font-size: clamp(1.2rem, 1.7vw, 1.5rem); }
.app-content h3 { font-size: 1.05rem; }
.app-content h4 { font-family: var(--font-body); font-size: .9rem; letter-spacing: .01em; }

button, input, select, textarea { font: inherit; }
button, a, select, input, textarea { -webkit-tap-highlight-color: transparent; }

@media (max-width: 760px) {
  body { font-size: 15px; }
  .btn { min-height: 44px; }
}

/* -------------------------------------------------------------
   Buttons
   ------------------------------------------------------------- */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  min-height: 42px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease), color .15s var(--ease);
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }

/* Crisp interaction feedback shared by public booking flows and the staff app. */
@media (hover: hover) and (pointer: fine) {
  .btn:hover:not(:disabled) { transform: translateY(-2px); }
}
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(27, 42, 91, .3); }

.btn-brass { background: var(--brass); color: var(--white); }
.btn-brass:hover { background: var(--brass-dark); box-shadow: 0 4px 14px rgba(21, 105, 49, .32); }

.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--stone-light); }
.btn-ghost:hover { background: var(--parchment-dim); color: var(--ink); border-color: var(--stone); }

.btn-signin { background: transparent; color: var(--white); border: 1.5px solid var(--stone-light); }
.btn-signin:hover { background: var(--parchment-dim); color: var(--ink); border-color: var(--stone); }

.btn-text {
  font-family: var(--font-body);
  font-size: 0.92rem;
  background: transparent;
  color: var(--clay);
  border: none;
  padding: 8px 4px;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
}
.btn-text:hover { background: transparent; color: var(--clay-dark); }
.btn-danger-text { color: var(--danger); }
.btn-danger-text:hover { color: var(--danger); text-decoration: underline; background: transparent; }

.btn-danger { background: var(--danger); color: var(--white); }
.btn-danger:hover { background: #8A2A21; }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; min-height: 34px; }
.btn-icon-text { display: inline-flex; align-items: center; gap: 6px; }
.btn-block { width: 100%; }

/* -------------------------------------------------------------
   Key Tag — the signature element
   A brass tag with a punched hole and mono numerals, like the
   physical tags hanging behind reception.
   ------------------------------------------------------------- */
.keytag {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(155deg, var(--clay-light), var(--clay-dark) 55%, #3b2a6e);
  color: var(--ink);
  font-family: var(--font-mono);
  font-weight: 600;
  border-radius: 8px 8px 8px 22px;
  padding: 8px 16px 8px 30px;
  box-shadow: var(--shadow-tag);
}

.keytag-logo{
  width: 30px;
  height: 30px;
  border-radius: 50px;
}
.keytag--terracotta {
  background: linear-gradient(155deg, #D68A63, var(--terracotta-dark) 55%, #5c2c17);
  color: var(--white);
}
.keytag--terracotta::before { background: var(--terracotta-bg); }
.keytag::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--parchment);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.4);
}
.keytag--lg { padding: 16px 28px 16px 46px; border-radius: 12px 12px 12px 34px; font-size: 1.3rem; }
.keytag--lg::before { left: 18px; width: 12px; height: 12px; }
.keytag--outline {
  background: transparent;
  border: 1.5px solid var(--clay-dark);
  color: var(--clay-dark);
  box-shadow: none;
}
.keytag--outline::before { background: var(--clay-dark); box-shadow: none; }

/* -------------------------------------------------------------
   Status badges (mirrors rooms.status vocabulary)
   ------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px 4px 8px;
  border-radius: 20px;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-vacant      { background: var(--moss-light); color: var(--moss); }
.badge-occupied    { background: var(--clay-bg); color: var(--clay-dark); }
.badge-dirty       { background: var(--danger-bg); color: var(--danger); }
.badge-maintenance { background: #E4DCC8; color: var(--ink-soft); }
/* Emitted by the room board for a room that is sold for tonight but not yet
   occupied. Pairs with .room-card[data-status="reserved"]. */
.badge-reserved   { background: #EDE4F8; color: #4A2C6E; }

/* -------------------------------------------------------------
   Cards / Panels
   ------------------------------------------------------------- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.9), rgba(244, 247, 217, 0.96));
  border-radius: 16px;
  box-shadow: 0 12px 28px rgba(16,24,40,0.06), inset 0 1px 0 rgba(255,255,255,0.7);
  border: 1px solid rgba(16,24,40,.08);
}
.card-pad { padding: 22px; }

/* -------------------------------------------------------------
   Forms
   ------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--stone);
  margin-bottom: 6px;
}
.field input,
.field select,
.field textarea {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  min-height: 42px;
  border: 1.5px solid var(--parchment-dim);
  background: var(--parchment-flat);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.field textarea { min-height: 90px; }
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brass);
  outline: none;
  box-shadow: 0 0 0 3px rgba(21, 105, 49, .14);
}
.field-error { color: var(--danger); font-size: 0.78rem; margin-top: 4px; }

/* .folio-input: used standalone (not wrapped in .field) for the Folio
   ID / open-folio search boxes in Bar & Restaurant, so it needs its
   own rule rather than relying on ".field input" - same visual
   treatment though, for consistency. */
.folio-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 10px 12px;
  min-height: 42px;
  border: 1.5px solid var(--parchment-dim);
  background: var(--parchment-flat);
  border-radius: var(--radius-sm);
  color: var(--ink);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.folio-input:focus {
  border-color: var(--brass);
  outline: none;
  box-shadow: 0 0 0 3px rgba(184, 134, 59, .18);
}
.field-hint { color: var(--stone); font-size: 0.78rem; margin-top: 4px; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; }

.form-error-banner {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  margin-bottom: 16px;
  display: none;
}
.form-error-banner.show { display: block; }

/* -------------------------------------------------------------
   Table
   ------------------------------------------------------------- */
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--white);
  font-weight: 700;
  padding: 12px 16px;
  background: var(--primary);
  border-bottom: 1.5px solid var(--primary-dark);
}
.data-table th:first-child { border-top-left-radius: var(--radius-sm); }
.data-table th:last-child { border-top-right-radius: var(--radius-sm); }
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--parchment-dim);
  font-size: 0.9rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--parchment-flat); }

/* -------------------------------------------------------------
   Modal
   ------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(16,24,40,.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 60px 20px;
  overflow-y: auto;
  z-index: 100;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  width: 100%;
  max-width: 460px;
  padding: 28px;
  overflow: hidden;
  animation: modal-in .18s var(--ease);
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  margin: -28px -28px 20px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-head h2, .modal-head h3 { color: var(--white); margin: 0; font-size: 1.05rem; }
.modal-close {
  background: rgba(255, 255, 255, 0.14);
  border: none; cursor: pointer;
  font-size: 1.1rem; color: rgba(255, 255, 255, 0.9); line-height: 1;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .12s var(--ease);
}
.modal-close:hover { background: rgba(255, 255, 255, 0.28); color: var(--white); }

@media (max-width: 560px) {
  .modal-backdrop, .modal-overlay { padding: 0; align-items: stretch; }
  .modal { max-width: none; min-height: 100vh; border-radius: 0; padding: 20px; overflow-y: scroll;}
  .modal-head { margin: -20px -20px 18px; border-radius: 0; }
}

/* -------------------------------------------------------------
   Toast
   ------------------------------------------------------------- */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--ink);
  color: var(--white);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  box-shadow: var(--shadow-tag);
  animation: toast-in .2s var(--ease);
  max-width: 320px;
}
.toast.toast-error { background: var(--danger); }
.toast.toast-success { background: var(--moss); }
.toast.toast-warning { background: #e6c48d; color: #4a2f08; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* -------------------------------------------------------------
   Utility
   ------------------------------------------------------------- */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--clay-dark);
  font-weight: 600;
}
.text-stone { color: var(--stone); }
.text-center { text-align: center; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-gap { display: flex; align-items: center; gap: 10px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--stone);
}
.empty-state .keytag { margin-bottom: 16px; }

.skeleton {
  background: linear-gradient(90deg, var(--parchment-dim) 25%, var(--parchment-flat) 50%, var(--parchment-dim) 75%);
  background-size: 200% 100%;
  animation: skeleton-sheen 1.3s infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-sheen {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* -------------------------------------------------------------
   Spinner — a two-tone rotating ring (brand green track, yellow
   leading edge) rather than a flat single-color spinner, so it
   reads as an intentional brand touch rather than a generic
   bootstrap-style loader. Three sizes cover every context it's
   used in: inline text ("Loading…"), a standalone panel/table
   placeholder, and full-page.
   ------------------------------------------------------------- */
.spinner {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid var(--parchment-dim);
  border-top-color: var(--clay);
  border-right-color: var(--clay-light);
  animation: spinner-spin .9s cubic-bezier(.5,.05,.5,.95) infinite;
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(109,79,194,.4));
}
/* Second, counter-rotating ring in the forest-green half of the
   palette - same two-color-in-motion idea as .page-loader, just
   small enough to sit inline next to "Loading…" text or inside a
   button without needing any markup beyond the one <span>. */
.spinner::before {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-bottom-color: var(--primary);
  border-left-color: var(--accent-green);
  animation: spinner-spin-rev 1.3s cubic-bezier(.5,.05,.5,.95) infinite;
}
.spinner--sm { width: 14px; height: 14px; border-width: 2px; }
.spinner--sm::before { inset: 2px; border-width: 1.5px; }
.spinner--lg { width: 32px; height: 32px; border-width: 3px; }
.spinner--lg::before { inset: 5px; border-width: 2.5px; }
@keyframes spinner-spin { to { transform: rotate(360deg); } }
@keyframes spinner-spin-rev { to { transform: rotate(-360deg); } }

/* Drop into a .btn while a request is in flight - hides the label
   without reflowing the button's width/height. */
.btn .spinner { margin-right: 2px; }
.btn.is-loading { color: transparent; pointer-events: none; position: relative; }
.btn.is-loading .spinner {
  position: absolute;
  left: 50%; top: 50%;
  margin: -9px 0 0 -9px;
  border-color: rgba(255,255,255,.35);
  border-top-color: var(--white);
  border-right-color: var(--white);
  filter: none;
}
.btn.is-loading .spinner::before {
  border-bottom-color: rgba(255,255,255,.9);
  border-left-color: rgba(255,255,255,.55);
}

/* Standard "this panel is loading" state - spinner + muted text,
   centered, with breathing room so it doesn't feel like an error
   or an empty state. Swap in for any bare "Loading…" text. */
.loading-state {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--stone);
  font-size: 0.9rem;
}
.loading-state--inline { padding: 8px 0; justify-content: flex-start; }
.loading-state--row { padding: 14px 0; }

/* -------------------------------------------------------------
   Page loader — full-screen boot/transition overlay shown while a
   public page (via partials/nav.php) or the staff app shell
   (index.php) loads, and right after sign-in while the next page
   stands up. Built around the same "key tag" motif the design
   system calls out up top: a brass ring and a forest-green ring
   counter-rotate around a dark "punched hole" core that pulses -
   two brand colors in motion instead of a generic single-tone
   spinner, so it reads as Kawa Lodge rather than a stock loader.
   ------------------------------------------------------------- */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: radial-gradient(circle at 50% 42%, var(--parchment-flat) 0%, var(--parchment) 75%);
  transition: opacity .5s ease, visibility .5s ease;
}
.page-loader.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.page-loader-mark { position: relative; width: 84px; height: 84px; }
.page-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--clay);
  border-right-color: var(--clay-light);
  animation: page-loader-spin 1.1s cubic-bezier(.5,.05,.5,.95) infinite;
  filter: drop-shadow(0 0 6px rgba(109,79,194,.5));
}
.page-loader-ring--rev {
  inset: 11px;
  border-top-color: transparent;
  border-right-color: transparent;
  border-bottom-color: var(--primary);
  border-left-color: var(--accent-green);
  animation: page-loader-spin-rev 1.6s cubic-bezier(.5,.05,.5,.95) infinite;
  filter: drop-shadow(0 0 6px rgba(27,42,91,.45));
}
.page-loader-core {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 4px var(--parchment-flat), 0 0 16px rgba(16,24,40,.45);
  animation: page-loader-pulse 1.4s ease-in-out infinite;
}
.page-loader-word {
  font-family: var(--font-display);
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--stone);
}
@keyframes page-loader-spin { to { transform: rotate(360deg); } }
@keyframes page-loader-spin-rev { to { transform: rotate(-360deg); } }
@keyframes page-loader-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: .6; }
}

/* -------------------------------------------------------------
   Page-level motion - subtle, not showy. Content fades/lifts in
   rather than popping, and interactive elements get a touch of
   spring so the app feels responsive rather than static.
   ------------------------------------------------------------- */
@keyframes content-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.app-content-inner { animation: content-in .25s var(--ease); }

@media (prefers-reduced-motion: reduce) {
  .spinner, .spinner::before { animation-duration: 1.8s; }
  .app-content-inner { animation: none; }
  .page-loader-ring, .page-loader-ring--rev { animation-duration: 2.2s; }
  .page-loader-core { animation: none; }
}
/* Public Kawa AI */
.kawa-public-ai-fab { position:fixed; right:22px; bottom:22px; z-index:45; display:inline-flex; align-items:center; gap:8px; min-height:48px; padding:0 16px 0 10px; border:1px solid rgba(146,119,219,.34); border-radius:999px; background:linear-gradient(135deg,#1b2a5b 0%,#3fa45b 68%,#6d4fc2 100%); color:#fff; box-shadow:0 14px 34px rgba(16,24,40,.24),0 0 0 5px rgba(146,119,219,.08); font:600 .78rem var(--font-body); cursor:pointer; transition:transform .18s var(--ease),box-shadow .18s var(--ease); }
.kawa-public-ai-fab:hover { transform:translateY(-2px); box-shadow:0 18px 40px rgba(16,24,40,.28),0 0 0 6px rgba(146,119,219,.11); }
.kawa-public-ai-fab:focus-visible { outline:3px solid rgba(146,119,219,.75); outline-offset:3px; }
.kawa-public-ai-spark,.kawa-public-ai-mark { display:grid; place-items:center; border-radius:50%; color:#b9a4e8; }
.kawa-public-ai-spark { width:27px;height:27px;background:rgba(255,255,255,.13); }
.kawa-public-ai-overlay { position:fixed; inset:0; z-index:100; display:grid; place-items:end; padding:22px; }
.kawa-public-ai-overlay[hidden] { display:none; }
/* Fixed (not absolute) so it's anchored to the viewport itself rather than
   the overlay's padding box — absolute+inset:0 here would only cover the
   area *inside* the 22px padding, leaving a strip of raw page visible
   around every edge instead of dimming the whole screen. */
.kawa-public-ai-backdrop { position:fixed; inset:0; background:rgba(12,21,51,.4); backdrop-filter:blur(2px); }
.kawa-public-ai-modal { position:relative; width:min(430px,100%); height:min(680px,calc(100vh - 44px)); max-height:min(680px,calc(100vh - 44px)); overflow:hidden; border:1px solid rgba(16,24,40,.1); border-radius:18px; background:var(--white); box-shadow:0 28px 80px rgba(12,21,51,.3); display:flex; flex-direction:column; }
.kawa-public-ai-header { flex:0 0 auto; display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px;background:linear-gradient(135deg,#101c42 0%,#1b2a5b 62%,#4e3690 100%);border-bottom:1px solid rgba(146,119,219,.32);color:#fff; }
.kawa-public-ai-heading { display:flex;align-items:center;gap:11px;min-width:0; }
.kawa-public-ai-mark { width:38px;height:38px;background:linear-gradient(145deg,rgba(146,119,219,.3),rgba(255,255,255,.1));border:1px solid rgba(146,119,219,.3);font-size:1.05rem; }
.kawa-public-ai-header h2 { margin:0; display:flex; align-items:center; gap:7px; font:600 1.05rem var(--font-display); }
.kawa-public-ai-badge { font:600 .56rem var(--font-body); letter-spacing:.03em; text-transform:uppercase; padding:2px 7px; border-radius:999px; background:rgba(255,255,255,.14); border:1px solid rgba(146,119,219,.35); color:#b9a4e8; }
.kawa-public-ai-header p { margin:2px 0 0;font-size:.7rem;color:rgba(255,255,255,.78); }
.kawa-public-ai-close { width:34px;height:34px;border:0;border-radius:9px;background:rgba(255,255,255,.1);color:#fff;cursor:pointer;font-size:1.35rem; }

.kawa-public-ai-body { flex:1; min-height:0; display:flex; flex-direction:column; padding:14px 14px 12px; }

/* Chat thread */
.kawa-public-ai-messages { flex:1; min-height:0; overflow-y:auto; display:flex; flex-direction:column; gap:14px; padding:2px 2px 8px; scroll-behavior:smooth; }
.kawa-msg { display:flex; gap:9px; align-items:flex-start; animation:kawaMsgIn .22s var(--ease); max-width:100%; }
.kawa-msg-user { flex-direction:row-reverse; }
.kawa-msg-avatar { flex:0 0 auto; width:26px;height:26px;border-radius:50%; display:grid; place-items:center; background:linear-gradient(145deg,#3fa45b,#1b2a5b); color:#b9a4e8; font-size:.72rem; border:1px solid rgba(146,119,219,.35); margin-top:2px; }
.kawa-msg-content { display:flex; flex-direction:column; gap:8px; max-width:84%; min-width:0; }
.kawa-msg-user .kawa-msg-content { align-items:flex-end; max-width:88%; }
.kawa-msg-bubble { padding:10px 12px; border-radius:14px; font-size:.79rem; line-height:1.55; word-wrap:break-word; }
.kawa-msg-bot .kawa-msg-bubble { background:#f7f9fc; border:1px solid rgba(16,24,40,.08); color:var(--ink); border-top-left-radius:4px; }
.kawa-msg-user .kawa-msg-bubble { background:linear-gradient(135deg,#3fa45b,#1b2a5b); color:#fff; border-top-right-radius:4px; }
.kawa-msg-bubble strong { display:block; margin-bottom:2px; font-size:.84rem; }
.kawa-msg-bot .kawa-msg-bubble strong { color:var(--primary); }
.kawa-msg-bubble p { margin:0 0 6px; } .kawa-msg-bubble p:last-child { margin-bottom:0; }
.kawa-msg-bubble ul { margin:4px 0; padding-left:18px; } .kawa-msg-bubble li { margin:2px 0; }

/* Per-message follow-up chips */
.kawa-msg-chips { display:flex; flex-wrap:wrap; gap:6px; }
.kawa-public-ai-chip { border:1px solid rgba(16,24,40,.14); border-radius:999px; background:#fff; color:var(--ink); padding:6px 10px; font:600 .68rem var(--font-body); cursor:pointer; transition:background .15s,border-color .15s; }
.kawa-public-ai-chip:hover { border-color:rgba(63,164,91,.35); background:rgba(63,164,91,.06); }

/* Typing indicator */
.kawa-typing-bubble { display:flex; gap:4px; align-items:center; padding:13px 14px; }
.kawa-typing-bubble span { width:6px;height:6px;border-radius:50%;background:rgba(16,24,40,.35); animation:kawaTyping 1.1s infinite ease-in-out; }
.kawa-typing-bubble span:nth-child(2) { animation-delay:.15s; }
.kawa-typing-bubble span:nth-child(3) { animation-delay:.3s; }

/* Composer */
.kawa-public-ai-form { flex:0 0 auto; display:flex; gap:8px; align-items:flex-end; padding-top:10px; margin-top:6px; border-top:1px solid rgba(16,24,40,.08); }
.kawa-public-ai-input-wrap { flex:1; min-width:0; }
.kawa-public-ai-input-wrap textarea { display:block; width:100%; max-height:120px; min-height:40px; resize:none; padding:10px 12px; border:1px solid rgba(16,24,40,.14); border-radius:12px; background:#fff; font:.78rem/1.45 var(--font-body); color:var(--ink); }
.kawa-public-ai-input-wrap textarea:focus { outline:none; border-color:rgba(63,164,91,.45); box-shadow:0 0 0 3px rgba(63,164,91,.12); }
.kawa-public-ai-submit { flex:0 0 auto; width:40px; height:40px; min-width:40px; min-height:40px; border-radius:12px; display:grid; place-items:center; padding:0; font-size:1rem; line-height:1; }

/* Attention pulse on the launcher, shown once per session */
.kawa-public-ai-fab-pulse { animation:kawaFabPulse 1.6s ease-in-out 2; }

@keyframes kawaMsgIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes kawaTyping { 0%,60%,100% { transform:translateY(0); opacity:.4; } 30% { transform:translateY(-4px); opacity:1; } }
@keyframes kawaFabPulse {
  0% { box-shadow:0 14px 34px rgba(16,24,40,.24),0 0 0 5px rgba(146,119,219,.08); }
  50% { box-shadow:0 14px 34px rgba(16,24,40,.24),0 0 0 11px rgba(146,119,219,.2); }
  100% { box-shadow:0 14px 34px rgba(16,24,40,.24),0 0 0 5px rgba(146,119,219,.08); }
}

@media (max-width:620px) {
  .kawa-public-ai-fab { right:14px;bottom:14px; }
  .kawa-public-ai-overlay { padding:12px; }
  .kawa-public-ai-modal { height:calc(100vh - 24px); max-height:calc(100vh - 24px); }
  .kawa-msg-content, .kawa-msg-user .kawa-msg-content { max-width:90%; }
}

/* -------------------------------------------------------------
   Public Kawa AI — conversation experience pass 1
   Keep the visitor assistant fully self-contained so public-site
   header/section rules cannot introduce spacing or sizing surprises.
   ------------------------------------------------------------- */
.kawa-ai-open { overflow:hidden; }
.kawa-public-ai-overlay { align-items:end; justify-items:end; }
.kawa-public-ai-modal {
  box-sizing:border-box;
  margin:0 !important;
  padding:0 !important;
  align-self:end;
  isolation:isolate;
}
.kawa-public-ai-modal > .kawa-public-ai-header,
.kawa-public-ai-modal > .kawa-public-ai-body {
  box-sizing:border-box;
  margin:0;
}
.kawa-public-ai-header {
  min-height:76px;
  padding:14px 16px;
}
.kawa-public-ai-heading { flex:1 1 auto; }
.kawa-public-ai-close {
  flex:0 0 auto;
  display:grid;
  place-items:center;
  padding:0;
  transition:background .15s var(--ease), transform .15s var(--ease);
}
.kawa-public-ai-close:hover { background:rgba(255,255,255,.17); transform:translateY(-1px); }
.kawa-public-ai-close:focus-visible { outline:3px solid rgba(243,213,143,.7); outline-offset:2px; }
.kawa-public-ai-body { padding:12px; }
.kawa-public-ai-messages {
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:rgba(27,42,91,.3) transparent;
}
.kawa-public-ai-messages::-webkit-scrollbar { width:7px; }
.kawa-public-ai-messages::-webkit-scrollbar-track { background:transparent; }
.kawa-public-ai-messages::-webkit-scrollbar-thumb { background:rgba(27,42,91,.22); border-radius:999px; }
.kawa-msg-bubble a { color:inherit; text-decoration:underline; text-underline-offset:2px; }
.kawa-msg-bot .kawa-msg-bubble a { color:var(--primary); }
.kawa-public-ai-chip {
  min-height:32px;
  line-height:1.2;
  transition:background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.kawa-public-ai-chip:hover { transform:translateY(-1px); }
.kawa-public-ai-chip:focus-visible { outline:3px solid rgba(63,164,91,.2); outline-offset:2px; border-color:rgba(63,164,91,.45); }
.kawa-public-ai-form { position:relative; }
.kawa-public-ai-input-wrap textarea {
  box-sizing:border-box;
  min-height:42px;
  max-height:120px;
  overflow-y:auto;
  overscroll-behavior:contain;
}
.kawa-public-ai-input-wrap textarea::placeholder { color:rgba(16,24,40,.5); }
.kawa-public-ai-input-wrap textarea:disabled { opacity:.7; cursor:not-allowed; background:#f3f5f1; }
.kawa-public-ai-submit {
  transition:transform .15s var(--ease), opacity .15s var(--ease), box-shadow .15s var(--ease);
}
.kawa-public-ai-submit:hover:not(:disabled) { transform:translateY(-1px); }
.kawa-public-ai-submit:focus-visible { outline:3px solid rgba(63,164,91,.2); outline-offset:2px; }
.kawa-public-ai-submit:disabled { opacity:.58; cursor:wait; }
.kawa-public-ai-submit.is-loading span { animation:kawaSendPulse 1s ease-in-out infinite; }
.kawa-public-ai-error .kawa-msg-bubble { background:#fff8f0; border-color:rgba(166,91,42,.18); }
.kawa-public-ai-retry {
  margin-top:8px;
  min-height:30px;
  padding:5px 10px;
  border:1px solid rgba(166,91,42,.25);
  border-radius:999px;
  background:#fff;
  color:#7a451f;
  font:600 .68rem var(--font-body);
  cursor:pointer;
}
.kawa-public-ai-retry:hover { background:#fff4e8; }
.kawa-public-ai-retry:focus-visible { outline:3px solid rgba(166,91,42,.18); outline-offset:2px; }
.kawa-public-ai-fab[aria-expanded="true"] { box-shadow:0 18px 42px rgba(16,24,40,.3),0 0 0 6px rgba(146,119,219,.12); }

@keyframes kawaSendPulse { 0%,100% { transform:scale(1); opacity:.75; } 50% { transform:scale(.82); opacity:1; } }

@media (max-width:620px) {
  .kawa-public-ai-overlay { inset:0; padding:0; place-items:stretch; }
  .kawa-public-ai-modal {
    width:100%;
    height:100dvh;
    max-height:none;
    border:0;
    border-radius:0;
  }
  .kawa-public-ai-header { min-height:70px; padding:12px 14px; }
  .kawa-public-ai-body { padding:10px; }
  .kawa-public-ai-fab { right:12px; bottom:12px; }
  .kawa-msg-content, .kawa-msg-user .kawa-msg-content { max-width:92%; }
  .kawa-public-ai-chip { min-height:34px; }
}

@media (max-width:380px) {
  .kawa-public-ai-header h2 { font-size:1rem; }
  .kawa-public-ai-header p { font-size:.66rem; }
  .kawa-public-ai-badge { display:none; }
  .kawa-public-ai-mark { width:34px; height:34px; }
  .kawa-msg-bubble { font-size:.76rem; }
  .kawa-public-ai-fab { min-height:44px; padding-right:13px; }
  .kawa-public-ai-fab span:last-child { font-size:.74rem; }
}

@media (prefers-reduced-motion: reduce) {
  .kawa-public-ai-fab,
  .kawa-public-ai-chip,
  .kawa-public-ai-close,
  .kawa-public-ai-submit { transition:none; }
  .kawa-public-ai-submit.is-loading span { animation:none; }
}
