/* ============================================================
   WCSH DGAS v3 — App layer (loaded after styles.css)
   Dropdown groups · logout · bottom navigation · Ask DGAS · Insights
============================================================ */

html { -webkit-tap-highlight-color: transparent; }
body { overscroll-behavior-y: none; }
button { -webkit-appearance: none; appearance: none; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 6px; }

.spinner { width: 30px; height: 30px; margin: 0 auto; border: 3px solid var(--border); border-top-color: var(--orange); border-radius: 50%; animation: spin .7s linear infinite; }
.muted { color: var(--text-light); font-size: .85rem; }

/* ── Topbar additions ─────────────────────────────────────── */
.topbar-btn-ai { background: linear-gradient(135deg, var(--navy-light), var(--navy)); color: #fff; }
.topbar-btn-ai i { color: var(--orange-light); }
.topbar-btn-ai:hover { box-shadow: 0 4px 16px rgba(11,31,58,.35); transform: translateY(-1px); }
.topbar-logout:hover { color: var(--danger); border-color: rgba(220,38,38,.35); background: var(--danger-bg); }

/* ── Sidebar additions ────────────────────────────────────── */
.nav-ai .nav-icon { color: var(--orange-light); }
.nav-pill { font-size: .6rem; font-weight: 800; letter-spacing: .5px; padding: 2px 6px; border-radius: 8px; background: var(--orange); color: #fff; }
.nav-collapsible { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.nav-collapsible:hover { color: rgba(255,255,255,.6); }
.nav-collapsible i { font-size: .6rem; transition: transform .2s; }
.nav-section.collapsed .nav-collapsible i { transform: rotate(-90deg); }
.nav-section.collapsed .nav-section-body { display: none; }
.sidebar-footer-link.logout-link:hover { color: #fca5a5; background: rgba(220,38,38,.12); }

/* ── Home hero ────────────────────────────────────────────── */
.home-hello { position: relative; z-index: 1; font-size: .9rem; color: var(--orange-light); font-weight: 600; margin-bottom: 8px; }
.dev-credit { display: inline-flex; align-items: center; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: 20px; padding: 5px 14px; font-size: .75rem; color: rgba(255,255,255,.75); position: relative; z-index: 1; margin-bottom: 20px; }
.dev-credit strong { color: #fff; margin-left: 4px; }
.hero-ask { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; max-width: 560px; background: #fff; border-radius: 40px; padding: 6px 6px 6px 18px; box-shadow: 0 10px 30px rgba(0,0,0,.25); margin-bottom: 26px; }
.hero-ask > i { color: var(--orange); }
.hero-ask input { flex: 1; min-width: 0; border: none; outline: none; background: none; font-size: .92rem; color: var(--text); padding: 10px 0; font-family: inherit; }
.hero-ask input::placeholder { color: var(--text-light); }
.hero-ask button { width: 42px; height: 42px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; font-size: .9rem; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.hero-ask button:hover { transform: scale(1.06); box-shadow: var(--shadow-orange); }
.home-hero-stats { margin-top: 2px; }
.quick-card:active { transform: scale(.97); }
.quick-count { position: absolute; top: 10px; right: 10px; min-width: 22px; padding: 1px 7px; border-radius: 10px; background: rgba(255,255,255,.22); color: #fff; font-size: .68rem; font-weight: 700; z-index: 1; }

/* ── Dropdown groups (accordion) ──────────────────────────── */
.acc-stack { display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.acc-toolbar { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 10px; }
.acc-tool { background: none; color: var(--text-mid); font-size: .78rem; font-weight: 600; padding: 6px 10px; border-radius: 8px; display: inline-flex; gap: 6px; align-items: center; transition: var(--transition); }
.acc-tool:hover { background: var(--surface-2); color: var(--orange-dark); }
.acc { background: #fff; border: 1.5px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: border-color .2s, box-shadow .2s; scroll-margin-top: 80px; }
.acc:hover { border-color: var(--border-dark); }
.acc.open { border-color: rgba(242,101,34,.45); box-shadow: var(--shadow-md); }
.acc-head { width: 100%; display: flex; align-items: center; gap: 12px; padding: 15px 18px; background: none; text-align: left; color: var(--navy); }
.acc-chip { width: 36px; height: 36px; flex-shrink: 0; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: .9rem; }
.acc-national { background: var(--navy-pale); color: var(--navy-light); }
.acc-wcsh { background: var(--orange-pale); color: var(--orange); }
.acc-sop { background: linear-gradient(135deg, var(--orange), var(--orange-light)); color: #fff; box-shadow: 0 2px 8px rgba(242,101,34,.3); }
.acc-title { flex: 1; min-width: 0; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1rem; }
.acc-count { background: var(--surface-2); color: var(--text-mid); font-size: .74rem; font-weight: 700; padding: 3px 10px; border-radius: 12px; }
.acc.open .acc-count { background: var(--orange-pale); color: var(--orange-dark); }
.acc-empty .acc-title { color: var(--text-mid); }
.acc-chev { color: var(--text-light); font-size: .8rem; transition: transform .25s; }
.acc.open .acc-chev { transform: rotate(180deg); color: var(--orange); }
.acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .28s ease; }
.acc.open .acc-body { grid-template-rows: 1fr; }
.acc-inner { overflow: hidden; min-height: 0; }
.acc-inner > * { margin: 0 18px; }
.acc-inner > :first-child { margin-top: 2px; }
.acc-inner > :last-child { margin-bottom: 18px; }
.doc-card-soon { opacity: .55; cursor: default; }
.doc-placeholder { padding: 14px 16px; background: var(--surface); border: 1px dashed var(--border-dark); border-radius: var(--radius-md); color: var(--text-light); font-size: .85rem; display: flex; align-items: center; gap: 8px; }

/* ── Bottom navigation (phones) ───────────────────────────── */
.bottom-nav { display: none; }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(11,31,58,.5); z-index: 640; display: none; align-items: flex-end; justify-content: center; }
.sheet-backdrop.open { display: flex; animation: fadeIn .2s ease; }
.sheet { width: 100%; max-width: 520px; background: #fff; border-radius: 22px 22px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); animation: sheetUp .28s cubic-bezier(.2,.8,.2,1); }
.sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border-dark); margin: 0 auto 14px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px 6px; background: var(--surface); border-radius: 14px; color: var(--navy); font-size: .78rem; font-weight: 600; }
.sheet-grid button i { font-size: 1.15rem; color: var(--orange); }
.sheet-grid button:active { background: var(--orange-pale); }
.sheet-logout { width: 100%; margin-top: 12px; padding: 14px; border-radius: 14px; background: var(--danger-bg); color: var(--danger); font-weight: 700; font-size: .9rem; display: flex; align-items: center; justify-content: center; gap: 8px; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 768px) {
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 250; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: flex-end; }
  .bottom-nav button { flex: 1; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; color: var(--text-light); font-size: .66rem; font-weight: 600; border-radius: 12px; min-width: 0; }
  .bottom-nav button i { font-size: 1.1rem; }
  .bottom-nav button.active { color: var(--orange); }
  .bottom-nav .bn-center { margin-top: -22px; color: var(--navy); }
  .bn-orb { width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; box-shadow: 0 6px 18px rgba(242,101,34,.45); border: 4px solid #fff; }
  .bn-center.active .bn-orb { box-shadow: 0 6px 22px rgba(242,101,34,.65); }
  .bottom-nav .bn-center.active { color: var(--orange); }
  .page { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .footer { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  .scroll-top { bottom: calc(88px + env(safe-area-inset-bottom)) !important; }
  .toast-stack { bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
  .topbar-btn-ai, .topbar-btn-primary, .topbar-logout { display: none; }
  .hero-ask { margin-bottom: 20px; }
  .acc-head { padding: 13px 14px; gap: 10px; }
  .acc-inner > * { margin-left: 12px; margin-right: 12px; }
}

/* installed-app (standalone) polish */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(var(--topbar-h) + env(safe-area-inset-top)); }
}

/* ── Ask DGAS (chat) ──────────────────────────────────────── */
.page.page-chat { padding: 0; }
.chat { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); max-width: 880px; margin: 0 auto; background: #fff; }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.chat-head-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chat-logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--navy-light), var(--navy)); color: var(--orange-light); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-title { font-family: 'Outfit', sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--navy); line-height: 1.2; }
.chat-sub { font-size: .74rem; color: var(--text-mid); display: flex; align-items: center; gap: 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px rgba(5,150,105,.18); display: inline-block; flex-shrink: 0; }
.live-dot.off { background: var(--warning); box-shadow: 0 0 0 3px rgba(217,119,6,.18); }
.chat-clear { background: var(--surface); border: 1px solid var(--border); color: var(--text-mid); padding: 7px 12px; border-radius: 10px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chat-clear:hover { color: var(--orange-dark); border-color: var(--orange); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; background: linear-gradient(180deg, var(--surface), #fff 60%); scroll-behavior: smooth; }
.chat-welcome { margin: auto; text-align: center; max-width: 520px; padding: 20px 0; }
.chat-welcome h2 { font-family: 'Outfit', sans-serif; font-size: 1.5rem; color: var(--navy); margin: 16px 0 8px; }
.chat-welcome p { color: var(--text-mid); font-size: .92rem; line-height: 1.7; }
.orb { width: 68px; height: 68px; margin: 0 auto; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; box-shadow: 0 10px 30px rgba(242,101,34,.4); animation: orbPulse 3.2s ease-in-out infinite; }
@keyframes orbPulse { 0%,100% { box-shadow: 0 10px 30px rgba(242,101,34,.4); } 50% { box-shadow: 0 10px 44px rgba(242,101,34,.65); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 22px; }
.chip { background: #fff; border: 1.5px solid var(--border); color: var(--navy); padding: 9px 14px; border-radius: 22px; font-size: .82rem; font-weight: 500; text-align: left; transition: var(--transition); }
.chip:hover { border-color: var(--orange); color: var(--orange-dark); background: var(--orange-pale); }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg-user { justify-content: flex-end; }
.bubble { background: linear-gradient(135deg, var(--navy-light), var(--navy)); color: #fff; padding: 11px 16px; border-radius: 18px 18px 4px 18px; max-width: 82%; font-size: .92rem; line-height: 1.55; word-break: break-word; }
.avatar { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; margin-top: 2px; }
.ai-card { background: #fff; border: 1px solid var(--border); border-radius: 4px 18px 18px 18px; padding: 14px 16px; box-shadow: var(--shadow-sm); min-width: 0; max-width: min(640px, calc(100% - 44px)); animation: msgIn .25s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ai-text { font-size: .92rem; line-height: 1.7; color: var(--text); word-break: break-word; }
.ai-text p { margin: 0 0 9px; } .ai-text p:last-child { margin-bottom: 0; }
.ai-text ul, .ai-text ol { margin: 4px 0 10px 20px; } .ai-text ul { list-style: disc; } .ai-text ol { list-style: decimal; } .ai-text li { margin-bottom: 4px; }
.cite { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 4px; margin: 0 1px; border-radius: 9px; background: var(--orange-pale); color: var(--orange-dark) !important; font-size: .66rem; font-weight: 800; vertical-align: 2px; text-decoration: none; }
.src-label { margin: 14px 0 8px; font-size: .74rem; font-weight: 700; color: var(--text-mid); display: flex; gap: 6px; align-items: center; }
.src-list { display: flex; flex-direction: column; gap: 6px; }
.src-card { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: inherit; transition: var(--transition); min-width: 0; }
.src-card:hover { border-color: var(--orange); background: var(--orange-pale); }
.src-card.flash { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(242,101,34,.2); }
.src-card > i { color: var(--text-light); font-size: .75rem; flex-shrink: 0; }
.src-num { width: 24px; height: 24px; border-radius: 8px; background: var(--navy); color: #fff; font-size: .72rem; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.src-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.src-title { font-size: .82rem; font-weight: 600; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-meta { font-size: .7rem; color: var(--text-light); }
.ai-note { margin-top: 12px; font-size: .72rem; color: var(--text-light); display: flex; gap: 6px; align-items: flex-start; }
.msg-fb { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--surface-2); display: flex; align-items: center; gap: 8px; font-size: .74rem; color: var(--text-light); }
.msg-fb button { background: var(--surface); width: 30px; height: 30px; border-radius: 50%; color: var(--text-mid); }
.msg-fb button:hover { background: var(--orange-pale); color: var(--orange-dark); }
.typing { display: flex; gap: 5px; padding: 4px 0; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--orange); opacity: .35; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,80%,100% { opacity: .25; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }
.typing-label { font-size: .75rem; color: var(--text-light); margin-top: 4px; }
.chat-input { display: flex; align-items: flex-end; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: #fff; flex-shrink: 0; }
.chat-input textarea { flex: 1; resize: none; border: 1.5px solid var(--border); border-radius: 22px; padding: 11px 16px; font: inherit; font-size: .92rem; line-height: 1.4; outline: none; background: var(--surface); max-height: 120px; transition: var(--transition); }
.chat-input textarea:focus { border-color: var(--orange); background: #fff; box-shadow: 0 0 0 3px rgba(242,101,34,.1); }
.chat-input button { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--orange), var(--orange-dark)); color: #fff; flex-shrink: 0; transition: var(--transition); }
.chat-input button:hover { box-shadow: var(--shadow-orange); }
.chat-input button:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 768px) {
  .chat { height: calc(100dvh - var(--topbar-h) - 66px - env(safe-area-inset-bottom)); }
  .chat-head { padding: 10px 14px; } .chat-scroll { padding: 14px; }
  .chat-clear span { display: none; }
  .bubble { max-width: 88%; }
  .page.page-chat { padding-bottom: 0; }
  .chat-input { padding-bottom: 12px; }
}

/* ── Insights ─────────────────────────────────────────────── */
.ins-hero { margin-bottom: 20px; }
.ins-hero .hero-desc { max-width: none; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.src-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: 20px; font-size: .76rem; font-weight: 600; background: rgba(255,255,255,.12); color: #fff; }
.src-badge.ok .live-dot { background: #34d399; }
.src-badge.warn { background: rgba(217,119,6,.28); }
.src-badge.sample { background: rgba(255,255,255,.2); }
.src-hint { font-size: .78rem; color: rgba(255,255,255,.65); }
.link-btn { background: none; color: var(--orange-dark); font-weight: 600; font-size: .78rem; display: inline-flex; gap: 6px; align-items: center; padding: 4px 6px; border-radius: 8px; }
.link-btn:hover { background: var(--orange-pale); }
.ins-hero .link-btn { color: var(--orange-light); }
.ins-hero .link-btn:hover { background: rgba(255,255,255,.1); }
.seg { display: inline-flex; background: rgba(255,255,255,.1); border-radius: 12px; padding: 3px; margin-top: 18px; position: relative; z-index: 1; }
.seg button { background: none; color: rgba(255,255,255,.7); padding: 7px 16px; border-radius: 9px; font-size: .8rem; font-weight: 600; transition: var(--transition); }
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px 12px; box-shadow: var(--shadow-xs); min-width: 0; }
.kpi-label { font-size: .78rem; color: var(--text-mid); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi-dot { width: 8px; height: 8px; border-radius: 3px; }
.kpi-row { display: flex; align-items: baseline; gap: 10px; margin: 6px 0 2px; flex-wrap: wrap; }
.kpi-num { font-family: 'Outfit', sans-serif; font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.kpi-delta { font-size: .74rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; background: var(--surface-2); color: var(--text-mid); white-space: nowrap; }
.kpi-delta.up { background: var(--success-bg); color: var(--success); }
.kpi-delta.down { background: var(--danger-bg); color: var(--danger); }
.spark { width: 100%; height: 34px; display: block; margin-top: 4px; }
.ins-card { padding: 18px 20px 20px; margin-bottom: 16px; min-width: 0; }
.ins-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ins-h { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1rem; color: var(--navy); display: flex; align-items: center; gap: 8px; }
.ins-s { font-size: .78rem; color: var(--text-light); margin-top: 2px; }
.ins-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }
.lg { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 5px 11px; font-size: .76rem; font-weight: 600; color: var(--text-mid); display: inline-flex; align-items: center; gap: 7px; }
.lg.off { opacity: .45; text-decoration: line-through; }
.lg-sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex-shrink: 0; }
.chart-wrap { position: relative; width: 100%; margin-top: 8px; }
.chart { display: block; max-width: 100%; touch-action: pan-y; }
.chart .ax { font-size: 11px; fill: #75736d; font-family: 'Plus Jakarta Sans', sans-serif; }
.chart .endlab { font-size: 11.5px; fill: var(--text-mid); font-weight: 600; font-family: 'Plus Jakarta Sans', sans-serif; }
.tip { position: absolute; z-index: 5; background: var(--navy); color: #fff; font-size: .76rem; padding: 8px 11px; border-radius: 10px; pointer-events: none; box-shadow: var(--shadow-lg); white-space: nowrap; }
.tip-float { position: absolute; display: none; padding: 5px 9px; font-weight: 600; z-index: 900; max-width: 280px; white-space: normal; }
.tip-d { font-weight: 700; margin-bottom: 5px; }
.tip-r { display: flex; align-items: center; gap: 7px; margin-top: 3px; }
.tip-r b { margin-left: auto; padding-left: 14px; }
.ins-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.bars { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.bar-top { display: flex; justify-content: space-between; gap: 12px; font-size: .82rem; }
.bar-label { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.bar-val { color: var(--text-mid); font-weight: 700; flex-shrink: 0; }
.bar-track { height: 8px; border-radius: 4px; background: var(--surface-2); margin-top: 5px; }
.bar-fill { height: 100%; border-radius: 0 4px 4px 0; border-radius: 4px; }
.bar-sub { font-size: .7rem; color: var(--text-light); margin-top: 3px; }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 150px; margin-top: 18px; }
.hour { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.hour-bar { width: 100%; background: #9fc2ee; border-radius: 3px 3px 0 0; min-height: 2px; transition: background .15s; }
.hour:hover .hour-bar { background: var(--orange); }
.hour-bar.peak { background: #2a78d6; }
.hours-axis { display: flex; justify-content: space-between; font-size: .68rem; color: var(--text-light); margin-top: 6px; }
.chips-cloud { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.tag { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 6px 12px; font-size: .8rem; color: var(--navy); font-weight: 500; }
.tag b { color: var(--orange-dark); margin-left: 5px; }
.gaps-card { border-left: 4px solid var(--warning); }
.gap-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gap { background: var(--warning-bg); border: 1px solid rgba(217,119,6,.25); border-radius: 12px; padding: 7px 12px; font-size: .82rem; color: var(--text); display: flex; gap: 10px; align-items: center; }
.gap b { color: var(--warning); }
.story ul { list-style: disc; margin: 12px 0 0 18px; display: flex; flex-direction: column; gap: 8px; font-size: .9rem; line-height: 1.6; color: var(--text-mid); }
.story b { color: var(--navy); }
.tbl-wrap { max-height: 360px; overflow: auto; margin-top: 10px; border: 1px solid var(--border); border-radius: 12px; }
.tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.tbl th, .tbl td { padding: 9px 14px; text-align: right; border-bottom: 1px solid var(--surface-2); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { position: sticky; top: 0; background: var(--surface); color: var(--text-mid); font-weight: 700; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .ins-grid { grid-template-columns: 1fr; } }
@media (max-width: 480px) { .kpi-num { font-size: 1.6rem; } .ins-card { padding: 16px 14px 16px; } .hours { height: 120px; gap: 2px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.chips-inline { justify-content: flex-start; margin-top: 12px; gap: 6px; }
.chips-inline .chip { padding: 7px 12px; font-size: .78rem; }
.ai-link { color: var(--orange-dark); text-decoration: underline; word-break: break-all; }


/* ── Chat input & voice (roomier layout; voice buttons) ───── */
.chat-tools { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.chat-input { gap: 8px; align-items: center; }
.chat-input textarea { flex: 1 1 auto; min-width: 0; padding: 11px 14px; }
.chat-input button { width: 42px; height: 42px; }
.chat-input .v-mic { background: var(--surface); color: var(--orange); border: 1.5px solid var(--border); box-shadow: none; }
.chat-input .v-mic:hover { box-shadow: none; border-color: var(--orange); }
.chat-input .v-mic.rec { background: #e5484d; color: #fff; border-color: #e5484d; animation: vpulse 1.3s ease-out infinite; }
@keyframes vpulse { 0% { box-shadow: 0 0 0 0 rgba(229,72,77,.45); } 100% { box-shadow: 0 0 0 16px rgba(229,72,77,0); } }
.chat-input textarea.listening { border-color: #e5484d; box-shadow: 0 0 0 3px rgba(229,72,77,.12); }
.chat-clear.v-lang { padding: 7px 10px; min-width: 40px; text-align: center; font-weight: 700; }
.chat-clear.v-auto.on { color: var(--orange-dark); border-color: var(--orange); }
.chat-tools .chat-clear { height: 36px; }
.v-listen { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; padding: 6px 12px; border-radius: 999px; font: inherit; font-size: .78rem; font-weight: 600; color: var(--text-mid); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.v-listen:hover { color: var(--orange-dark); border-color: var(--orange); }
.v-listen.speaking { color: #fff; background: var(--orange); border-color: var(--orange); }
.v-toast { position: absolute; left: 16px; right: 16px; bottom: 76px; background: #1f2a3d; color: #fff; padding: 10px 14px; border-radius: 12px; font-size: .82rem; text-align: center; z-index: 5; }
@media (max-width: 768px) {
  .chat-head { gap: 8px; padding: 10px 12px; }
  .chat-title { font-size: 1rem; }
  .chat-sub { font-size: .7rem; line-height: 1.25; }
  .chat-tools .chat-clear { width: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; }
  .chat-tools .chat-clear.v-lang { width: auto; min-width: 38px; padding: 0 8px; border-radius: 18px; }
  .chat-input { padding: 10px 12px 12px; }
  .chat-input textarea { font-size: .95rem; padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) { .chat-input .v-mic.rec { animation: none; } }

/* ── Tools: STG answers, Word/Excel downloads, data analysis ── */
.t-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; font-size: .74rem; color: var(--text-light); }
.t-actions span { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: .66rem; margin-right: 2px; }
.t-actions button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font: inherit; font-size: .76rem; font-weight: 600; color: var(--text-mid); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.t-actions button:hover { color: var(--orange-dark); border-color: var(--orange); }
.t-actions button:disabled { opacity: .6; cursor: wait; }
.ai-text em { color: var(--text-light); font-size: .86em; }
.an-scroll { overflow-x: auto; margin: 10px 0; -webkit-overflow-scrolling: touch; }
.an-t { border-collapse: collapse; width: 100%; font-size: .8rem; }
.an-t th { background: var(--navy); color: #fff; font-weight: 600; text-align: left; padding: 7px 10px; white-space: nowrap; }
.an-t td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.an-t tbody tr:nth-child(even) td { background: var(--surface); }
.an-title { font-family: 'Outfit', sans-serif; font-weight: 800; color: var(--navy); font-size: 1rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; word-break: break-word; }
.an-title i { color: var(--orange); }
.an-obs { margin: 6px 0 4px 18px; padding: 0; font-size: .88rem; line-height: 1.5; }
.an-obs li { margin-bottom: 4px; }
.an-h { font-weight: 700; color: var(--navy); font-size: .84rem; margin: 14px 0 6px; }
.an-h span { font-weight: 500; color: var(--text-light); font-size: .74rem; margin-left: 6px; }
.an-chart svg { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 10px; }
.an-bar { display: grid; grid-template-columns: minmax(70px, 30%) 1fr auto; gap: 8px; align-items: center; font-size: .78rem; margin-bottom: 4px; }
.an-k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.an-track { height: 10px; background: var(--surface-2, #eef1f6); border-radius: 6px; overflow: hidden; }
.an-track i { display: block; height: 100%; background: #2a78d6; border-radius: 6px; }
.an-v { color: var(--text-mid); font-variant-numeric: tabular-nums; white-space: nowrap; }
.an-note { margin-top: 12px; font-size: .72rem; color: var(--text-light); display: flex; align-items: center; gap: 6px; }
@media (max-width: 768px) { .chat-tools .chat-clear.v-attach { width: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; } }

/* ── Feedback page ───────────────────────────────────────── */
.fb-card { background: var(--white, #fff); border: 1px solid var(--border, #e5e9f0); border-radius: 16px; padding: 22px; max-width: 760px; box-shadow: 0 1px 3px rgba(15,30,60,.05); }
.fb-label { display: block; font-weight: 700; font-size: .88rem; color: var(--navy, #0f2a4a); margin: 18px 0 8px; }
.fb-label:first-child { margin-top: 0; }
.fb-opt { font-weight: 500; color: var(--text-light, #6b7a90); font-size: .8rem; }
.fb-kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.fb-kind { text-align: left; border: 1.5px solid var(--border, #dde3ec); background: #fff; border-radius: 12px; padding: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; font: inherit; color: inherit; }
.fb-kind i { color: var(--orange, #f26a1b); font-size: 1.05rem; margin-bottom: 2px; }
.fb-kind b { font-size: .88rem; }
.fb-kind span { font-size: .76rem; color: var(--text-light, #6b7a90); line-height: 1.35; }
.fb-kind.on { border-color: var(--orange, #f26a1b); background: rgba(242,106,27,.07); }
.fb-input { width: 100%; box-sizing: border-box; border: 1.5px solid var(--border, #dde3ec); border-radius: 10px; padding: 11px 12px; font: inherit; font-size: .92rem; background: #fff; color: inherit; resize: vertical; }
.fb-input:focus { outline: none; border-color: var(--orange, #f26a1b); box-shadow: 0 0 0 3px rgba(242,106,27,.15); }
.fb-count { text-align: right; font-size: .74rem; color: var(--text-light, #6b7a90); margin-top: 4px; }
.fb-stars { display: flex; gap: 6px; }
.fb-stars button { border: 0; background: none; cursor: pointer; font-size: 1.5rem; color: #cfd6e2; padding: 2px; }
.fb-stars button.on { color: #f5a623; }
.fb-note { margin-top: 14px; font-size: .82rem; color: var(--text-mid, #44546a); }
.fb-note:empty { display: none; }
.fb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.fb-fine { margin-top: 12px; font-size: .75rem; color: var(--text-light, #6b7a90); }
.fb-done { text-align: center; padding: 18px 6px; }
.fb-done-icon { font-size: 2.6rem; color: #16a34a; margin-bottom: 8px; }
.fb-done h3 { margin: 0 0 6px; }
.doc-fb { margin-left: 10px; }
@media (max-width: 600px) { .fb-card { padding: 16px; } .fb-actions .btn { width: 100%; justify-content: center; } }

/* ── Calculators ── */
.calc-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; -webkit-overflow-scrolling: touch; }
.calc-tabs button { flex-shrink: 0; border: 1px solid var(--border); background: var(--surface); color: var(--text-mid); padding: 9px 14px; border-radius: 999px; font: 600 .82rem inherit; cursor: pointer; white-space: nowrap; }
.calc-tabs button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.calc-tabs button i { margin-right: 6px; opacity: .8; }
.calc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin: 10px 0 16px; }
.calc-grid label { display: flex; flex-direction: column; gap: 6px; font-size: .8rem; font-weight: 600; color: var(--text-mid); }
.calc-grid input, .calc-grid select { padding: 11px 12px; border: 1px solid var(--border); border-radius: 10px; font: 500 1rem inherit; background: var(--surface); color: var(--text); width: 100%; }
.calc-grid input:focus, .calc-grid select:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.calc-out { background: var(--surface-2); border-left: 4px solid var(--orange); border-radius: 10px; padding: 14px 16px; font-size: 1rem; line-height: 1.6; color: var(--text); }
.calc-out small { display: block; margin-top: 8px; font-size: .78rem; color: var(--text-mid); line-height: 1.5; }

/* ── Print an answer ── */
.t-actions .t-print { }
#print-area { display: none; }
@media print {
  body.printing > *:not(#print-area) { display: none !important; }
  body.printing #print-area { display: block !important; padding: 0; color: #000; font: 12pt/1.5 Georgia, serif; }
  #print-area h1 { font: 700 16pt Georgia, serif; margin: 0 0 4pt; }
  #print-area .pa-sub { font-size: 9.5pt; color: #444; border-bottom: 1.5pt solid #F26522; padding-bottom: 6pt; margin-bottom: 10pt; }
  #print-area .pa-q { font-weight: 700; margin-bottom: 8pt; }
  #print-area .pa-src { margin-top: 12pt; font-size: 10pt; }
  #print-area .pa-note { margin-top: 14pt; font-size: 8.5pt; color: #555; border-top: .5pt solid #aaa; padding-top: 6pt; }
  #print-area ul, #print-area ol { padding-left: 18pt; }
}
