:root {
  --bg: #07080c;
  --bg-soft: #0d1017;
  --panel: #111621;
  --panel-2: #151b28;
  --border: rgba(255,255,255,.08);

  --text: #f7f8fb;
  --muted: #8f9aaa;

  --purple: #8a3bff;
  --purple-soft: rgba(138,59,255,.16);

  --gold: #d4af37;
  --gold-soft: rgba(212,175,55,.14);

  --cyan: #26e7ff;
  --cyan-soft: rgba(38,231,255,.12);

  --danger: #ff5d73;
  --warning: #ffb547;
  --success: #32d583;

  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0,0,0,.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(138,59,255,.16), transparent 34%),
    radial-gradient(circle at 90% 20%, rgba(38,231,255,.07), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
  background: rgba(7,8,12,.92);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 8px 6px 26px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  font-weight: 800;
  color: white;
  background:
    linear-gradient(145deg, var(--purple), #5f2de2 55%, var(--gold));
  box-shadow: 0 0 32px rgba(138,59,255,.28);
}

.brand strong {
  display: block;
  letter-spacing: .12em;
  font-size: .92rem;
}

.brand span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
  font-size: .78rem;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  color: var(--muted);
  text-decoration: none;
  padding: 12px 13px;
  border-radius: 12px;
  transition: .2s ease;
}

.nav-item:hover,
.nav-item.active {
  color: white;
  background: linear-gradient(90deg, var(--purple-soft), transparent);
  border: 1px solid rgba(138,59,255,.18);
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: .8rem;
  padding: 12px 6px;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legal-links {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .72rem;
}

.legal-links a {
  color: var(--muted);
  text-decoration: none;
}

.legal-links a:hover,
.legal-links a:focus-visible {
  color: white;
  text-decoration: underline;
}

.legal-disclaimer {
  color: var(--muted);
  font-size: .66rem;
  line-height: 1.4;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 14px rgba(50,213,131,.8);
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--cyan);
  font-size: .72rem;
  letter-spacing: .16em;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  letter-spacing: -.04em;
}

h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.topbar-actions,
.simulation-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-btn,
.secondary-btn,
.decision-card button,
#askAiBtn {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 700;
}

.primary-btn,
#askAiBtn {
  color: white;
  background: linear-gradient(135deg, var(--purple), #672cff);
  box-shadow: 0 10px 30px rgba(138,59,255,.2);
}

.secondary-btn {
  color: var(--text);
  background: #151a24;
  border: 1px solid var(--border);
}

.command-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 12px 11px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.ai-spark {
  color: var(--purple);
  font-size: 1.2rem;
}

.command-bar input {
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  min-width: 0;
}

.command-bar input::placeholder {
  color: #667085;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card,
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.025), transparent), var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 18px;
}

.kpi-card span,
.kpi-card small {
  color: var(--muted);
}

.kpi-card strong {
  display: block;
  margin: 10px 0 6px;
  font-size: 1.55rem;
}

.risk-card {
  border-color: rgba(255,93,115,.25);
}

.risk-label {
  color: var(--danger) !important;
  font-weight: 700;
}

.intelligence-layout {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.live-badge {
  color: var(--success);
  border: 1px solid rgba(50,213,131,.25);
  background: rgba(50,213,131,.08);
  padding: 6px 9px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
}

.insight-lead {
  color: #c9d0db;
  line-height: 1.75;
  font-size: 1rem;
}

.recommendation {
  margin-top: 20px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--purple-soft), rgba(38,231,255,.05));
  border: 1px solid rgba(138,59,255,.2);
}

.recommendation span {
  display: block;
  color: var(--purple);
  font-size: .75rem;
  font-weight: 800;
  margin-bottom: 7px;
}

.globe-stage {
  position: relative;
  min-height: 380px;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.global-core {
  position: relative;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 35% 30%, rgba(38,231,255,.35), transparent 20%),
    radial-gradient(circle at 60% 65%, rgba(138,59,255,.48), transparent 38%),
    linear-gradient(145deg, #141b28, #080b11);
  border: 1px solid rgba(38,231,255,.35);
  box-shadow:
    0 0 70px rgba(138,59,255,.22),
    inset 0 0 45px rgba(38,231,255,.08);
  z-index: 3;
}

.core-globe {
  font-size: .85rem;
  font-weight: 900;
  letter-spacing: .22em;
}

.core-glow {
  position: absolute;
  inset: -28px;
  border-radius: 50%;
  border: 1px solid rgba(138,59,255,.14);
}

.orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.08);
}

.orbit-one {
  width: 290px;
  height: 160px;
  transform: rotate(20deg);
}

.orbit-two {
  width: 330px;
  height: 210px;
  transform: rotate(-25deg);
}

