:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #64748b;
  --primary: #0f7a8a;
  --primary-dark: #0b5965;
  --cyan: #1282a2;
  --amber: #d97706;
  --rose: #e11d48;
  --violet: #6d5dfc;
  --line: #d8e0ea;
  --soft: #eef7f8;
  --shadow: 0 18px 42px rgba(17, 24, 39, .09);
  --shadow-sm: 0 10px 26px rgba(17, 24, 39, .07);
  --side-width: 270px;
  --top-height: 66px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(rgba(17, 24, 39, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 24, 39, .035) 1px, transparent 1px),
    linear-gradient(180deg, #fbfcfe 0%, var(--bg) 58%, #e7edf3 100%);
  background-size: 34px 34px, 34px 34px, auto;
  color: var(--ink);
  font-size: 15px;
}
a { color: var(--primary); text-decoration: none; font-weight: 750; }
a:hover { color: var(--primary-dark); }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 29px; line-height: 1.15; }
h2 { font-size: 18px; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--side-width);
  padding: 16px 10px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.06) 0 8%, transparent 8% 16%, rgba(255,255,255,.035) 16% 24%, transparent 24% 100%),
    linear-gradient(180deg, #111827 0%, #172033 56%, #101318 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 16px 0 38px rgba(17, 24, 39, .28);
  z-index: 1040;
  transition: width .2s ease, transform .2s ease, padding .2s ease;
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; }
.brand:hover { color: #fff; }
.brand-link { min-height: 66px; padding: 4px 10px 12px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-logo {
  width: 58px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.32);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0,0,0,.20);
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }
.brand-copy strong, .brand-copy small { display: block; }
.brand-copy strong {
  max-width: 164px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.brand-copy small { color: #b8c8d8; margin-top: 3px; }

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 6px;
  padding: 12px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.09);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user small { color: #b8c8d8; margin-top: 3px; font-size: 12px; }
.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #22c55e 48%, var(--amber));
  color: #fff;
  font-weight: 900;
  border: 2px solid rgba(255,255,255,.86);
  text-transform: uppercase;
  overflow: hidden;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar.small { width: 28px; height: 28px; font-size: 12px; }

.side-nav { display: grid; gap: 6px; overflow-y: auto; padding: 0 0 16px; }
.side-nav .nav-link {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dce7f1;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}
.side-nav .nav-link:hover,
.side-nav .nav-link.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(15, 122, 138, .96), rgba(34, 197, 94, .70));
  border-color: rgba(255,255,255,.28);
  box-shadow: 0 12px 20px rgba(0,0,0,.18);
}
.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.11);
  color: #f8fafc;
  font-size: 15px;
  flex: 0 0 auto;
}
.nav-parent { justify-content: flex-start; }
.nav-chevron { margin-left: auto; transform: rotate(-90deg); transition: transform .18s ease; }
.nav-group.open .nav-chevron { transform: rotate(90deg); }
.sub-nav {
  display: none;
  margin: 5px 0 5px 19px;
  padding-left: 11px;
  border-left: 1px dashed rgba(255,255,255,.30);
}
.nav-group.open .sub-nav { display: grid; gap: 4px; }
.side-nav .sub-link { min-height: 34px; padding: 7px 8px; font-size: 13px; background: rgba(255,255,255,.04); }

.app-main {
  min-height: 100vh;
  margin-left: var(--side-width);
  padding-top: var(--top-height);
  display: flex;
  flex-direction: column;
}
.app-main, .app-topbar, .app-footer { transition: margin-left .2s ease, left .2s ease; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  background: rgba(9, 18, 18, .46);
  backdrop-filter: blur(2px);
  z-index: 1035;
}
body.sidebar-collapsed { --side-width: 84px; }
body.sidebar-collapsed .sidebar {
  padding-inline: 10px;
  align-items: center;
}
body.sidebar-collapsed .brand {
  justify-content: center;
  width: 100%;
}
body.sidebar-collapsed .brand-link { padding-inline: 0; }
body.sidebar-collapsed .brand-logo {
  width: 48px;
  height: 44px;
}
body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .sidebar-user > span:not(.user-avatar),
body.sidebar-collapsed .side-nav .nav-link > span:not(.nav-icon),
body.sidebar-collapsed .nav-chevron,
body.sidebar-collapsed .sub-nav {
  display: none;
}
body.sidebar-collapsed .sidebar-user {
  width: 54px;
  padding: 8px;
  margin-inline: 0;
  justify-content: center;
}
body.sidebar-collapsed .side-nav {
  width: 100%;
}
body.sidebar-collapsed .side-nav .nav-link {
  justify-content: center;
  padding-inline: 0;
}
body.sidebar-collapsed .nav-icon {
  width: 34px;
  height: 34px;
}
.app-topbar {
  position: fixed;
  top: 0;
  left: var(--side-width);
  right: 0;
  height: var(--top-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: rgba(255,255,255,.90);
  border-bottom: 1px solid rgba(17, 24, 39, .10);
  box-shadow: 0 10px 26px rgba(17, 24, 39, .08);
  backdrop-filter: blur(12px);
  z-index: 1030;
}
.topbar-context {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: #526174;
  font-size: 13px;
  font-weight: 750;
}
.system-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid #bfe9e3;
  border-radius: 999px;
  background: linear-gradient(135deg, #effdf8, #eef8ff);
  color: #0f7a62;
  white-space: nowrap;
}
.system-status i { font-size: 12px; }
.topbar-date {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-spacer { flex: 1; }
.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248,250,252,.92);
  box-shadow: var(--shadow-sm);
}
.icon-btn, .profile-chip, .contact-pill {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}
.icon-btn { width: 40px; padding: 0; }
.icon-btn:hover, .profile-chip:hover, .contact-pill:hover { color: var(--primary); border-color: rgba(15, 122, 138, .42); }
.contact-pill { color: var(--primary); }
.profile-menu { position: relative; }
.profile-chip { border-radius: 999px; }
.profile-dropdown {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  min-width: 172px;
  background: #fff;
  border: 1px solid rgba(17,24,39,.12);
  border-radius: 8px;
  box-shadow: 0 22px 38px rgba(17,24,39,.16);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: .18s ease;
}
.profile-menu.open .profile-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.profile-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
  padding: 10px;
  border-radius: 8px;
  font-size: 14px;
}
.profile-dropdown a:hover { background: var(--soft); color: var(--ink); }

