:root {
  --bg-page: #eef5ef;
  --bg-page-deep: #dce9de;
  --bg-page-core: #cddfcf;
  --bg-sidebar: #053230;
  --bg-sidebar-deep: #031d1c;
  --bg-sidebar-glass: rgba(6, 49, 45, 0.8);
  --bg-surface: #f9fcf9;
  --bg-surface-soft: #eef5ee;
  --bg-surface-strong: #ffffff;
  --bg-surface-float: rgba(255, 255, 255, 0.76);
  --line-soft: #c8d7cb;
  --line-strong: #90a594;
  --line-accent: rgba(15, 143, 122, 0.32);
  --ink-primary: #102c28;
  --ink-muted: #49665d;
  --ink-soft: #5f7f74;
  --accent: #0f8f7a;
  --accent-hover: #0d7f6c;
  --accent-strong: #096152;
  --accent-soft: rgba(15, 143, 122, 0.12);
  --accent-glow: rgba(15, 143, 122, 0.32);
  --accent-glow-strong: rgba(15, 143, 122, 0.48);
  --warn: #a86428;
  --warn-soft: rgba(168, 100, 40, 0.12);
  --danger: #b23d3d;
  --danger-soft: rgba(178, 61, 61, 0.12);
  --ok: #1e7a4e;
  --ok-soft: rgba(30, 122, 78, 0.12);
  --shadow-xs: 0 2px 8px rgba(6, 34, 29, 0.05);
  --shadow-sm: 0 8px 20px rgba(6, 34, 29, 0.08), 0 1px 0 rgba(255, 255, 255, 0.78) inset;
  --shadow-md: 0 16px 34px rgba(6, 34, 29, 0.12), 0 1px 0 rgba(255, 255, 255, 0.82) inset;
  --shadow-lg: 0 24px 58px rgba(6, 34, 29, 0.16), 0 1px 0 rgba(255, 255, 255, 0.86) inset;
  --shadow-accent: 0 10px 30px rgba(15, 143, 122, 0.26);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-2xl: 30px;
  --font-sans: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", Menlo, Monaco, monospace;
  --type-display: clamp(1.65rem, 2.8vw, 2.45rem);
  --type-title: clamp(1.1rem, 1.5vw, 1.32rem);
  --type-body: 0.93rem;
  --type-label: 0.71rem;
  --transition-short: 120ms;
  --transition-default: 220ms;
  --transition-long: 420ms;
  --curve-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --curve-cubic: cubic-bezier(0.65, 0.05, 0.36, 1);
  --curve-quart: cubic-bezier(0.77, 0, 0.18, 1);
  --curve-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: var(--transition-default) var(--curve-out);
  --ease-cubic: var(--curve-cubic);
  --ease-quart: var(--curve-quart);
  --ease-spring: 300ms var(--curve-spring);
  --motion-fast: var(--transition-short) var(--curve-out);
  --motion-base: var(--transition-default) var(--curve-out);
  --motion-slow: var(--transition-long) var(--curve-cubic);
  --mouse-x: 50vw;
  --mouse-y: 50vh;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-primary);
  background:
    radial-gradient(150% 90% at 92% -18%, rgba(13, 143, 122, 0.14) 0%, rgba(13, 143, 122, 0.04) 40%, transparent 68%),
    radial-gradient(110% 72% at 10% 2%, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.45) 40%, transparent 72%),
    radial-gradient(88% 88% at 50% 110%, rgba(5, 67, 56, 0.12) 0%, transparent 75%),
    linear-gradient(170deg, var(--bg-page) 0%, var(--bg-page-deep) 44%, var(--bg-page-core) 100%);
}

body {
  position: relative;
  overflow-x: hidden;
  font-size: var(--type-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-atmosphere {
  position: fixed;
  inset: -8vh -6vw;
  pointer-events: none;
  z-index: 0;
}

.app-grain-overlay {
  position: absolute;
  inset: -4px;
  opacity: 0.13;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(15, 44, 40, 0.18) 0.7px, transparent 0.9px);
  background-size: 3px 3px;
  mix-blend-mode: multiply;
}

.app-orb {
  position: absolute;
  width: 38vw;
  max-width: 640px;
  aspect-ratio: 1;
  border-radius: 999px;
  filter: blur(44px);
  opacity: 0.34;
  animation: orb-float 18s var(--ease-cubic) infinite alternate;
}

.app-orb-a {
  top: -12%;
  right: -12%;
  background:
    radial-gradient(circle at 42% 40%, rgba(17, 163, 138, 0.44) 0%, rgba(17, 163, 138, 0.18) 42%, transparent 76%);
}

.app-orb-b {
  bottom: -24%;
  left: -8%;
  width: 42vw;
  background:
    radial-gradient(circle at 52% 46%, rgba(4, 70, 57, 0.22) 0%, rgba(4, 70, 57, 0.07) 40%, transparent 78%);
  animation-duration: 24s;
}

@keyframes orb-float {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(2.2%, -2.4%, 0) scale(1.06); }
}

.ambient-glow {
  position: fixed;
  inset: -8% -6%;
  pointer-events: none;
  background:
    radial-gradient(circle at 14% 24%, rgba(255, 255, 255, 0.44) 0, rgba(255, 255, 255, 0.08) 38%, transparent 62%),
    radial-gradient(circle at 86% 10%, rgba(43, 165, 140, 0.14) 0, rgba(43, 165, 140, 0.02) 42%, transparent 70%),
    radial-gradient(circle at 58% 104%, rgba(8, 88, 73, 0.13) 0, transparent 64%);
  z-index: 0;
  animation: ambient-pulse 14s var(--ease-cubic) infinite alternate;
}

@keyframes ambient-pulse {
  0% { transform: scale(1); opacity: 0.74; }
  100% { transform: scale(1.04); opacity: 1; }
}

.ambient-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.64;
}

button,
input,
textarea,
label,
select,
summary {
  font: inherit;
}

input,
textarea,
select,
button {
  color: inherit;
}

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

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

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  backdrop-filter: saturate(1.04);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--bg-sidebar) 0%, var(--bg-sidebar-deep) 100%);
  border-right: 1px solid rgba(180, 210, 200, 0.12);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.06);
}

.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.05) 3px,
    transparent 4px
  );
  z-index: 10;
  opacity: 0.4;
}

.sidebar-scroll {
  position: relative;
  z-index: 11;
  height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px 20px 20px;
}

.brand-block {
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(200, 230, 218, 0.2);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 11px;
  color: rgba(230, 248, 239, 0.72);
}