.data-node {
  position: absolute;
  padding: 7px 10px;
  background: rgba(10,14,21,.9);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #cbd5e1;
  font-size: .72rem;
}

.node-one { top: 22%; left: 10%; }
.node-two { top: 18%; right: 8%; }
.node-three { bottom: 20%; left: 12%; }
.node-four { bottom: 16%; right: 10%; }

.decision-center {
  margin-bottom: 18px;
}

.decision-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.decision-card {
  padding: 17px;
  border-radius: 15px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.decision-card > span {
  display: inline-block;
  margin-bottom: 12px;
  color: var(--cyan);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .1em;
}

.decision-card.critical {
  border-color: rgba(255,93,115,.26);
}

.decision-card.critical > span {
  color: var(--danger);
}

.decision-card.warning {
  border-color: rgba(255,181,71,.24);
}

.decision-card.warning > span {
  color: var(--warning);
}

.decision-card p {
  color: var(--muted);
  line-height: 1.6;
}

.decision-card button {
  color: white;
  background: #202737;
  border: 1px solid var(--border);
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1.3fr .8fr;
  gap: 18px;
  margin-bottom: 18px;
}

.forecast-chart {
  position: relative;
  height: 210px;
  margin-top: 20px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.chart-line {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 30%;
  height: 3px;
  background: linear-gradient(90deg, var(--cyan), var(--purple), var(--gold));
  transform: rotate(-7deg);
  transform-origin: left center;
  box-shadow: 0 0 20px rgba(138,59,255,.35);
}

.chart-point {
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 0 16px rgba(138,59,255,.8);
}

.point-a { left: 18%; bottom: 30%; }
.point-b { left: 53%; bottom: 45%; }
.point-c { right: 8%; bottom: 64%; }

.forecast-note {
  color: var(--muted);
  margin: 14px 0 0;
}

.simulation-value {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin: 28px 0 20px;
}

.simulation-value span {
  color: var(--muted);
}

.simulation-value strong {
  font-size: 1.8rem;
}

.simulation-panel input[type="range"] {
  width: 100%;
  margin: 16px 0 24px;
  accent-color: var(--purple);
}

.copilot-panel {
  margin-bottom: 18px;
}

.agent-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.agent {
  color: var(--text);
  padding: 10px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #151b26;
}

.agent.active {
  color: white;
  border-color: rgba(138,59,255,.35);
  background: var(--purple-soft);
}

.agent.orchestrator {
  border-color: rgba(212,175,55,.3);
  background: var(--gold-soft);
}

.status-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  color: var(--muted);
  font-size: .76rem;
  padding: 14px 4px 4px;
}

.status-bar > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-bar strong {
  color: #cfd6e1;
}

body.focus-mode .sidebar {
  width: 88px;
}

body.focus-mode .brand div:last-child,
body.focus-mode .nav-item,
body.focus-mode .sidebar-footer span:last-child {
  font-size: 0;
}

body.focus-mode .app-shell {
  grid-template-columns: 88px 1fr;
}

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

  .intelligence-layout,
  .analytics-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    width: auto;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

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

  .main-content {
    padding: 18px 14px 28px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .kpi-grid,
  .decision-grid,
  .status-bar {
    grid-template-columns: 1fr;
  }

  .command-bar {
    grid-template-columns: auto 1fr;
  }

  #askAiBtn {
    grid-column: 1 / -1;
  }

  .globe-stage {
    min-height: 330px;
  }

  .global-core {
    width: 160px;
    height: 160px;
  }

  .orbit-one {
    width: 250px;
  }

  .orbit-two {
    width: 285px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
/* ORVENIX Global Intelligence Core v2 */

.globe-stage {
  isolation: isolate;
  perspective: 1200px;
}

.global-core {
  width: 220px;
  height: 220px;
  overflow: visible;
  transform-style: preserve-3d;
  animation: coreFloat 8s ease-in-out infinite;
}

.global-core::before,
.global-core::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.global-core::before {
  inset: 12%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0 16px,
      rgba(38, 231, 255, .12) 17px 18px
    ),
    repeating-linear-gradient(
      0deg,
      transparent 0 16px,
      rgba(138, 59, 255, .1) 17px 18px
    );
  border: 1px solid rgba(38, 231, 255, .18);
  opacity: .7;
  transform: rotate(-12deg);
}

.global-core::after {
  inset: -18px;
  border: 1px solid rgba(212, 175, 55, .2);
  box-shadow:
    0 0 35px rgba(138, 59, 255, .18),
    0 0 70px rgba(38, 231, 255, .1);
}

.core-globe {
  position: relative;
  z-index: 4;
  width: 132px;
  height: 132px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,.18), transparent 16%),
    radial-gradient(circle at 38% 35%, rgba(38,231,255,.25), transparent 28%),
    radial-gradient(circle at 65% 65%, rgba(138,59,255,.52), transparent 48%),
    #080b12;
  border: 1px solid rgba(38,231,255,.42);
  box-shadow:
    inset -18px -14px 40px rgba(0,0,0,.65),
    inset 10px 10px 30px rgba(38,231,255,.06),
    0 0 40px rgba(138,59,255,.28);
  text-shadow: 0 0 14px rgba(38,231,255,.6);
}

