/* ==========================================================================
   budget.urbannext.online — ปีกพัฒนาเมือง
   Civic Editorial theme: น้ำเงินกรม 70% / ส้ม 30% / พื้นครีม-เทา
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --navy-900: #0B2154;
  --navy-800: #12336B;
  --navy-700: #1A4185;
  --navy-050: #EEF2F9;
  --navy-border: #C9D6EE;

  --blue-600: #1D4ED8;

  --orange:      #F47920;
  --orange-dark: #C25608;
  --orange-tint: #FFF3E8;
  --orange-line: #F6C89B;

  --red:      #C0392B;
  --red-tint: #FDEDEC;
  --red-line: #F3C2BC;

  --page:   #F6F6F2;
  --card:   #FFFFFF;
  --line:   #E4E3DD;
  --line-2: #D3D2CA;
  --tint:   #F1F1EC;

  --ink:   #0B2154;
  --body:  #3B4252;
  --muted: #71767F;
  --faint: #9C9F98;
  --zero:  #B6B8B2;

  --chart-1: #1D4ED8;
  --chart-2: #F47920;
  --chart-3: #0D9488;
  --chart-4: #7C3AED;
  --chart-5: #B45309;
  --chart-other: #B9C2D3;

  --radius-lg: 16px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --shadow-card: 0 6px 18px rgba(11, 33, 84, .05);
  --shadow-card-lg: 0 10px 28px rgba(11, 33, 84, .07);
}

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

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  font-family: 'Anuphan', 'Noto Sans Thai', system-ui, sans-serif;
  background: var(--page);
  color: var(--body);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: var(--navy-800); text-decoration: none; }
a:hover { color: var(--orange-dark); }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

h1, h2, h3 { color: var(--ink); font-weight: 700; }

img, svg { display: block; max-width: 100%; }

button { font-family: inherit; }

/* ---------- layout shells ---------- */

.page { display: flex; flex-direction: column; min-height: 100vh; }
.container { max-width: 1440px; margin: 0 auto; width: 100%; }
.px-page { padding-left: 72px; padding-right: 72px; }

@media (max-width: 900px) {
  .px-page { padding-left: 20px; padding-right: 20px; }
}

/* ---------- header ---------- */

.site-header {
  height: 64px;
  background: var(--navy-900);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 72px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
}