.brand-block h1 {
  margin: 8px 0 0;
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  background: linear-gradient(135deg, #ffffff 0%, #a4e6ce 100%);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  text-shadow: 0 2px 10px rgba(164, 230, 206, 0.2);
}

.brand-copy {
  margin: 10px 0 0;
  color: rgba(220, 242, 234, 0.82);
  font-size: 0.82rem;
  line-height: 1.5;
}

.sidebar-card {
  background: rgba(233, 249, 242, 0.07);
  border: 1px solid rgba(226, 245, 236, 0.22);
  border-radius: var(--radius-md);
  padding: 12px;
  color: rgba(232, 249, 240, 0.9);
}

.sidebar-focus-card {
  text-align: center;
}

.sidebar-kicker {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: rgba(232, 249, 240, 0.68);
}

.sidebar-card h3 {
  margin: 8px 0 0;
  font-size: 0.9rem;
  line-height: 1.35;
  color: #eefaf4;
}

.sidebar-card p {
  margin: 8px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(232, 249, 240, 0.78);
}

.sidebar-focus-picker {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  text-align: left;
}

.sidebar-focus-picker span {
  font: 600 11px/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(232, 249, 240, 0.72);
}

.sidebar-focus-picker select {
  width: 100%;
  border: 1px solid rgba(231, 248, 240, 0.3);
  background: rgba(4, 25, 22, 0.36);
  color: #effdf6;
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  font: 500 12px/1.35 var(--font-mono);
}

.sidebar-focus-picker select:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.sidebar-inline-note {
  margin: 8px 0 0;
  color: rgba(232, 249, 240, 0.66);
  font-size: 0.72rem;
  line-height: 1.4;
}

.sidebar-company-card {
  margin-top: 2px;
}

.sidebar-company-stats {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.sidebar-company-stat {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: rgba(232, 249, 240, 0.82);
}

.sidebar-company-stat strong {
  color: #eefaf4;
  font-weight: 600;
}

.sidebar-company-info {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(226, 245, 236, 0.2);
  border-radius: var(--radius-sm);
  background: rgba(4, 25, 22, 0.32);
  max-height: 240px;
  overflow-y: auto;
  font-size: 0.72rem;
  line-height: 1.5;
  color: rgba(232, 249, 240, 0.72);
}

.sidebar-company-info::-webkit-scrollbar {
  width: 6px;
}

.sidebar-company-info::-webkit-scrollbar-track {
  background: rgba(233, 249, 242, 0.05);
}

.sidebar-company-info::-webkit-scrollbar-thumb {
  background: rgba(226, 245, 236, 0.2);
  border-radius: 3px;
}

.sidebar-company-info::-webkit-scrollbar-thumb:hover {
  background: rgba(226, 245, 236, 0.3);
}

.sidebar-company-info h1,
.sidebar-company-info h2,
.sidebar-company-info h3 {
  margin: 12px 0 6px;
  color: rgba(232, 249, 240, 0.9);
  font-weight: 600;
}

.sidebar-company-info h1 {
  font-size: 0.9rem;
  margin-top: 0;
}

.sidebar-company-info h2 {
  font-size: 0.82rem;
}

.sidebar-company-info h3 {
  font-size: 0.76rem;
}

.sidebar-company-info p {
  margin: 6px 0;
  color: rgba(232, 249, 240, 0.72);
}

.sidebar-company-info ul,
.sidebar-company-info ol {
  margin: 6px 0;
  padding-left: 18px;
  color: rgba(232, 249, 240, 0.72);
}

.sidebar-company-info li {
  margin: 4px 0;
}

.sidebar-company-info code {
  background: rgba(1, 20, 17, 0.4);
  border: 1px solid rgba(230, 248, 239, 0.2);
  border-radius: 4px;
  padding: 2px 5px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: rgba(240, 255, 248, 0.85);
}

.sidebar-company-info pre {
  background: rgba(1, 20, 17, 0.5);
  border: 1px solid rgba(230, 248, 239, 0.2);
  border-radius: 6px;
  padding: 8px;
  margin: 8px 0;
  overflow-x: auto;
}

.sidebar-company-info pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.68rem;
}

.sidebar-company-info a {
  color: rgba(13, 138, 117, 0.9);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sidebar-company-info a:hover {
  color: rgba(13, 138, 117, 1);
}

#sidebarStatsContent {
  margin: 10px 0 0;
  display: grid;
  gap: 6px;
}

.sidebar-stat {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(232, 249, 240, 0.82);
}

.sidebar-stat strong {
  color: #eefaf4;
  font-weight: 600;
}

.shortcut-list {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.shortcut-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.76rem;
  color: rgba(232, 249, 240, 0.82);
}

kbd {
  border: 1px solid rgba(230, 248, 239, 0.34);
  border-bottom-color: rgba(230, 248, 239, 0.5);
  background: rgba(1, 20, 17, 0.4);
  border-radius: 6px;
  padding: 2px 6px;
  font: 500 11px/1.25 var(--font-mono);
  color: #f0fff8;
  white-space: nowrap;
}

.stack-field {
  display: grid;
  gap: 7px;
}

.stack-field label {
  color: rgba(234, 250, 242, 0.9);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stack-field input {
  width: 100%;
  border: 1px solid rgba(231, 248, 240, 0.3);
  background: rgba(4, 25, 22, 0.36);
  color: #effdf6;
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  font: 500 12px/1.35 var(--font-mono);
}

.stack-field input::placeholder {
  color: rgba(225, 244, 235, 0.52);
}

.main {
  padding: 28px clamp(16px, 3.2vw, 40px);
  display: grid;
  align-content: start;
  gap: 22px;
}

.animate-stagger {
  animation: cascade-in 0.5s var(--curve-out) both;
  animation-delay: calc(var(--stagger-idx, 0) * 56ms);
}

@keyframes cascade-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
    filter: blur(1.5px);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

.view {
  display: grid;
  gap: 20px;
  animation: view-fade 260ms var(--curve-out);
}

@keyframes view-fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.hidden {
  display: none !important;
}

.view-head {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 20px 24px;
  backdrop-filter: blur(12px);
  transition: box-shadow var(--ease-out);
}

.view-head:hover {
  box-shadow: var(--shadow-md);
}

.view-head h2 {
  margin: 5px 0 0;
  font-size: clamp(1.4rem, 2.5vw, 2.05rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
}

.view-subcopy {
  margin: 10px 0 0;
  color: var(--ink-muted);
  font-size: 0.88rem;
}

.kicker {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.69rem;
  color: var(--ink-soft);
}

.project-head {
  position: sticky;
  top: 10px;
  z-index: 6;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.project-ai-automation-toggle {
  min-width: 210px;
  padding: 8px 10px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
}

.project-ai-automation-toggle .toggle-row {
  justify-content: space-between;
}

.project-ai-automation-toggle .field-hint {
  font-size: 0.73rem;
  color: var(--ink-muted);
}

.project-ai-automation-toggle input[type="checkbox"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.project-meta {
  margin: 10px 0 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  font-weight: 600;
}

.btn-danger:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}

.btn-danger:focus-visible {
  outline: 2px solid rgba(239, 68, 68, 0.5);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.home-bar {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 18px;
  backdrop-filter: blur(12px);
  transition: box-shadow var(--ease-out);
}

.home-bar:hover {
  box-shadow: var(--shadow-md);
}

.home-bar .field-control.search-field {
  flex: 1;
  min-width: 0;
}

.home-filters {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1.05fr) minmax(190px, 0.84fr) minmax(0, 1fr);
  align-items: stretch;
  padding: 8px;
  border: 1px solid rgba(187, 208, 197, 0.72);
  border-radius: calc(var(--radius-lg) - 1px);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
}

.home-filter-block {
  min-height: 100%;
  border: 1px solid rgba(187, 208, 197, 0.8);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 8px rgba(8, 38, 33, 0.06);
  padding: 8px 9px;
  display: grid;
  gap: 6px;
}

.home-filter-title {
  margin: 0;
  font: 700 10px/1.15 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(72, 101, 91, 0.86);
}

.filter-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(175, 198, 186, 0.82);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: rgba(70, 96, 87, 0.92);
  min-height: 28px;
  padding: 5px 10px;
  font: 700 10px/1.1 var(--font-mono);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color var(--ease-out), box-shadow var(--ease-out), background var(--ease-out), color var(--ease-out), transform var(--ease-out);
}

.filter-chip:hover:not(.active) {
  border-color: rgba(13, 138, 117, 0.46);
  background: rgba(242, 250, 247, 0.94);
  color: var(--ink-primary);
  transform: translateY(-1px);
}

.filter-chip.active {
  border-color: rgba(13, 138, 117, 0.64);
  background: linear-gradient(165deg, rgba(223, 245, 238, 0.94) 0%, rgba(210, 241, 231, 0.9) 100%);
  color: var(--accent-strong);
  box-shadow: 0 3px 10px rgba(13, 138, 117, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.home-industry-field {
  min-width: 0;
  min-height: 100%;
  border: 1px solid rgba(187, 208, 197, 0.8);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 8px rgba(8, 38, 33, 0.06);
  padding: 8px 9px;
}

.home-industry-field span {
  margin-bottom: 2px;
}

.home-industry-field select {
  min-height: 28px;
  border-radius: 9px;
  padding-block: 5px;
}


.field-control {
  display: grid;
  gap: 6px;
  min-width: min(300px, 100%);
}

.field-control span {
  font: 600 11px/1.2 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
}

.search-field {
  flex: 1;
}

.select-field {
  min-width: 180px;
}

.search-field-compact,
.select-field-compact {
  min-width: 0;
}

.search-field-compact {
  flex: 1;
}

.select-field-compact {
  width: 130px;
}

.field-control input,
.field-control select,
.inbound-form textarea,
.field textarea,
.field input,
.field select,
.advanced-block textarea,
.stack-field input {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 10px 11px;
  background: var(--bg-surface-strong);
  color: var(--ink-primary);
  transition: border-color var(--ease-out), box-shadow var(--ease-out), background var(--ease-out);
}

.field-control input,
.field-control select,
.inbound-form textarea,
.field textarea,
.field input,
.advanced-block textarea {
  font: 500 13px/1.4 var(--font-mono);
}

.field-control input:focus,
.field-control select:focus,
.inbound-form textarea:focus,
.field textarea:focus,
.field input:focus,
.field select:focus,
.advanced-block textarea:focus,
.stack-field input:focus {
  outline: none;
  border-color: rgba(13, 138, 117, 0.6);
  box-shadow: 0 0 0 3px rgba(13, 138, 117, 0.12);
}

.metrics-grid {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px auto;
}

.home-company-counter {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  border: 1px solid rgba(183, 205, 192, 0.72);
  background: rgba(255, 255, 255, 0.62);
  font: 700 9px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(78, 105, 95, 0.84);
}

.home-company-counter strong {
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  color: rgba(27, 57, 50, 0.95);
}

.projects-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.project-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), var(--shadow-sm);
  transition: border-color var(--ease-out), box-shadow var(--ease-out), background var(--ease-out);
}

.project-card::before, .thread-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    400px circle at var(--card-mouse-x, 0px) var(--card-mouse-y, 0px),
    rgba(13, 138, 117, 0.08),
    transparent 40%
  );
  opacity: 0;
  transition: opacity 0.5s var(--ease-out);
  z-index: 0;
}

.project-card:hover::before, .thread-item:hover::before {
  opacity: 1;
}

.project-card:hover {
  border-color: rgba(13, 138, 117, 0.35);
  box-shadow: var(--shadow-md);
  background: var(--bg-surface-strong);
}

.project-card-content {
  position: relative;
  z-index: 1;
  border: none;
  padding: 16px 50px 16px 18px;
  background: transparent;
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 10px;
  width: 100%;
  transition: transform var(--ease-spring);
}

.project-card:hover .project-card-content {
  transform: translateY(-3px);
}

.project-card-content:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.project-card h3 {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
  line-height: 1.3;
}

.project-card p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.83rem;
  line-height: 1.45;
}

.project-delete-btn {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background var(--ease-out), border-color var(--ease-out), color var(--ease-out), transform var(--ease-out);
  opacity: 0.7;
}

.project-card:hover .project-delete-btn {
  opacity: 1;
}

.project-delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
  transform: scale(1.1);
}

.project-delete-btn:focus-visible {
  outline: 2px solid rgba(239, 68, 68, 0.5);
  outline-offset: 2px;
  opacity: 1;
}

.empty-state-card {
  border: 2px dashed var(--line-strong);
  background: var(--bg-surface-soft);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  padding: 28px 24px;
  gap: 12px;
  transition: border-color var(--ease-out), background var(--ease-out);
  appearance: none;
  font: inherit;
  text-align: center;
}

.empty-state-card:hover {
  border-color: var(--accent);
  background: rgba(13, 138, 117, 0.04);
}

.empty-state-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.empty-state-card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--ink-primary);
}

.empty-state-card p {
  margin: 0;
  text-align: center;
  color: var(--ink-muted);
  max-width: 36ch;
}

.empty-state-card .empty-state-cta {
  margin-top: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.thread-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.thread-item .thread-line,
.thread-sidebar-item .thread-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.thread-line-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.attention-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d93025;
  box-shadow: 0 0 0 3px rgba(217, 48, 37, 0.16);
  flex: 0 0 10px;
}

.alert-badge {
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  padding: 0 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 11px/1 var(--font-mono);
  color: #ffffff;
  background: #d93025;
  box-shadow: 0 4px 10px rgba(217, 48, 37, 0.28);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font: 600 11px/1 var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
}

.status-chip.active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: rgba(13, 138, 117, 0.3);
}

