:root {
  --v9-bg: #070510;
  --v9-bg-soft: #0b0715;
  --v9-bg-elevated: #110b21;
  --v9-sidebar: rgba(9, 6, 19, 0.96);
  --v9-panel: rgba(19, 13, 36, 0.82);
  --v9-panel-strong: rgba(24, 16, 47, 0.96);
  --v9-panel-hover: rgba(33, 20, 64, 0.96);
  --v9-input: rgba(8, 5, 19, 0.74);
  --v9-border: rgba(202, 158, 255, 0.14);
  --v9-border-strong: rgba(194, 126, 255, 0.38);
  --v9-text: #fbf9ff;
  --v9-text-soft: #d6cfe1;
  --v9-muted: #aaa3bc;
  --v9-muted-2: #756e86;
  --v9-purple: #9b4dff;
  --v9-purple-bright: #c56cff;
  --v9-indigo: #5c43ff;
  --v9-pink: #f06bff;
  --v9-cyan: #65d9ff;
  --v9-success: #5af2a5;
  --v9-warning: #f4c36a;
  --v9-danger: #ff6d91;
  --v9-shadow-sm: 0 12px 34px rgba(0, 0, 0, 0.22);
  --v9-shadow: 0 26px 90px rgba(0, 0, 0, 0.44);
  --v9-glow: 0 0 42px rgba(154, 75, 255, 0.16);
  --v9-radius-sm: 12px;
  --v9-radius: 18px;
  --v9-radius-lg: 24px;
  --v9-sidebar-width: 256px;
  --v9-topbar-height: 70px;
  --v9-content-width: 1440px;
}

/* ------------------------------------------------------------------
   RESET + GLOBAL
------------------------------------------------------------------- */

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

html {
  min-height: 100%;
  background: var(--v9-bg);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body.jugi-v9 {
  min-height: 100vh;
  margin: 0;
  color: var(--v9-text);
  background:
    radial-gradient(circle at 75% -5%, rgba(121, 53, 255, 0.14), transparent 31%),
    radial-gradient(circle at 12% 95%, rgba(240, 107, 255, 0.06), transparent 26%),
    linear-gradient(180deg, #080511, #05040b 76%);
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overflow-x: hidden;
}

body.jugi-v9::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, rgba(0,0,0,.75), transparent 88%);
}

body.jugi-v9 a {
  color: inherit;
}

body.jugi-v9 h1,
body.jugi-v9 h2,
body.jugi-v9 h3,
body.jugi-v9 h4,
body.jugi-v9 p {
  text-wrap: pretty;
}

body.jugi-v9 h1,
body.jugi-v9 h2,
body.jugi-v9 h3 {
  color: var(--v9-text);
  letter-spacing: -0.035em;
}

body.jugi-v9 ::selection {
  color: #fff;
  background: rgba(155, 77, 255, 0.62);
}

body.jugi-v9 :focus-visible {
  outline: 2px solid var(--v9-purple-bright);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------
   APP SHELL
------------------------------------------------------------------- */

.v9-app-shell,
.app-shell.v9-app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--v9-sidebar-width) minmax(0, 1fr);
  background: transparent;
}

.v9-sidebar,
.sidebar.v9-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 80;
  width: var(--v9-sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  border-right: 1px solid rgba(199, 151, 255, 0.11);
  background:
    radial-gradient(circle at 38% 0%, rgba(126, 57, 255, 0.11), transparent 26%),
    linear-gradient(180deg, rgba(11, 7, 24, 0.985), rgba(6, 4, 13, 0.99));
  box-shadow: 14px 0 60px rgba(0, 0, 0, 0.22);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(190, 129, 255, 0.22) transparent;
}

.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  padding: 0 6px;
}

.v9-brand,
.brand.v9-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #fff;
  text-decoration: none;
}

.v9-brand-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 13px;
  box-shadow:
    0 0 0 1px rgba(216, 178, 255, 0.2),
    0 12px 32px rgba(118, 48, 255, 0.24),
    0 0 34px rgba(183, 83, 255, 0.12);
}

.v9-brand-copy {
  min-width: 0;
  display: grid;
  gap: 0;
}

.v9-brand-copy strong {
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -0.025em;
}

.v9-brand-copy small {
  color: var(--v9-muted-2);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.v9-sidebar-close {
  display: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--v9-border);
  border-radius: 11px;
  color: var(--v9-text-soft);
  background: rgba(255, 255, 255, 0.035);
  cursor: pointer;
}

.v9-new-chat {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  margin: 16px 0 13px;
  padding: 9px 11px;
  border: 1px solid rgba(195, 136, 255, 0.2);
  border-radius: 13px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(155, 77, 255, 0.19), rgba(92, 67, 255, 0.08));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.v9-new-chat:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 133, 255, 0.4);
  background:
    linear-gradient(135deg, rgba(155, 77, 255, 0.29), rgba(92, 67, 255, 0.12));
}

.v9-new-chat > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--v9-purple-bright), var(--v9-indigo));
  font-size: 17px;
  box-shadow: 0 8px 20px rgba(117, 50, 255, 0.25);
}

.v9-new-chat strong {
  font-size: 11px;
  font-weight: 760;
}