@media (max-width: 900px) {
  .site-header { height: 56px; padding: 0 20px; }
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-icon {
  width: 34px; height: 34px; border-radius: 9px; background: var(--orange);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
@media (max-width: 900px) { .brand-icon { width: 30px; height: 30px; border-radius: 8px; } }

.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-text .name { font-size: 15px; font-weight: 600; color: #FFFFFF; letter-spacing: -.2px; }
.brand-text .tagline { font-size: 11.5px; font-weight: 500; color: var(--orange-line); letter-spacing: .06em; }
@media (max-width: 900px) {
  .brand-text .name { font-size: 12.5px; }
  .brand-text .tagline { font-size: 10px; }
}

.main-nav { display: flex; align-items: center; gap: 24px; }
@media (max-width: 1240px) {
  .site-header { padding: 0 32px; }
  .main-nav { gap: 14px; }
  .nav-search { min-width: 160px; padding: 0 10px; }
}
@media (max-width: 900px) { .main-nav { display: none; } }

.main-nav a {
  font-size: 14px; font-weight: 500; color: #C6CEDC; padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.main-nav a:hover { color: #FFFFFF; }
.main-nav a.active { font-weight: 600; color: #FFFFFF; border-bottom-color: var(--orange); }

.nav-search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  border-radius: 999px; background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .18);
  min-width: 220px;
  transition: background .15s ease, border-color .15s ease;
}
.nav-search:focus-within {
  background: rgba(255, 255, 255, .16);
  border-color: rgba(255, 255, 255, .35);
}
.nav-search span { font-size: 13px; color: #9FAAC0; }

/* ---------- mobile header & navigation ---------- */

.mobile-menu-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-right: -6px;
  border-radius: 8px;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s ease;
}
.mobile-menu-btn:hover, .mobile-menu-btn:focus-visible {
  background: rgba(255, 255, 255, .12);
  outline: none;
}

@media (max-width: 900px) {
  .mobile-menu-btn { display: flex; }
}

.hamburger-box {
  width: 24px;
  height: 18px;
  display: inline-block;
  position: relative;
}

.hamburger-inner, .hamburger-inner::before, .hamburger-inner::after {
  width: 24px;
  height: 2px;
  background-color: #FFFFFF;
  border-radius: 2px;
  position: absolute;
  transition: transform 0.22s cubic-bezier(0.55, 0.055, 0.675, 0.19),
              top 0.22s cubic-bezier(0.55, 0.055, 0.675, 0.19),
              background-color 0.2s ease,
              opacity 0.2s ease;
}

.hamburger-inner {
  top: 50%;
  transform: translateY(-50%);
}

.hamburger-inner::before, .hamburger-inner::after {
  content: "";
  display: block;
}

.hamburger-inner::before {
  top: -7px;
}

.hamburger-inner::after {
  top: 7px;
}

/* Hamburger active transformation to X */
.mobile-menu-btn.is-active .hamburger-inner {
  background-color: transparent;
}
.mobile-menu-btn.is-active .hamburger-inner::before {
  top: 0;
  transform: rotate(45deg);
  background-color: var(--orange);
}
.mobile-menu-btn.is-active .hamburger-inner::after {
  top: 0;
  transform: rotate(-45deg);
  background-color: var(--orange);
}

/* Mobile backdrop */
.mobile-nav-backdrop {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(4, 14, 38, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
  z-index: 48;
}
.mobile-nav-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}

/* Mobile Nav Drawer */
.mobile-nav-drawer {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  max-height: calc(100vh - 56px);
  background: #0B2154;
  border-bottom: 2px solid #1A4185;
  box-shadow: 0 16px 36px rgba(11, 33, 84, 0.45);
  transform: translateY(-100%);
  opacity: 0;
  visibility: hidden;
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.22s ease,
              visibility 0.28s;
  z-index: 49;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.mobile-nav-drawer.is-open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.mobile-nav-inner {
  padding: 16px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mobile-nav-search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 0 8px 0 14px;
  height: 46px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mobile-nav-search:focus-within {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}
.mobile-nav-search input {
  flex: 1;
  background: none;
  border: none;
  color: #FFFFFF;
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
.mobile-nav-search input::placeholder {
  color: #9FAAC0;
}
.mobile-nav-search input:focus {
  outline: none;
}
.mobile-search-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--orange);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.mobile-search-btn:hover {
  background: var(--orange-dark);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 48px;
  padding: 0 14px;
  border-radius: 10px;
  color: #C6CEDC;
  font-size: 14.5px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
  text-decoration: none;
}
.mobile-nav-item:hover, .mobile-nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}
.mobile-nav-item.active {
  background: rgba(244, 121, 32, 0.16);
  color: #FFFFFF;
  font-weight: 600;
  border-left: 3px solid var(--orange);
  padding-left: 11px;
}

.mob-item-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  color: #9FAAC0;
  flex-shrink: 0;
}
.mobile-nav-item.active .mob-item-icon {
  color: var(--orange);
}
.mob-icon-sparkle {
  color: var(--orange) !important;
}

.mob-item-label {
  flex: 1;
}

.mob-item-badge {
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.10);
  color: #C6CEDC;
}
.mob-item-badge.badge-ai {
  background: var(--orange);
  color: #FFFFFF;
  font-weight: 700;
}

.mobile-nav-footer {
  margin-top: 6px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mob-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mob-footer-brand .name {
  font-size: 12.5px;
  color: #FFFFFF;
  font-weight: 600;
}
.mob-footer-brand .tagline {
  font-size: 11px;
  color: var(--orange-line);
}

/* ---------- breadcrumb ---------- */

.breadcrumb {
  height: 44px; background: var(--card); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; padding: 0 72px; gap: 9px; flex-shrink: 0;
}
@media (max-width: 900px) { .breadcrumb { padding: 0 20px; } }
.breadcrumb a { font-size: 13px; color: var(--muted); }
.breadcrumb .current { font-size: 13px; font-weight: 600; color: var(--ink); }
.breadcrumb svg { flex-shrink: 0; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 9px; height: 46px; padding: 0 22px;
  border-radius: var(--radius-xs); font-size: 15px; font-weight: 600; border: none; cursor: pointer;
  white-space: nowrap;
}
.btn-primary { background: var(--orange); color: #FFFFFF; box-shadow: 0 6px 16px rgba(244, 121, 32, .28); }
.btn-primary:hover { background: var(--orange-dark); color: #FFFFFF; }
.btn-navy { background: var(--navy-900); color: #FFFFFF; }
.btn-navy:hover { background: var(--navy-800); color: #FFFFFF; }
.btn-outline { background: #FFFFFF; border: 1px solid var(--line-2); color: var(--ink); }
.btn-outline:hover { border-color: var(--navy-800); color: var(--navy-800); }
.btn-tint { background: var(--orange-tint); border: 1px solid var(--orange-line); color: var(--orange-dark); }
.btn-tint:hover { background: var(--orange-line); }
.btn-text { height: auto; padding: 0; background: none; color: var(--navy-800); font-weight: 600; }
.btn-sm { height: 40px; padding: 0 16px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

/* ---------- cards ---------- */

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-md);
}

.badge {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px;
  border-radius: 999px; background: var(--orange-tint); border: 1px solid var(--orange-line);
  font-size: 12.5px; font-weight: 600; color: var(--orange-dark);
}
.badge .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--orange); }
.badge-status { background: #E9F6F2; color: #0D9488; }
.badge-status .dot { background: #0D9488; }
.badge-muted { background: var(--tint); color: var(--muted); font-weight: 600; font-size: 11px; padding: 3px 8px; height: auto; }

/* ---------- footer ---------- */

.site-footer {
  margin-top: auto; background: var(--navy-900); padding: 26px 72px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
@media (max-width: 900px) { .site-footer { padding: 22px 20px; flex-direction: column; align-items: flex-start; gap: 6px; } }
.site-footer .name { font-size: 13.5px; font-weight: 600; color: #FFFFFF; }
.site-footer .tagline, .site-footer .disclaimer { font-size: 12px; color: #9FAAC0; line-height: 1.6; }

.footer-link {
  color: #FFFFFF;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.4);
  font-weight: 600;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
.footer-link:hover {
  color: var(--orange);
  text-decoration-color: var(--orange);
}

/* ---------- map ---------- */

.pv { fill: #E7E7E1; stroke: var(--page); stroke-width: .8; transition: fill .15s ease, stroke .15s ease; cursor: pointer; }
.pv:hover { fill: #CBD5E1; }
.pv.q { fill: #BFC8D8; cursor: pointer; }
.pv.q:hover { fill: #94A3B8; }
.pv.on { fill: var(--navy-800); stroke: #FFFFFF; stroke-width: 1; cursor: pointer; }
.pv.on:hover { fill: var(--orange); }
.pv.sel { fill: var(--orange) !important; stroke: #FFFFFF !important; stroke-width: 1.6; filter: drop-shadow(0 2px 5px rgba(244,121,32,0.45)); }

.map-legend { display: flex; flex-direction: column; gap: 7px; }
.map-legend .row { display: flex; align-items: center; gap: 8px; }
.map-legend .swatch { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.map-legend .sw-on { background: var(--navy-800); }
.map-legend .sw-q { background: #BFC8D8; }
.map-legend .sw-off { background: #E7E7E1; border: 1px solid var(--line-2); }

/* Quick Province Chips */
.quick-prov-chips-wrap {
  display: flex; align-items: center; gap: 8px; margin-bottom: 16px; padding: 7px 12px;
  background: var(--page); border: 1px solid var(--line); border-radius: 10px; flex-wrap: wrap;
}
.quick-prov-chips-list {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1;
}
.prov-chip {
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line); background: #FFFFFF; color: var(--ink);
  cursor: pointer; transition: all .15s ease; display: inline-flex; align-items: center; gap: 4px;
}
.prov-chip:hover { border-color: var(--orange-line); color: var(--orange-dark); background: var(--orange-tint); }
.prov-chip.active { border-color: var(--orange); background: var(--orange); color: #FFFFFF; }
.prov-chip.chip-queued { border-style: dashed; color: #1E40AF; background: #EFF6FF; border-color: #BFDBFE; }
.prov-chip.chip-queued.active { border-style: solid; background: #1E40AF; color: #FFFFFF; }
.prov-chip .chip-count {
  background: var(--orange-tint); color: var(--orange-dark); font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 999px; line-height: 1;
}
.prov-chip.active .chip-count { background: rgba(255,255,255,0.3); color: #FFFFFF; }
.prov-chip .chip-queued-dot { width: 5px; height: 5px; border-radius: 999px; background: #3B82F6; }
.prov-chip.active .chip-queued-dot { background: #FFFFFF; }

/* Layout to keep map & province list side-by-side */
.map-card-body {
  display: flex;
  align-items: stretch;
  gap: 16px;
  flex-wrap: nowrap;
}
.map-svg-col {
  width: 220px;
  flex: 0 0 220px;
  position: relative;
}
.map-panel-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (max-width: 640px) {
  .map-card-body {
    flex-wrap: wrap;
  }
  .map-svg-col {
    width: 100%;
    max-width: 240px;
    margin: 0 auto;
  }
}

/* Compact Org Row inside Province Detail Panel (like original side-by-side layout) */
.org-panel-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #FFFFFF;
  transition: all .15s ease;
}
.org-panel-row:hover {
  border-color: var(--orange-line);
  box-shadow: 0 2px 8px rgba(11,33,84,.06);
  background: #FFFCF9;
}
.org-panel-row .org-row-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-decoration: none;
}
.org-panel-row .idx {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--orange-tint);
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.org-panel-row:hover .idx {
  background: var(--orange);
  color: #FFFFFF;
}
.org-panel-row .org-row-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.org-panel-row .org-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.btn-action-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-050);
  color: var(--navy-800);
  border: 1px solid var(--navy-border);
  text-decoration: none;
  transition: all .12s ease;
}
.btn-action-icon:hover {
  background: var(--orange);
  color: #FFFFFF;
  border-color: var(--orange);
}

/* Province Detail Drilldown Panel */
.prov-panel-header { padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.badge-region {
  font-size: 11px; padding: 2px 7px; border-radius: 5px; background: var(--navy-050);
  color: var(--navy-800); font-weight: 600;
}
.badge-status-ready {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  color: #0D9488; background: #E6F7F5; padding: 2px 7px; border-radius: 5px;
}
.badge-status-ready .dot { width: 5px; height: 5px; border-radius: 999px; background: #0D9488; }
.badge-status-queued {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700;
  color: #1E40AF; background: #EFF6FF; padding: 2px 7px; border-radius: 5px;
}
.badge-status-queued .dot-queued { width: 5px; height: 5px; border-radius: 999px; background: #1E40AF; }
.badge-status-empty {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600;
  color: var(--muted); background: var(--tint); padding: 2px 7px; border-radius: 5px;
}

.prov-overview-link {
  font-size: 12.5px; font-weight: 600; color: var(--navy-800); text-decoration: underline;
  text-underline-offset: 3px; display: inline-flex; align-items: center; gap: 4px; transition: color .15s ease;
}
.prov-overview-link:hover { color: var(--orange); }

.org-panel-item {
  background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; transition: all .15s ease;
}
.org-panel-item:hover { border-color: var(--orange-line); box-shadow: var(--shadow-card); }
.icon-tile-sm {
  width: 34px; height: 34px; border-radius: 8px; background: var(--navy-050);
  border: 1px solid var(--navy-border); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.icon-tile-sm.muni { background: var(--orange-tint); border-color: var(--orange-line); }
.badge-mini {
  font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--tint);
  padding: 1px 6px; border-radius: 4px;
}
.btn-panel-action {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 6px; text-decoration: none; transition: all .12s ease;
}
.btn-panel-primary { background: var(--navy-900); color: #FFFFFF; }
.btn-panel-primary:hover { background: var(--navy-800); color: #FFFFFF; }
.btn-panel-tint { background: var(--orange-tint); color: var(--orange-dark); border: 1px solid var(--orange-line); }
.btn-panel-tint:hover { background: var(--orange); color: #FFFFFF; }

.panel-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 22px 16px; border: 1px dashed var(--line); border-radius: 10px; background: var(--page); text-align: center;
}
.panel-queued-card {
  display: flex; flex-direction: column; gap: 5px; padding: 14px 16px;
  border: 1px solid #BFDBFE; border-radius: 10px; background: #EFF6FF;
}

.map-marker-pin .marker-circle { transition: transform .15s ease, r .15s ease; }
.map-marker-pin:hover .marker-circle { r: 12; }
.map-marker-pin.active .marker-circle { stroke: #0B2154; stroke-width: 3; fill: #F47920; }


/* ---------- org list / cards ---------- */

.org-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: #FFFFFF;
}
.org-row.current { border-color: var(--orange-line); background: var(--orange-tint); }
.org-row .idx {
  width: 20px; height: 20px; border-radius: 5px; background: var(--orange-tint); color: var(--orange-dark);
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.org-row.current .idx { background: var(--orange); color: #FFFFFF; }

.org-card {
  display: flex; flex-direction: column; gap: 12px; background: #FFFFFF; border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; transition: box-shadow .15s ease, border-color .15s ease, transform .15s ease;
  text-decoration: none;
}
.org-card:hover { border-color: var(--orange); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.org-card .icon-tile {
  width: 38px; height: 38px; border-radius: 10px; background: var(--navy-050); border: 1px solid var(--navy-border);
  display: flex; align-items: center; justify-content: center;
}
.org-card .icon-tile.muni { background: var(--orange-tint); border-color: var(--orange-line); }

/* ---------- Province-grouped Directory & Filter Toolbar ---------- */

.org-dir-toolbar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow-card);
}

.org-dir-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.org-dir-search-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.org-dir-search-wrap svg.search-icon {
  position: absolute;
  left: 14px;
  pointer-events: none;
  color: #64748B;
}

.org-dir-search-input {
  width: 100%;
  height: 42px;
  padding: 0 36px 0 42px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  transition: all 0.15s ease;
}

.org-dir-search-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244, 121, 32, 0.12);
}

.org-dir-search-clear {
  position: absolute;
  right: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--tint);
  border: none;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.12s ease;
}

.org-dir-search-clear:hover {
  background: #E2E8F0;
  color: var(--ink);
}

.org-dir-search-clear.visible {
  display: flex;
}

.org-dir-pills-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  overflow-x: auto;
  padding-bottom: 2px;
}

.region-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: var(--page);
  border: 1px solid var(--line);
  color: var(--body);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
  font-family: inherit;
}

.region-pill:hover {
  background: var(--navy-050);
  border-color: var(--navy-border);
  color: var(--navy-900);
}

.region-pill.active {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #FFFFFF;
  box-shadow: 0 2px 6px rgba(11, 33, 84, 0.2);
}

.region-pill .pill-count {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--tint);
  color: var(--muted);
}

.region-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.22);
  color: #FFFFFF;
}

/* ---------- Province Bento Grid & Cards ---------- */

.province-bento-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
  align-items: start;
}

@media (max-width: 640px) {
  .province-bento-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.prov-bento-card {
  background: #FFFFFF;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 10px rgba(11, 33, 84, 0.03);
  transition: border-color .2s ease, box-shadow .2s ease, transform .15s ease;
  position: relative;
}

.prov-bento-card:hover {
  border-color: rgba(224, 90, 0, 0.35);
  box-shadow: 0 6px 20px rgba(11, 33, 84, 0.06);
}

.prov-bento-card.is-expanded {
  border-color: var(--orange-line);
  box-shadow: 0 8px 26px rgba(11, 33, 84, 0.08);
}

.prov-bento-head {
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  border-radius: 10px;
  padding: 4px;
  margin: -4px;
  transition: background 0.15s ease;
}

.prov-bento-head:hover {
  background: rgba(224, 90, 0, 0.03);
}

.prov-bento-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prov-bento-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.prov-bento-icon-pin {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--orange-tint);
  border: 1px solid var(--orange-line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--orange-dark);
  flex-shrink: 0;
}

.prov-bento-title h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy-900);
  margin: 0;
  letter-spacing: -0.3px;
}

.prov-bento-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.prov-bento-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.prov-bento-chevron-btn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--page);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}

.prov-bento-head:hover .prov-bento-chevron-btn {
  background: var(--orange-tint);
  border-color: var(--orange-line);
  color: var(--orange-dark);
}

.prov-bento-card.is-expanded .prov-bento-chevron-btn {
  transform: rotate(180deg);
  background: var(--orange-tint);
  border-color: var(--orange-line);
  color: var(--orange-dark);
}

.prov-bento-substat {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.prov-bento-substat-left {
  display: flex;
  align-items: baseline;
  gap: 5px;
}

.prov-bento-substat .total-val {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--ink);
  font-size: 13.5px;
}

.substat-toggle-label {
  font-size: 11px;
  color: var(--orange-dark);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  opacity: 0.9;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.prov-bento-card.is-expanded .substat-toggle-label {
  color: var(--muted);
  opacity: 0.65;
}

/* Accordion Collapsible Body */
.prov-bento-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease, margin-top 0.2s ease, padding-top 0.2s ease;
  opacity: 0;
  visibility: hidden;
}

.prov-bento-card.is-expanded .prov-bento-body {
  grid-template-rows: 1fr;
  opacity: 1;
  visibility: visible;
  padding-top: 14px;
  margin-top: 8px;
  border-top: 1px dashed var(--line);
}

.prov-bento-body-inner {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-toggle-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--navy-800);
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
}

.btn-toggle-all:hover {
  background: var(--navy-050);
  border-color: var(--navy-border);
  color: var(--navy-900);
}

.btn-toggle-all.active {
  background: var(--orange-tint);
  border-color: var(--orange-line);
  color: var(--orange-dark);
}

.prov-bento-org-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.prov-bento-org-item {
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.15s ease;
}

.prov-bento-org-item:hover {
  background: #FFFFFF;
  border-color: var(--orange-line);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.prov-bento-org-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.prov-bento-org-identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.prov-bento-org-name {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--navy-900);
  line-height: 1.3;
}

.prov-bento-org-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 2px 0;
}

.prov-bento-org-budget {
  font-family: "JetBrains Mono", monospace;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.prov-bento-org-budget .unit {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
}

.prov-bento-org-items-count {
  font-size: 11.5px;
  color: var(--muted);
}

.prov-bento-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(0, 0, 0, 0.08);
}

.prov-bento-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 31px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.12s ease;
}

.prov-bento-btn-primary {
  background: var(--navy-900);
  color: #FFFFFF;
  border: 1px solid var(--navy-900);
}
.prov-bento-btn-primary:hover {
  background: var(--navy-800);
  color: #FFFFFF;
}

.prov-bento-btn-subtle {
  background: #FFFFFF;
  color: var(--navy-800);
  border: 1px solid var(--line);
}
.prov-bento-btn-subtle:hover {
  background: var(--navy-050);
  border-color: var(--navy-border);
  color: var(--navy-900);
}

.prov-bento-btn-ai {
  background: var(--orange-tint);
  color: var(--orange-dark);
  border: 1px solid var(--orange-line);
  font-weight: 700;
}
.prov-bento-btn-ai:hover {
  background: var(--orange);
  color: #FFFFFF;
  border-color: var(--orange);
}

.prov-bento-btn-ai-lg {
  width: 100%;
  height: 36px;
  font-size: 13px;
  border-radius: 8px;
}

.prov-bento-footer {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.prov-bento-more-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy-800);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s ease;
}
.prov-bento-more-link:hover {
  color: var(--orange);
}

.org-dir-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  background: #FFFFFF;
  border: 1px dashed var(--line);
  border-radius: 16px;
  text-align: center;
  gap: 10px;
}


/* ---------- KPI tiles ---------- */

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-tile { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.kpi-tile.accent { border-left: 3px solid var(--orange); }
.kpi-tile .label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.kpi-tile .value { font-size: 34px; font-weight: 700; color: var(--ink); letter-spacing: -1.2px; line-height: 1; }
.kpi-tile .value.up { color: var(--orange-dark); }
.kpi-tile .note { font-size: 12px; color: var(--muted); }

/* ---------- breakdown bars ---------- */

.bar-track { height: 22px; border-radius: 4px; background: var(--tint); position: relative; overflow: hidden; }
.bar-fill { height: 22px; border-radius: 0 4px 4px 0; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; gap: 12px; align-items: center; }
.bar-label { font-size: 13px; color: var(--body); font-weight: 500; }
.bar-value { font-size: 13px; font-weight: 600; color: var(--ink); text-align: right; }
.bar-value .pct { color: var(--muted); font-weight: 500; }

/* ---------- tabs ---------- */

.tab-bar {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar {
  display: none;
}
.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  flex-shrink: 0;
  white-space: nowrap;
}
.tab-link.active { font-weight: 700; color: var(--ink); border-bottom-color: var(--orange); }
.tab-link .count { font-size: 11.5px; font-weight: 600; color: var(--muted); background: var(--tint); padding: 2px 7px; border-radius: 5px; }
.tab-link.active .count { color: var(--orange-dark); background: var(--orange-tint); }

/* ---------- table ---------- */

.table-scroll { overflow-x: auto; background: #FFFFFF; border: 1px solid var(--line); border-radius: 12px; }
table.budget-table { border-collapse: collapse; width: 100%; min-width: 920px; }
table.budget-table th {
  font-size: 11.5px; font-weight: 700; color: #5C6270; text-align: left; padding: 12px 14px;
  background: var(--tint); border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
table.budget-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, color 0.15s ease;
}
table.budget-table th.sortable:hover {
  background: #E8EEF5;
  color: var(--navy-900);
}
table.budget-table th.sort-active {
  color: var(--navy-900);
  background: #DEE7F2;
}
table.budget-table th.num { text-align: right; }
table.budget-table th.highlight { color: var(--orange-dark); background: #FFF8F2; }
table.budget-table th.highlight.sortable:hover { background: #FFEFE0; color: var(--orange-dark); }
table.budget-table th.highlight.sort-active { color: var(--orange-dark); background: #FFE8D6; }

.th-content {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
table.budget-table th.num .th-content {
  justify-content: flex-end;
}
.sort-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  opacity: 0.35;
  transition: opacity 0.15s ease, color 0.15s ease;
}
table.budget-table th.sortable:hover .sort-icon {
  opacity: 0.75;
  color: var(--ink);
}
table.budget-table th.sort-active .sort-icon {
  opacity: 1;
  color: var(--navy-900);
  font-weight: 800;
}
table.budget-table th.highlight.sort-active .sort-icon {
  color: var(--orange-dark);
}

table.budget-table td {
  font-size: 13px; color: var(--body); padding: 12px 14px; border-bottom: 1px solid #EDEDE7;
  vertical-align: top; line-height: 1.45;
}
table.budget-table td.num {
  text-align: right; font-family: 'JetBrains Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums;
  white-space: nowrap; font-size: 12.5px;
}
table.budget-table td.highlight { font-weight: 700; color: var(--ink); background: #FFF8F2; }
table.budget-table td.zero { color: var(--zero); }
table.budget-table td.plan-col { color: var(--ink); font-weight: 600; }
table.budget-table tfoot td { padding: 14px; background: var(--navy-900); color: #FFFFFF; border: none; }
table.budget-table tfoot td.num { font-weight: 600; }
table.budget-table tfoot td.highlight { background: var(--navy-800); font-weight: 700; }

.chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.chip-1 { background: var(--navy-050); color: var(--blue-600); }
.chip-2 { background: var(--orange-tint); color: var(--orange-dark); }
.chip-3 { background: #E9F6F2; color: #0D9488; }
.chip-4 { background: #F5EFFE; color: #7C3AED; }
.chip-5 { background: #FCEEE0; color: #B45309; }
.chip-other { background: var(--tint); color: var(--muted); }

.bar-fill-1 { background: var(--chart-1); }
.bar-fill-2 { background: var(--chart-2); }
.bar-fill-3 { background: var(--chart-3); }
.bar-fill-4 { background: var(--chart-4); }
.bar-fill-5 { background: var(--chart-5); }
.bar-fill-other { background: var(--chart-other); }
.bar-fill-plan { background: var(--navy-800); }

/* ---------- toolbar / filters ---------- */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.field {
  display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 14px; border-radius: 9px;
  background: #FFFFFF; border: 1px solid var(--line-2);
}
.field select { border: none; background: none; font-size: 13.5px; font-weight: 600; color: var(--ink); font-family: inherit; }
.field input[type="text"] { border: none; background: none; font-size: 13.5px; color: var(--body); font-family: inherit; width: 220px; }
.field input[type="text"]:focus, .field select:focus { outline: none; }
.field-search { width: 300px; }
@media (max-width: 640px) { .field-search { width: 100%; } .field-search input { width: 100%; } }

.col-toggle { display: flex; align-items: center; gap: 10px; }
.col-toggle label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--body); cursor: pointer; }
.col-toggle input { accent-color: var(--navy-900); width: 15px; height: 15px; }

/* ---------- empty state ---------- */

.empty-card {
  display: flex; align-items: center; gap: 16px; background: #FFFFFF; border: 1px dashed var(--line-2);
  border-radius: 12px; padding: 20px 22px;
}
@media (max-width: 640px) { .empty-card { flex-direction: column; align-items: flex-start; } }

/* ---------- utility ---------- */

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.gap-xs { gap: 6px; } .gap-sm { gap: 10px; } .gap-md { gap: 16px; } .gap-lg { gap: 24px; }
.muted { color: var(--muted); }
.text-orange { color: var(--orange-dark); }
.hr { height: 1px; background: var(--line); border: none; }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) 620px; gap: 56px; align-items: start; }
@media (max-width: 960px) { .hero-grid { grid-template-columns: 1fr; gap: 32px; } }

.province-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .province-grid { grid-template-columns: 1fr; gap: 24px; } }

@media (max-width: 900px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 901px) {
  .hide-desktop { display: none !important; }
}

/* ---------- ask-ai chat ---------- */

body.chat-page-body {
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
body.chat-page-body .site-footer {
  display: none !important;
}
body.chat-page-body main {
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
body.chat-page-body .chat-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-top: 10px !important;
  padding-bottom: 14px !important;
}

.chat-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0;
  background: #FFFFFF;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 22px;
  background: var(--navy-050);
  display: flex;
  flex-direction: column;
  gap: 16px;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-border) transparent;
}
.chat-messages::-webkit-scrollbar {
  width: 6px;
}
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--navy-border);
  border-radius: 999px;
}
.chat-messages::-webkit-scrollbar-thumb:hover {
  background: var(--navy-700);
}

.chat-row { display: flex; gap: 10px; align-items: flex-start; max-width: 82%; }
.chat-row-user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
  width: 30px; height: 30px; border-radius: 999px; background: var(--navy-900);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px;
}

.chat-bubble {
  padding: 12px 15px; border-radius: 4px 14px 14px 14px; font-size: 14px; line-height: 1.7;
  background: #FFFFFF; color: var(--body); border: 1px solid var(--line); white-space: pre-wrap;
  box-shadow: var(--shadow-card);
  word-break: break-word;
}
.chat-row-user .chat-bubble {
  background: var(--navy-900); color: #FFFFFF; border-color: var(--navy-900);
  border-radius: 14px 4px 14px 14px;
}
.chat-bubble b { color: inherit; }
.chat-row-user .chat-bubble b { color: #FFFFFF; }

.chat-bubble.error { background: var(--red-tint); color: var(--red); border-color: var(--red-line); }

.chat-typing { display: flex; gap: 4px; align-items: center; padding: 5px 2px; }
.chat-typing span {
  width: 6px; height: 6px; border-radius: 999px; background: var(--muted);
  animation: chatTyping 1.1s ease-in-out infinite;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes chatTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: .35; }
  30% { transform: translateY(-3px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .chat-typing span { animation: chatTypingFade 1.4s ease-in-out infinite; }
  @keyframes chatTypingFade { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
}

/* suggested-question chips */
.chat-suggestions-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  width: 100%;
}
.chat-suggestions-hint {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}
.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chat-suggest-btn {
  height: 32px; padding: 0 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--navy-050); border: 1px solid var(--navy-border); color: var(--navy-800); cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.chat-suggest-btn:hover { background: var(--orange-tint); border-color: var(--orange-line); color: var(--orange-dark); }
.chat-suggest-btn:active { transform: scale(0.97); }
.chat-suggest-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(26, 65, 133, .15); }

/* Floating Scroll to Bottom button */
.chat-scroll-bottom {
  position: absolute;
  right: 18px;
  bottom: 84px;
  z-index: 25;
  background: var(--navy-900);
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 18px rgba(11, 33, 84, 0.3);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
  animation: chatFadeUp .2s ease;
}
.chat-scroll-bottom:hover {
  background: var(--orange);
  color: #FFFFFF;
  border-color: var(--orange);
}
@keyframes chatFadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-footer-dock {
  background: #FFFFFF;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.chat-input-bar {
  display: flex;
  gap: 10px;
  padding: 12px 18px 8px;
  background: #FFFFFF;
}
.chat-input-bar input {
  flex: 1; min-width: 0; height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 14px; font-family: inherit; color: var(--ink); background: #FFFFFF;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.chat-input-bar input::placeholder { color: var(--muted); }
.chat-input-bar input:focus { outline: none; border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(26, 65, 133, .12); }
.chat-input-bar .btn { height: 44px; flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; }

.chat-disclaimer { font-size: 11px; padding: 0 18px 10px; display: block; background: #FFFFFF; color: var(--muted); text-align: center; }

/* Mobile App-like Experience (<= 768px) */
@media (max-width: 768px) {
  body.chat-page-body {
    height: 100dvh;
    height: 100vh;
    overflow: hidden;
  }

  body.chat-page-body .site-header {
    height: 50px;
    padding: 0 14px;
  }

  body.chat-page-body .site-footer {
    display: none !important;
  }

  body.chat-page-body main {
    height: calc(100dvh - 50px);
    height: calc(100vh - 50px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .chat-page-header {
    padding: 10px 14px 0 !important;
    gap: 8px !important;
    background: #FFFFFF;
    border-bottom: 1px solid var(--line) !important;
    flex-shrink: 0;
  }

  .chat-org-badge-icon {
    width: 34px !important;
    height: 34px !important;
    border-radius: 9px !important;
  }
  .chat-org-badge-icon svg {
    width: 18px !important;
    height: 18px !important;
  }

  .chat-org-name {
    font-size: 16px !important;
  }
  .chat-org-sub {
    font-size: 11px !important;
  }

  .chat-tab-bar {
    gap: 2px;
  }
  .chat-tab-bar .tab-link {
    height: 34px;
    padding: 0 10px;
    font-size: 12.5px;
    border-bottom-width: 2.5px;
  }
  .chat-tab-bar .tab-link svg {
    width: 14px;
    height: 14px;
  }

  .chat-section {
    padding: 0 !important;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .chat-shell {
    height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    flex: 1;
    min-height: 0;
  }

  .chat-messages {
    padding: 12px 12px 14px !important;
    gap: 12px !important;
  }

  .chat-row {
    max-width: 94% !important;
  }

  .chat-avatar {
    width: 26px;
    height: 26px;
  }
  .chat-avatar svg {
    width: 13px;
    height: 13px;
  }

  .chat-bubble {
    padding: 10px 12px;
    font-size: 13.5px;
    line-height: 1.6;
    border-radius: 4px 12px 12px 12px;
  }
  .chat-row-user .chat-bubble {
    border-radius: 12px 4px 12px 12px;
  }

  /* Horizontal swipe for suggestions on mobile */
  .chat-suggestions {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 4px 2px 6px 2px;
    scrollbar-width: none;
    max-width: 100%;
  }
  .chat-suggestions::-webkit-scrollbar {
    display: none;
  }
  .chat-suggest-btn {
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    height: 29px;
    font-size: 11.5px;
    padding: 0 11px;
  }

  .chat-footer-dock {
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    background: #FFFFFF;
    position: sticky;
    bottom: 0;
    z-index: 30;
    padding-bottom: max(4px, env(safe-area-inset-bottom));
  }

  .chat-input-bar {
    padding: 8px 10px 4px !important;
    gap: 8px;
  }

  .chat-input-bar input {
    height: 40px !important;
    font-size: 13.5px !important;
    padding: 0 14px !important;
  }

  .chat-input-bar .btn {
    height: 40px !important;
    padding: 0 14px !important;
    font-size: 13px !important;
  }

  .chat-disclaimer {
    font-size: 10px !important;
    padding: 0 10px 6px !important;
    line-height: 1.3;
    opacity: 0.85;
  }

  .chat-scroll-bottom {
    right: 12px;
    bottom: 74px;
    padding: 5px 11px;
    font-size: 11px;
  }
}

/* ---------- login screen ---------- */

.login-wrapper {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.login-card-box {
  background: #FFFFFF;
  border-radius: 16px;
  padding: 32px 28px 24px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-header {
  text-align: center;
  margin-bottom: 20px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy-900);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.login-subtitle {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.5;
}

.login-alert-error {
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: 8px;
  padding: 10px 14px;
  color: #DC2626;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.4;
}

.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.login-input-wrap svg {
  position: absolute;
  left: 14px;
  pointer-events: none;
}

.login-input-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 40px;
  background: var(--navy-050);
  border: 1px solid var(--line-2);
  border-radius: 8px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  transition: all 0.15s ease;
}

.login-input-wrap input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(244, 121, 32, 0.15);
}

.login-footer-info {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
}