.status-chip.completed,
.status-chip.audited {
  background: var(--ok-soft);
  color: var(--ok);
  border-color: rgba(30, 122, 78, 0.25);
}

.status-chip.warning {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(168, 100, 40, 0.25);
}

.status-chip.unknown,
.status-chip.error {
  background: rgba(100, 115, 108, 0.12);
  color: var(--ink-muted);
  border-color: rgba(100, 115, 108, 0.2);
}

.status-chip.initializing {
  background: rgba(13, 138, 117, 0.15);
  color: var(--accent-strong);
  border-color: rgba(13, 138, 117, 0.4);
}

.status-chip.management-ai {
  background: rgba(13, 71, 82, 0.08);
  color: rgba(13, 71, 82, 1);
  border-color: rgba(13, 71, 82, 0.12);
}

.status-chip.management-human {
  background: rgba(60, 60, 67, 0.06);
  color: rgba(60, 60, 67, 0.9);
  border-color: rgba(60, 60, 67, 0.08);
}

.project-layout {
  display: grid;
  gap: 16px;
}

.project-layout:has(.contacts-grid-container:not(.hidden)) {
  grid-template-columns: 1fr;
}

.project-layout:has(.threads-sidebar:not(.hidden)) {
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
}

.contacts-grid-container {
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
}

.threads-sidebar {
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 200px);
}

.chat-panel {
  background: var(--bg-surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px;
}

.panel-head {
  margin-bottom: 10px;
}

.panel-head h3 {
  margin: 0;
  font-size: 0.98rem;
}

.panel-subcopy {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.panel-tools {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
  align-items: end;
}

.panel-tools .field-control {
  min-width: 0;
}

.panel-tools .field-control.search-field-compact {
  flex: 1;
}

.panel-tools .field-control.select-field-compact {
  flex: 0 0 auto;
}

.contacts-header {
  margin-bottom: 20px;
}

.contacts-header > div:first-child {
  margin-bottom: 16px;
}

.contacts-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.thread-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  overflow: visible;
}

.thread-card {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.thread-item {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: var(--bg-surface-strong);
  padding: 20px 22px;
  text-align: left;
  display: grid;
  gap: 12px;
  cursor: pointer;
  transition: border-color var(--ease-out), transform var(--ease-out), box-shadow var(--ease-out), background var(--ease-out);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), var(--shadow-sm);
  min-height: 140px;
  min-width: 0;
}

.thread-item > * {
  position: relative;
  z-index: 1;
}

.thread-item:hover {
  border-color: rgba(13, 138, 117, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.thread-item.active {
  border-color: rgba(13, 138, 117, 0.6);
  background: linear-gradient(160deg, rgba(13, 138, 117, 0.12) 0%, rgba(13, 138, 117, 0.04) 100%);
  box-shadow: 0 4px 16px rgba(13, 138, 117, 0.18);
}

.thread-item-static {
  cursor: default;
}

.thread-item-static:hover {
  transform: none;
  box-shadow: var(--shadow-sm);
  border-color: var(--line-soft);
}

.thread-card-archived .thread-item {
  background: linear-gradient(160deg, rgba(120, 130, 126, 0.08) 0%, rgba(120, 130, 126, 0.03) 100%);
}

.thread-item-actions {
  display: flex;
  justify-content: flex-end;
}

.thread-action-btn {
  min-width: 92px;
}

.thread-title {
  margin: 0;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 600;
  color: var(--ink-primary);
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.thread-item .thread-title,
.thread-sidebar-item .thread-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-caption {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.sidebar-header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.thread-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  flex: 1;
}

.thread-sidebar-item {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--bg-surface-strong);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ease-out), background var(--ease-out);
  display: grid;
  gap: 6px;
}

.thread-sidebar-item:hover {
  border-color: var(--line-strong);
  background: var(--bg-surface-soft);
}

.thread-sidebar-item.active {
  border-color: rgba(13, 138, 117, 0.5);
  background: linear-gradient(160deg, rgba(13, 138, 117, 0.08) 0%, rgba(13, 138, 117, 0.02) 100%);
}

.thread-sidebar-item .thread-title {
  font-size: 0.88rem;
}

.thread-sidebar-item .thread-caption {
  font-size: 0.75rem;
}

.chat-panel {
  min-height: 560px;
  display: grid;
}

.chat-empty {
  margin: auto;
  text-align: center;
  max-width: 42ch;
  padding: 32px 24px;
  color: var(--ink-muted);
}

.chat-empty h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.chat-empty p {
  margin: 12px 0 0;
  line-height: 1.5;
  font-size: 0.9rem;
}

.chat-content {
  display: grid;
  gap: 10px;
  grid-template-rows: auto auto 1fr auto;
}

.chat-panel.chat-panel-whatsapp .chat-head {
  background: linear-gradient(180deg, rgba(214, 247, 226, 0.9), rgba(232, 251, 240, 0.9));
  border-color: rgba(37, 113, 72, 0.3);
}

.chat-panel.chat-panel-whatsapp .chat-thread h3,
.chat-panel.chat-panel-whatsapp .chat-meta,
.chat-panel.chat-panel-whatsapp .chat-summary {
  color: #1f5a3c;
}

.chat-panel.chat-panel-whatsapp .inbound-form {
  background: linear-gradient(180deg, #f5fcf7 0%, #ecf9f1 100%);
  border-color: rgba(37, 113, 72, 0.24);
}

.chat-panel.chat-panel-whatsapp .inbound-form label {
  color: #2a6b46;
}

.chat-panel.chat-panel-whatsapp .inbound-form textarea {
  border-color: rgba(37, 113, 72, 0.26);
  background: #ffffff;
}

.chat-panel.chat-panel-whatsapp .inbound-form textarea:focus {
  border-color: rgba(37, 113, 72, 0.46);
  box-shadow: 0 0 0 2px rgba(37, 113, 72, 0.14);
}

.chat-panel.chat-panel-whatsapp .chat-head-actions .btn-secondary {
  background: #e8f8ee;
  border-color: rgba(37, 113, 72, 0.26);
  color: #1f5a3c;
}

.chat-panel.chat-panel-whatsapp .chat-head-actions .btn-secondary:hover:not(:disabled) {
  background: #def4e6;
  border-color: rgba(37, 113, 72, 0.4);
}

.chat-panel.chat-panel-whatsapp #sendInboundBtn.btn-primary {
  background: linear-gradient(165deg, #1f9d5c 0%, #157a45 100%);
  border-color: rgba(21, 122, 69, 0.65);
  box-shadow: 0 4px 14px rgba(21, 122, 69, 0.28);
}

.chat-panel.chat-panel-whatsapp #sendInboundBtn.btn-primary:hover:not(:disabled) {
  background: linear-gradient(165deg, #19874f 0%, #0f6438 100%);
  box-shadow: 0 6px 18px rgba(21, 122, 69, 0.34);
}

.chat-head {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 11px;
  background: var(--bg-surface-strong);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.chat-head h3 {
  margin: 0;
  font-size: 0.97rem;
}

.chat-meta {
  margin: 6px 0 0;
  color: var(--ink-muted);
  font-size: 0.79rem;
  line-height: 1.35;
}

.chat-summary {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.76rem;
}

.chat-summary-copyable {
  cursor: copy;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid rgba(13, 138, 117, 0.28);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(245, 252, 250, 0.95) 0%, rgba(235, 248, 243, 0.95) 100%);
  color: var(--ink-primary);
  font-size: 0.78rem;
  font-weight: 600;
  transition: border-color var(--ease-out), background var(--ease-out), color var(--ease-out), box-shadow var(--ease-out);
}

.chat-summary-copyable::after {
  content: attr(data-copy-label);
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #0b6f5e;
  border: 1px solid rgba(13, 138, 117, 0.38);
  border-radius: 999px;
  background: rgba(13, 138, 117, 0.12);
  padding: 4px 8px;
  flex-shrink: 0;
}

.chat-summary-copyable:hover {
  border-color: rgba(13, 138, 117, 0.45);
  background: #ffffff;
  color: var(--ink-primary);
  box-shadow: 0 0 0 2px rgba(13, 138, 117, 0.12);
}

.chat-summary-copyable:hover::after {
  border-color: rgba(13, 138, 117, 0.52);
  background: rgba(13, 138, 117, 0.18);
}

.chat-summary-copyable.copied::after {
  content: "Copied";
  color: #145d3c;
  border-color: rgba(30, 122, 78, 0.45);
  background: rgba(30, 122, 78, 0.16);
}

.chat-summary-copyable:focus-visible {
  outline: none;
  border-color: rgba(13, 138, 117, 0.55);
  box-shadow: 0 0 0 2px rgba(13, 138, 117, 0.22);
}

.email-thread-link-panel {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 14px 10px 10px;
  background: var(--bg-surface-strong);
  display: grid;
  gap: 8px;
  position: relative;
}

.email-thread-link-close-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  border: 1px solid #b03030;
  border-radius: 999px;
  background: #de4747;
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 1px 4px rgba(176, 48, 48, 0.28);
  transition: background-color var(--ease-out), border-color var(--ease-out), transform var(--ease-out), box-shadow var(--ease-out);
}

.email-thread-link-close-btn:hover:not(:disabled) {
  background: #c93535;
  border-color: #972929;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(151, 41, 41, 0.34);
}

.email-thread-link-close-btn:focus-visible {
  outline: 2px solid #972929;
  outline-offset: 1px;
}

.email-thread-link-panel label {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  padding-right: 32px;
}

.email-thread-link-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.email-thread-link-row input {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  background: var(--bg-surface-soft);
  color: var(--ink-primary);
  font: 500 12px/1.4 var(--font-mono);
}

.chat-head-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.chat-head-primary-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chat-head-danger-actions {
  display: flex;
  justify-content: flex-end;
  padding-left: 12px;
  border-left: 1px dashed rgba(100, 115, 108, 0.35);
}

.transcript {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 12px;
  background: var(--bg-surface-soft);
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  max-height: 47vh;
  scroll-behavior: smooth;
}

.transcript-empty-cta {
  margin: auto;
  width: min(100%, 320px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  padding: 8px 4px;
}

.transcript-empty-cta .empty-note {
  margin: 0;
}

.transcript-first-message-btn {
  min-width: 190px;
}

.transcript.transcript-whatsapp {
  background:
    radial-gradient(circle at 20% 20%, rgba(40, 176, 111, 0.08), transparent 45%),
    radial-gradient(circle at 80% 70%, rgba(8, 106, 163, 0.06), transparent 40%),
    #ece5dd;
  border-color: rgba(18, 32, 50, 0.1);
  border-radius: 12px;
  padding: 12px;
  gap: 7px;
}

.transcript.transcript-whatsapp .wa-row {
  display: flex;
}

.transcript.transcript-whatsapp .wa-row.incoming {
  justify-content: flex-start;
}

.transcript.transcript-whatsapp .wa-row.outgoing {
  justify-content: flex-end;
}

.transcript.transcript-whatsapp .wa-msg {
  max-width: min(76%, 640px);
  border-radius: 10px;
  padding: 8px 10px 24px;
  position: relative;
  border: 1px solid rgba(18, 32, 50, 0.1);
  box-shadow: 0 2px 6px rgba(14, 35, 50, 0.08);
  animation: message-rise 260ms var(--ease-out);
}

.transcript.transcript-whatsapp .wa-msg.incoming {
  background: #ffffff;
}

.transcript.transcript-whatsapp .wa-msg.outgoing {
  background: #d9fdd3;
  border-color: rgba(37, 113, 72, 0.16);
}

.transcript.transcript-whatsapp .wa-sender {
  display: block;
  margin-bottom: 3px;
  color: rgba(22, 41, 54, 0.65);
  font: 700 10px/1.1 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.transcript.transcript-whatsapp .wa-text {
  margin: 0;
  color: #162936;
  font-size: 0.9rem;
  line-height: 1.44;
  white-space: pre-wrap;
}

.transcript.transcript-whatsapp .wa-time {
  position: absolute;
  right: 8px;
  bottom: 4px;
  color: rgba(22, 41, 54, 0.55);
  font: 500 10px/1 var(--font-mono);
}

.message-delivery-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

.message-delivery-chip {
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 3px 8px;
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.message-delivery-chip.undelivered {
  color: #8f2d2d;
  background: rgba(178, 61, 61, 0.1);
  border-color: rgba(178, 61, 61, 0.34);
}

.message-delivery-chip.delivered {
  color: #1a6441;
  background: rgba(34, 125, 84, 0.1);
  border-color: rgba(34, 125, 84, 0.34);
}

.message-delivery-btn {
  padding: 4px 8px;
  font-size: 0.65rem;
}

.transcript-message {
  cursor: pointer;
}

.transcript-message::after {
  content: "⧉";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(20, 50, 80, 0.16);
  background: #ffffff;
  color: #35506d;
  font: 600 12px/22px var(--font-mono);
  text-align: center;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 130ms var(--ease-out), transform 130ms var(--ease-out);
  pointer-events: none;
}

.transcript-message:hover::after,
.transcript-message.editing::after {
  opacity: 1;
  transform: translateY(0);
}

.transcript-message .msg-copy-feedback {
  position: absolute;
  top: -10px;
  right: 10px;
  border-radius: 999px;
  border: 1px solid rgba(20, 50, 80, 0.18);
  background: #ffffff;
  color: #35506d;
  font: 600 10px/1 var(--font-mono);
  letter-spacing: 0.03em;
  padding: 3px 7px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 140ms var(--ease-out), transform 140ms var(--ease-out);
  pointer-events: none;
}

.transcript-message.copied .msg-copy-feedback {
  opacity: 1;
  transform: translateY(0);
}

.message-edit-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 25px;
  height: 25px;
  border-radius: 999px;
  border: 1px solid rgba(20, 50, 80, 0.2);
  background: #ffffff;
  color: #35506d;
  cursor: pointer;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 130ms var(--ease-out), transform 130ms var(--ease-out), background 130ms var(--ease-out);
}

.transcript-message:hover .message-edit-btn,
.transcript-message.editing .message-edit-btn {
  opacity: 1;
  transform: translateY(0);
}

.message-edit-btn:hover {
  background: #edf4ff;
}

.message-editor {
  margin-top: 10px;
  border-top: 1px dashed rgba(20, 50, 80, 0.24);
  padding-top: 9px;
  display: grid;
  gap: 7px;
}

.message-editor-input {
  width: 100%;
  min-height: 84px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink-primary);
  font: 500 13px/1.45 var(--font-mono);
  resize: vertical;
}

.message-editor-input:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 2px rgba(42, 90, 76, 0.12);
}

.message-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.bubble-wrap {
  display: flex;
}

.bubble-wrap.from-me {
  justify-content: flex-end;
}

.bubble-wrap.from-contact {
  justify-content: flex-start;
}

.bubble {
  max-width: min(86%, 640px);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  position: relative;
  border: 1px solid var(--line-soft);
  background: var(--bg-surface-strong);
  display: grid;
  gap: 8px;
  animation: message-rise 260ms var(--ease-out);
}

.bubble.from-me {
  background: linear-gradient(155deg, rgba(13, 138, 117, 0.12) 0%, rgba(13, 138, 117, 0.05) 100%);
  border-color: rgba(13, 138, 117, 0.28);
  box-shadow: 0 1px 2px rgba(13, 138, 117, 0.06);
}

.bubble.from-contact {
  border-color: var(--line-soft);
}

.bubble-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font: 600 11px/1 var(--font-mono);
}

.bubble-text {
  margin: 0;
  color: var(--ink-primary);
  font-size: 0.87rem;
  line-height: 1.48;
  white-space: pre-wrap;
}

.bubble-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-chip {
  border-radius: 999px;
  border: 1px solid var(--line-soft);
  background: #f5f8f2;
  padding: 3px 8px;
  font: 500 10px/1.2 var(--font-mono);
  color: #455b51;
}

.mini-chip.warn {
  border-color: rgba(171, 106, 45, 0.34);
  background: var(--warn-soft);
  color: #7f481f;
}

.mini-chip.ok {
  border-color: rgba(34, 125, 84, 0.34);
  background: var(--ok-soft);
  color: #175f3d;
}

.inbound-form {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  padding: 11px;
  background: var(--bg-surface-strong);
  display: grid;
  gap: 8px;
}

.inbound-form label {
  font-size: 0.77rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.inbound-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 90px;
  max-height: 220px;
}

.field-hint {
  margin: -2px 0 0;
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.inbound-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-muted);
  font-size: 0.79rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 9px 13px;
  cursor: pointer;
  transition: transform var(--ease-out), box-shadow var(--ease-out), background var(--ease-out), border-color var(--ease-out), color var(--ease-out);
  font-size: 0.79rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
}