.v9-new-chat kbd,
.v9-command-trigger kbd {
  border: 1px solid rgba(210, 181, 255, 0.13);
  border-radius: 7px;
  color: var(--v9-muted-2);
  background: rgba(5, 3, 12, 0.38);
  padding: 2px 6px;
  font-family: inherit;
  font-size: 8px;
  font-weight: 650;
}

.v9-nav,
.sidebar-nav.v9-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 0;
}

.v9-nav-group {
  display: grid;
  gap: 4px;
}

.v9-nav-bottom {
  margin-top: auto;
}

.v9-nav-label {
  padding: 0 10px 4px;
  color: #5f5770;
  font-size: 8px;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

body.jugi-v9 .nav-item {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #a99fb8;
  background: transparent;
  font-size: 11px;
  font-weight: 650;
  text-decoration: none;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s ease;
}

body.jugi-v9 .nav-item:hover {
  color: #fff;
  border-color: rgba(197, 151, 255, 0.09);
  background: rgba(255, 255, 255, 0.035);
  transform: translateX(2px);
}

body.jugi-v9 .nav-item.active {
  color: #fff;
  border-color: rgba(194, 126, 255, 0.22);
  background:
    linear-gradient(90deg, rgba(155, 77, 255, 0.2), rgba(92, 67, 255, 0.055));
  box-shadow:
    inset 3px 0 0 var(--v9-purple-bright),
    0 8px 24px rgba(102, 42, 215, 0.09);
}

.v9-nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: #80748f;
  font-size: 13px;
}

.nav-item.active .v9-nav-icon {
  color: #d9aeff;
  background: rgba(174, 99, 255, 0.09);
}

.v9-sidebar-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 10px 6px 0;
  border-top: 1px solid rgba(197, 151, 255, 0.08);
}

.v9-user {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.v9-user-avatar,
.v9-profile-button {
  display: grid;
  place-items: center;
  color: #fff;
  background:
    linear-gradient(135deg, var(--v9-purple-bright), var(--v9-indigo));
  font-weight: 850;
  box-shadow: 0 8px 22px rgba(116, 49, 255, 0.2);
}

.v9-user-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  font-size: 10px;
}

.v9-user-copy {
  min-width: 0;
  display: grid;
}

.v9-user-copy strong,
.v9-user-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.v9-user-copy strong {
  color: #dcd5e5;
  font-size: 10px;
}

.v9-user-copy small {
  color: #6f677d;
  font-size: 8px;
}

.v9-logout {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(197, 151, 255, 0.08);
  border-radius: 9px;
  color: #867c94;
  background: rgba(255, 255, 255, 0.025);
  cursor: pointer;
}

.v9-logout:hover {
  color: var(--v9-danger);
  border-color: rgba(255, 109, 145, 0.2);
  background: rgba(255, 109, 145, 0.05);
}

.v9-sidebar-scrim {
  display: none;
}

.v9-main-shell,
.main-shell.v9-main-shell {
  grid-column: 2;
  min-width: 0;
  min-height: 100vh;
}

.v9-topbar,
.topbar.v9-topbar {
  position: sticky;
  top: 0;
  z-index: 55;
  min-height: var(--v9-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid rgba(199, 151, 255, 0.09);
  background:
    linear-gradient(180deg, rgba(8, 5, 17, 0.92), rgba(8, 5, 17, 0.78));
  backdrop-filter: blur(20px) saturate(135%);
}

.v9-topbar-left,
.v9-topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.v9-mobile-menu {
  display: none;
  width: 39px;
  height: 39px;
  border: 1px solid var(--v9-border);
  border-radius: 12px;
  color: var(--v9-text-soft);
  background: rgba(255, 255, 255, 0.035);
}

.v9-topbar-logo {
  display: none;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-weight: 820;
  text-decoration: none;
}

.v9-topbar-logo img {
  width: 31px;
  height: 31px;
  border-radius: 10px;
  object-fit: cover;
}

.v9-command-trigger {
  width: min(340px, 32vw);
  min-height: 38px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px 7px 12px;
  border: 1px solid rgba(197, 151, 255, 0.11);
  border-radius: 11px;
  color: #756d82;
  background: rgba(255, 255, 255, 0.025);
  text-align: left;
  cursor: pointer;
}

.v9-command-trigger:hover {
  color: #bdb5c7;
  border-color: rgba(194, 126, 255, 0.25);
  background: rgba(119, 59, 199, 0.08);
}

.v9-status {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(197, 151, 255, 0.09);
  border-radius: 11px;
  color: var(--v9-muted);
  background: rgba(255, 255, 255, 0.02);
  font-size: 10px;
  text-decoration: none;
}

.v9-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--v9-success);
  box-shadow: 0 0 14px rgba(90, 242, 165, 0.65);
}

.v9-profile-button {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 11px;
  text-decoration: none;
}

.v9-page,
.page.v9-page {
  width: min(var(--v9-content-width), calc(100% - 44px));
  margin: 0 auto;
  padding: 28px 0 70px;
}

.v9-flashes {
  position: fixed;
  z-index: 100;
  top: 82px;
  right: 22px;
  width: min(390px, calc(100vw - 28px));
  display: grid;
  gap: 8px;
}

.v9-flash,
.flash.v9-flash {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--v9-border);
  border-radius: 13px;
  color: #e8e1ef;
  background: rgba(19, 13, 36, 0.96);
  box-shadow: var(--v9-shadow-sm);
  backdrop-filter: blur(18px);
}

