:root {
  color-scheme: light;
  --bg: #f3f6f9;
  --ink: #10223d;
  --muted: #637187;
  --line: #d7e0ea;
  --panel: #ffffff;
  --green: #00843d;
  --green-dark: #005f30;
  --gold: #f2b705;
  --red: #c43e36;
  --blue: #003876;
  --navy: #041b3a;
  --navy-2: #082b58;
  --teal: #007a78;
  --shadow: 0 10px 28px rgba(9, 32, 64, 0.08);
}

* {
  box-sizing: border-box;
}

*,
*::before,
*::after {
  min-width: 0;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, #f7fafc 0, var(--bg) 320px),
    var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

h1,
h2,
h3,
p,
span,
strong,
button,
input,
select,
.tag,
.badge {
  overflow-wrap: anywhere;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(4, 27, 58, 0.96), rgba(0, 132, 61, 0.88)),
    var(--navy);
}

body.authenticated .login-screen {
  display: none;
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

.login-logo {
  width: 136px;
  height: auto;
}

.login-card h1 {
  margin: 0;
  color: var(--navy);
}

.login-form {
  display: grid;
  gap: 10px;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
}

.password-field input {
  width: 100%;
  padding-inline-end: 52px;
}

.password-toggle {
  position: absolute;
  inset-inline-end: 6px;
  width: 36px;
  min-height: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--navy);
  box-shadow: none;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #eaf4ef;
  box-shadow: 0 0 0 3px rgba(0, 132, 61, 0.12);
}

.eye-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eye-closed,
.password-visible .eye-open {
  display: none;
}

.password-visible .eye-closed {
  display: block;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 14px;
  font-weight: 700;
}

.login-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.login-controls span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 5px;
  background: #eaf4ef;
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 800;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
  color: var(--ink);
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.18;
  white-space: normal;
}

button:hover {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 132, 61, 0.09);
}

button[data-tooltip]:not(.global-assistant-toggle) {
  position: relative;
}

.button-help-tooltip {
  position: fixed;
  z-index: 200;
  width: max-content;
  max-width: min(320px, calc(100vw - 28px));
  padding: 11px 13px;
  border: 1px solid rgba(242, 183, 5, 0.5);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(8, 43, 88, 0.98), rgba(4, 27, 58, 0.98));
  box-shadow: 0 18px 44px rgba(4, 27, 58, 0.26);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.45;
  text-align: start;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.button-help-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.button-help-tooltip::before {
  content: "";
  position: absolute;
  inset-inline-start: calc(50% - 7px);
  top: -14px;
  border: 7px solid transparent;
  border-bottom-color: var(--navy);
}

.button-help-tooltip.above::before {
  top: auto;
  bottom: -14px;
  border-top-color: var(--navy);
  border-bottom-color: transparent;
}

.actions button:first-child,
#ask-global-ai-btn,
#ask-platform-ai-btn,
#recommend-btn,
#create-campaign-btn,
#save-rm-note-btn,
#save-policy-btn {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
  border-color: var(--green-dark);
  color: white;
}

input,
select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  min-width: 0;
  background: #fbfdff;
}