.btn:disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.btn-primary {
  color: #f0fdf9;
  background: linear-gradient(165deg, var(--accent) 0%, var(--accent-hover) 100%);
  border-color: rgba(10, 99, 85, 0.5);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(165deg, var(--accent-hover) 0%, var(--accent-strong) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-surface-strong);
  border-color: var(--line-soft);
  color: var(--ink-primary);
}

.btn-secondary:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: #ffffff;
  transform: translateY(-1px);
}

.btn.btn-secondary.whatsapp-link-btn {
  background: #0f5b35;
  border-color: #0b4729;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(9, 52, 30, 0.28);
  padding: 12px 18px;
  font-size: 0.93rem;
  font-weight: 700;
}

.btn.btn-secondary.whatsapp-link-btn::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 9px;
  vertical-align: -3px;
  background: currentColor;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M380.9 97.1C339 55.1 283.2 32 224.9 32 104.7 32 8 128.3 8 248.5c0 38.4 10 75.9 29 109L0 480l125.3-36.7c32.6 17.8 69.3 27.2 106.6 27.2h.1c120.2 0 216.9-96.3 216.9-216.5 0-58.2-23.1-114-68-156.9zM224.9 438.6h-.1c-33.7 0-66.8-9-95.6-26l-6.8-4-74.4 21.8 22-72.6-4.4-7.2c-18.5-29.4-28.2-63.4-28.2-98.1 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.7 19.2 130.5 54 34.9 34.8 54.1 81.2 54 130.5-.1 101.8-82.9 184.6-184.6 184.6zm101.2-138.2c-5.5-2.7-32.8-16.1-37.9-18-5.1-1.9-8.8-2.7-12.5 2.7-3.7 5.5-14.3 18-17.5 21.7-3.2 3.7-6.4 4.1-11.9 1.4-32.6-16.3-53.9-29.1-75.4-66-5.7-9.9 5.7-9.2 16.3-30.8 1.8-3.7.9-6.9-.5-9.6-1.4-2.7-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.6 1.4-14.6 6.9-5 5.5-19.2 18.8-19.2 45.9 0 27.1 19.7 53.3 22.4 57 2.7 3.7 38.8 59.3 94.1 83.1 35 15.1 48.6 16.4 66.1 13.8 10.7-1.6 32.8-13.4 37.4-26.3 4.6-12.9 4.6-23.9 3.2-26.2-1.3-2.3-5-3.7-10.5-6.4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512'%3E%3Cpath d='M380.9 97.1C339 55.1 283.2 32 224.9 32 104.7 32 8 128.3 8 248.5c0 38.4 10 75.9 29 109L0 480l125.3-36.7c32.6 17.8 69.3 27.2 106.6 27.2h.1c120.2 0 216.9-96.3 216.9-216.5 0-58.2-23.1-114-68-156.9zM224.9 438.6h-.1c-33.7 0-66.8-9-95.6-26l-6.8-4-74.4 21.8 22-72.6-4.4-7.2c-18.5-29.4-28.2-63.4-28.2-98.1 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.7 19.2 130.5 54 34.9 34.8 54.1 81.2 54 130.5-.1 101.8-82.9 184.6-184.6 184.6zm101.2-138.2c-5.5-2.7-32.8-16.1-37.9-18-5.1-1.9-8.8-2.7-12.5 2.7-3.7 5.5-14.3 18-17.5 21.7-3.2 3.7-6.4 4.1-11.9 1.4-32.6-16.3-53.9-29.1-75.4-66-5.7-9.9 5.7-9.2 16.3-30.8 1.8-3.7.9-6.9-.5-9.6-1.4-2.7-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.6 1.4-14.6 6.9-5 5.5-19.2 18.8-19.2 45.9 0 27.1 19.7 53.3 22.4 57 2.7 3.7 38.8 59.3 94.1 83.1 35 15.1 48.6 16.4 66.1 13.8 10.7-1.6 32.8-13.4 37.4-26.3 4.6-12.9 4.6-23.9 3.2-26.2-1.3-2.3-5-3.7-10.5-6.4z'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.btn.btn-secondary.whatsapp-link-btn:hover:not(:disabled) {
  background: #0c4a2b;
  border-color: #083b22;
  box-shadow: 0 6px 18px rgba(9, 52, 30, 0.34);
}