.v9-flash.success {
  border-color: rgba(90, 242, 165, 0.23);
}

.v9-flash.error,
.v9-flash.danger {
  border-color: rgba(255, 109, 145, 0.25);
}

.v9-flash.warning {
  border-color: rgba(244, 195, 106, 0.25);
}

.v9-flash button {
  border: 0;
  color: var(--v9-muted);
  background: transparent;
  cursor: pointer;
}

/* ------------------------------------------------------------------
   GLOBAL COMPONENT OVERRIDES
------------------------------------------------------------------- */

body.jugi-v9 .card,
body.jugi-v9 .panel,
body.jugi-v9 .device-card,
body.jugi-v9 .legal-card,
body.jugi-v9 .auth-card,
body.jugi-v9 .dashboard-card,
body.jugi-v9 .settings-card,
body.jugi-v9 .goal-card,
body.jugi-v9 .memory-card,
body.jugi-v9 .reminder-card {
  border: 1px solid var(--v9-border) !important;
  border-radius: var(--v9-radius) !important;
  color: var(--v9-text);
  background:
    linear-gradient(145deg, rgba(21, 14, 41, 0.86), rgba(9, 6, 21, 0.92)) !important;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.022) !important;
}

body.jugi-v9 .card:hover,
body.jugi-v9 .device-card:hover {
  border-color: rgba(194, 126, 255, 0.28) !important;
}

body.jugi-v9 .page-heading,
body.jugi-v9 .page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

body.jugi-v9 .page-heading h1,
body.jugi-v9 .page-header h1 {
  margin: 3px 0 5px;
  font-size: clamp(29px, 4vw, 48px);
  line-height: 1;
}

body.jugi-v9 .page-heading p,
body.jugi-v9 .page-header p {
  max-width: 760px;
  margin: 0;
  color: var(--v9-muted) !important;
}

body.jugi-v9 .eyebrow {
  color: #c58cff !important;
  font-size: 9px !important;
  font-weight: 900 !important;
  letter-spacing: 0.16em !important;
  text-transform: uppercase !important;
}

body.jugi-v9 .button,
body.jugi-v9 button.button,
body.jugi-v9 a.button {
  min-height: 40px;
  border: 1px solid rgba(197, 151, 255, 0.16) !important;
  border-radius: 12px !important;
  color: #d9d0e3 !important;
  background: rgba(255, 255, 255, 0.035) !important;
  box-shadow: none !important;
  font-weight: 720;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease;
}

body.jugi-v9 .button:hover,
body.jugi-v9 button.button:hover,
body.jugi-v9 a.button:hover {
  transform: translateY(-1px);
  border-color: rgba(194, 126, 255, 0.34) !important;
  color: #fff !important;
  background: rgba(130, 61, 220, 0.11) !important;
}

body.jugi-v9 .button.primary,
body.jugi-v9 button.primary,
body.jugi-v9 a.primary,
body.jugi-v9 .button[type="submit"] {
  border-color: rgba(197, 108, 255, 0.36) !important;
  color: #fff !important;
  background:
    linear-gradient(135deg, var(--v9-purple), var(--v9-indigo)) !important;
  box-shadow: 0 12px 30px rgba(106, 47, 239, 0.22) !important;
}

body.jugi-v9 .button.danger,
body.jugi-v9 button.danger {
  border-color: rgba(255, 109, 145, 0.24) !important;
  color: #ff9bb4 !important;
  background: rgba(255, 109, 145, 0.055) !important;
  box-shadow: none !important;
}

body.jugi-v9 input,
body.jugi-v9 textarea,
body.jugi-v9 select {
  width: 100%;
  border: 1px solid rgba(197, 151, 255, 0.14) !important;
  border-radius: 12px !important;
  color: #fff !important;
  background: var(--v9-input) !important;
  box-shadow: none !important;
  caret-color: var(--v9-purple-bright);
}

body.jugi-v9 input::placeholder,
body.jugi-v9 textarea::placeholder {
  color: #665e74 !important;
}

body.jugi-v9 input:focus,
body.jugi-v9 textarea:focus,
body.jugi-v9 select:focus {
  border-color: rgba(197, 108, 255, 0.54) !important;
  box-shadow: 0 0 0 3px rgba(155, 77, 255, 0.08) !important;
  outline: 0 !important;
}

body.jugi-v9 label {
  color: #cfc6d8;
}

body.jugi-v9 hr {
  border-color: rgba(197, 151, 255, 0.09) !important;
}

body.jugi-v9 .muted,
body.jugi-v9 .muted-text,
body.jugi-v9 .subtitle,
body.jugi-v9 .helper-text {
  color: var(--v9-muted) !important;
}

body.jugi-v9 .status-pill,
body.jugi-v9 .badge,
body.jugi-v9 .chip {
  border: 1px solid rgba(197, 151, 255, 0.15) !important;
  border-radius: 999px !important;
  color: #c9b8d9 !important;
  background: rgba(155, 77, 255, 0.075) !important;
}

body.jugi-v9 .status-pill.active,
body.jugi-v9 .status-pill.online,
body.jugi-v9 .badge.success {
  border-color: rgba(90, 242, 165, 0.2) !important;
  color: #8affc3 !important;
  background: rgba(90, 242, 165, 0.055) !important;
}