.app {
  display: grid;
  grid-template-columns: minmax(280px, 312px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background:
    linear-gradient(180deg, #031832 0%, var(--navy-2) 54%, #06371f 100%);
  color: white;
  padding: 24px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 8px 0 30px rgba(4, 27, 58, 0.18);
}

.sidebar h1,
.topbar h2 {
  margin: 4px 0 0;
  line-height: 1.05;
}

.brand {
  display: flex;
  align-items: stretch;
  gap: 14px;
  padding: 6px 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo {
  display: block;
  width: 112px;
  height: 80px;
  flex: 0 0 auto;
  object-fit: contain;
  padding: 8px 10px;
  box-sizing: border-box;
  border-radius: 6px;
  background: white;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.brand > div {
  min-height: 80px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand h1 {
  max-width: 150px;
  font-size: 13px;
  line-height: 1.12;
  letter-spacing: 0;
}

.ai-status-pill {
  width: fit-content;
  max-width: 150px;
  margin: 7px 0 0;
  padding: 4px 7px;
  border: 1px solid rgba(183, 214, 197, 0.35);
  border-radius: 6px;
  color: #d6eee7;
  background: rgba(255, 255, 255, 0.08);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 800;
}

.ai-status-pill.live {
  border-color: rgba(57, 217, 138, 0.7);
  color: #ecfff5;
}

.ai-status-pill.fallback {
  border-color: rgba(247, 178, 42, 0.7);
  color: #fff7df;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 700;
}

.sidebar .eyebrow {
  color: #b7d6c5;
  font-size: 11px;
  line-height: 1.2;
  max-width: 145px;
}

nav {
  display: grid;
  gap: 5px;
}

.nav {
  text-align: left;
  background: transparent;
  color: white;
  border-color: transparent;
  min-height: 42px;
  padding-left: 12px;
  font-size: 14px;
  color: #e5f1f5;
}

.nav.active {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.98), rgba(230, 242, 248, 0.92));
  color: var(--navy);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: inset 4px 0 0 var(--gold);
}

.status {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #d6eee7;
  font-size: 14px;
}

.status span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #39d98a;
}

.sidebar-legal {
  margin: -8px 0 0;
  color: rgba(214, 238, 231, 0.78);
  font-size: 11px;
  line-height: 1.35;
}

.workspace {
  padding: 16px 28px 32px;
  display: grid;
  gap: 16px;
  align-content: start;
  overflow-x: hidden;
}

.app-footer {
  margin-top: 6px;
  padding: 14px 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.workspace > *,
.view > *,
.split > section,
.customer-layout > *,
.panel,
.cards article {
  min-width: 0;
}

.enterprise-strip {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 0 12px;
  border-bottom: 1px solid #ccd8e4;
}

.enterprise-strip strong {
  display: block;
  color: var(--navy);
  font-size: 15px;
}

.enterprise-strip span {
  color: var(--muted);
  font-size: 13px;
}

.context-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.context-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: #28415f;
  font-weight: 700;
}

#signed-in-chip {
  max-width: 310px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  min-height: 64px;
  padding: 4px 0 14px;
  border-bottom: 1px solid #ccd8e4;
}

.actions,
.input-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions {
  justify-content: flex-end;
  max-width: min(760px, 100%);
}

.top-assistant-toggle {
  background: linear-gradient(135deg, var(--green), var(--blue));
  border-color: var(--green-dark);
  color: white;
}

.locale-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.locale-control select {
  min-height: 30px;
  padding: 0 8px;
}

.mini-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.assistant-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.decision-designer {
  display: grid;
  gap: 12px;
}

.strategy-form {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin-bottom: 0;
}

.strategy-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.strategy-toggle-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  color: #17365f;
  font-size: 13px;
  font-weight: 800;
}

.strategy-toggle-grid input {
  min-height: auto;
}

.platform-chat-form {
  grid-template-columns: 48px minmax(112px, 1fr) minmax(82px, auto);
  align-items: stretch;
  margin: 12px 0 0;
}

.platform-chat-form input {
  grid-column: 1 / -1;
}

.voice-button {
  width: 48px;
  min-width: 48px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.voice-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.read-answer-button {
  min-width: 82px;
  padding-inline: 12px;
  white-space: nowrap;
}

.voice-status {
  grid-column: 1 / -1;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.voice-status.warn {
  color: var(--red);
}

.voice-status.ok {
  color: var(--green-dark);
}

.assistant-form {
  grid-template-columns: minmax(130px, 0.7fr) minmax(180px, 1fr) 48px minmax(76px, auto) minmax(82px, auto);
}

.assistant-form input {
  grid-column: auto;
}

.voice-listening {
  border-color: var(--gold) !important;
  background: #fff7df !important;
  color: #4c3400 !important;
}

.voice-disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.chat-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.chat-history {
  display: grid;
  gap: 10px;
  max-height: 300px;
  overflow: auto;
}

.chat-message {
  max-width: 78%;
  border-radius: 8px;
  padding: 10px 12px;
  line-height: 1.4;
  font-size: 14px;
}

.chat-message.user {
  justify-self: end;
  background: #e8eff7;
  color: #17365f;
}

.chat-message.assistant {
  justify-self: start;
  background: #eaf4ef;
  color: #123625;
}

.chat-message .read-message-btn {
  margin-top: 8px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 12px;
}

.command-hero {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 380px;
  gap: 18px;
  align-items: center;
  min-height: 164px;
  padding: 22px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(0, 56, 118, 0.96), rgba(0, 132, 61, 0.92)),
    var(--blue);
  color: white;
  box-shadow: 0 18px 42px rgba(0, 56, 118, 0.2);
}

.command-hero .eyebrow {
  color: #cbeadd;
}

.command-hero h3 {
  margin: 6px 0 10px;
  color: white;
  font-size: 28px;
  line-height: 1.12;
}

.command-hero p {
  max-width: 740px;
  margin: 0;
  color: #e8f4ef;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hero-grid span {
  min-height: 54px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.13);
  border: 1px solid rgba(255, 255, 255, 0.24);
  color: white;
  font-weight: 800;
}