.btn.btn-secondary.email-link-btn {
  background: #154c78;
  border-color: #113b5d;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
  box-shadow: 0 4px 14px rgba(12, 44, 69, 0.24);
  padding: 12px 18px;
  font-size: 0.9rem;
  font-weight: 700;
}

.btn.btn-secondary.email-link-btn:link,
.btn.btn-secondary.email-link-btn:visited,
.btn.btn-secondary.email-link-btn:active,
.btn.btn-secondary.email-link-btn:focus-visible,
.btn.btn-secondary.email-link-btn:hover {
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.btn.btn-secondary.email-link-btn:hover:not(:disabled) {
  background: #123f63;
  border-color: #0d304b;
  box-shadow: 0 6px 18px rgba(12, 44, 69, 0.3);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-muted);
  border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(66, 96, 86, 0.08);
  color: var(--ink-primary);
}

.btn-back-home {
  padding: 10px 16px;
  font-size: 0.86rem;
  color: var(--ink-primary);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.72);
}

.btn-back-home:hover:not(:disabled) {
  background: #ffffff;
  border-color: var(--ink-soft);
}

.btn-sm {
  padding: 7px 11px;
  font-size: 0.73rem;
}

.btn-xs {
  padding: 5px 9px;
  font-size: 0.67rem;
  border-radius: 999px;
}

.btn-destructive {
  color: #8f2d2d;
  border-color: rgba(178, 61, 61, 0.35);
  background: rgba(178, 61, 61, 0.08);
}

.btn-destructive:hover:not(:disabled) {
  color: #7a2020;
  border-color: rgba(178, 61, 61, 0.52);
  background: rgba(178, 61, 61, 0.14);
  transform: none;
}

.chat-panel.chat-panel-whatsapp .chat-head-danger-actions .btn-destructive {
  color: #8f2d2d;
  border-color: rgba(178, 61, 61, 0.35);
  background: rgba(178, 61, 61, 0.08);
}

.btn-full {
  width: 100%;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

.field-toggle .toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.field-toggle .field-hint {
  margin: 0;
}

.field-toggle input[type="checkbox"] {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(100, 115, 108, 0.45);
  background: rgba(100, 115, 108, 0.2);
  position: relative;
  cursor: pointer;
  transition: background var(--ease-out), border-color var(--ease-out);
  flex: 0 0 auto;
}

.field-toggle input[type="checkbox"]::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform var(--ease-spring);
}

.field-toggle input[type="checkbox"]:checked {
  background: rgba(13, 138, 117, 0.25);
  border-color: rgba(13, 138, 117, 0.55);
}

.field-toggle input[type="checkbox"]:checked::after {
  transform: translateX(18px);
}

.cost-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 4px;
  border: 1px solid rgba(168, 100, 40, 0.35);
  background: var(--warn-soft);
  color: var(--warn);
  font: 700 10px/1 var(--font-mono);
}