body.jugi-v9 .status-pill.danger,
body.jugi-v9 .badge.danger {
  border-color: rgba(255, 109, 145, 0.22) !important;
  color: #ff9bb4 !important;
  background: rgba(255, 109, 145, 0.055) !important;
}

body.jugi-v9 .status-pill.paused,
body.jugi-v9 .badge.warning {
  border-color: rgba(244, 195, 106, 0.22) !important;
  color: #f8cf82 !important;
  background: rgba(244, 195, 106, 0.05) !important;
}

body.jugi-v9 table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--v9-border);
  border-radius: var(--v9-radius);
  background: rgba(14, 9, 28, 0.74);
}

body.jugi-v9 th,
body.jugi-v9 td {
  border-bottom: 1px solid rgba(197, 151, 255, 0.08);
  padding: 12px 14px;
  text-align: left;
}

body.jugi-v9 th {
  color: #a594b7;
  background: rgba(155, 77, 255, 0.06);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

body.jugi-v9 td {
  color: #d5cedd;
}

/* ------------------------------------------------------------------
   DASHBOARD / LIST PAGES
------------------------------------------------------------------- */

body.jugi-v9 .dashboard-grid,
body.jugi-v9 .device-grid,
body.jugi-v9 .quick-grid,
body.jugi-v9 .cards-grid,
body.jugi-v9 .form-grid {
  gap: 14px !important;
}

body.jugi-v9 .quick-action,
body.jugi-v9 .memory-row,
body.jugi-v9 .goal-row,
body.jugi-v9 .reminder-row,
body.jugi-v9 .list-row {
  border: 1px solid rgba(197, 151, 255, 0.1) !important;
  border-radius: 13px !important;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.025) !important;
}

body.jugi-v9 .quick-action:hover,
body.jugi-v9 a.quick-action:hover {
  border-color: rgba(194, 126, 255, 0.28) !important;
  background: rgba(130, 61, 220, 0.1) !important;
}

body.jugi-v9 .quick-action > span:first-child {
  color: var(--v9-purple-bright) !important;
  background: rgba(155, 77, 255, 0.1) !important;
}

body.jugi-v9 .empty-state {
  border-color: rgba(197, 151, 255, 0.12) !important;
  color: var(--v9-muted) !important;
  background: rgba(155, 77, 255, 0.035) !important;
}

/* ------------------------------------------------------------------
   CHAT — SIMPLE, CENTERED, FUTURISTIC
------------------------------------------------------------------- */

body.jugi-v9:has(.chat-shell),
body.jugi-v9:has(.chat-page),
body.jugi-v9:has(.chat-layout) {
  overflow: hidden;
}

body.jugi-v9 .chat-shell,
body.jugi-v9 .chat-page,
body.jugi-v9 .chat-layout {
  height: calc(100vh - var(--v9-topbar-height) - 54px);
  min-height: 620px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(197, 151, 255, 0.1) !important;
  border-radius: 21px !important;
  background:
    radial-gradient(circle at 50% 0%, rgba(119, 53, 255, 0.075), transparent 32%),
    rgba(8, 5, 18, 0.58) !important;
  box-shadow: var(--v9-shadow-sm);
}

body.jugi-v9 .chat-header {
  border-bottom: 1px solid rgba(197, 151, 255, 0.08) !important;
  background: rgba(10, 7, 22, 0.62) !important;
  backdrop-filter: blur(16px);
}

body.jugi-v9 .messages,
body.jugi-v9 .chat-messages,
body.jugi-v9 .conversation,
body.jugi-v9 .message-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 30px max(20px, calc((100% - 860px) / 2)) 160px !important;
  scrollbar-width: thin;
  scrollbar-color: rgba(191, 124, 255, 0.22) transparent;
}

body.jugi-v9 .message,
body.jugi-v9 .chat-message,
body.jugi-v9 .message-row {
  width: 100%;
  max-width: 860px;
  margin-inline: auto;
  border: 0 !important;
  background: transparent !important;
}

body.jugi-v9 .message.user,
body.jugi-v9 .chat-message.user,
body.jugi-v9 .message-row.user,
body.jugi-v9 [data-role="user"] {
  display: flex;
  justify-content: flex-end;
}

body.jugi-v9 .message.user .message-content,
body.jugi-v9 .chat-message.user .content,
body.jugi-v9 .message.user .bubble,
body.jugi-v9 [data-role="user"] .message-content {
  max-width: min(76%, 660px);
  border: 1px solid rgba(194, 126, 255, 0.24) !important;
  border-radius: 18px 18px 5px 18px !important;
  color: #fff !important;
  background:
    linear-gradient(135deg, rgba(155, 77, 255, 0.24), rgba(92, 67, 255, 0.12)) !important;
  box-shadow: 0 12px 35px rgba(88, 36, 189, 0.09) !important;
}

body.jugi-v9 .message.assistant .message-content,
body.jugi-v9 .chat-message.assistant .content,
body.jugi-v9 .message.assistant .bubble,
body.jugi-v9 [data-role="assistant"] .message-content {
  max-width: 100%;
  color: #eae5ef !important;
  background: transparent !important;
}

body.jugi-v9 .message-content,
body.jugi-v9 .message .bubble,
body.jugi-v9 .chat-message .content {
  padding: 14px 16px !important;
  line-height: 1.65;
}