.global-assistant-toggle {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: 22px;
  z-index: 40;
  min-height: 46px;
  padding: 0 18px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  color: white;
  border-color: var(--green-dark);
  box-shadow: 0 14px 34px rgba(0, 56, 118, 0.26);
  max-width: calc(100vw - 36px);
  white-space: nowrap;
}

.global-assistant-panel {
  position: fixed;
  right: 22px;
  bottom: 82px;
  z-index: 39;
  display: none;
  width: min(420px, calc(100vw - 32px));
  max-height: min(680px, calc(100vh - 110px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 24px 60px rgba(7, 31, 65, 0.22);
}

.global-assistant-panel.open {
  display: grid;
  gap: 12px;
}

.global-assistant-panel header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.global-assistant-panel h3 {
  margin: 2px 0 0;
}

#print-root {
  display: none;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 22px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.compact-metrics {
  grid-template-columns: repeat(3, minmax(110px, 1fr));
}

.metric,
.panel,
.split > section,
.client-table,
.cards article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric {
  border-top: 4px solid var(--blue);
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbfe 100%);
}

.metric strong {
  display: block;
  font-size: 30px;
  line-height: 1;
  color: var(--navy);
}

.production-metric strong {
  overflow-wrap: anywhere;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.08;
}

.metric span,
.muted {
  color: var(--muted);
  font-size: 14px;
}

.split,
.customer-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.client-command {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.client-search {
  width: min(640px, 100%);
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 0.8fr);
  gap: 8px;
}

.priority-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.priority-card {
  min-height: 92px;
  display: grid;
  align-content: center;
  text-align: left;
  border-top: 4px solid var(--green);
}

.priority-card span,
.priority-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.client-360-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(0, 1.25fr);
  gap: 16px;
  align-items: start;
}

.client-360-layout > aside:not(.client-rail) {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: start;
}

.client-360-layout > aside:not(.client-rail) > h3 {
  margin-top: 10px;
}

.client-rail,
.client-360-layout > section,
.client-360-layout > aside {
  min-width: 0;
}

.client-card-list {
  display: grid;
  gap: 10px;
  max-height: 540px;
  overflow: auto;
}

.client-action-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.client-action-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0, 132, 61, 0.12);
}

.timeline {
  display: grid;
  gap: 9px;
}

.timeline-item {
  display: grid;
  gap: 3px;
  padding: 10px 10px 10px 16px;
  border-left: 3px solid var(--green);
  border-radius: 0 6px 6px 0;
  background: #f8fbfd;
}

.timeline-item span,
.timeline-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.customer-snapshot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--navy), #06345d 58%, var(--green-dark));
  color: white;
}

.customer-snapshot h2 {
  margin: 0;
  font-size: 28px;
}

.customer-snapshot p,
.customer-snapshot .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.snapshot-badges,
.customer-tabs,
.decision-card-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.decision-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  margin: 12px 0;
}

.decision-card-grid article {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fbfd;
}

.decision-card-grid span,
.decision-card-grid em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.customer-tabs {
  margin: 12px 0;
  border-bottom: 1px solid var(--line);
}

.customer-tab {
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-transform: capitalize;
}

.customer-tab.active {
  color: var(--green-dark);
  border-bottom-color: var(--green);
}

.customer-tab-panel {
  display: none;
}

.customer-tab-panel.active {
  display: block;
}

.next-action-compact,
.collab-summary {
  display: grid;
  gap: 5px;
}