.modal {
  border: 0;
  padding: 0;
  border-radius: var(--radius-lg);
  width: min(560px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
  animation: modal-in 220ms var(--ease-spring);
}

.modal::backdrop {
  background: rgba(10, 40, 36, 0.4);
  backdrop-filter: blur(6px);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-card {
  margin: 0;
  padding: 0;
  display: grid;
}

.modal-head,
.modal-foot {
  padding: 12px 14px;
  background: var(--bg-surface-soft);
}

.modal-head {
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-head h3 {
  margin: 0;
}

.modal-body {
  padding: 14px;
  display: grid;
  gap: 10px;
  background: var(--bg-surface-strong);
}

.advanced-block {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 8px 9px;
  background: var(--bg-surface-soft);
}

.advanced-block summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--ink-muted);
}

.advanced-block textarea {
  margin-top: 8px;
  width: 100%;
}

.modal-foot {
  border-top: 1px solid var(--line-soft);
  display: flex;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 420px;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  border: 1px solid rgba(140, 220, 200, 0.35);
  background: linear-gradient(165deg, #0e3d35 0%, #0a312b 100%);
  color: #e8fbf5;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  font-size: 0.84rem;
  line-height: 1.4;
  animation: toast-in 280ms var(--ease-spring);
}

.toast.error {
  background: linear-gradient(165deg, #3d1f1f 0%, #2d1717 100%);
  border-color: rgba(220, 140, 140, 0.4);
  color: #ffebeb;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.empty-note {
  margin: 4px 0 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 40, 36, 0.25);
  backdrop-filter: blur(4px);
  z-index: 70;
  animation: fade-in 150ms ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.loading-card {
  min-width: min(360px, calc(100vw - 32px));
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  text-align: center;
  background: var(--bg-surface-strong);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), var(--shadow-lg);
  animation: loading-pop 220ms var(--ease-spring);
  position: relative;
  overflow: hidden;
}

.loading-card::before {
  content: "";
  position: absolute;
  top: 0; left: -100%; width: 50%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(13, 138, 117, 0.05), transparent);
  animation: typing-shimmer 1.5s infinite linear;
  pointer-events: none;
  z-index: 0;
}

.loading-card > * {
  position: relative;
  z-index: 1;
}

@keyframes loading-pop {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.loading-card p {
  margin: 0;
}

.processing-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  gap: 16px;
}

.processing-state .loading-spinner {
  margin: 0 auto;
}

.processing-state h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.processing-state .empty-note {
  margin: 0;
  color: var(--ink-muted);
}

.loading-spinner {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  margin: 0 auto 14px;
  border: 3px solid rgba(13, 138, 117, 0.1);
  border-top-color: var(--accent);
  border-right-color: rgba(13, 138, 117, 0.4);
  animation: spin 800ms cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loading-spinner-small {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(13, 138, 117, 0.2);
  border-top-color: var(--accent);
  animation: spin 800ms linear infinite;
  vertical-align: middle;
  margin-left: 6px;
}

.project-card.initializing {
  opacity: 0.9;
  position: relative;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes message-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ai-typing-indicator {
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(13, 138, 117, 0.4);
  animation: typing-pulse 1.5s infinite alternate;
}

.ai-typing-indicator::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: typing-shimmer 2s infinite linear;
  pointer-events: none;
  z-index: 10;
}

@keyframes typing-pulse {
  0% { box-shadow: 0 0 0 1px rgba(13, 138, 117, 0.2); }
  100% { box-shadow: 0 0 0 3px rgba(13, 138, 117, 0.6); }
}

@keyframes typing-shimmer {
  0% { left: -100%; }
  100% { left: 200%; }
}

/* Cinematic Premium Visual Layer */

.sidebar {
  background:
    linear-gradient(180deg, rgba(6, 45, 41, 0.98) 0%, rgba(2, 28, 25, 0.98) 68%, rgba(3, 23, 21, 0.99) 100%);
  border-right: 1px solid rgba(184, 224, 208, 0.16);
  box-shadow:
    8px 0 34px rgba(0, 0, 0, 0.16),
    inset -1px 0 0 rgba(174, 224, 205, 0.08);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(140% 90% at 0% 0%, rgba(100, 224, 190, 0.12) 0, transparent 48%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0, transparent 18%);
  z-index: 9;
}

.sidebar::after {
  opacity: 0.28;
}

.sidebar-scroll {
  gap: 16px;
  padding: 24px 20px 22px;
}

.brand-block {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(206, 245, 231, 0.3);
  background:
    linear-gradient(160deg, rgba(223, 250, 240, 0.12) 0%, rgba(116, 219, 191, 0.04) 42%, rgba(5, 43, 39, 0.25) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -8px 24px rgba(0, 0, 0, 0.2),
    0 18px 28px rgba(0, 0, 0, 0.18);
}

.brand-block::after {
  content: "";
  position: absolute;
  inset: -20% -70% auto;
  height: 40%;
  background: linear-gradient(90deg, transparent 0%, rgba(196, 245, 227, 0.22) 35%, transparent 75%);
  transform: rotate(-9deg);
  pointer-events: none;
}

.brand-eyebrow {
  letter-spacing: 0.12em;
  font-size: 10px;
}

.brand-block h1 {
  font-size: clamp(1.46rem, 1.8vw, 1.68rem);
  letter-spacing: -0.03em;
}

.brand-copy {
  font-size: 0.8rem;
  line-height: 1.54;
}

.sidebar-card {
  border-radius: 14px;
  border: 1px solid rgba(226, 245, 236, 0.28);
  background:
    linear-gradient(160deg, rgba(233, 249, 242, 0.11) 0%, rgba(124, 199, 173, 0.05) 45%, rgba(5, 30, 27, 0.23) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.main {
  padding: 30px clamp(16px, 3.2vw, 44px);
  gap: 24px;
}

.view {
  gap: 22px;
  animation: view-fade var(--transition-default) var(--curve-out);
}

.view-head,
.home-bar,
.contacts-grid-container,
.threads-sidebar,
.chat-panel {
  background:
    linear-gradient(166deg, rgba(255, 255, 255, 0.82) 0%, rgba(248, 252, 249, 0.74) 58%, rgba(240, 247, 242, 0.7) 100%);
  border: 1px solid rgba(189, 212, 200, 0.84);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
}

.view-head,
.home-bar {
  border-radius: var(--radius-2xl);
}

.contacts-grid-container,
.threads-sidebar,
.chat-panel {
  border-radius: 20px;
}

.view-head h2 {
  font-size: var(--type-display);
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.project-meta {
  font-size: 0.85rem;
}

.kicker {
  font-size: var(--type-label);
  letter-spacing: 0.12em;
  font-weight: 600;
}

.home-bar {
  padding: 16px 18px;
}

.field-control span,
.field span,
.inbound-form label,
.email-thread-link-panel label {
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  font-weight: 700;
}

.field-control input,
.field-control select,
.inbound-form textarea,
.field textarea,
.field input,
.field select,
.advanced-block textarea,
.stack-field input {
  border: 1px solid rgba(187, 206, 194, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(247, 251, 248, 0.94) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.field-control input:focus,
.field-control select:focus,
.inbound-form textarea:focus,
.field textarea:focus,
.field input:focus,
.field select:focus,
.advanced-block textarea:focus,
.stack-field input:focus {
  border-color: rgba(15, 143, 122, 0.62);
  box-shadow:
    0 0 0 3px rgba(15, 143, 122, 0.15),
    0 6px 16px rgba(15, 143, 122, 0.14);
}

.metrics-grid,
.projects-grid {
  gap: 14px;
}

.project-card,
.thread-item {
  border-color: rgba(183, 205, 192, 0.94);
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.96) 0%, rgba(251, 254, 252, 0.94) 35%, rgba(243, 250, 246, 0.9) 100%);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--motion-base),
    border-color var(--motion-base),
    box-shadow var(--motion-base),
    background var(--motion-slow);
}

.project-card::before,
.thread-item::before {
  background: radial-gradient(
    460px circle at var(--card-mouse-x, 0px) var(--card-mouse-y, 0px),
    rgba(20, 160, 135, 0.2),
    rgba(20, 160, 135, 0.06) 26%,
    transparent 56%
  );
  transition: opacity var(--motion-base);
}

.project-card::after,
.thread-item::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  border: 1px solid rgba(255, 255, 255, 0.72);
  opacity: 0.8;
}

.project-card:hover,
.thread-item:hover {
  transform: translateY(-3px);
  border-color: rgba(15, 143, 122, 0.42);
  box-shadow: var(--shadow-lg);
}

.project-card:hover .project-card-content {
  transform: translateY(-2px);
}

.project-card h3,
.thread-title {
  letter-spacing: -0.018em;
  font-size: var(--type-title);
}

.project-card p,
.thread-caption,
.panel-subcopy,
.chat-meta,
.chat-summary {
  font-size: 0.8rem;
}

.status-chip {
  border: 1px solid rgba(100, 138, 120, 0.3);
  background: rgba(243, 250, 247, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.status-chip.active {
  background: linear-gradient(180deg, rgba(216, 245, 236, 0.96), rgba(190, 239, 224, 0.92));
  border-color: rgba(15, 143, 122, 0.38);
}

.status-chip.completed,
.status-chip.audited {
  background: linear-gradient(180deg, rgba(223, 246, 234, 0.96), rgba(196, 238, 216, 0.92));
}

.status-chip.warning {
  background: linear-gradient(180deg, rgba(250, 236, 219, 0.95), rgba(246, 224, 196, 0.92));
}

.chat-panel {
  min-height: 580px;
}

.chat-head,
.inbound-form,
.email-thread-link-panel,
.transcript {
  border-color: rgba(184, 207, 194, 0.9);
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.93) 0%, rgba(246, 251, 247, 0.93) 100%);
  box-shadow: var(--shadow-xs);
}

.chat-head {
  padding: 13px;
}

.transcript {
  padding: 14px;
  gap: 11px;
  max-height: 50vh;
  background:
    radial-gradient(180% 90% at 0% 0%, rgba(15, 143, 122, 0.06) 0, transparent 48%),
    radial-gradient(120% 90% at 100% 100%, rgba(2, 70, 58, 0.07) 0, transparent 52%),
    linear-gradient(180deg, rgba(244, 251, 247, 0.95) 0%, rgba(238, 247, 241, 0.95) 100%);
}

.transcript.transcript-whatsapp {
  background:
    radial-gradient(circle at 22% 24%, rgba(45, 174, 112, 0.11), transparent 46%),
    radial-gradient(circle at 86% 74%, rgba(8, 106, 163, 0.08), transparent 44%),
    linear-gradient(180deg, #ede8de 0%, #e9e4db 100%);
}

.bubble,
.transcript.transcript-whatsapp .wa-msg {
  border-radius: 13px;
  border-color: rgba(174, 198, 186, 0.9);
  box-shadow:
    0 8px 20px rgba(11, 39, 34, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.bubble.from-me {
  background:
    linear-gradient(162deg, rgba(218, 244, 236, 0.95) 0%, rgba(198, 239, 225, 0.9) 100%);
  border-color: rgba(15, 143, 122, 0.34);
}

.bubble-text {
  font-size: 0.85rem;
  line-height: 1.5;
}

.inbound-form {
  padding: 12px;
}

.btn {
  border-radius: 999px;
  border-color: rgba(183, 206, 193, 0.94);
  padding: 9px 14px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 8px rgba(10, 40, 36, 0.08);
  transition:
    transform var(--motion-fast),
    border-color var(--motion-base),
    box-shadow var(--motion-base),
    background var(--motion-base),
    color var(--motion-base);
}

.btn-primary {
  color: #f2fdf9;
  background: linear-gradient(165deg, var(--accent) 0%, var(--accent-hover) 56%, var(--accent-strong) 100%);
  border-color: rgba(7, 80, 67, 0.55);
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow:
    0 10px 24px var(--accent-glow),
    0 0 0 1px rgba(12, 119, 101, 0.38) inset;
}

.btn-secondary {
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.95) 0%, rgba(247, 251, 248, 0.95) 100%);
}

.btn-secondary:hover:not(:disabled),
.btn-ghost:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(8, 38, 33, 0.1);
}

.modal {
  border-radius: 20px;
  border: 1px solid rgba(188, 211, 199, 0.88);
  box-shadow:
    0 28px 64px rgba(4, 29, 25, 0.22),
    0 1px 0 rgba(255, 255, 255, 0.82) inset;
}

.modal::backdrop {
  background: rgba(6, 37, 32, 0.45);
  backdrop-filter: blur(8px) saturate(1.18);
  -webkit-backdrop-filter: blur(8px) saturate(1.18);
}

.modal-head,
.modal-foot {
  background:
    linear-gradient(170deg, rgba(245, 250, 247, 0.98) 0%, rgba(237, 246, 240, 0.95) 100%);
}

.toast {
  border-color: rgba(172, 229, 209, 0.46);
  background: linear-gradient(165deg, #0d3d35 0%, #0a312a 72%, #082822 100%);
  box-shadow:
    0 18px 42px rgba(4, 32, 27, 0.34),
    0 1px 0 rgba(149, 240, 211, 0.14) inset;
}

.loading-overlay {
  background: rgba(8, 36, 31, 0.3);
}

.loading-card {
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 251, 247, 0.95) 100%);
}

@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .view-head,
  .home-bar,
  .contacts-grid-container,
  .threads-sidebar,
  .chat-panel,
  .chat-head,
  .inbound-form,
  .email-thread-link-panel,
  .transcript {
    background: var(--bg-surface-strong);
  }
}

@media (max-width: 1280px) {
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-industry-field {
    grid-column: 1 / -1;
  }

  .project-layout {
    grid-template-columns: minmax(250px, 300px) minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .app-orb {
    opacity: 0.24;
    filter: blur(34px);
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(200, 236, 222, 0.24);
  }

  .sidebar-scroll {
    height: auto;
  }

  .main {
    padding-top: 18px;
  }

  .project-head {
    position: static;
  }

  .home-filters {
    grid-template-columns: 1fr;
  }

  .home-industry-field {
    grid-column: auto;
  }

  .project-layout {
    grid-template-columns: 1fr !important;
  }

  .thread-list {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  }

  .threads-sidebar {
    max-height: 300px;
  }

  .chat-head {
    flex-direction: column;
  }

  .chat-head-actions {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .chat-head-primary-actions {
    justify-content: flex-start;
  }

  .chat-head-danger-actions {
    margin-left: auto;
  }

}

@media (max-width: 700px) {
  .app-grain-overlay {
    opacity: 0.08;
  }

  .app-orb {
    opacity: 0.16;
  }

  .main {
    padding-inline: 12px;
  }

  .view-head {
    flex-direction: column;
    padding: 15px;
  }

  .head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .head-actions .btn {
    flex: 1;
  }

  .project-ai-automation-toggle {
    width: 100%;
  }

  .project-ai-automation-toggle .toggle-row {
    justify-content: flex-start;
    gap: 12px;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .thread-list {
    grid-template-columns: 1fr;
  }

  .project-layout:has(.threads-sidebar:not(.hidden)) {
    grid-template-columns: 1fr !important;
  }

  .threads-sidebar {
    order: -1;
  }

  .view-toolbar,
  .panel-tools {
    flex-direction: column;
    align-items: stretch;
  }

  .metrics-grid {
    margin-bottom: 6px;
  }

  .home-company-counter {
    padding: 2px 5px;
    font-size: 8px;
  }

  .home-company-counter strong {
    font-size: 10px;
  }

  .home-filters {
    padding: 6px;
    gap: 8px;
  }

  .home-filter-block {
    padding: 7px 8px;
  }

  .home-industry-field {
    padding: 7px 8px;
  }

  .filter-chip {
    flex: 1 1 calc(50% - 6px);
    min-height: 26px;
    justify-content: center;
  }

  .field-control,
  .select-field,
  .select-field-compact {
    width: 100%;
    min-width: 0;
  }

  .inbound-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .inbound-actions .btn {
    width: 100%;
  }

  .transcript {
    max-height: 40vh;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}

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

  .app-orb,
  .ambient-glow,
  .app-grain-overlay,
  .ambient-canvas {
    animation: none !important;
  }

  .app-orb,
  .ambient-canvas {
    opacity: 0 !important;
  }
}

/* UI Elevation #2: Editorial Minimal + Premium Subtle */

#projectView .view-head.project-head {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(178, 199, 188, 0.9);
  background:
    linear-gradient(176deg, rgba(255, 255, 255, 0.84) 0%, rgba(248, 252, 249, 0.76) 100%);
  box-shadow:
    0 10px 30px rgba(6, 34, 29, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.88);
  gap: 16px;
}

#projectView .project-head h2 {
  font-size: clamp(1.75rem, 2.9vw, 2.4rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

#projectView .project-meta {
  margin-top: 9px;
  max-width: 76ch;
  font-size: 0.82rem;
  line-height: 1.45;
  color: rgba(61, 86, 78, 0.92);
}

#projectView #projectKicker {
  margin-top: 10px;
}

#projectView #projectSourceUrlLink {
  color: rgba(84, 112, 102, 0.96);
  text-decoration: none;
  text-underline-offset: 2px;
  word-break: break-all;
}

#projectView #projectSourceUrlLink:hover:not(.is-disabled) {
  text-decoration: underline;
  text-decoration-color: rgba(84, 112, 102, 0.65);
}

#projectView #projectSourceUrlLink:focus-visible {
  outline: 2px solid rgba(69, 110, 96, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

#projectView #projectSourceUrlLink.is-disabled {
  cursor: default;
  color: rgba(84, 112, 102, 0.72);
  pointer-events: none;
}

#projectView .head-actions {
  gap: 9px;
  align-items: flex-end;
}