.orbit-one {
  animation: orbitSpinA 18s linear infinite;
}

.orbit-two {
  animation: orbitSpinB 24s linear infinite reverse;
}

.data-node {
  z-index: 5;
  backdrop-filter: blur(10px);
  box-shadow: 0 8px 28px rgba(0,0,0,.24);
}

.data-node::before {
  content: "";
  width: 6px;
  height: 6px;
  display: inline-block;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(38,231,255,.85);
}

.node-two::before {
  background: var(--purple);
  box-shadow: 0 0 10px rgba(138,59,255,.85);
}

.node-three::before {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(212,175,55,.85);
}

.node-four::before {
  background: var(--success);
  box-shadow: 0 0 10px rgba(50,213,131,.85);
}

@keyframes coreFloat {
  0%, 100% {
    transform: translateY(0) rotateX(2deg);
  }
  50% {
    transform: translateY(-8px) rotateX(-2deg);
  }
}

@keyframes orbitSpinA {
  from {
    transform: rotate(20deg);
  }
  to {
    transform: rotate(380deg);
  }
}

@keyframes orbitSpinB {
  from {
    transform: rotate(-25deg);
  }
  to {
    transform: rotate(-385deg);
  }
}

@media (max-width: 760px) {
  .global-core {
    width: 185px;
    height: 185px;
  }

  .core-globe {
    width: 112px;
    height: 112px;
    font-size: .7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-core,
  .orbit-one,
  .orbit-two {
    animation: none !important;
  }
}

/* Contract Analysis */
.analysis-panel {
  position: relative;
  overflow: hidden;
}

.analysis-panel::before {
  content: "";
  position: absolute;
  width: 220px;
  height: 220px;
  top: -110px;
  right: -80px;
  border-radius: 50%;
  background: rgba(123, 63, 242, 0.12);
  filter: blur(55px);
  pointer-events: none;
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.analysis-card {
  min-height: 150px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  display: flex;
  flex-direction: column;
  gap: 10px;
}


/* Contract Analysis - Mobile Responsive */
@media (max-width: 700px) {
  .analysis-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .analysis-card {
    min-height: auto;
    padding: 18px;
  }
}

/* Contract Intelligence Details */
.contract-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.detail-card {
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.detail-card p {
  margin: 8px 0 0;
  line-height: 1.6;
}

@media (max-width: 700px) {
  .contract-details {
    grid-template-columns: 1fr;
  }
}

/* Contract Details Expand / Collapse */
.detail-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.detail-card summary::-webkit-details-marker {
  display: none;
}

.detail-toggle {
  font-size: 20px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.detail-card[open] .detail-toggle {
  transform: rotate(45deg);
}

.detail-card[open] p {
  margin-top: 14px;
}

.detail-card summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 6px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  .detail-toggle {
    transition: none;
  }
}

/* AI Summary Expand / Collapse */
.summary-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.summary-details summary::-webkit-details-marker {
  display: none;
}

.summary-details[open] .detail-toggle {
  transform: rotate(45deg);
}

.summary-details p {
  margin-top: 14px;
  line-height: 1.6;
}

.risk-tag {
  margin-left: auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1;
}

.risk-high {
  color: #ff7a7a;
  background: rgba(255, 90, 90, 0.12);
  border: 1px solid rgba(255, 90, 90, 0.28);
}

.risk-medium {
  color: #f2c96d;
  background: rgba(242, 201, 109, 0.12);
  border: 1px solid rgba(242, 201, 109, 0.28);
}

.detail-card summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-card[open] {
  border-color: rgba(123, 63, 242, 0.34);
}


.risk-low {
  color: #7ee2a8;
  background: rgba(126, 226, 168, 0.12);
  border: 1px solid rgba(126, 226, 168, 0.28);
}


/* Contracts Portfolio */
.contracts-panel {
  margin-top: 24px;
}

.contracts-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.contract-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition:
    transform 0.2s ease,
    border-color 0.2s ease,
    background 0.2s ease;
}

.contract-item:hover {
  transform: translateY(-2px);
  border-color: rgba(77, 226, 255, 0.28);
  background: rgba(255, 255, 255, 0.04);
}

.contract-item > div:first-child {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.contract-item strong {
  font-size: 1rem;
  color: #f7f9fc;
  overflow-wrap: anywhere;
}

.contract-item > div:first-child span {
  color: #9aa5b5;
  font-size: 0.9rem;
}

.contract-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.contract-meta span {
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #d9e0ea;
  font-size: 0.82rem;
  white-space: nowrap;
}

.contract-meta span:last-child {
  color: #ff7a7a;
  background: rgba(255, 90, 90, 0.1);
  border-color: rgba(255, 90, 90, 0.22);
}

@media (max-width: 720px) {
  .contract-item {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
    min-width: 0;
    max-width: 100%;
  }

  .contract-meta {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-content: flex-start;
  }

  .contract-meta span {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

.contract-delete {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 90, 90, 0.28);
  background: rgba(255, 90, 90, 0.08);
  color: #ff8a8a;
  font-size: 0.8rem;
  cursor: pointer;
}

.contract-delete:hover {
  background: rgba(255, 90, 90, 0.14);
}

.contract-delete:disabled {
  opacity: 0.55;
  cursor: wait;
}

.contract-item.selected {
  border-color: rgba(77, 226, 255, 0.5);
  background: rgba(77, 226, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(77, 226, 255, 0.08);
}

.contract-item.selected::before {
  content: 'Selected';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(77, 226, 255, 0.1);
  border: 1px solid rgba(77, 226, 255, 0.25);
  color: #7cecff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.contracts-search {
  margin-top: 16px;
}

.contracts-search input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: #f7f9fc;
  font: inherit;
  outline: none;
}

.contracts-search input::placeholder {
  color: #7f8a99;
}

.contracts-search input:focus {
  border-color: rgba(77, 226, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}

.contract-item[hidden] {
  display: none !important;
}

.contracts-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.contracts-search select {
  min-width: 150px;
  padding: 12px 36px 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: #f7f9fc;
  font: inherit;
  outline: none;
}

.contracts-search select:focus {
  border-color: rgba(77, 226, 255, 0.4);
}

@media (max-width: 720px) {
  .contracts-search {
    grid-template-columns: 1fr;
  }

  .contracts-search select {
    width: 100%;
  }
}

.contract-uploaded {
  color: #7f8a99;
  font-size: 0.78rem;
  line-height: 1.4;
}

.contract-context-bar {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin: 18px 0 20px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.07);
}

.contract-context-bar > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.contract-context-bar span {
  color: #7f8a99;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.contract-context-bar strong {
  color: #f7f9fc;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  .contract-context-bar {
    grid-template-columns: 1fr;
  }
}

/* Risk Breakdown */
.risk-breakdown-details {
  margin-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
}

.risk-breakdown-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary, #a7afbd);
  list-style: none;
}

.risk-breakdown-details summary::-webkit-details-marker {
  display: none;
}

.risk-breakdown-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.risk-breakdown-item {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.risk-breakdown-item.is-critical {
  border-color: rgba(255, 95, 95, 0.35);
}

.risk-breakdown-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.risk-breakdown-meta span {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary, #a7afbd);
}

.risk-breakdown-meta strong {
  font-size: 0.8rem;
  color: var(--text-primary, #ffffff);
}

.risk-breakdown-item p {
  margin: 6px 0 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary, #a7afbd);
}

/* Contract Top Risk */
.contract-top-risk {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.025);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-secondary, #a7afbd);
}

/* Risk Severity */
.risk-severity {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.risk-severity[data-severity="high"] {
  color: #ff8f8f;
  border-color: rgba(255, 95, 95, 0.35);
  background: rgba(255, 95, 95, 0.08);
}

.risk-severity[data-severity="medium"] {
  color: #f0c66d;
  border-color: rgba(240, 198, 109, 0.35);
  background: rgba(240, 198, 109, 0.08);
}

.risk-severity[data-severity="low"] {
  color: #8fd6bd;
  border-color: rgba(143, 214, 189, 0.28);
  background: rgba(143, 214, 189, 0.07);
}

/* Contract Action Workflow */
.contract-actions-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.contract-action-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.025);
}

.contract-action-item strong {
  min-width: 0;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.contract-action-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.contract-action-status[data-status="open"] {
  color: #f0c66d;
  border-color: rgba(240, 198, 109, 0.35);
  background: rgba(240, 198, 109, 0.08);
}

.contract-action-status[data-status="completed"] {
  color: #8fd6bd;
  border-color: rgba(143, 214, 189, 0.3);
  background: rgba(143, 214, 189, 0.08);
}

.contract-action-toggle {
  appearance: none;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary, #ffffff);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.contract-action-toggle:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 640px) {
  .contract-action-item {
    grid-template-columns: 1fr auto;
  }

  .contract-action-item strong {
    grid-column: 1 / -1;
  }

  .contract-action-toggle {
    justify-self: end;
  }
}

.contract-action-meta {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.4;
  color: var(--muted, #94a3b8);
}

.contract-action-priority {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.contract-action-priority[data-priority="critical"] {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

.contract-action-priority[data-priority="high"] {
  background: rgba(249, 115, 22, 0.14);
  color: #fb923c;
}

.contract-action-priority[data-priority="medium"] {
  background: rgba(234, 179, 8, 0.14);
  color: #facc15;
}

.contract-action-priority[data-priority="low"] {
  background: rgba(34, 197, 94, 0.14);
  color: #4ade80;
}

.contract-action-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  margin: 16px 0;
  align-items: center;
}

.contract-action-form input,
.contract-action-form select {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  color: inherit;
  font: inherit;
}

.contract-action-form input:focus,
.contract-action-form select:focus {
  outline: 2px solid rgba(139, 92, 246, 0.45);
  outline-offset: 2px;
}

.contract-action-add {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}

.contract-action-add:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 720px) {
  .contract-action-form {
    grid-template-columns: 1fr;
  }
}

.contract-action-delete {
  appearance: none;
  padding: 8px 12px;
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 10px;
  background: rgba(248, 113, 113, 0.08);
  color: #f87171;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.contract-action-delete:hover {
  background: rgba(248, 113, 113, 0.14);
}

.contract-action-delete:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 640px) {
  .contract-action-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .contract-action-meta {
    min-width: 0;
  }

  .contract-action-toggle,
  .contract-action-delete {
    justify-self: end;
  }
}

.contract-action-edit {
  appearance: none;
  padding: 8px 12px;
  border: 1px solid rgba(56, 189, 248, 0.26);
  border-radius: 10px;
  background: rgba(56, 189, 248, 0.08);
  color: #67e8f9;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
}

.contract-action-edit:hover {
  background: rgba(56, 189, 248, 0.14);
}

.contract-action-edit:disabled {
  opacity: 0.6;
  cursor: wait;
}

@media (max-width: 640px) {
  .contract-action-edit {
    justify-self: end;
  }
}

.contract-action-due-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.contract-action-due-state[data-state="overdue"] {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(248, 113, 113, 0.1);
}

.contract-action-due-state[data-state="today"] {
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(251, 191, 36, 0.1);
}

.contract-action-due-state[data-state="soon"] {
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.1);
}

@media (max-width: 640px) {
  .contract-action-item {
    grid-template-columns: 1fr;
    gap: 12px;
    align-items: stretch;
  }

  .contract-action-item strong,
  .contract-action-priority,
  .contract-action-status,
  .contract-action-due-state,
  .contract-action-meta,
  .contract-action-toggle,
  .contract-action-edit,
  .contract-action-delete {
    grid-column: 1 / -1;
    justify-self: stretch;
    min-width: 0;
    max-width: 100%;
  }

  .contract-action-priority,
  .contract-action-status,
  .contract-action-due-state {
    width: fit-content;
    justify-self: start;
  }

  .contract-action-meta {
    margin-top: 0;
    overflow-wrap: anywhere;
  }

  .contract-action-toggle,
  .contract-action-edit,
  .contract-action-delete {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

.contract-action-highlight {
  outline: 2px solid rgba(56, 189, 248, 0.75);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(56, 189, 248, 0.08);
  transition:
    outline-color 180ms ease,
    box-shadow 180ms ease;
}

/* Deadline Alerts */
.deadline-alerts {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 16px;
  background: rgba(255,255,255,.025);
}

.deadline-alerts-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.deadline-alerts-header h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.deadline-alerts-list {
  display: grid;
  gap: 10px;
}

.deadline-alert-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  background: rgba(255,255,255,.02);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.deadline-alert-item:hover {
  background: rgba(255,255,255,.045);
}

.deadline-alert-state {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
}

.deadline-alert-body {
  display: grid;
  gap: 3px;
}

.deadline-alert-body small {
  opacity: .7;
}

.deadline-alert-state[data-state="overdue"] {
  color: #ff6b6b;
}

.deadline-alert-state[data-state="today"] {
  color: #f5c451;
}

.deadline-alert-state[data-state="soon"] {
  color: #67d5ff;
}

.risk-confidence {
  margin-top: 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary, #a7afbd);
}

.risk-evidence {
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
}

.risk-evidence > strong {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary, #ffffff);
}

.risk-evidence p {
  margin: 5px 0 0;
  font-size: 0.74rem;
  line-height: 1.5;
}

.risk-evidence small {
  display: block;
  margin-top: 6px;
  font-size: 0.66rem;
  color: var(--text-secondary, #a7afbd);
  opacity: 0.8;
}

.analysis-review-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.review-status {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.review-unreviewed {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.32);
}

.review-reviewed {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.32);
}

.review-action-btn {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.review-action-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.review-action-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.legal-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.legal-page h1 {
  margin-bottom: 8px;
}

.legal-page h2 {
  margin-top: 32px;
  font-size: 1.1rem;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  line-height: 1.75;
}

.legal-page a {
  color: #c9a7ff;
}


/* Closed Beta UX hardening */
#contractActionDueDate {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.ai-response-panel {
  margin: 12px 0 20px;
  padding: 16px 18px;
  border: 1px solid rgba(139, 92, 246, 0.24);
  border-radius: 14px;
  background: rgba(139, 92, 246, 0.07);
}

.ai-response-panel[data-state="error"] {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.07);
}

.ai-response-header {
  margin-bottom: 8px;
}

#aiResponseText {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
}

#contractActionDueDate,
#contractActionDueDate::-webkit-datetime-edit,
#contractActionDueDate::-webkit-datetime-edit-fields-wrapper {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  text-align: left !important;
}

#contractActionDueDate::-webkit-datetime-edit-year-field,
#contractActionDueDate::-webkit-datetime-edit-month-field,
#contractActionDueDate::-webkit-datetime-edit-day-field {
  direction: ltr !important;
  unicode-bidi: isolate !important;
}