.next-action-compact span,
.next-action-compact p,
.collab-summary span {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

#customer-offer-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.compact-offer-card {
  display: grid;
  gap: 8px;
}

h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--navy);
}

.list,
.check-list,
.panel {
  display: grid;
  gap: 10px;
}

.ai-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.ai-status-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #f6faf9 100%);
}

.ai-status-card strong {
  display: block;
  color: var(--navy);
  font-size: 15px;
  line-height: 1.2;
}

.ai-status-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(84px, 38%);
  align-items: flex-start;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.row > span {
  min-width: 0;
}

.row > strong {
  text-align: right;
  min-width: 0;
  max-width: 100%;
}

.row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.audit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, max-content);
  gap: 14px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.audit-row > strong {
  text-align: right;
}

.audit-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.user-admin-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.user-admin-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.user-admin-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}

.user-admin-controls input,
.user-admin-controls select,
.user-admin-controls button {
  min-height: 34px;
  font-size: 13px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
  margin: 8px 0 12px;
}

.permission-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfdff;
}

.permission-option input {
  min-height: auto;
  margin-top: 4px;
}

.permission-option strong,
.permission-option small,
.permission-option em {
  display: block;
}

.permission-option small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.permission-option em {
  margin-top: 5px;
  color: var(--green-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.permission-details {
  grid-column: 1 / -1;
  padding-top: 8px;
}

.permission-details summary {
  cursor: pointer;
  color: var(--navy);
  font-weight: 850;
}

.compact-panel {
  padding: 10px;
  background: #f8fbfd;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 6px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  background: #eaf4ef;
  color: var(--green);
}

.badge.warn {
  background: #fff5d3;
  color: #7c5514;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.cards.compact {
  grid-template-columns: 1fr;
}

.capability-cards {
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.cards article {
  display: grid;
  gap: 10px;
  border-top: 4px solid var(--blue);
}

.capability-cards article {
  align-content: start;
}

.score {
  font-size: 34px;
  color: var(--green);
  font-weight: 800;
}

.offer-header,
.offer-actions,
.channel-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.profile-section-title {
  margin: -2px -2px 4px;
  padding: 10px 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--navy), var(--green-dark));
  color: white;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.offer-header {
  justify-content: space-between;
}

.offer-actions {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.offer-send-btn {
  background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
  border-color: var(--green-dark);
  color: white;
}

.offer-send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

.client-table {
  padding: 0;
  overflow-x: auto;
  max-width: 100%;
  width: 100%;
}

.client-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(92px, 0.7fr) minmax(120px, 0.9fr) minmax(160px, 1fr) minmax(64px, 0.45fr) minmax(220px, 1.4fr);
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  min-width: 900px;
}

.client-row:last-child {
  border-bottom: 0;
}

.client-row.header {
  background: linear-gradient(180deg, #eef4f8 0%, #e7eef5 100%);
  color: #3b506c;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  box-shadow: inset 0 -1px 0 var(--line);
}

.client-row:not(.header):hover {
  background: #fbfcfe;
}

.client-row strong,
.client-row span {
  min-width: 0;
}

.client-row button {
  min-height: 34px;
  padding: 0 10px;
}

.action-stack {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.fit-score {
  font-size: 24px;
  font-weight: 850;
  color: var(--blue);
}

.insight {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border-radius: 5px;
  background: #e8eff7;
  color: #29466b;
  font-size: 12px;
}

.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--green-dark);
  border-radius: 6px;
  background: linear-gradient(180deg, var(--green) 0%, var(--green-dark) 100%);
  color: white;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.document-preview {
  max-height: 680px;
  overflow: auto;
  line-height: 1.5;
  background:
    linear-gradient(180deg, rgba(0, 132, 61, 0.04), rgba(255, 255, 255, 0) 180px),
    white;
}

.document-cover {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: -4px -4px 18px;
  padding: 18px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--navy), #07345f 54%, var(--green-dark));
  color: white;
  font-weight: 900;
  text-transform: uppercase;
}

.document-cover img {
  width: 122px;
  max-width: 45%;
  padding: 8px;
  border-radius: 6px;
  background: white;
}

.document-preview h2 {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 26px;
}

.document-preview h3 {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--green-dark);
}

.document-preview code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef4f8;
}