body.jugi-v9 .message.assistant::before,
body.jugi-v9 .chat-message.assistant::before {
  content: "";
  width: 28px;
  height: 28px;
  float: left;
  margin: 13px 10px 0 0;
  border-radius: 9px;
  background:
    url("/static/v9/heyjugi-purple-icon.png")
    center / cover no-repeat;
  box-shadow: 0 7px 22px rgba(121, 49, 255, 0.2);
}

body.jugi-v9 .composer,
body.jugi-v9 .chat-composer,
body.jugi-v9 .message-composer,
body.jugi-v9 .chat-input-wrap {
  position: sticky;
  z-index: 8;
  bottom: 0;
  width: min(880px, calc(100% - 28px));
  margin: -125px auto 18px !important;
  padding: 10px !important;
  border: 1px solid rgba(198, 142, 255, 0.23) !important;
  border-radius: 20px !important;
  background:
    linear-gradient(180deg, rgba(21, 13, 43, 0.96), rgba(9, 6, 21, 0.98)) !important;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.46),
    0 0 0 3px rgba(155, 77, 255, 0.055),
    0 0 42px rgba(121, 54, 255, 0.13) !important;
  backdrop-filter: blur(18px);
}

body.jugi-v9 .composer textarea,
body.jugi-v9 .composer input,
body.jugi-v9 .chat-composer textarea,
body.jugi-v9 .chat-composer input,
body.jugi-v9 #message-input {
  min-height: 48px;
  max-height: 190px;
  border: 0 !important;
  border-radius: 13px !important;
  background: transparent !important;
  box-shadow: none !important;
  resize: none;
}

body.jugi-v9 .composer button[type="submit"],
body.jugi-v9 .chat-composer button[type="submit"],
body.jugi-v9 .send-button {
  width: 42px;
  height: 42px;
  min-height: 42px;
  border-radius: 13px !important;
  color: #fff !important;
  background:
    linear-gradient(135deg, var(--v9-purple-bright), var(--v9-indigo)) !important;
  box-shadow: 0 10px 26px rgba(106, 46, 239, 0.3) !important;
}

/* ------------------------------------------------------------------
   DEVICES + SECURITY
------------------------------------------------------------------- */

body.jugi-v9 .device-card {
  overflow: hidden;
  transition:
    transform 0.18s ease,
    border-color 0.18s ease;
}

body.jugi-v9 .device-card:hover {
  transform: translateY(-3px);
}

body.jugi-v9 .device-icon,
body.jugi-v9 .security-icon {
  color: #d5a9ff !important;
  background:
    linear-gradient(135deg, rgba(197, 108, 255, 0.18), rgba(92, 67, 255, 0.08)) !important;
}

body.jugi-v9 .security-score,
body.jugi-v9 .score-value {
  color: #e6d1ff !important;
  text-shadow: 0 0 30px rgba(173, 103, 255, 0.36);
}

body.jugi-v9 .severity-critical,
body.jugi-v9 .critical {
  color: #ff90aa !important;
}

body.jugi-v9 .severity-high,
body.jugi-v9 .high {
  color: #ffb08a !important;
}

body.jugi-v9 .severity-medium,
body.jugi-v9 .medium {
  color: #f5d17e !important;
}

body.jugi-v9 .severity-low,
body.jugi-v9 .low {
  color: #a9d1ff !important;
}

/* ------------------------------------------------------------------
   SETTINGS / AUTH / PUBLIC
------------------------------------------------------------------- */

.v9-public-background {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    linear-gradient(150deg, #080511, #05030a 70%);
}

.v9-public-background::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(255,255,255,.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.02) 1px, transparent 1px);
  background-size: 54px 54px;
}

.v9-public-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(75px);
}

.v9-orb-one {
  width: 420px;
  height: 420px;
  right: 4%;
  top: -150px;
  background: rgba(117, 52, 255, 0.28);
}

.v9-orb-two {
  width: 360px;
  height: 360px;
  left: -100px;
  bottom: -130px;
  background: rgba(240, 107, 255, 0.1);
}

body.jugi-v9 .public-shell,
body.jugi-v9 .auth-shell,
body.jugi-v9 .legal-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

body.jugi-v9 .public-nav {
  min-height: 78px;
  border-bottom: 1px solid rgba(197, 151, 255, 0.08);
}

body.jugi-v9 .public-nav .brand-mark,
body.jugi-v9 .auth-brand .brand-mark,
body.jugi-v9 .legal-shell .brand-mark {
  width: 40px !important;
  height: 40px !important;
  font-size: 0 !important;
  border-radius: 13px !important;
  background:
    url("/static/v9/heyjugi-purple-icon.png")
    center / cover no-repeat !important;
  box-shadow:
    0 0 0 1px rgba(210, 166, 255, 0.2),
    0 12px 34px rgba(118, 48, 255, 0.24) !important;
}

body.jugi-v9 .hero,
body.jugi-v9 .landing-hero,
body.jugi-v9 .public-hero {
  min-height: 70vh;
  display: grid;
  align-items: center;
  background:
    radial-gradient(circle at 70% 28%, rgba(154, 72, 255, 0.2), transparent 24%),
    transparent !important;
}

body.jugi-v9 .hero h1,
body.jugi-v9 .landing-hero h1,
body.jugi-v9 .public-hero h1 {
  max-width: 900px;
  font-size: clamp(48px, 8vw, 96px) !important;
  line-height: 0.92 !important;
  letter-spacing: -0.065em !important;
}