/* Stable mobile date display */
.contract-action-date {
  position: relative;
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.72);
  overflow: hidden;
}

.contract-action-date:focus-within {
  outline: 2px solid rgba(139, 92, 246, 0.45);
  outline-offset: 2px;
}

.contract-action-date-display {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 0 40px 0 12px;
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  pointer-events: none;
  white-space: nowrap;
}

#contractActionDueDate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* Legal consent gate */
body.legal-consent-open {
  overflow: hidden;
}

.legal-consent-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 8, 12, .88);
  backdrop-filter: blur(16px);
}

.legal-consent-overlay[hidden] {
  display: none;
}

.legal-consent-card {
  width: min(560px, 100%);
  padding: 26px;
  background:
    linear-gradient(
      180deg,
      rgba(255,255,255,.035),
      transparent
    ),
    var(--panel);
  border: 1px solid rgba(138,59,255,.3);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    0 0 55px rgba(138,59,255,.12);
}

.legal-consent-card h2 {
  margin: 9px 0 12px;
  font-size: 1.55rem;
}

.legal-consent-copy {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.legal-consent-links {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 18px;
}

.legal-consent-links a {
  color: var(--cyan);
  font-weight: 700;
  text-decoration: none;
}

.legal-consent-links a:hover,
.legal-consent-links a:focus-visible {
  text-decoration: underline;
}

.legal-consent-version {
  min-height: 18px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: .82rem;
}

.legal-consent-agreement {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 20px;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  line-height: 1.5;
  cursor: pointer;
}

.legal-consent-agreement input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  accent-color: var(--purple);
}