.main {
  flex: 1 1 auto;
  padding: 22px 18px 28px;
}
.page-strip {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 4px 2px 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.page-subtitle { margin: 6px 0 0; color: #475569; }
.page-meta { display: grid; justify-items: end; gap: 7px; color: var(--ink); font-size: 14px; text-align: right; }
.page-meta span {
  background: linear-gradient(135deg, #e9f8fa, #f5f7ff);
  border-radius: 999px;
  padding: 5px 12px;
  font-weight: 800;
  color: var(--primary);
}

.module-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid rgba(15, 122, 138, .18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 122, 138, .11), rgba(255, 255, 255, .82) 46%, rgba(217, 119, 6, .12)),
    linear-gradient(90deg, rgba(17, 24, 39, .045) 0 1px, transparent 1px),
    #fff;
  background-size: auto, 26px 26px, auto;
  box-shadow: var(--shadow-sm);
}
.dashboard-hero h2 {
  margin-top: 10px;
  font-size: 26px;
  line-height: 1.2;
}
.dashboard-hero p {
  max-width: 680px;
  margin: 8px 0 0;
  color: #475569;
}
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.hero-command {
  width: min(360px, 100%);
  display: grid;
  gap: 10px;
}
.hero-score {
  padding: 14px;
  border: 1px solid rgba(15, 122, 138, .18);
  border-radius: 8px;
  background: rgba(255,255,255,.70);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
}
.hero-score span,
.hero-mini-grid span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.hero-score strong {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-size: 24px;
}
.hero-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.hero-mini-grid span {
  min-height: 58px;
  padding: 11px;
  border: 1px solid rgba(216, 224, 234, .9);
  border-radius: 8px;
  background: #fff;
  display: grid;
  gap: 4px;
}
.hero-mini-grid i { color: var(--primary); font-size: 16px; }
.hero-mini-grid b {
  color: var(--ink);
  font-size: 18px;
}
.hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.module-toolbar h2,
.panel-head h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.toolbar-actions, .quick-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.stats-grid, .grid, .prediction-grid { display: grid; gap: 18px; }
.stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
.prediction-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.ai-forecast-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(340px, .95fr);
  align-items: stretch;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid rgba(15, 122, 138, .18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 122, 138, .10), rgba(34, 197, 94, .08)),
    linear-gradient(180deg, #fff, #f7fbfb);
  box-shadow: var(--shadow-sm);
}
.ai-forecast-copy {
  display: grid;
  align-content: center;
  gap: 10px;
  min-width: 0;
}
.ai-forecast-copy > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #08724f;
  font-size: 12px;
  font-weight: 900;
}
.ai-forecast-copy h2 {
  font-size: 28px;
  line-height: 1.12;
}
.ai-forecast-copy p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.ai-forecast-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.ai-forecast-metrics div {
  display: grid;
  align-content: center;
  gap: 5px;
  min-width: 0;
  min-height: 118px;
  padding: 15px;
  border: 1px solid rgba(216, 224, 234, .95);
  border-radius: 8px;
  background: rgba(255,255,255,.82);
}
.ai-forecast-metrics small,
.ai-forecast-metrics span {
  color: var(--muted);
  font-weight: 800;
}
.ai-forecast-metrics small {
  font-size: 12px;
  text-transform: uppercase;
}
.ai-forecast-metrics strong {
  color: var(--ink);
  font-size: clamp(19px, 2vw, 28px);
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.ai-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 18px;
  margin-bottom: 18px;
}
.ai-demand-bars,
.ai-advice-list {
  display: grid;
  gap: 12px;
}
.ai-demand-row {
  display: grid;
  gap: 8px;
}
.ai-demand-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}
.ai-demand-meta strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-demand-meta span {
  color: var(--muted);
  font-weight: 850;
  white-space: nowrap;
}
.ai-demand-track {
  height: 12px;
  border-radius: 999px;
  background: #edf3f5;
  overflow: hidden;
}
.ai-demand-track span {
  display: block;
  width: max(var(--score), 4%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), #22c55e, #f59e0b);
}
.ai-advice-list div,
.ai-advice-empty {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}
.ai-advice-list i {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff7ed;
  color: var(--amber);
}
.ai-advice-list span,
.ai-advice-empty span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}
.ai-advice-list strong,
.ai-advice-empty strong {
  color: var(--ink);
  font-size: 14px;
}
.ai-advice-empty {
  min-height: 124px;
  justify-content: center;
  text-align: center;
  flex-direction: column;
}
.ai-advice-empty i {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #ecfdf5;
  color: #08724f;
  font-size: 18px;
}
.ai-prediction-grid {
  padding-bottom: 94px;
}
.ai-graph-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, .72fr) minmax(280px, .82fr);
  gap: 18px;
  margin-bottom: 18px;
}
.ai-chart-panel {
  min-height: 260px;
}
.ai-line-visual {
  min-height: 190px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdff, #f4faf8);
}
.ai-line-visual svg {
  display: block;
  width: 100%;
  height: auto;
}
.ai-page-axis {
  stroke: #94a3b8;
  stroke-width: 1.2;
}
.ai-page-line {
  fill: none;
  stroke: #0f7a8a;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 4px 5px rgba(15, 122, 138, .18));
}
.ai-page-dot {
  fill: #ffffff;
  stroke: #16a34a;
  stroke-width: 3;
}
.ai-page-value,
.ai-page-label {
  fill: #334155;
  font-weight: 900;
}
.ai-page-value {
  font-size: 10px;
}
.ai-page-label {
  font-size: 9px;
}
.ai-histogram {
  display: flex;
  align-items: end;
  gap: 8px;
  min-height: 192px;
  padding: 12px 8px 2px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdff, #f8fafc);
}
.ai-histogram-col {
  flex: 1 1 0;
  min-width: 0;
  display: grid;
  align-items: end;
  gap: 8px;
  height: 170px;
  text-align: center;
}
.ai-histogram-col span {
  align-self: end;
  min-height: max(12px, var(--score));
  border-radius: 6px 6px 3px 3px;
  display: grid;
  place-items: start center;
  padding-top: 7px;
  background: linear-gradient(180deg, #16a34a, #0f7a8a);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24), 0 10px 18px rgba(15, 122, 138, .16);
}
.ai-histogram-col.empty span {
  min-height: 7px;
  background: #e2e8f0;
  color: #64748b;
  box-shadow: none;
}
.ai-histogram-col b {
  font-size: 12px;
}
.ai-histogram-col small {
  color: #475569;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}
.ai-gap-list {
  display: grid;
  gap: 12px;
}
.ai-gap-row {
  display: grid;
  grid-template-columns: minmax(0, 140px) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.ai-gap-row div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ai-gap-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-gap-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.ai-gap-track {
  height: 14px;
  border-radius: 999px;
  background: #fee2e2;
  overflow: hidden;
}
.ai-gap-track b {
  display: block;
  width: max(var(--score), 4%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4444, #f59e0b);
}
.ai-advice-empty.compact {
  min-height: 164px;
}
.ai-chat-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2500;
}
.ai-chat-nudge {
  position: absolute;
  right: 74px;
  bottom: 2px;
  display: flex;
  align-items: center;
  min-width: 122px;
  pointer-events: none;
  animation: ai-chat-nudge-float 2.8s ease-in-out infinite;
}
.ai-chat-nudge-bubble {
  position: relative;
  min-height: 38px;
  padding: 10px 14px;
  border: 1px solid rgba(15, 122, 138, .18);
  border-radius: 999px;
  background: rgba(255,255,255,.97);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  opacity: 0;
  transform: translateX(10px);
  animation: ai-chat-bubble-in .55s ease 1.85s forwards;
}
.ai-chat-nudge-bubble::before {
  content: "";
  position: absolute;
  right: -5px;
  bottom: 11px;
  width: 10px;
  height: 10px;
  background: inherit;
  border-top: inherit;
  border-right: inherit;
  transform: rotate(45deg);
}
.ai-chat-widget.open .ai-chat-nudge {
  display: none;
}
.ai-chat-widget.open .ai-chat-fab {
  opacity: 0;
  transform: scale(.86);
  pointer-events: none;
}
.ai-chat-fab {
  position: relative;
  width: 70px;
  height: 70px;
  border: 3px solid rgba(255,255,255,.92);
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--primary);
  box-shadow: 0 18px 36px rgba(15, 122, 138, .30);
  cursor: pointer;
  overflow: hidden;
  transition: opacity .16s ease, transform .16s ease;
}
.ai-chat-widget:not(.open) .ai-chat-fab {
  animation: ai-chat-fab-hop 2.8s ease-in-out infinite;
}
.ai-chat-fab-icon {
  position: absolute;
  z-index: 2;
  color: var(--primary);
  font-size: 28px;
  animation: ai-chat-message-flow 1.7s ease .12s forwards;
}
.ai-chat-fab img {
  position: relative;
  z-index: 1;
  width: 126%;
  height: 126%;
  object-fit: cover;
  transition: transform .18s ease;
}
.ai-chat-fab-avatar {
  opacity: 0;
  transform: translateY(9px) scale(.68);
  animation: ai-chat-avatar-in .46s ease 1.34s forwards;
}
.ai-chat-fab:hover img {
  transform: scale(1.05);
}
.ai-chat-fab-pulse {
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(34, 197, 94, .38);
  border-radius: inherit;
  animation: ai-chat-pulse 1.8s ease-out infinite;
}
.ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 36px;
  width: min(420px, calc(100vw - 28px));
  max-height: min(620px, calc(100vh - 98px));
  border: 1px solid rgba(45, 212, 191, .28);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(18, 29, 43, .98), rgba(9, 17, 26, .98)),
    #101923;
  box-shadow:
    0 34px 90px rgba(0, 0, 0, .36),
    0 0 0 1px rgba(255,255,255,.04),
    0 0 42px rgba(45, 212, 191, .16);
  overflow: hidden;
  backdrop-filter: blur(10px);
}
.ai-chat-widget.open .ai-chat-panel {
  animation: ai-chat-panel-in .18s ease;
}
.ai-chat-head {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border-bottom: 1px solid rgba(45, 212, 191, .14);
  background:
    linear-gradient(135deg, rgba(10, 93, 102, .92), rgba(28, 42, 73, .94) 54%, rgba(7, 68, 72, .96)),
    #142333;
  color: #f8fafc;
}
.ai-chat-head::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, .60), rgba(45, 212, 191, .70), transparent);
}
.ai-chat-head-actions {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}
.ai-chat-profile {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.ai-chat-profile > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ai-chat-head-avatar,
.ai-chat-bot-avatar {
  flex: 0 0 auto;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #e9edef;
  overflow: hidden;
}
.ai-chat-head-avatar {
  width: 46px;
  height: 46px;
  border: 2px solid rgba(125, 249, 255, .92);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, .26),
    0 0 0 4px rgba(45, 212, 191, .10),
    0 0 24px rgba(56, 189, 248, .28);
}
.ai-chat-head-avatar img,
.ai-chat-bot-avatar img {
  width: 128%;
  height: 128%;
  object-fit: cover;
}
.ai-chat-head-avatar.is-talking,
.ai-chat-widget.is-talking .ai-chat-fab-avatar {
  animation: ai-chat-talk .52s ease-in-out infinite;
}
.ai-chat-profile > div span {
  display: block;
  color: rgba(226, 232, 240, .70);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.ai-chat-profile > div strong {
  color: #f8fafc;
  font-size: 15px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chat-profile > div strong::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 999px;
  display: inline-block;
  background: #2dd4bf;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .14), 0 0 16px rgba(45, 212, 191, .32);
  vertical-align: 1px;
}
.ai-chat-profile > div small {
  color: #93c5fd;
  font-size: 11px;
  font-weight: 850;
}
.ai-chat-profile > div small i {
  color: #facc15;
  margin-right: 4px;
}
.ai-chat-head-actions button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(148, 163, 184, .22);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, .55);
  color: #cbd5e1;
  cursor: pointer;
  transition: background .16s ease, color .16s ease, border-color .16s ease;
}
.ai-chat-head-actions button:hover {
  border-color: rgba(45, 212, 191, .45);
  background: rgba(15, 118, 110, .28);
  color: #f8fafc;
}
.ai-chat-settings {
  position: relative;
}
.ai-chat-settings-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  padding: 10px;
  border: 1px solid rgba(45, 212, 191, .24);
  border-radius: 8px;
  background: #101923;
  color: #f8fafc;
  box-shadow: 0 22px 42px rgba(0, 0, 0, .34), 0 0 20px rgba(45, 212, 191, .12);
  z-index: 20;
}
.ai-chat-switch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}
.ai-chat-switch > span:first-child {
  flex: 1 1 auto;
}
.ai-chat-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.ai-chat-slider {
  position: relative;
  flex: 0 0 auto;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #475569;
  transition: background .16s ease;
}
.ai-chat-slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #f8fafc;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .24);
  transition: transform .16s ease;
}
.ai-chat-switch input:checked + .ai-chat-slider {
  background: #2dd4bf;
}
.ai-chat-switch input:checked + .ai-chat-slider::before {
  transform: translateX(18px);
}
.ai-chat-smartbar {
  flex: 0 0 auto;
  display: flex;
  gap: 7px;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid rgba(45, 212, 191, .10);
  background: linear-gradient(90deg, rgba(15, 118, 110, .20), rgba(30, 41, 59, .78));
}
.ai-chat-smartbar span {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid rgba(125, 249, 255, .18);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(15, 23, 42, .42);
  color: #bae6fd;
  font-size: 11px;
  font-weight: 850;
}
.ai-chat-smartbar i {
  color: #5eead4;
}
.ai-chat-messages {
  flex: 1 1 auto;
  min-height: 272px;
  max-height: 388px;
  overflow-y: auto;
  padding: 18px 14px 16px;
  display: grid;
  align-content: start;
  gap: 10px;
  background-color: #0f1720;
  background-image:
    linear-gradient(135deg, rgba(125, 249, 255, .045) 10%, transparent 10%, transparent 50%, rgba(45, 212, 191, .040) 50%, rgba(45, 212, 191, .040) 60%, transparent 60%),
    linear-gradient(90deg, rgba(30, 41, 59, .88), rgba(15, 23, 42, .72)),
    linear-gradient(180deg, rgba(14, 116, 144, .24), rgba(9, 17, 26, .96));
  background-size: 38px 38px, auto, auto;
}
.ai-chat-messages::-webkit-scrollbar {
  width: 8px;
}
.ai-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.ai-chat-messages::-webkit-scrollbar-thumb {
  border: 2px solid #0f1720;
  border-radius: 999px;
  background: rgba(94, 234, 212, .34);
}
.ai-chat-message {
  width: 100%;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.5;
}
.ai-chat-message.bot {
  color: #e9edef;
}
.ai-chat-message.user {
  justify-content: flex-end;
  color: #e9edef;
}
.ai-chat-bot-avatar {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(125, 249, 255, .32);
  box-shadow: 0 8px 18px rgba(0, 0, 0, .20), 0 0 14px rgba(56, 189, 248, .16);
}
.ai-chat-widget.is-talking .ai-chat-message.bot:last-child .ai-chat-bot-avatar {
  animation: ai-chat-talk .52s ease-in-out infinite;
}
.ai-chat-bubble {
  position: relative;
  width: fit-content;
  max-width: min(78%, 292px);
  padding: 10px 12px;
  border-radius: 8px;
  white-space: pre-line;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .20);
}
.ai-chat-message.bot .ai-chat-bubble {
  border-top-left-radius: 2px;
  background:
    linear-gradient(180deg, rgba(30, 41, 59, .98), rgba(20, 32, 45, .98)),
    #17212f;
  border: 1px solid rgba(148, 163, 184, .16);
  color: #f1f5f9;
}
.ai-chat-message.user .ai-chat-bubble {
  border-top-right-radius: 2px;
  background:
    linear-gradient(135deg, rgba(13, 148, 136, .98), rgba(5, 112, 92, .98)),
    #0f766e;
  border: 1px solid rgba(94, 234, 212, .28);
  color: #f8fafc;
  box-shadow: 0 8px 22px rgba(13, 148, 136, .22);
}
.ai-chat-message.typing .ai-chat-bubble {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 36px;
  padding: 10px 15px;
  border-radius: 18px 18px 18px 6px;
  border-color: rgba(226, 232, 240, .96);
  background: #ffffff;
  color: #9da3ca;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .18);
  animation: ai-chat-typing-glow 1.2s ease-in-out infinite;
}
.ai-chat-message.with-charts {
  align-items: flex-start;
}
.ai-chat-message.with-charts .ai-chat-bubble {
  width: min(92%, 360px);
  max-width: min(92%, 360px);
}
.ai-chat-charts {
  display: grid;
  gap: 10px;
  white-space: normal;
}
.ai-chat-charts + .ai-chat-answer-text {
  display: block;
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(148, 163, 184, .14);
  white-space: pre-line;
}
.ai-chat-chart {
  min-width: 0;
  padding: 10px;
  border: 1px solid #d8e2ee;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(186, 230, 253, .28), rgba(255, 255, 255, .72) 38%),
    #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, .16);
}
.ai-chat-chart-head {
  display: grid;
  gap: 2px;
  margin-bottom: 7px;
  text-align: center;
}
.ai-chat-chart-head strong {
  color: #111827;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 900;
}
.ai-chat-chart-head span,
.ai-chat-chart-source,
.ai-chat-chart-empty {
  color: #52637a;
  font-size: 10.5px;
  font-weight: 800;
}
.ai-chat-chart-source {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}
.ai-chat-chart-empty {
  min-height: 38px;
  display: grid;
  place-items: center;
  text-align: center;
}
.ai-chart-plot {
  border-radius: 7px;
  background: rgba(255, 255, 255, .72);
}
.ai-chart-plot svg {
  display: block;
  width: 100%;
  height: auto;
}
.ai-chart-grid-line {
  stroke: #c8d2df;
  stroke-width: .9;
  stroke-dasharray: 2 2;
}
.ai-chart-axis-line,
.ai-chart-axis-arrow {
  stroke: #1f2937;
  fill: #1f2937;
  stroke-width: 1.25;
}
.ai-chart-axis-label {
  fill: #334155;
  font-size: 8.5px;
  font-weight: 800;
}
.ai-chart-x-label {
  fill: #1f2937;
  font-size: 8.8px;
  font-weight: 850;
}
.ai-chart-value-label {
  fill: #0f172a;
  font-size: 9px;
  font-weight: 900;
}
.ai-chart-bar {
  filter: drop-shadow(0 2px 1px rgba(15, 23, 42, .18));
}
.ai-chart-histogram-bar {
  filter: drop-shadow(0 2px 1px rgba(15, 23, 42, .16));
  shape-rendering: crispEdges;
}
.ai-chat-chart.histogram .ai-chat-chart-head strong {
  color: #0f5132;
}
.ai-chart-line-stroke {
  fill: none;
  stroke: #4eb7c3;
  stroke-width: 4;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.ai-chart-line-dot {
  fill: #ffffff;
  stroke: #4eb7c3;
  stroke-width: 3;
}
.ai-chart-pie {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(86px, .85fr);
  align-items: center;
  gap: 8px;
  min-height: 126px;
}
.ai-chart-pie-visual {
  position: relative;
  min-width: 0;
}
.ai-chart-pie-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.ai-chart-pie-shadow {
  fill: rgba(15, 23, 42, .22);
}
.ai-chart-pie-side {
  opacity: .95;
  stroke: rgba(15, 23, 42, .14);
  stroke-width: .65;
}
.ai-chart-pie-top {
  stroke: #ffffff;
  stroke-width: 1.5;
  filter: drop-shadow(0 2px 1px rgba(15, 23, 42, .18));
}
.ai-chart-pie-label {
  fill: #111827;
  font-size: 9px;
  font-weight: 950;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, .72);
  stroke-width: 2px;
}
.ai-chart-legend {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.ai-chart-legend div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}
.ai-chart-legend div::before {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--chart-color);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .12);
}
.ai-chart-legend span {
  flex: 1 1 auto;
  min-width: 0;
  color: #1f2937;
  font-size: 10px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-chart-legend strong {
  color: #0f172a;
  font-size: 9.5px;
  font-weight: 900;
  white-space: nowrap;
}
.ai-chat-typing-dots {
  display: inline-flex;
  gap: 7px;
}
.ai-chat-typing-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  display: block;
  background: #a7abc9;
  animation: ai-chat-dot-bounce .9s ease-in-out infinite;
}
.ai-chat-typing-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.ai-chat-typing-dots span:nth-child(2) {
  animation-delay: .12s;
}
.ai-chat-typing-dots span:nth-child(3) {
  animation-delay: .24s;
}
.ai-chat-prompts {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  overflow-x: auto;
  background: #eef6f3;
  border-top: 1px solid rgba(216, 224, 234, .88);
}
.ai-chat-prompts button {
  flex: 0 0 auto;
  border: 1px solid rgba(15, 122, 138, .20);
  border-radius: 999px;
  min-height: 32px;
  padding: 0 10px;
  background: #fff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}
.ai-chat-form {
  flex: 0 0 auto;
  display: block;
  min-width: 0;
  padding: 9px 10px 10px;
  border-top: 1px solid rgba(45, 212, 191, .13);
  background: linear-gradient(180deg, #101923, #0c141f);
}
.ai-chat-input-shell {
  position: relative;
  display: grid;
  grid-template-columns: 34px 34px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 46px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.ai-chat-command-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: 238px;
  padding: 8px;
  border: 1px solid rgba(94, 234, 212, .22);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  background: linear-gradient(180deg, rgba(15, 23, 42, .98), rgba(17, 34, 45, .98));
  box-shadow: 0 22px 44px rgba(0, 0, 0, .34), 0 0 20px rgba(45, 212, 191, .12);
  z-index: 6;
}
.ai-chat-command-menu[hidden],
.ai-chat-count[hidden] {
  display: none;
}
.ai-chat-command-menu button {
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, .14);
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  background: rgba(30, 41, 59, .74);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.ai-chat-command-menu button:hover {
  border-color: rgba(94, 234, 212, .34);
  background: rgba(15, 118, 110, .22);
  transform: translateY(-1px);
}
.ai-chat-command-menu i {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(45, 212, 191, .12);
  color: #5eead4;
}
.ai-chat-input-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid rgba(125, 249, 255, .10);
  border-radius: 999px;
  background: rgba(30, 41, 59, .88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), 0 8px 18px rgba(0,0,0,.20);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.ai-chat-widget.has-chat-text .ai-chat-input-shell::before {
  right: 50px;
}
.ai-chat-input-shell:focus-within::before {
  border-color: rgba(94, 234, 212, .42);
  box-shadow: 0 0 0 3px rgba(45, 212, 191, .11), 0 10px 24px rgba(45, 212, 191, .10);
}
.ai-chat-form input {
  position: relative;
  z-index: 1;
  grid-column: 3;
  grid-row: 1;
  flex: 1 1 auto;
  width: 100%;
  min-height: 46px;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 0 54px 0 2px;
  background: transparent;
  color: #f8fafc;
  font-size: 14px;
  caret-color: #5eead4;
}
.ai-chat-form input::placeholder {
  color: #94a3b8;
}
.ai-chat-form input:focus {
  border: 0;
  outline: 0;
  box-shadow: none;
}
.ai-chat-count {
  position: relative;
  z-index: 2;
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  margin-right: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(15, 23, 42, .46);
  color: #94a3b8;
  font-size: 10px;
  font-weight: 850;
  pointer-events: none;
}
.ai-chat-tool,
.ai-chat-voice,
.ai-chat-send {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ai-chat-tool {
  width: 34px;
  height: 46px;
  background: transparent;
  color: #cbd5e1;
  font-size: 21px;
}
.ai-chat-tool:hover,
.ai-chat-voice:hover {
  color: #f8fafc;
}
.ai-chat-voice {
  grid-column: 4;
  grid-row: 1;
  width: 42px;
  height: 46px;
  background: transparent;
  color: #cbd5e1;
  font-size: 18px;
}
.ai-chat-voice.is-listening {
  background: #ffe4e6;
  color: var(--rose);
}
.ai-chat-send {
  grid-column: 4;
  grid-row: 1;
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #5eead4, #22c55e);
  color: #052e2b;
  font-size: 20px;
  box-shadow: 0 12px 24px rgba(45, 212, 191, .28);
}
.ai-chat-send i {
  transform: translate(1px, -1px) rotate(42deg);
}
.ai-chat-send:disabled,
.ai-chat-form input:disabled,
.ai-chat-voice:disabled {
  opacity: .7;
  cursor: wait;
}
.panel, .stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.panel { padding: 18px; overflow: hidden; }
.stat {
  position: relative;
  overflow: hidden;
  padding: 18px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.stat::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #22c55e, var(--amber));
}
.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 122, 138, .28);
  box-shadow: 0 20px 42px rgba(17, 24, 39, .12);
}
.stat span {
  color: #64748b;
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.stat strong { display: block; font-size: 32px; margin-top: 8px; }
.stat.warning strong { color: var(--rose); }
.action-card { position: relative; overflow: hidden; border-top: 4px solid var(--cyan); }
.action-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, transparent 0 70%, rgba(18, 130, 162, .08) 70% 100%);
  pointer-events: none;
}
.action-card > * {
  position: relative;
  z-index: 1;
}
.action-card.teal { border-top-color: var(--primary); }
.action-card.amber { border-top-color: var(--amber); }
.action-card.rose { border-top-color: #e45c50; }
.action-card.teal::before { background: linear-gradient(90deg, var(--primary), #22c55e); }
.action-card.amber::before { background: linear-gradient(90deg, var(--amber), #fbbf24); }
.action-card.rose::before { background: linear-gradient(90deg, var(--rose), #fb7185); }
.stat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stat-head b {
  width: 50px;
  height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--cyan);
  background: #f8fbfd;
  font-size: 20px;
}
.action-card.teal .stat-head b { color: var(--primary); }
.action-card.amber .stat-head b { color: var(--amber); }
.action-card.rose .stat-head b { color: var(--rose); }
.action-card p { min-height: 42px; margin: 8px 0 16px; color: #475569; line-height: 1.5; }
.action-card .btn { width: 100%; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.panel-head a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
}
.panel-head a:hover {
  background: var(--soft);
  border-color: rgba(15, 122, 138, .32);
}
.panel-badge {
  border-radius: 999px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #edfafa, #f6f7ff);
  color: var(--primary);
  font-size: 12px;
  font-weight: 850;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
thead th { background: #f6f9fc; position: sticky; top: 0; z-index: 1; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7fbfd; }
.action-cell { width: 52px; text-align: right; }

.form-stack { display: grid; gap: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.form-grid.three-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 800; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.field-control {
  position: relative;
  display: block;
  width: 100%;
}
.field-control input,
.field-control select,
.field-control textarea {
  padding-left: 42px;
}
.field-control select {
  padding-right: 34px;
}
.field-control.has-password-toggle input {
  padding-right: 46px;
}
.field-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #7a8797;
  font-size: 16px;
  pointer-events: none;
  z-index: 2;
}
.field-control.is-textarea .field-icon {
  top: 17px;
  transform: none;
}
.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  z-index: 3;
}
.password-toggle:hover {
  background: var(--soft);
  color: var(--primary);
}
.password-strength,
.password-match-hint {
  margin-top: 7px;
  padding: 9px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}
.password-strength-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}
.password-strength-top strong {
  color: #475569;
  white-space: nowrap;
}
.password-strength-bar {
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  background: #e5edf4;
  overflow: hidden;
}
.password-strength-bar span {
  display: block;
  width: 8%;
  height: 100%;
  border-radius: inherit;
  background: #ef4444;
  transition: width .18s ease, background .18s ease;
}
.password-strength.medium .password-strength-bar span {
  background: #f59e0b;
}
.password-strength.strong .password-strength-bar span {
  background: #16a34a;
}
.password-strength.weak,
.password-match-hint.mismatch {
  border-color: #fecaca;
  background: #fff1f2;
  color: #b91c1c;
}
.password-strength.medium {
  border-color: #fed7aa;
  background: #fffbeb;
}
.password-strength.strong,
.password-match-hint.matches {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #15803d;
}
.password-strength-rules {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.password-strength-rules span {
  min-height: 23px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 11px;
  font-weight: 900;
}
.password-strength-rules span.passed {
  background: #dcfce7;
  color: #15803d;
}
.password-match-hint {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}
.date-control {
  position: relative;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 36px 36px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.86);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.date-control:focus-within {
  border-color: rgba(15, 122, 138, .45);
  box-shadow: 0 0 0 3px rgba(15, 122, 138, .12);
}
.date-control .date-icon {
  color: #7a8797;
  justify-self: center;
  pointer-events: none;
}
.date-control input[type="date"] {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  border: 0;
  background: transparent;
  padding: 0 4px;
  color: var(--ink);
  font: inherit;
}
.date-control input[type="date"]:focus {
  outline: 0;
  box-shadow: none;
}
.date-control input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 0;
  margin: 0;
}
.date-picker-button,
.date-clear-button {
  width: 31px;
  height: 31px;
  border: 0;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: transparent;
  color: #64748b;
  cursor: pointer;
}
.date-picker-button:hover,
.date-clear-button:hover {
  background: var(--soft);
  color: var(--primary);
}
.date-clear-button {
  color: var(--rose);
}
.phone-control {
  display: flex;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}
.phone-flag,
.phone-code,
.phone-local,
.phone-progress {
  min-height: 44px;
  border: 1px solid var(--line);
}
.phone-flag {
  min-width: 48px;
  border-right: 0;
  border-radius: 8px 0 0 8px;
  display: inline-grid;
  place-items: center;
  background: #f8fafc;
  color: var(--primary);
  font-size: 12px;
  font-weight: 950;
}
.phone-code {
  width: 88px;
  border-radius: 0;
  padding: 0 8px;
  background: #fff;
  font-weight: 850;
  color: var(--ink);
}
.phone-local {
  min-width: 0;
  flex: 1 1 auto;
  border-left: 0;
  border-radius: 0;
  padding: 11px 12px;
}
.phone-progress {
  min-width: 54px;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  display: inline-grid;
  place-items: center;
  background: #f8fafc;
  color: #64756f;
  font-size: 12px;
  font-weight: 900;
}
.phone-progress.complete { color: var(--primary); }
.phone-control:focus-within .phone-flag,
.phone-control:focus-within .phone-code,
.phone-control:focus-within .phone-local,
.phone-control:focus-within .phone-progress {
  border-color: var(--primary);
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid rgba(15, 122, 138, .15);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(15, 122, 138, .14);
}
input[readonly], input:disabled {
  background: #f5f8fb;
  color: #64748b;
}
.inline-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.inline-fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 14px;
  font-weight: 850;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  line-height: 1;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
.btn:hover { border-color: rgba(15, 122, 138, .45); color: var(--primary); transform: translateY(-1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--primary), #138a65);
  border-color: transparent;
  color: #fff;
}
.btn.primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), #0f7a62);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 22px rgba(15, 122, 138, .23);
}
.btn.subtle { background: var(--soft); color: var(--primary); border-color: #cfe4e9; }
.btn.small { min-height: 34px; padding: 7px 10px; font-size: 13px; }
.btn.danger { color: var(--rose); }
.icon-action {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
}
.icon-action:hover { background: var(--soft); border-color: rgba(15, 122, 138, .35); color: var(--primary-dark); }
.icon-action.danger { color: var(--rose); }

.flash-list { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 12px 14px; border-radius: 8px; background: #ecf9f6; border: 1px solid #b8e1da; color: #15534c; font-weight: 750; }
.flash.error { background: #fff0f0; border-color: #edb9b9; color: #8d2525; }
.flash.info { background: #eef5ff; border-color: #bfd5f3; color: #1f4d83; margin-bottom: 18px; }
.muted { color: var(--muted); margin: 0; }
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eef7f3;
  color: var(--primary);
  font-weight: 850;
}
.status-pill.success { background: #e7f6ef; color: #08724f; }
.status-pill.danger { background: #fff1f1; color: var(--rose); }
.status-pill.muted-pill { background: #eef1f1; color: #66756f; }

.product-rank { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.product-rank div {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 14px 14px 48px;
  display: grid;
  gap: 5px;
  background: linear-gradient(180deg, #fff, #fbfdfc);
}
.product-rank .rank-index {
  position: absolute;
  left: 12px;
  top: 14px;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft);
  color: var(--primary);
  font-weight: 900;
}
.product-rank span, .product-rank em { color: var(--muted); font-style: normal; }
.sale-items { display: grid; gap: 10px; }
.sale-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 90px 120px 44px;
  gap: 8px;
  align-items: center;
}
.line-total, .total-box { font-weight: 900; }
.total-box { background: #f6f9f8; border: 1px solid var(--line); border-radius: 8px; padding: 14px; font-size: 18px; }
.receipt { max-width: 920px; }
.receipt-meta, .receipt-totals { display: grid; gap: 8px; margin: 14px 0; }
.receipt-totals { justify-items: end; font-size: 16px; }

.modal.show {
  display: flex !important;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 10px;
  overflow: hidden;
}
.modal.show .modal-dialog {
  margin: 0 auto;
  max-height: calc(100vh - 36px);
}
.modal-content {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(16,32,29,.22);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
}
.modal-content > form,
.modal-form {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  max-height: inherit;
}
.modal-header {
  background: linear-gradient(135deg, #f8fbfa, #eef5f2);
  border-bottom: 1px solid var(--line);
}
.modal-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 19px;
  font-weight: 900;
  color: var(--ink);
}
.modal-body {
  flex: 1 1 auto;
  padding: 18px;
  overflow-y: auto;
  min-height: 0;
  max-height: calc(100vh - 180px);
}
.modal-footer { border-top: 1px solid var(--line); }
.modal-dialog-scrollable .modal-content { max-height: calc(100vh - 36px); }
.modal-dialog-scrollable .modal-body {
  overflow-y: auto;
  max-height: calc(100vh - 180px);
}
.modal-form .spinner-border { width: 1rem; height: 1rem; }

.user-form-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.photo-picker,
.profile-photo-trigger {
  display: grid;
  justify-items: center;
  gap: 10px;
}
.photo-picker label,
.profile-photo-trigger {
  cursor: pointer;
}
.photo-picker img,
.profile-avatar-img {
  width: 132px;
  height: 132px;
  border-radius: 999px;
  object-fit: cover;
  border: 4px solid #fff;
  box-shadow: 0 14px 30px rgba(16, 32, 29, .14);
  background: var(--soft);
}
.photo-picker input[type="file"],
#profile_photo_input {
  display: none;
}
.table-user { display: inline-flex; align-items: center; gap: 10px; }
.table-user img,
.table-user span {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--amber));
  color: #fff;
  font-weight: 900;
}

.profile-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; }
.profile-card { text-align: center; }
.profile-card form { display: grid; justify-items: center; gap: 10px; margin-bottom: 16px; }
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  background: linear-gradient(135deg, var(--primary), var(--amber));
  color: #fff;
  font-size: 34px;
  font-weight: 900;
}
.profile-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
  text-align: left;
}
.profile-meta span { color: var(--muted); font-weight: 800; }
.profile-panel { overflow: visible; }
.profile-tabs {
  gap: 8px;
  margin-bottom: 18px;
}
.profile-tabs .nav-link {
  border-radius: 8px;
  color: var(--primary);
  font-weight: 850;
}
.profile-tabs .nav-link.active {
  background: var(--primary);
  color: #fff;
}
.profile-tab-content { max-width: 720px; }

.app-footer {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 16px;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  color: #7b8794;
  font-weight: 650;
}
.app-footer strong { color: var(--primary); }

.login-page {
  background:
    linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px),
    linear-gradient(115deg, rgba(34,197,94,.16) 0 18%, transparent 18% 100%),
    linear-gradient(115deg, #101827 0%, #172033 50%, #f5f8fb 50.2%, #e8eef5 100%);
  background-size: 42px 42px, 42px 42px, auto, auto;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-x: hidden;
}
.login-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(min(390px, 100%), 460px);
  gap: 42px;
  align-items: center;
  min-width: 0;
}
.login-aside {
  position: relative;
  color: #fff;
  padding: 24px 0;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.20);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}
.login-aside h1 {
  max-width: 560px;
  margin-top: 16px;
  font-size: 52px;
  line-height: 1.05;
  color: #fff;
}
.login-aside-copy h1 {
  min-height: 56px;
}
.login-aside-copy p {
  max-width: 520px;
  min-height: 62px;
  margin: 14px 0 0;
  color: rgba(236,244,251,.84);
  font-size: 18px;
  line-height: 1.55;
  font-weight: 650;
}
.login-aside::after {
  display: none;
}
.login-showcase {
  width: min(560px, 100%);
  margin-top: 30px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.14), rgba(255,255,255,.06)),
    rgba(15, 23, 42, .24);
  box-shadow: 0 28px 64px rgba(0,0,0,.22);
  backdrop-filter: blur(14px);
}
.showcase-top,
.showcase-feed {
  display: flex;
  align-items: center;
  gap: 8px;
}
.showcase-top strong {
  margin-left: auto;
  color: #dff8f1;
  font-size: 13px;
}
.showcase-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.10);
}
.showcase-dot:nth-child(2) { background: #38bdf8; box-shadow: 0 0 0 4px rgba(56,189,248,.10); }
.showcase-dot:nth-child(3) { background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.10); }
.showcase-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.showcase-metrics span {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.10);
}
.showcase-metrics small {
  color: rgba(236,244,251,.74);
  font-weight: 800;
}
.showcase-metrics b {
  color: #fff;
  font-size: 22px;
}
.showcase-chart {
  height: 148px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 8px;
  background:
    repeating-linear-gradient(180deg, rgba(255,255,255,.10) 0 1px, transparent 1px 28px),
    rgba(4, 11, 22, .28);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}