#projectView .project-ai-automation-toggle {
  min-width: 220px;
  border-radius: 11px;
  border-color: rgba(178, 199, 188, 0.86);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(245, 250, 247, 0.88) 100%);
}

#projectView .project-ai-automation-toggle .field-hint {
  font-size: 0.7rem;
}

#projectView .contacts-grid-container {
  border-radius: 18px;
  padding: 18px 20px;
  border: 1px solid rgba(181, 202, 191, 0.9);
  background:
    linear-gradient(176deg, rgba(255, 255, 255, 0.84) 0%, rgba(247, 252, 249, 0.8) 100%);
  box-shadow:
    0 10px 28px rgba(6, 34, 29, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#projectView .contacts-header {
  margin-bottom: 16px;
}

#projectView .contacts-header > div:first-child {
  margin-bottom: 12px;
}

#projectView .contacts-header h3 {
  font-size: 1.16rem;
  letter-spacing: -0.012em;
}

#projectView .threadsSummary,
#projectView .panel-subcopy {
  font-size: 0.78rem;
  color: rgba(71, 95, 87, 0.9);
}

#projectView .panel-tools {
  margin-bottom: 12px;
  gap: 10px;
}

#projectView .panel-tools .field-control.search-field {
  min-width: 280px;
}

#projectView .thread-list {
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(286px, 1fr));
}

#projectView .thread-card {
  gap: 7px;
}

#projectView .thread-item {
  min-height: 126px;
  padding: 16px 17px;
  gap: 10px;
  border-radius: 14px;
  border-color: rgba(182, 202, 192, 0.92);
  background:
    linear-gradient(174deg, rgba(255, 255, 255, 0.95) 0%, rgba(250, 253, 251, 0.94) 100%);
  box-shadow:
    0 5px 16px rgba(8, 34, 30, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

#projectView .thread-item:hover {
  transform: translateY(-1px);
  border-color: rgba(108, 169, 148, 0.55);
  box-shadow:
    0 10px 24px rgba(8, 34, 30, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

#projectView .thread-item.active {
  border-color: rgba(84, 156, 133, 0.7);
  background:
    linear-gradient(166deg, rgba(228, 247, 240, 0.95) 0%, rgba(217, 242, 233, 0.9) 100%);
  box-shadow:
    0 10px 24px rgba(12, 80, 65, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

#projectView .thread-title {
  font-size: 1.04rem;
  line-height: 1.32;
  letter-spacing: -0.016em;
}

#projectView .thread-caption {
  font-size: 0.79rem;
  line-height: 1.45;
  color: rgba(76, 102, 93, 0.92);
}

#projectView .thread-item-actions {
  margin-top: 1px;
}

#projectView .thread-action-btn {
  min-width: 86px;
}

#projectView .attention-dot {
  width: 8px;
  height: 8px;
  box-shadow: 0 0 0 2px rgba(214, 68, 56, 0.15);
}

#projectView .alert-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 10px;
  box-shadow: 0 3px 8px rgba(217, 48, 37, 0.24);
}

#projectView .status-chip {
  padding: 4px 9px;
  font-size: 10px;
  letter-spacing: 0.04em;
  border-color: rgba(145, 175, 163, 0.34);
  background: rgba(247, 252, 249, 0.86);
}

#projectView .threads-sidebar {
  border-radius: 16px;
  border-color: rgba(180, 201, 191, 0.9);
  padding: 14px;
  background:
    linear-gradient(176deg, rgba(255, 255, 255, 0.85) 0%, rgba(247, 251, 249, 0.82) 100%);
  box-shadow:
    0 8px 22px rgba(8, 34, 30, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#projectView .sidebar-header {
  margin-bottom: 12px;
  padding-bottom: 10px;
}

#projectView .thread-sidebar-list {
  gap: 7px;
}

#projectView .thread-sidebar-item {
  gap: 5px;
  padding: 10px 12px;
  border-radius: 11px;
  border-color: rgba(185, 204, 194, 0.9);
  background:
    linear-gradient(174deg, rgba(255, 255, 255, 0.94) 0%, rgba(249, 253, 251, 0.93) 100%);
}

#projectView .thread-sidebar-item:hover {
  border-color: rgba(131, 169, 154, 0.58);
  background: rgba(244, 251, 247, 0.95);
}

#projectView .thread-sidebar-item.active {
  border-color: rgba(86, 155, 133, 0.62);
  background:
    linear-gradient(166deg, rgba(226, 246, 238, 0.94) 0%, rgba(214, 242, 231, 0.9) 100%);
}

#projectView .chat-panel {
  border-radius: 16px;
  min-height: 550px;
  padding: 12px;
  border-color: rgba(180, 201, 191, 0.9);
  background:
    linear-gradient(176deg, rgba(255, 255, 255, 0.85) 0%, rgba(247, 252, 249, 0.82) 100%);
  box-shadow:
    0 8px 22px rgba(8, 34, 30, 0.11),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

#projectView .chat-content {
  gap: 9px;
}

#projectView .chat-head {
  gap: 10px;
  padding: 10px 11px;
  border-radius: 12px;
  border-color: rgba(180, 201, 191, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(246, 251, 248, 0.93) 100%);
}

#projectView .chat-head h3 {
  font-size: 1rem;
  letter-spacing: -0.01em;
}

#projectView .chat-meta {
  font-size: 0.76rem;
}

#projectView .chat-head-actions {
  gap: 10px;
}

#projectView .chat-head-primary-actions {
  gap: 5px;
}

#projectView .chat-head-danger-actions {
  padding-left: 10px;
}

#projectView .chat-summary,
#projectView .chat-summary-copyable {
  font-size: 0.76rem;
}

#projectView .chat-summary-copyable {
  padding: 8px 9px;
  border-left-width: 3px;
}

#projectView .chat-summary-copyable::after {
  font-size: 9.5px;
  padding: 4px 7px;
}

#projectView .email-thread-link-panel {
  border-radius: 11px;
  padding: 12px 9px 9px;
}

#projectView .transcript {
  max-height: 46vh;
  padding: 11px;
  gap: 8px;
  border-radius: 12px;
  border-color: rgba(180, 201, 191, 0.9);
  background:
    linear-gradient(180deg, rgba(248, 252, 250, 0.96) 0%, rgba(241, 249, 245, 0.96) 100%);
}

#projectView .transcript.transcript-whatsapp {
  background:
    radial-gradient(circle at 20% 20%, rgba(40, 176, 111, 0.07), transparent 45%),
    radial-gradient(circle at 78% 74%, rgba(8, 106, 163, 0.06), transparent 42%),
    linear-gradient(180deg, #eee9df 0%, #ebe6dd 100%);
}

#projectView .bubble {
  gap: 6px;
  padding: 10px 11px;
  border-radius: 11px;
  border-color: rgba(177, 197, 188, 0.92);
}

#projectView .bubble-header {
  font-size: 10px;
}

#projectView .bubble-text {
  font-size: 0.84rem;
  line-height: 1.45;
}

#projectView .transcript.transcript-whatsapp .wa-msg {
  padding: 7px 9px 22px;
  border-radius: 9px;
}

#projectView .transcript.transcript-whatsapp .wa-text {
  font-size: 0.84rem;
  line-height: 1.43;
}

#projectView .message-delivery-chip {
  padding: 2px 7px;
  font-size: 9.5px;
}

#projectView .message-edit-btn {
  width: 23px;
  height: 23px;
}

#projectView .transcript-message::after {
  width: 20px;
  height: 20px;
  font-size: 11px;
  line-height: 20px;
}

#projectView .message-editor-input {
  min-height: 78px;
  font-size: 12px;
}

#projectView .inbound-form {
  gap: 7px;
  padding: 10px;
  border-radius: 12px;
  border-color: rgba(180, 201, 191, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94) 0%, rgba(247, 251, 248, 0.93) 100%);
}

#projectView .inbound-form textarea {
  min-height: 82px;
  border-color: rgba(186, 203, 194, 0.94);
}

/* Sidebar Context refinement */

#sidebarFocusCard,
#sidebarCompanyCard {
  border-radius: 12px;
  padding: 11px;
  border-color: rgba(215, 243, 233, 0.28);
  background:
    linear-gradient(170deg, rgba(225, 248, 240, 0.11) 0%, rgba(118, 201, 174, 0.05) 45%, rgba(3, 26, 23, 0.2) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 8px 18px rgba(1, 12, 10, 0.16);
}

#sidebarFocusCard h3,
#sidebarCompanyCard h3 {
  margin-top: 7px;
  font-size: 0.97rem;
  letter-spacing: -0.01em;
}

#sidebarFocusCard p,
#sidebarCompanyCard p {
  line-height: 1.42;
}

.sidebar-focus-picker {
  gap: 5px;
}