.legal-consent-status {
  min-height: 20px;
  margin: 13px 0 0;
  color: var(--muted);
  font-size: .88rem;
}

.legal-consent-status.is-error {
  color: var(--danger);
}

.legal-consent-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

#legalAcceptBtn:disabled {
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none;
}

@media (max-width: 560px) {
  .legal-consent-overlay {
    padding: 14px;
  }

  .legal-consent-card {
    padding: 20px;
  }

  .legal-consent-actions {
    flex-direction: column-reverse;
  }

  .legal-consent-actions button {
    width: 100%;
  }
}

/* Arabic RTL final reliability hardening */
html[dir="rtl"] body { text-align: start; }
html[dir="rtl"] .main-content,
html[dir="rtl"] .topbar,
html[dir="rtl"] .section-heading,
html[dir="rtl"] .analysis-card,
html[dir="rtl"] .detail-card,
html[dir="rtl"] .decision-card,
html[dir="rtl"] .contract-item,
html[dir="rtl"] .deadline-alert-item,
html[dir="rtl"] .legal-consent-card { text-align: start; }
html[dir="rtl"] .contract-meta { justify-content: flex-start; }
html[dir="rtl"] .contract-item,
html[dir="rtl"] .contract-item > div:first-child,
html[dir="rtl"] .contract-action-item,
html[dir="rtl"] .deadline-alert-body,
html[dir="rtl"] .risk-breakdown-item,
html[dir="rtl"] .decision-card { min-width: 0; max-width: 100%; }
html[dir="rtl"] .contract-item strong,
html[dir="rtl"] .contract-action-item strong,
html[dir="rtl"] .deadline-alert-body strong,
html[dir="rtl"] .deadline-alert-body small,
html[dir="rtl"] .risk-evidence p,
html[dir="rtl"] .decision-card p { overflow-wrap: anywhere; }
html[dir="rtl"] .contract-uploaded,
html[dir="rtl"] #analysisKeyDate,
html[dir="rtl"] #selectedContractUploaded { direction: ltr; unicode-bidi: isolate; text-align: start; }
html[dir="rtl"] .contract-action-meta,
html[dir="rtl"] .risk-evidence p,
html[dir="rtl"] .decision-card p { unicode-bidi: plaintext; }
html[dir="rtl"] .deadline-alert-item { text-align: start; }
html[dir="rtl"] .legal-consent-actions { justify-content: flex-start; }
html[dir="rtl"] input:not([type="date"]),
html[dir="rtl"] select { text-align: start; }