.showcase-chart span {
  height: var(--bar);
  min-height: 18px;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, #facc15, #22c55e 54%, #22d3ee);
  box-shadow: 0 12px 20px rgba(0,0,0,.20);
}
.showcase-feed {
  flex-wrap: wrap;
  margin-top: 12px;
}
.showcase-feed span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
  color: #e6f6ff;
  font-weight: 800;
}
.login-points {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}
.login-points span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.18);
  font-weight: 800;
}
.login-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  min-width: 0;
  background:
    radial-gradient(circle at 18% 10%, rgba(34, 197, 94, .11), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(109, 93, 252, .10), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,.99), rgba(248,251,253,.98));
  border: 1px solid rgba(216, 224, 234, .86);
  border-radius: 8px;
  padding: 30px 36px 30px;
  box-shadow: 0 34px 80px rgba(17, 24, 39, .25);
  overflow: hidden;
}
.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), #22c55e, var(--amber), var(--violet));
}
.login-panel::after {
  content: "";
  position: absolute;
  inset: auto -28px -72px auto;
  width: 210px;
  height: 210px;
  background: linear-gradient(135deg, rgba(15,122,138,.10), rgba(217,119,6,.10));
  transform: rotate(18deg);
  pointer-events: none;
}
.login-panel > * {
  position: relative;
  z-index: 1;
}
.login-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(15, 122, 138, .12);
}
.login-brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.login-logo-wrap {
  position: relative;
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(15, 122, 138, .45), rgba(34, 197, 94, .35), rgba(109, 93, 252, .36)) border-box;
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: 0 18px 34px rgba(15, 23, 42, .12);
  overflow: hidden;
}
.login-logo-wrap::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(15, 122, 138, .10);
  border-radius: 8px;
  pointer-events: none;
}
.login-logo {
  width: 76%;
  height: 76%;
  object-fit: contain;
  padding: 0;
  filter: drop-shadow(0 9px 14px rgba(3, 34, 71, .14));
}
.login-brand-text {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.login-brand-text span {
  color: var(--primary);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}
.login-brand-text strong {
  color: var(--ink);
  font-size: 17px;
  line-height: 1.2;
  font-weight: 950;
}
.login-secure-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  flex: 0 0 auto;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(236,253,245,.82);
  border: 1px solid rgba(34,197,94,.28);
  color: #08724f;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(8, 114, 79, .08);
}
.login-form-head {
  text-align: left;
  margin: 0 0 20px;
}
.login-form-head h2 {
  font-size: 30px;
  line-height: 1.18;
  margin: 0;
}
.typewriter-cursor {
  display: none;
  width: 2px;
  height: 1em;
  margin-left: 4px;
  background: var(--primary);
  vertical-align: -0.12em;
  animation: typewriter-caret 1s steps(2, start) infinite;
}
.login-aside .typewriter-cursor {
  background: #facc15;
}
.login-typewriter.typing-title .title-cursor,
.login-typewriter.typing-body .body-cursor {
  display: inline-block;
}
.login-panel .flash { margin-bottom: 16px; }
.login-panel .form-stack { gap: 15px; }
.login-panel label {
  color: #334155;
  font-size: 13px;
}
.login-panel input {
  min-height: 52px;
  background: #fff;
  border-color: #cbd5e1;
}
.login-panel input::placeholder { color: #94a3b8; }
.login-panel .field-control input { padding-left: 44px; }
.login-panel .field-icon { color: #64748b; }
.login-btn {
  width: 100%;
  margin-top: 2px;
  min-height: 52px;
  box-shadow: 0 16px 28px rgba(15, 122, 138, .24);
}
.login-support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #f7fafc;
  color: var(--muted);
  font-size: 13px;
}
.login-support span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 850;
}
.login-support strong { color: var(--ink); white-space: nowrap; }
.login-loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 12, 22, .58);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, visibility .18s ease;
  z-index: 3000;
}
.login-page.login-loading .login-loader {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.login-loader-card {
  min-width: min(320px, 100%);
  padding: 28px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 8px;
  background: rgba(255,255,255,.94);
  box-shadow: 0 32px 80px rgba(0,0,0,.28);
  text-align: center;
  transform: translateY(10px) scale(.98);
  transition: transform .18s ease;
}
.login-page.login-loading .login-loader-card {
  transform: translateY(0) scale(1);
}
.login-loader-mark {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    conic-gradient(from 0deg, var(--primary), #22c55e, var(--amber), var(--violet), var(--primary));
  animation: login-loader-spin .9s linear infinite;
}
.login-loader-mark::before {
  content: "";
  width: 54px;
  height: 54px;
  border-radius: inherit;
  background: #fff;
}
.login-loader-mark span {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 8px rgba(15,122,138,.10);
}
.login-loader-card strong,
.login-loader-card small {
  display: block;
}
.login-loader-card strong {
  color: var(--ink);
  font-size: 18px;
}
.login-loader-card small {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 750;
}
.login-page.login-loading .login-btn {
  cursor: wait;
  opacity: .88;
}
.login-btn-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.42);
  border-top-color: #fff;
  border-radius: 999px;
  animation: login-loader-spin .72s linear infinite;
}