body.jugi-v9 .auth-card {
  width: min(500px, 100%);
  margin: 8vh auto;
  padding: 30px !important;
  backdrop-filter: blur(18px);
}

body.jugi-v9 .legal-card {
  margin: 30px auto 70px;
  padding: clamp(24px, 5vw, 52px) !important;
}

body.jugi-v9 .legal-card h2 {
  margin-top: 30px;
  color: #ded1e9;
}

body.jugi-v9 .legal-card p,
body.jugi-v9 .legal-card li {
  color: #b8afc2;
  line-height: 1.72;
}

/* ------------------------------------------------------------------
   COMMAND PALETTE
------------------------------------------------------------------- */

.v9-command-palette[hidden] {
  display: none;
}

.v9-command-palette {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: start center;
  padding-top: min(15vh, 140px);
}

.v9-command-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 2, 8, 0.74);
  backdrop-filter: blur(13px);
  cursor: default;
}

.v9-command-dialog {
  position: relative;
  width: min(680px, calc(100% - 28px));
  overflow: hidden;
  border: 1px solid rgba(204, 153, 255, 0.25);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(25, 16, 49, 0.99), rgba(8, 5, 19, 0.99));
  box-shadow:
    0 35px 130px rgba(0, 0, 0, 0.68),
    0 0 70px rgba(117, 47, 255, 0.12);
}

.v9-command-input-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 11px;
  padding: 14px 15px;
  border-bottom: 1px solid rgba(197, 151, 255, 0.1);
}

.v9-command-input-row > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(135deg, var(--v9-purple-bright), var(--v9-indigo));
  box-shadow: 0 9px 24px rgba(116, 49, 255, 0.26);
}

.v9-command-input-row input {
  min-height: 44px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font-size: 15px;
}

.v9-command-input-row kbd {
  border: 1px solid var(--v9-border);
  border-radius: 8px;
  color: var(--v9-muted);
  background: rgba(255, 255, 255, 0.035);
  padding: 4px 7px;
  font-family: inherit;
  font-size: 9px;
}

.v9-command-results {
  max-height: min(52vh, 480px);
  overflow-y: auto;
  padding: 8px;
}

.v9-command-result {
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: #ddd5e5;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.v9-command-result:hover,
.v9-command-result.is-selected {
  border-color: rgba(197, 151, 255, 0.15);
  color: #fff;
  background: rgba(144, 67, 236, 0.1);
}

.v9-command-result-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #d1a0ff;
  background: rgba(155, 77, 255, 0.1);
}

.v9-command-result strong,
.v9-command-result small {
  display: block;
}

.v9-command-result strong {
  font-size: 11px;
}

.v9-command-result small {
  color: var(--v9-muted-2);
  font-size: 9px;
}

.v9-command-result > kbd {
  color: #675e75;
  font-size: 9px;
}

.v9-command-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 14px;
  border-top: 1px solid rgba(197, 151, 255, 0.08);
  color: #6e657b;
  font-size: 8px;
}

/* ------------------------------------------------------------------
   RESPONSIVE
------------------------------------------------------------------- */

@media (max-width: 980px) {
  .v9-app-shell,
  .app-shell.v9-app-shell {
    grid-template-columns: 1fr;
  }

  .v9-sidebar,
  .sidebar.v9-sidebar {
    transform: translateX(-105%);
    transition: transform 0.2s ease;
  }

  body.v9-sidebar-open .v9-sidebar {
    transform: translateX(0);
  }

  .v9-sidebar-close {
    display: grid;
    place-items: center;
  }

  .v9-sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    border: 0;
    background: rgba(2, 1, 6, 0.7);
    opacity: 0;
    visibility: hidden;
    backdrop-filter: blur(7px);
    transition:
      opacity 0.2s ease,
      visibility 0.2s ease;
  }

  body.v9-sidebar-open .v9-sidebar-scrim {
    opacity: 1;
    visibility: visible;
  }

  .v9-main-shell,
  .main-shell.v9-main-shell {
    grid-column: 1;
  }

  .v9-mobile-menu {
    display: grid;
    place-items: center;
  }

  .v9-topbar-logo {
    display: flex;
  }

  .v9-command-trigger {
    width: 44px;
    height: 39px;
    display: grid;
    place-items: center;
    padding: 0;
  }

  .v9-command-trigger span {
    display: none;
  }

  .v9-command-trigger::before {
    content: "⌕";
    color: #b8acc5;
    font-size: 18px;
  }

  .v9-command-trigger kbd {
    display: none;
  }

  .v9-status span:last-child {
    display: none;
  }
}

@media (max-width: 640px) {
  :root {
    --v9-topbar-height: 62px;
  }

  .v9-topbar,
  .topbar.v9-topbar {
    min-height: var(--v9-topbar-height);
    padding: 0 12px;
  }

  .v9-topbar-logo span {
    display: none;
  }

  .v9-page,
  .page.v9-page {
    width: min(100% - 22px, var(--v9-content-width));
    padding-top: 16px;
  }

  .v9-status {
    display: none;
  }

  body.jugi-v9 .page-heading,
  body.jugi-v9 .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  body.jugi-v9 .messages,
  body.jugi-v9 .chat-messages,
  body.jugi-v9 .conversation,
  body.jugi-v9 .message-list {
    padding-inline: 12px !important;
  }

  body.jugi-v9 .message.user .message-content,
  body.jugi-v9 .chat-message.user .content,
  body.jugi-v9 .message.user .bubble {
    max-width: 88%;
  }

  .v9-flashes {
    top: 70px;
    right: 11px;
  }
}