.report-tools {
  margin-bottom: 12px;
}

.doc-bullet {
  padding-left: 14px;
  position: relative;
}

.doc-bullet::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.72em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--green);
}

body.rtl {
  direction: ltr;
}

body.rtl .sidebar,
body.rtl .workspace,
body.rtl .global-assistant-panel,
body.rtl .global-assistant-toggle {
  direction: rtl;
}

body.rtl .nav,
body.rtl .row > strong,
body.rtl .client-row {
  text-align: right;
}

body.rtl .nav.active {
  box-shadow: inset -4px 0 0 var(--gold);
}

body.rtl .actions {
  justify-content: flex-start;
}

body.rtl .brand {
  flex-direction: row-reverse;
}

body.rtl .row > strong {
  text-align: left;
}

body.rtl .action-stack {
  justify-content: flex-start;
}

body.rtl .global-assistant-toggle,
body.rtl .global-assistant-panel {
  right: auto;
  left: 22px;
}

body.rtl .chat-message.user {
  justify-self: start;
}

body.rtl .chat-message.assistant {
  justify-self: end;
}

@media (max-width: 880px) {
  .app,
  .split,
  .customer-layout,
  .client-360-layout,
  .client-command,
  .client-search,
  .priority-strip,
  .decision-card-grid,
  .command-hero {
    grid-template-columns: 1fr;
  }

  .client-command {
    display: grid;
  }

  .customer-snapshot {
    display: grid;
  }

  .client-360-layout > aside:not(.client-rail) {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  #customer-offer-panel {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

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

  .mini-form {
    grid-template-columns: 1fr;
  }

  .compact-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .context-chips {
    justify-content: flex-start;
  }

  .global-assistant-toggle {
    inset-inline: 12px;
    right: 12px;
    left: 12px;
    bottom: 12px;
    width: auto;
    justify-content: center;
  }

  .global-assistant-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 68px;
    max-height: calc(100vh - 86px);
  }

  .client-row,
  .client-row.header,
  .user-admin-row {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .client-row.header {
    display: none;
  }
}

@media print {
  body {
    background: white;
  }

  body.printing .app {
    display: none !important;
  }

  body.printing #print-root {
    display: block !important;
  }

  #print-root {
    display: none;
  }

  #print-root .print-page {
    display: grid;
    gap: 16px;
    color: #071f41;
  }

  #print-root .print-title {
    border-bottom: 2px solid #00843d;
    padding-bottom: 12px;
    margin-bottom: 4px;
  }

  #print-root .print-footer {
    margin-top: 18px;
    padding-top: 10px;
    border-top: 1px solid #ccd8e4;
    color: #48617a;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
  }

  .sidebar,
  .enterprise-strip,
  .actions,
  .global-assistant-toggle,
  .global-assistant-panel,
  #login-screen {
    display: none !important;
  }

  .app,
  .workspace {
    display: block;
  }

  .workspace {
    padding: 0;
  }

  .view {
    display: none !important;
  }

  .view.active {
    display: block !important;
  }

  section,
  .panel,
  .metric,
  article {
    box-shadow: none !important;
    break-inside: avoid;
  }
}