@keyframes typewriter-caret {
  0%, 45% { opacity: 1; }
  46%, 100% { opacity: 0; }
}
@keyframes login-loader-spin {
  to { transform: rotate(360deg); }
}
@keyframes ai-chat-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@keyframes ai-chat-nudge-float {
  0%, 100% { transform: translate(0, 0); }
  28% { transform: translate(-2px, -7px); }
  56% { transform: translate(2px, -3px); }
  76% { transform: translate(0, -9px); }
}
@keyframes ai-chat-fab-hop {
  0%, 100% { transform: translateY(0) scale(1); }
  18% { transform: translateY(-8px) scale(1.02); }
  32% { transform: translateY(0) scale(.99); }
  48% { transform: translateY(-4px) scale(1.01); }
  64% { transform: translateY(0) scale(1); }
}
@keyframes ai-chat-bubble-in {
  to { opacity: 1; transform: translateX(0); }
}
@keyframes ai-chat-panel-in {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ai-chat-pulse {
  0% { opacity: .9; transform: scale(.92); }
  100% { opacity: 0; transform: scale(1.24); }
}
@keyframes ai-chat-message-flow {
  0%, 46% { opacity: 1; transform: translateY(0) scale(1); }
  76%, 100% { opacity: 0; transform: translate(-18px, -22px) scale(.82); }
}
@keyframes ai-chat-avatar-in {
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes ai-chat-talk {
  0%, 100% { transform: translateY(0) scale(1); }
  35% { transform: translateY(-2px) scale(1.035); }
  70% { transform: translateY(1px) scale(.99); }
}
@keyframes ai-chat-typing-glow {
  0%, 100% { opacity: .72; }
  50% { opacity: 1; }
}
@keyframes ai-chat-dot-bounce {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50% { transform: translateY(-4px); opacity: 1; }
}

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .profile-grid, .ai-forecast-hero, .ai-insight-grid, .ai-graph-grid { grid-template-columns: 1fr; }
  .form-grid.three-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-forecast-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body.sidebar-collapsed { --side-width: 270px; }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .sidebar-user > span:not(.user-avatar),
  body.sidebar-collapsed .side-nav .nav-link > span:not(.nav-icon),
  body.sidebar-collapsed .nav-chevron {
    display: initial;
  }
  body.sidebar-collapsed .sidebar {
    align-items: stretch;
  }
  body.sidebar-collapsed .side-nav .nav-link {
    justify-content: flex-start;
    padding-inline: 10px;
  }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .app-main { margin-left: 0; }
  .app-topbar { left: 0; }
  .app-footer { left: 0; position: static; }
  .main { padding: 18px; }
  .topbar-context { display: none; }
  .page-strip { align-items: flex-start; flex-direction: column; margin-bottom: 18px; }
  .page-meta { justify-items: start; text-align: left; }
  .contact-pill { display: none; }
  .sale-row, .inline-fields, .inline-fields.three, .form-grid, .form-grid.three-cols, .user-form-layout { grid-template-columns: 1fr; }
  .module-toolbar { align-items: flex-start; flex-direction: column; }
  .dashboard-hero { align-items: flex-start; flex-direction: column; }
  .hero-command { width: 100%; }
  .ai-forecast-metrics { grid-template-columns: 1fr; }
  .login-page { justify-items: center; }
  .login-shell { width: min(100%, 480px); max-width: 480px; grid-template-columns: minmax(0, 1fr); }
  .login-aside { display: none; }
  .login-panel { width: 100%; max-width: 100%; padding: 32px 24px 28px; }
  .login-panel-top { gap: 14px; }
  .login-logo-wrap { width: 76px; height: 76px; }
  .login-brand-text strong { font-size: 16px; }
  .modal.show { padding: 10px; }
  .modal.show .modal-dialog,
  .modal-content { max-height: calc(100vh - 20px); }
  .modal-body,
  .modal-dialog-scrollable .modal-body {
    max-height: calc(100vh - 160px);
  }
  .phone-control { flex-wrap: nowrap; }
  .phone-code { width: 82px; }
  .phone-progress { min-width: 48px; }
}
@media (max-width: 620px) {
  .stats-grid { grid-template-columns: 1fr; }
  .ai-forecast-hero { padding: 16px; }
  .ai-forecast-copy h2 { font-size: 24px; }
  .ai-gap-row { grid-template-columns: 1fr; }
  .ai-histogram { gap: 5px; padding-inline: 6px; }
  .ai-histogram-col small { font-size: 10px; }
  .password-strength-rules span { flex: 1 1 46%; text-align: center; }
  .ai-chat-widget { right: 16px; bottom: 16px; }
  .ai-chat-nudge { display: none; }
  .ai-chat-panel {
    position: fixed;
    left: 14px !important;
    right: 14px !important;
    bottom: 18px;
    width: calc(100vw - 28px) !important;
    max-height: calc(100vh - 84px);
  }
  .ai-chat-smartbar { padding: 7px 10px; }
  .ai-chat-smartbar span { min-height: 24px; font-size: 10.5px; }
  .ai-chat-messages { min-height: 220px; max-height: none; }
  .ai-chat-form { padding: 10px; }
  .ai-chat-command-menu { width: min(238px, calc(100vw - 48px)); }
  .ai-chat-input-shell {
    grid-template-columns: 32px 32px minmax(0, 1fr) 40px;
    gap: 4px;
    min-height: 44px;
  }
  .ai-chat-widget.has-chat-text .ai-chat-input-shell::before { right: 48px; }
  .ai-chat-tool {
    width: 32px;
    height: 44px;
  }
  .ai-chat-voice,
  .ai-chat-send {
    width: 40px;
    height: 40px;
  }
  .ai-chat-voice { height: 44px; }
  .ai-chat-message.with-charts .ai-chat-bubble {
    width: min(96%, 340px);
    max-width: min(96%, 340px);
  }
  .ai-chart-pie {
    grid-template-columns: minmax(0, 1fr);
  }
  .login-page { padding: 16px; }
  .login-shell { width: min(100%, 360px); max-width: 360px; }
  .login-panel-top { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 24px; padding-bottom: 18px; }
  .login-logo-wrap { width: 70px; height: 70px; }
  .login-secure-badge { justify-content: center; }
  .login-form-head h2 { font-size: 25px; }
  .login-support { align-items: flex-start; flex-direction: column; }
  .hero-actions, .hero-mini-grid { grid-template-columns: 1fr; }
  .top-actions { max-width: calc(100vw - 84px); }
  .profile-chip span:not(.user-avatar) { display: none; }
  .toolbar-actions { width: 100%; }
  .toolbar-actions .btn, .module-toolbar > .btn { width: 100%; }
  .profile-meta { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .app-topbar, .app-footer, .btn { display: none !important; }
  .app-main, .main { margin: 0; padding: 0; }
  .panel { box-shadow: none; border: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .typewriter-cursor,
  .login-loader-mark,
  .ai-chat-nudge,
  .ai-chat-nudge-bubble,
  .ai-chat-fab,
  .ai-chat-fab-icon,
  .ai-chat-fab-avatar,
  .ai-chat-fab-pulse,
  .ai-chat-head-avatar.is-talking,
  .ai-chat-widget.is-talking .ai-chat-fab-avatar,
  .ai-chat-widget.is-talking .ai-chat-message.bot:last-child .ai-chat-bot-avatar,
  .ai-chat-message.typing .ai-chat-bubble,
  .ai-chat-typing-dots span {
    animation: none;
  }
  .typewriter-cursor {
    display: none !important;
  }
  .ai-chat-nudge-bubble {
    opacity: 1;
    transform: none;
  }
  .ai-chat-fab-icon {
    display: none;
  }
  .ai-chat-fab-avatar {
    opacity: 1;
    transform: none;
  }
}