@media (max-width: 760px) {
  html[dir="rtl"] .main-content,
  html[dir="rtl"] .contract-item,
  html[dir="rtl"] .contract-meta,
  html[dir="rtl"] .contract-action-item,
  html[dir="rtl"] .deadline-alert-item,
  html[dir="rtl"] .analysis-card,
  html[dir="rtl"] .detail-card,
  html[dir="rtl"] .decision-card { min-width: 0; max-width: 100%; }
  html[dir="rtl"] .contract-meta { width: 100%; justify-content: flex-start; }
  html[dir="rtl"] .contract-meta span { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  html[dir="rtl"] .contract-action-toggle,
  html[dir="rtl"] .contract-action-edit,
  html[dir="rtl"] .contract-action-delete { width: 100%; max-width: 100%; }
  html[dir="rtl"] .deadline-alert-item { align-items: flex-start; }
  html[dir="rtl"] .deadline-alert-body { flex: 1 1 auto; }
}


/* Authenticated workspace context */
.auth-workspace {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.auth-workspace-switcher {
  min-width: 0;
  max-width: 260px;
}

.auth-workspace-switcher button {
  max-width: 100%;
}

@media (max-width: 760px) {
  .auth-workspace {
    width: 100%;
    justify-content: flex-start;
  }

  .auth-workspace-switcher {
    flex: 1 1 auto;
    max-width: min(280px, calc(100vw - 110px));
  }
}

html[dir="rtl"] .auth-workspace {
  direction: rtl;
}


/* ORVENIX workspace control — enterprise visual contract */
.auth-workspace {
  --workspace-fg: #f7f8fb;
  --workspace-muted: #b7c0ce;
  --workspace-surface: rgba(17, 22, 33, .96);
  --workspace-border: rgba(255, 255, 255, .14);
  --workspace-focus: #26e7ff;
}

.auth-workspace-switcher {
  color: var(--workspace-fg);
  isolation: isolate;
}

.auth-workspace-switcher :where(button) {
  min-height: 44px;
  color: var(--workspace-fg) !important;
  background: var(--workspace-surface) !important;
  border: 1px solid var(--workspace-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
}

.auth-workspace-switcher :where(button:hover) {
  border-color: rgba(138, 59, 255, .52) !important;
  background: rgba(21, 27, 40, .98) !important;
}

.auth-workspace-switcher :where(button:focus-visible) {
  outline: 3px solid rgba(38, 231, 255, .42) !important;
  outline-offset: 2px;
  border-color: var(--workspace-focus) !important;
}

.auth-workspace-switcher :where(span, p) {
  color: inherit;
}

.auth-workspace-switcher :where(svg) {
  color: var(--workspace-muted);
}

@media (max-width: 760px) {
  .auth-workspace {
    gap: 8px;
  }

  .auth-workspace-switcher {
    min-width: 0;
    max-width: calc(100vw - 104px);
  }

  .auth-workspace-switcher :where(button) {
    min-height: 48px;
    max-width: 100%;
  }
}

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


/* ORVENIX workspace control — premium interaction hardening */
.auth-workspace-switcher :where(button) {
  min-width: 0;
  padding: 0 12px !important;
  gap: 8px;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.auth-workspace-switcher :where(button:hover:not(:disabled)) {
  transform: translateY(-1px);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, .28),
    0 0 0 1px rgba(138, 59, 255, .08);
}

.auth-workspace-switcher :where(button:active:not(:disabled)) {
  transform: translateY(0);
}

.auth-workspace-switcher :where(button:disabled) {
  cursor: not-allowed;
  opacity: .62;
}

.auth-workspace-switcher :where(button > *, span, p) {
  min-width: 0;
}

.auth-workspace-switcher :where(button span, button p) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-workspace-switcher :where(svg) {
  flex: 0 0 auto;
}

.auth-workspace-switcher :where([role="menu"], [role="dialog"], [data-radix-popper-content-wrapper]) {
  max-width: min(360px, calc(100vw - 24px));
}

html[dir="rtl"] .auth-workspace-switcher :where(button) {
  text-align: start;
}

@media (max-width: 760px) {
  .auth-workspace-switcher {
    width: min(100%, 320px);
  }

  .auth-workspace-switcher :where(button) {
    width: 100%;
    padding-inline: 12px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-workspace-switcher :where(button) {
    transform: none !important;
  }
}


/* V4 mobile visual QA — executive shell convergence */
@media (max-width: 760px) {
  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
  }

  .topbar-actions .orvenix-language-switcher {
    grid-column: 1 / -1;
  }

  #authMount {
    min-width: 0;
  }

  .auth-workspace {
    width: 100%;
    min-width: 0;
  }

  .auth-workspace-switcher {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
  }

  #focusModeBtn {
    min-height: 48px;
    white-space: nowrap;
  }

  #uploadContractBtn {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 52px;
  }

  .section-heading {
    align-items: flex-start;
    gap: 10px 16px;
  }

  .section-heading > :last-child {
    max-width: 42%;
    text-align: end;
    overflow-wrap: anywhere;
  }

  .decision-center .section-heading > :last-child {
    font-size: .92rem;
    line-height: 1.35;
  }
}