/* ------------------------------------------------------------------
   REDUCED MOTION
------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
/* ==================================================================
   HEYJUGI V9.1 — INTERACTION + FUTURE POLISH
================================================================== */

body.v9-1-polished {
  font-size: 16px;
}

body.v9-1-polished::after {
  content: "";
  position: fixed;
  inset: -20% -15%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.55;
  background:
    radial-gradient(circle at 75% 15%, rgba(162, 78, 255, 0.16), transparent 23%),
    radial-gradient(circle at 22% 80%, rgba(92, 67, 255, 0.10), transparent 25%),
    conic-gradient(
      from 205deg at 50% 50%,
      transparent,
      rgba(197, 108, 255, 0.035),
      transparent 28%,
      rgba(101, 217, 255, 0.025),
      transparent 55%
    );
  filter: blur(12px);
  animation: v9AuroraDrift 18s ease-in-out infinite alternate;
}

@keyframes v9AuroraDrift {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(1.5%, 1.2%, 0) scale(1.04);
  }
}

body.v9-1-polished .v9-sidebar::after {
  content: "";
  position: absolute;
  inset: 0 0 0 auto;
  width: 1px;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      transparent,
      rgba(197, 108, 255, 0.52) 24%,
      rgba(92, 67, 255, 0.20) 67%,
      transparent
    );
  box-shadow: 0 0 24px rgba(155, 77, 255, 0.24);
}

body.v9-1-polished .v9-brand-copy strong {
  font-size: 17px;
}

body.v9-1-polished .v9-brand-copy small {
  font-size: 9.5px;
}

body.v9-1-polished .v9-new-chat {
  min-height: 48px;
}

body.v9-1-polished .v9-new-chat strong {
  font-size: 12.5px;
}

body.v9-1-polished .v9-nav-label {
  font-size: 9px;
}

body.v9-1-polished .nav-item {
  min-height: 42px;
  font-size: 12.5px;
}

body.v9-1-polished .v9-nav-icon {
  width: 27px;
  height: 27px;
  font-size: 14px;
}

body.v9-1-polished .v9-topbar {
  min-height: 74px;
  background:
    linear-gradient(
      180deg,
      rgba(10, 6, 22, 0.94),
      rgba(8, 5, 18, 0.78)
    );
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.12),
    inset 0 -1px 0 rgba(194, 126, 255, 0.035);
}

body.v9-1-polished .v9-command-trigger {
  width: min(390px, 35vw);
  min-height: 42px;
  font-size: 12px;
}

body.v9-1-polished .v9-status {
  min-height: 40px;
  font-size: 11px;
}

body.v9-1-polished .v9-page {
  padding-top: 32px;
}

body.v9-1-polished .page-heading h1,
body.v9-1-polished .page-header h1 {
  font-size: clamp(34px, 4.5vw, 54px);
}

body.v9-1-polished .page-heading p,
body.v9-1-polished .page-header p {
  font-size: 15.5px;
  line-height: 1.62;
}

body.v9-1-polished .eyebrow {
  font-size: 10px !important;
}

body.v9-1-polished .card,
body.v9-1-polished .panel,
body.v9-1-polished .device-card,
body.v9-1-polished .legal-card,
body.v9-1-polished .auth-card,
body.v9-1-polished .dashboard-card,
body.v9-1-polished .settings-card,
body.v9-1-polished .goal-card,
body.v9-1-polished .memory-card,
body.v9-1-polished .reminder-card {
  position: relative;
  overflow: hidden;
}

body.v9-1-polished .card::before,
body.v9-1-polished .panel::before,
body.v9-1-polished .device-card::before,
body.v9-1-polished .dashboard-card::before {
  content: "";
  position: absolute;
  inset: 0 14% auto;
  height: 1px;
  pointer-events: none;
  opacity: 0.75;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(197, 108, 255, 0.55),
      transparent
    );
}

body.v9-1-polished .card:hover,
body.v9-1-polished .panel:hover,
body.v9-1-polished .device-card:hover {
  box-shadow:
    0 24px 74px rgba(0, 0, 0, 0.24),
    0 0 42px rgba(137, 58, 255, 0.07) !important;
}

body.v9-1-polished .card h2,
body.v9-1-polished .panel h2,
body.v9-1-polished .device-card h2 {
  font-size: clamp(18px, 1.7vw, 23px);
}

body.v9-1-polished .card p,
body.v9-1-polished .panel p,
body.v9-1-polished .device-card p,
body.v9-1-polished .quick-action,
body.v9-1-polished .memory-row,
body.v9-1-polished .goal-row,
body.v9-1-polished .reminder-row {
  font-size: 14px;
}

body.v9-1-polished .button,
body.v9-1-polished button.button,
body.v9-1-polished a.button {
  min-height: 43px;
  padding: 10px 15px;
  font-size: 12.5px;
}

body.v9-1-polished input,
body.v9-1-polished textarea,
body.v9-1-polished select {
  min-height: 44px;
  font-size: 14.5px;
}