.chat-message-footer { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.chat-meta-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-citations { background: rgba(0,0,0,0.04); border-radius: 8px; padding: 6px 10px; }
.chat-citations ul { margin: 4px 0 0 16px; padding: 0; }
.chat-citations li { margin: 2px 0; }
.chat-feedback { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chat-fb-btn { background: transparent; border: 1px solid rgba(0,0,0,0.15); border-radius: 999px; padding: 4px 10px; cursor: pointer; font-size: 12px; }
.chat-fb-btn:hover:not(:disabled) { background: rgba(0,0,0,0.05); }
.chat-fb-btn:disabled { opacity: 0.5; cursor: default; }
.chat-fb-status { font-size: 11px; }
#ai-model-card-panel details { margin: 6px 0; }
#ai-model-card-panel summary { cursor: pointer; padding: 4px 0; }

/* ============================================================
   Users & Access — production directory + drawer
   ============================================================ */
.ua-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  flex-wrap: wrap; margin-bottom: 14px;
}
.ua-header h3 { margin: 0 0 4px; }
.ua-header .muted { margin: 0; max-width: 720px; }
.ua-header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ghost-btn {
  background: #fff; color: var(--navy); border: 1px solid var(--line);
  border-radius: 7px; padding: 8px 14px; font-weight: 700; cursor: pointer;
  min-height: 36px; font-size: 13px;
}
.ghost-btn:hover { border-color: var(--navy); background: #f7fafc; }

.ua-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-top: 4px;
}
.ua-stat {
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  padding: 12px 14px; position: relative;
}
.ua-stat .label { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ua-stat .value { color: var(--navy); font-size: 22px; font-weight: 850; margin-top: 4px; line-height: 1.1; }
.ua-stat .sub { color: var(--muted); font-size: 11px; margin-top: 2px; }
.ua-stat.warn { border-left: 3px solid #d18b00; }
.ua-stat.danger { border-left: 3px solid var(--red); }
.ua-stat.good { border-left: 3px solid var(--green); }
.ua-stat.privileged { border-left: 3px solid var(--teal); }

.ua-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.ua-search {
  flex: 1 1 320px; min-height: 38px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  font-size: 13px; color: var(--navy);
}
.ua-search:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(4,27,58,0.08); }
.ua-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.ua-chip {
  background: #fff; border: 1px solid var(--line); color: var(--navy);
  border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  min-height: 30px;
}
.ua-chip:hover { border-color: var(--navy); }
.ua-chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.ua-chip .count {
  background: rgba(4,27,58,0.08); color: var(--navy);
  border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 800;
}
.ua-chip.active .count { background: rgba(255,255,255,0.18); color: #fff; }

.ua-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}
.ua-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; cursor: pointer; transition: all 0.15s ease;
  display: flex; flex-direction: column; gap: 10px; position: relative;
}
.ua-card:hover {
  border-color: var(--navy); box-shadow: 0 4px 12px rgba(4,27,58,0.08);
  transform: translateY(-1px);
}
.ua-card.suspended { background: #fff8f3; }
.ua-card.disabled { background: #f6f6f8; opacity: 0.78; }
.ua-card.privileged { border-left: 3px solid var(--teal); }

.ua-card-top { display: flex; gap: 12px; align-items: flex-start; }
.ua-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 15px; flex-shrink: 0;
  letter-spacing: 0.03em;
}
.ua-identity { flex: 1; min-width: 0; }
.ua-identity .name {
  color: var(--navy); font-weight: 800; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ua-identity .email { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ua-status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
  background: var(--green); margin-right: 6px;
}
.ua-status-dot.suspended { background: #d18b00; }
.ua-status-dot.disabled { background: #98a3b3; }

.ua-role-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ua-role-chip {
  display: inline-flex; align-items: center; padding: 3px 9px;
  border-radius: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.02em;
  text-transform: uppercase;
}
.ua-role-chip[data-role="relationship_manager"] { background: #e7f1ff; color: #0b3b7a; }
.ua-role-chip[data-role="marketing_manager"] { background: #fde6f3; color: #8a1857; }
.ua-role-chip[data-role="compliance"] { background: #eaf4ef; color: var(--green-dark); }
.ua-role-chip[data-role="it_admin"] { background: #ecf0fa; color: #2a2d6e; }
.ua-role-chip[data-role="executive"] { background: #fff1d4; color: #6b4500; }
.ua-role-chip[data-role="super_admin"] { background: #e8f6f5; color: #00524d; border: 1px solid #aedcd8; }

.ua-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.ua-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ua-meta strong { color: var(--navy); font-weight: 700; }

.ua-flags { display: flex; gap: 6px; flex-wrap: wrap; }
.ua-flag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 700;
}
.ua-flag.ok { background: #eaf4ef; color: var(--green-dark); }
.ua-flag.warn { background: #fff5d3; color: #7c5514; }
.ua-flag.info { background: #e7f1ff; color: #0b3b7a; }
.ua-flag.danger { background: #fde4e2; color: var(--red); }
.ua-flag.neutral { background: #eef2f6; color: var(--muted); }

.ua-card-footer {
  display: flex; gap: 6px; justify-content: space-between; align-items: center;
  padding-top: 8px; border-top: 1px dashed var(--line); font-size: 11px; color: var(--muted);
}
.ua-quick-actions { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.ua-card:hover .ua-quick-actions { opacity: 1; }
.ua-icon-btn {
  background: transparent; border: 1px solid var(--line); border-radius: 5px;
  padding: 4px 8px; font-size: 11px; font-weight: 700; color: var(--navy); cursor: pointer;
}
.ua-icon-btn:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
.ua-icon-btn.danger:hover { background: var(--red); border-color: var(--red); }

/* Drawer */
.ua-drawer-root { position: fixed; inset: 0; pointer-events: none; z-index: 80; }
.ua-drawer-root.open { pointer-events: auto; }
.ua-backdrop {
  position: absolute; inset: 0; background: rgba(4,27,58,0.45);
  opacity: 0; transition: opacity 0.2s ease;
}
.ua-drawer-root.open .ua-backdrop { opacity: 1; }
.ua-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(620px, 96vw);
  background: #fff; box-shadow: -8px 0 32px rgba(4,27,58,0.18);
  transform: translateX(100%); transition: transform 0.25s ease;
  display: flex; flex-direction: column;
}
.ua-drawer-root.open .ua-drawer { transform: translateX(0); }
.ua-drawer-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
}
.ua-drawer-head-id { display: flex; gap: 12px; align-items: center; min-width: 0; }
.ua-drawer-close {
  background: transparent; border: 0; font-size: 22px; cursor: pointer; color: var(--muted);
  width: 32px; height: 32px; border-radius: 6px;
}
.ua-drawer-close:hover { background: #f3f6f9; color: var(--navy); }
.ua-drawer-body { padding: 18px 22px; overflow-y: auto; flex: 1; }
.ua-drawer-body section { margin-bottom: 20px; }
.ua-drawer-body h4 {
  margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 800;
}
.ua-security-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px; margin-bottom: 8px;
}
.ua-security-tile {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.ua-security-tile .label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.ua-security-tile .value { color: var(--navy); font-weight: 800; margin-top: 3px; font-size: 14px; }

.ua-field { display: grid; gap: 5px; margin-bottom: 12px; }
.ua-field label { font-size: 12px; font-weight: 700; color: var(--navy); }
.ua-field input, .ua-field select {
  min-height: 36px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 13px; color: var(--navy); background: #fff;
}
.ua-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.ua-perm-matrix { display: grid; gap: 6px; }
.ua-perm-row {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: flex-start;
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fbfdff;
}
.ua-perm-row input { margin-top: 3px; }
.ua-perm-row strong { color: var(--navy); font-size: 13px; }
.ua-perm-row small { color: var(--muted); font-size: 11px; display: block; margin-top: 2px; }
.ua-perm-row .area { font-size: 10px; font-weight: 800; text-transform: uppercase; color: var(--teal); letter-spacing: 0.04em; }

.ua-danger-zone {
  border: 1px solid #f5c5c1; border-radius: 8px; padding: 12px;
  background: #fff6f5;
}
.ua-danger-zone h4 { color: var(--red); margin-bottom: 8px; }
.ua-danger-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ua-danger-actions button { font-size: 12px; padding: 7px 12px; }

.ua-drawer-foot {
  border-top: 1px solid var(--line); padding: 14px 22px;
  display: flex; justify-content: space-between; gap: 10px; background: #f8fafc;
}

.ua-queue-row {
  display: grid; grid-template-columns: 1fr auto; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; align-items: center;
}
.ua-queue-row + .ua-queue-row { margin-top: 8px; }
.ua-queue-row .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.ua-queue-actions { display: flex; gap: 6px; }

.ua-role-card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px;
}
.ua-role-card + .ua-role-card { margin-top: 8px; }
.ua-role-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ua-role-perms { display: flex; gap: 6px; flex-wrap: wrap; }
.ua-role-perms .perm-pill {
  background: #eef2f6; color: var(--navy); padding: 3px 8px; border-radius: 5px;
  font-size: 11px; font-weight: 600;
}

.ua-empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  background: #fff; border: 1px dashed var(--line); border-radius: 10px;
}

@media (max-width: 700px) {
  .ua-field-row { grid-template-columns: 1fr; }
  .ua-drawer { width: 100vw; }
}