@media (max-width: 420px) {
  .main-content {
    overflow-x: clip;
  }

  .panel,
  .kpi-card {
    min-width: 0;
  }

  .decision-grid button,
  .simulation-actions button {
    min-height: 48px;
  }
}


/* V4 real-device polish — premium mobile rhythm and hierarchy */
@media (max-width: 760px) {
  .sidebar { padding: 20px 18px 18px; }
  .brand { padding: 4px 6px 18px; }
  .nav { gap: 6px 10px; }
  .nav-item { min-height: 48px; display: flex; align-items: center; padding: 10px 12px; line-height: 1.35; }
  .sidebar-footer { margin-top: 16px; padding: 10px 6px 0; gap: 7px; }
  .main-content { padding: 24px 18px 32px; }
  .topbar { gap: 22px; margin-bottom: 22px; }
  h1 { font-size: clamp(2rem, 9.5vw, 2.65rem); line-height: 1.08; letter-spacing: -.045em; }
  .eyebrow, .section-kicker { line-height: 1.45; }
  .command-bar { margin-bottom: 20px; }
  .kpi-grid, .intelligence-layout, .analytics-grid { gap: 16px; }
  .kpi-card, .panel { border-radius: 20px; }
  .kpi-card, .panel { padding: 20px; }
  .section-heading { margin-bottom: 20px; }
  .section-heading > div:first-child { min-width: 0; }
  .contracts-panel .section-heading, .decision-center .section-heading, .forecast-panel .section-heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .contracts-panel .section-heading > :last-child, .decision-center .section-heading > :last-child, .forecast-panel .section-heading > :last-child { max-width: 11rem; text-align: end; }
  .globe-panel .section-heading { justify-content: center; text-align: center; }
  .globe-panel .section-heading > div { width: 100%; }
  .globe-panel .section-kicker { display: block; max-width: 22rem; margin-inline: auto; }
  .globe-stage { min-height: 300px; margin-top: 4px; }
  .global-core { width: 170px; height: 170px; }
  .core-globe { width: 104px; height: 104px; font-size: .66rem; letter-spacing: .16em; }
  .orbit-one { width: 230px; }
  .orbit-two { width: 270px; }
  .data-node { padding: 6px 9px; font-size: .64rem; }
  .node-one { top: 18%; left: 4%; }
  .node-two { top: 15%; right: 3%; }
  .node-three { bottom: 16%; left: 4%; }
  .node-four { bottom: 13%; right: 3%; }
  .decision-card { padding: 20px; }
}
@media (max-width: 420px) {
  .sidebar, .main-content { padding-inline: 16px; }
  .brand-mark { width: 42px; height: 42px; }
  .contracts-panel .section-heading, .decision-center .section-heading, .forecast-panel .section-heading { grid-template-columns: minmax(0, 1fr) minmax(6.5rem, auto); gap: 10px 12px; }
  .decision-center .section-heading > :last-child { max-width: 8.5rem; font-size: .82rem; }
  .globe-stage { min-height: 286px; }
  .global-core { width: 156px; height: 156px; }
  .core-globe { width: 96px; height: 96px; }
  .orbit-one { width: 215px; }
  .orbit-two { width: 248px; }
}