body.v9-1-polished label {
  font-size: 13px;
}

/* Command palette fixes and larger typography. */
body.v9-command-open {
  overflow: hidden;
}

.v9-command-palette {
  z-index: 500;
  pointer-events: none;
}

.v9-command-backdrop {
  z-index: 0;
  pointer-events: auto;
}

.v9-command-dialog {
  z-index: 2;
  pointer-events: auto;
  width: min(760px, calc(100% - 28px));
  border-radius: 24px;
  border-color: rgba(205, 151, 255, 0.34);
  box-shadow:
    0 42px 160px rgba(0, 0, 0, 0.78),
    0 0 0 1px rgba(197, 108, 255, 0.07),
    0 0 100px rgba(117, 47, 255, 0.18);
}

.v9-command-dialog::before {
  content: "";
  position: absolute;
  inset: 0 16% auto;
  height: 1px;
  pointer-events: none;
  background:
    linear-gradient(
      90deg,
      transparent,
      rgba(218, 171, 255, 0.75),
      transparent
    );
}

.v9-command-input-row {
  padding: 17px 18px;
}

.v9-command-input-row > span {
  width: 41px;
  height: 41px;
  border-radius: 13px;
  font-size: 17px;
}

.v9-command-input-row input {
  min-height: 50px;
  font-size: 17px;
}

.v9-command-results {
  max-height: min(58vh, 560px);
  padding: 10px;
}

.v9-command-result {
  min-height: 64px;
  padding: 11px 13px;
  border-radius: 15px;
  text-decoration: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
  transition:
    transform 0.14s ease,
    border-color 0.14s ease,
    background 0.14s ease;
}

.v9-command-result:hover,
.v9-command-result.is-selected,
.v9-command-result:focus-visible {
  transform: translateX(2px);
  border-color: rgba(207, 153, 255, 0.27);
  background:
    linear-gradient(
      90deg,
      rgba(155, 77, 255, 0.17),
      rgba(92, 67, 255, 0.055)
    );
}

.v9-command-result-icon {
  width: 39px;
  height: 39px;
  border-radius: 12px;
  font-size: 15px;
}

.v9-command-result strong {
  font-size: 13.5px;
}

.v9-command-result small {
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.35;
}

.v9-command-footer {
  padding: 11px 16px;
  font-size: 9.5px;
}

/* Chat readability. */
body.v9-1-polished .message-content,
body.v9-1-polished .message .bubble,
body.v9-1-polished .chat-message .content {
  font-size: 15.5px;
  line-height: 1.72;
}

body.v9-1-polished .composer,
body.v9-1-polished .chat-composer,
body.v9-1-polished .message-composer,
body.v9-1-polished .chat-input-wrap {
  width: min(940px, calc(100% - 28px));
  border-color: rgba(204, 145, 255, 0.30) !important;
  box-shadow:
    0 28px 86px rgba(0, 0, 0, 0.54),
    0 0 0 3px rgba(155, 77, 255, 0.065),
    0 0 58px rgba(121, 54, 255, 0.17) !important;
}

body.v9-1-polished #message-input,
body.v9-1-polished .composer textarea,
body.v9-1-polished .chat-composer textarea {
  font-size: 15.5px;
}

/* Workspace typography. */
body.workspace-v8-active.v9-1-polished .future-title-lockup h1 {
  font-size: clamp(40px, 5vw, 68px);
}

body.workspace-v8-active.v9-1-polished .future-title-lockup p {
  font-size: 16px;
}

body.workspace-v8-active.v9-1-polished .future-command input {
  font-size: 16.5px;
}

body.workspace-v8-active.v9-1-polished .future-panel-heading h2 {
  font-size: 20px;
}

body.workspace-v8-active.v9-1-polished .future-action strong,
body.workspace-v8-active.v9-1-polished .future-project-copy strong,
body.workspace-v8-active.v9-1-polished .future-device-list strong,
body.workspace-v8-active.v9-1-polished .future-create-grid strong,
body.workspace-v8-active.v9-1-polished .future-automation-list strong {
  font-size: 13px;
}

body.workspace-v8-active.v9-1-polished .future-action small,
body.workspace-v8-active.v9-1-polished .future-project-copy small,
body.workspace-v8-active.v9-1-polished .future-device-list small,
body.workspace-v8-active.v9-1-polished .future-create-grid small,
body.workspace-v8-active.v9-1-polished .future-automation-list small {
  font-size: 10px;
}

body.workspace-v8-active.v9-1-polished .future-panel {
  border-color: rgba(204, 148, 255, 0.18);
}

body.workspace-v8-active.v9-1-polished .future-panel:hover {
  border-color: rgba(205, 136, 255, 0.32);
  box-shadow:
    0 26px 82px rgba(0, 0, 0, 0.25),
    0 0 48px rgba(137, 58, 255, 0.09);
}

@media (max-width: 640px) {
  body.v9-1-polished {
    font-size: 15.5px;
  }

  .v9-command-dialog {
    width: calc(100% - 18px);
    border-radius: 18px;
  }

  .v9-command-input-row input {
    font-size: 15px;
  }

  .v9-command-result {
    min-height: 60px;
  }

  body.workspace-v8-active.v9-1-polished .future-title-lockup h1 {
    font-size: 39px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.v9-1-polished::after {
    animation: none;
  }
}