.sidebar-focus-picker span {
  font-size: 10px;
}

.sidebar-focus-picker select {
  padding: 9px 10px;
  border-radius: 8px;
  border-color: rgba(215, 243, 233, 0.3);
  background: rgba(2, 20, 18, 0.46);
  font-size: 11.5px;
}

.sidebar-inline-note {
  font-size: 0.71rem;
}

.sidebar-company-stats {
  margin-top: 8px;
  gap: 4px;
}

.sidebar-company-stat {
  font-size: 0.73rem;
}

.sidebar-company-info {
  margin-top: 8px;
  padding: 9px;
  max-height: 214px;
  border-radius: 8px;
  border-color: rgba(220, 246, 236, 0.22);
  background: rgba(1, 18, 16, 0.4);
  font-size: 0.69rem;
  line-height: 1.45;
}

.sidebar-company-info h1,
.sidebar-company-info h2,
.sidebar-company-info h3 {
  margin: 9px 0 5px;
}

.sidebar-company-info h1 { font-size: 0.86rem; }
.sidebar-company-info h2 { font-size: 0.79rem; }
.sidebar-company-info h3 { font-size: 0.73rem; }

.sidebar-company-info p,
.sidebar-company-info li {
  line-height: 1.44;
}

/* Modals + forms refinement */

.modal {
  width: min(560px, calc(100vw - 28px));
  border-radius: 18px;
  border: 1px solid rgba(185, 206, 195, 0.92);
  box-shadow:
    0 22px 56px rgba(5, 30, 26, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.modal::backdrop {
  background: rgba(9, 33, 28, 0.36);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.modal-head,
.modal-foot {
  padding: 11px 13px;
}

.modal-head h3 {
  font-size: 1.01rem;
  letter-spacing: -0.01em;
}

.modal-body {
  padding: 12px;
  gap: 9px;
}

.modal .field {
  gap: 5px;
}

.modal .field span {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.modal .field input,
.modal .field textarea,
.modal .field select {
  padding: 9px 10px;
  border-radius: 9px;
  border-color: rgba(186, 205, 195, 0.94);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 252, 249, 0.97) 100%);
}

.modal .field textarea {
  min-height: 72px;
}

.modal .field input:focus,
.modal .field textarea:focus,
.modal .field select:focus {
  border-color: rgba(83, 151, 129, 0.72);
  box-shadow: 0 0 0 3px rgba(70, 142, 120, 0.14);
}

.modal-foot .btn {
  min-width: 118px;
}

.field-hint {
  font-size: 0.72rem;
}

.toast {
  border-radius: 12px;
  padding: 10px 13px;
  font-size: 0.8rem;
  box-shadow:
    0 14px 36px rgba(4, 28, 24, 0.32),
    0 1px 0 rgba(144, 230, 202, 0.15) inset;
}

.toast.error {
  box-shadow:
    0 14px 36px rgba(38, 14, 14, 0.34),
    0 1px 0 rgba(252, 184, 184, 0.12) inset;
}

@media (max-width: 980px) {
  #projectView .view-head.project-head {
    padding: 15px 16px;
  }

  #projectView .contacts-grid-container {
    padding: 14px 15px;
  }

  #projectView .panel-tools {
    align-items: stretch;
    flex-wrap: wrap;
  }

  #projectView .thread-list {
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  }
}

@media (max-width: 700px) {
  #projectView .view-head.project-head {
    padding: 14px;
  }

  #projectView .project-head h2 {
    font-size: clamp(1.55rem, 8vw, 2rem);
  }

  #projectView .contacts-grid-container,
  #projectView .chat-panel,
  #projectView .threads-sidebar {
    border-radius: 14px;
  }

  #projectView .thread-list {
    gap: 10px;
  }

  #projectView .chat-head-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  #projectView .chat-head-primary-actions,
  #projectView .chat-head-danger-actions {
    width: 100%;
    padding-left: 0;
    border-left: 0;
    justify-content: flex-start;
  }

  #projectView .chat-head-primary-actions .btn,
  #projectView .chat-head-danger-actions .btn {
    width: 100%;
  }

  #sidebarFocusCard,
  #sidebarCompanyCard {
    padding: 10px;
  }

  .sidebar-company-info {
    max-height: 182px;
  }

  .modal {
    width: min(560px, calc(100vw - 20px));
  }
}

@media (prefers-reduced-motion: reduce) {
  #projectView .thread-item,
  #projectView .thread-sidebar-item,
  #projectView .chat-summary-copyable,
  .modal,
  .toast {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }

  #projectView .thread-item:hover,
  #projectView .thread-sidebar-item:hover {
    transform: none !important;
  }
}

/* Current Focus: targeted upgrade */

#sidebarFocusCard {
  --focus-border: rgba(215, 245, 234, 0.34);
  --focus-border-strong: rgba(178, 240, 219, 0.62);
  --focus-bg-top: rgba(227, 248, 241, 0.12);
  --focus-bg-mid: rgba(114, 195, 169, 0.05);
  --focus-bg-bottom: rgba(2, 24, 21, 0.24);
  --focus-ink: rgba(239, 252, 246, 0.96);
  --focus-ink-muted: rgba(223, 245, 235, 0.83);
  --focus-field-line: rgba(214, 244, 234, 0.3);
  --focus-field-line-strong: rgba(120, 206, 178, 0.72);
  position: relative;
  display: grid;
  gap: 9px;
  text-align: left;
  padding: 14px 13px 12px;
  border-radius: 15px;
  border: 1px solid var(--focus-border);
  background:
    linear-gradient(168deg, var(--focus-bg-top) 0%, var(--focus-bg-mid) 45%, var(--focus-bg-bottom) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 12px 24px rgba(1, 12, 10, 0.18);
  overflow: hidden;
  transition: border-color var(--motion-base), box-shadow var(--motion-base), transform var(--motion-base);
}

#sidebarFocusCard::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(178, 245, 223, 0.7) 40%, transparent 100%);
  pointer-events: none;
}

#sidebarFocusCard::after {
  content: "";
  position: absolute;
  right: -72px;
  top: -74px;
  width: 170px;
  aspect-ratio: 1;
  border-radius: 999px;
  pointer-events: none;
  background: radial-gradient(circle, rgba(136, 227, 198, 0.18) 0%, rgba(136, 227, 198, 0) 72%);
}

#sidebarFocusCard .sidebar-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(213, 245, 232, 0.24);
  background: rgba(3, 28, 24, 0.22);
  font-size: 0.6rem;
  line-height: 1.1;
  letter-spacing: 0.12em;
  color: rgba(226, 248, 240, 0.76);
}

#sidebarFocusTitle {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.25;
  letter-spacing: -0.014em;
  color: var(--focus-ink);
  overflow-wrap: anywhere;
  text-wrap: balance;
}

#sidebarFocusMeta {
  margin: -1px 0 0;
  font-size: 0.78rem;
  line-height: 1.44;
  color: var(--focus-ink-muted);
  max-width: 28ch;
}

#sidebarFocusCard .sidebar-focus-picker {
  position: relative;
  margin: 0;
  gap: 6px;
  text-align: left;
}

#sidebarFocusCard .sidebar-focus-picker span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.09em;
  color: rgba(226, 248, 240, 0.8);
}

#sidebarFocusCard .sidebar-focus-picker::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 14px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid rgba(220, 246, 237, 0.88);
  border-bottom: 1.5px solid rgba(220, 246, 237, 0.88);
  transform: rotate(45deg);
  pointer-events: none;
}

#sidebarFocusCard .sidebar-focus-picker select {
  width: 100%;
  min-height: 40px;
  padding: 10px 34px 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--focus-field-line);
  background:
    linear-gradient(180deg, rgba(3, 26, 23, 0.55) 0%, rgba(2, 22, 19, 0.65) 100%);
  color: var(--focus-ink);
  font: 500 12px/1.35 var(--font-mono);
  letter-spacing: 0.01em;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color var(--motion-base), box-shadow var(--motion-base), background var(--motion-base), color var(--motion-base);
}

#sidebarFocusCard .sidebar-focus-picker select:focus,
#sidebarFocusCard .sidebar-focus-picker select:focus-visible {
  outline: none;
  border-color: var(--focus-field-line-strong);
  box-shadow:
    0 0 0 3px rgba(77, 169, 141, 0.21),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, rgba(4, 30, 26, 0.64) 0%, rgba(2, 22, 19, 0.7) 100%);
}

#sidebarFocusCard .sidebar-focus-picker select:disabled {
  border-color: rgba(211, 243, 232, 0.22);
  color: rgba(214, 238, 228, 0.68);
  background: linear-gradient(180deg, rgba(5, 28, 24, 0.4) 0%, rgba(3, 22, 19, 0.5) 100%);
  cursor: not-allowed;
}

#sidebarFocusSelectHint {
  margin: 0;
  padding-top: 7px;
  border-top: 1px solid rgba(214, 244, 234, 0.15);
  font-size: 0.71rem;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: rgba(214, 241, 231, 0.74);
}

@media (hover: hover) and (pointer: fine) {
  #sidebarFocusCard:hover {
    border-color: var(--focus-border-strong);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.16),
      0 16px 30px rgba(1, 12, 10, 0.22);
    transform: translateY(-1px);
  }

  #sidebarFocusCard .sidebar-focus-picker select:hover:not(:disabled) {
    border-color: rgba(170, 233, 211, 0.48);
  }
}

@media (max-width: 700px) {
  #sidebarFocusCard {
    gap: 8px;
    padding: 12px 11px 11px;
  }

  #sidebarFocusTitle {
    font-size: 1rem;
  }

  #sidebarFocusMeta {
    font-size: 0.77rem;
  }

  #sidebarFocusCard .sidebar-focus-picker select {
    min-height: 38px;
    padding-top: 9px;
    padding-bottom: 9px;
  }

  #sidebarFocusCard .sidebar-focus-picker::after {
    right: 12px;
    bottom: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #sidebarFocusCard,
  #sidebarFocusCard .sidebar-focus-picker select {
    transition: none !important;
  }

  #sidebarFocusCard:hover {
    transform: none !important;
  }
}
