:root {
  color-scheme: light;
  --ink: #000000;
  --muted: #595750;
  --paper: #f5f4f0;
  --surface: #ffffff;
  --line: #d8d5cc;
  --accent: #111111;
  --accent-dark: #000000;
  --accent-soft: #ffec00;
  --warm: #ffec00;
  --sole-yellow: #ffec00;
  --sole-offwhite: #f5f4f0;
  --danger: #a23737;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.12);
  font-family: Montserrat, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

.financial-heading, .financial-period, .financial-tenant-card,
.financial-tenant-card dl, .financial-value-field {
  display: flex;
  gap: 1rem;
}
.financial-heading { justify-content: space-between; align-items: flex-end; flex-wrap: wrap; }
.financial-period { align-items: flex-end; flex-wrap: wrap; }
.financial-period label { min-width: 8rem; }
.financial-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: .8rem;
  margin: 1.5rem 0;
}
.financial-kpis article {
  border: 1px solid var(--line, #d9e1d9);
  border-radius: 1rem;
  padding: 1rem;
  background: #fff;
}
.financial-kpis strong { display: block; font-size: 1.35rem; margin-bottom: .35rem; }
.financial-kpis span { color: var(--muted, #657268); }
.financial-tenants { display: grid; gap: 1rem; }
.financial-tenant-card {
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line, #d9e1d9);
  border-radius: 1rem;
  padding: 1rem 1.2rem;
  background: #fff;
}
.financial-tenant-card h2, .financial-tenant-card p { margin: 0; }
.financial-tenant-card p { color: var(--muted, #657268); margin-top: .3rem; }
.financial-tenant-card dl { margin: 0; flex-wrap: wrap; }
.financial-tenant-card dl div { min-width: 7rem; }
.financial-tenant-card dt { color: var(--muted, #657268); font-size: .8rem; }
.financial-tenant-card dd { margin: .2rem 0 0; font-weight: 700; }
.financial-dialog { width: min(58rem, calc(100vw - 2rem)); max-height: 90vh; }
.financial-dialog fieldset {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem;
  border: 1px solid var(--line, #d9e1d9);
  border-radius: 1rem;
  padding: 1rem;
}
.financial-dialog legend { font-weight: 700; padding: 0 .4rem; }
.financial-value-fields { display: contents; }
.financial-value-field { flex-direction: column; }
.compliance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: .8rem;
  margin: 1.5rem 0;
}
.compliance-summary article {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  border: 1px solid var(--line, #d9e1d9);
  border-radius: 1rem;
  padding: 1rem;
  background: #fff;
}
.compliance-summary strong { font-size: 1.4rem; }
.compliance-summary small { color: var(--muted, #657268); }
.compliance-tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.compliance-tabs button { background: #fff; color: inherit; border: 1px solid var(--line, #d9e1d9); }
.compliance-tabs button.active { background: #0d6b49; color: #fff; }
.compliance-records { display: grid; gap: .75rem; margin-bottom: 1rem; }
.compliance-record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid var(--line, #d9e1d9);
  border-left: .35rem solid #b77a13;
  border-radius: .9rem;
  padding: 1rem;
  background: #fff;
}
.compliance-record.Verified { border-left-color: #17824f; }
.compliance-record.Expired, .compliance-record.ActionRequired, .compliance-record.Missing { border-left-color: #b52b24; }
.compliance-record h2, .compliance-record p { margin: 0; }
.compliance-record p { margin-top: .3rem; color: var(--muted, #657268); }
.compliance-detail-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  grid-column: 1 / -1;
}
#compliance-license-inventory { margin-top: 1.5rem; }
@media (max-width: 760px) {
  .financial-tenant-card { align-items: stretch; flex-direction: column; }
  .financial-tenant-card dl { display: grid; grid-template-columns: 1fr 1fr; }
  .compliance-record { align-items: stretch; flex-direction: column; }
}

@media (max-width: 900px) {
  .conversation-content { grid-template-columns: 1fr; }
  .customer-card { border-left: 0; border-top: 1px solid var(--line); }
  .database-import-form { align-items: stretch; flex-direction: column; }
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

.app-loading {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1rem;
  color: var(--muted);
}

.app-loading p {
  margin: 0;
  font-weight: 700;
}

.app-loading.error p { color: var(--danger); }

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

button { cursor: pointer; }

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-size: 0.73rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.muted { color: var(--muted); }

.brand-mark {
  display: grid;
  width: 3.1rem;
  height: 3.1rem;
  place-items: center;
  border-radius: 1rem;
  color: #000;
  background: var(--sole-yellow);
  font-size: 0.88rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.brand-mark.small {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.8rem;
  font-size: 0.72rem;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 15% 12%, #d8ecdf 0, transparent 28rem),
    radial-gradient(circle at 86% 88%, #eadfcd 0, transparent 30rem),
    var(--paper);
}

.login-shell {
  display: grid;
  width: min(1050px, 100%);
  grid-template-columns: 1.15fr 0.85fr;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 2rem;
  box-shadow: var(--shadow);
  background: var(--surface);
}

.brand-panel {
  min-height: 610px;
  padding: 4rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(145deg, rgba(10, 73, 49, 0.97), rgba(25, 107, 75, 0.9)),
    var(--accent);
  color: #fff;
}

.brand-panel .eyebrow {
  margin-top: 2.2rem;
  color: #b8dfca;
}

.brand-panel h1 {
  max-width: 11ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.lead {
  max-width: 47ch;
  margin: 1.8rem 0 0;
  color: #d9ece1;
  font-size: 1.05rem;
  line-height: 1.7;
}

.signal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 2.4rem;
}

.signal-row span {
  padding: 0.55rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  color: #e5f2ea;
  font-size: 0.78rem;
}

.login-card {
  padding: 4rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.4rem;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.login-card form {
  display: grid;
  gap: 1.2rem;
  margin-top: 2.2rem;
}

.login-card label {
  display: grid;
  gap: 0.5rem;
  color: #38443c;
  font-size: 0.84rem;
  font-weight: 750;
}

input {
  width: 100%;
  padding: 0.88rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  outline: none;
  color: var(--ink);
  background: #fbfcfa;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 107, 75, 0.12);
}

select,
textarea {
  width: 100%;
  padding: 0.88rem 1rem;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  outline: none;
  color: var(--ink);
  background: #fbfcfa;
}

select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(25, 107, 75, 0.12);
}

.login-card button {
  margin-top: 0.35rem;
  padding: 0.95rem 1.1rem;
  border: 0;
  border-radius: 0.85rem;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.login-card button:hover { background: var(--accent-dark); }
.login-card button:disabled { opacity: 0.6; cursor: wait; }

.mfa-qr-frame {
  display: flex;
  width: fit-content;
  margin: 1rem auto;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  background: #fff;
}

.mfa-qr-frame img {
  display: block;
  width: min(220px, 100%);
  height: auto;
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.83rem;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.product,
.operator {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.product {
  color: inherit;
  text-decoration: none;
}

.product span:last-child,
.operator span {
  display: grid;
  gap: 0.15rem;
}

.product small,
.operator small {
  color: var(--muted);
  font-size: 0.73rem;
}

.operator { text-align: right; }

.topnav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-button {
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: 0.65rem;
  color: var(--muted);
  background: transparent;
  font-weight: 750;
}

.nav-button:hover,
.nav-button.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.button-secondary {
  padding: 0.62rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.workspace {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(310px, 380px) 1fr;
}

.conversation-sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 1.5rem 1.1rem 0;
  border-right: 1px solid var(--line);
  background: #fafbf8;
}

.sidebar-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  padding: 0 0.4rem 1.1rem;
}

.sidebar-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.count {
  display: grid;
  min-width: 2rem;
  height: 2rem;
  place-items: center;
  padding: 0 0.55rem;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.8rem;
  font-weight: 800;
}

.search { display: block; }

.inbox-tenant {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.inbox-tenant select {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: var(--surface);
  color: var(--ink);
}

.conversation-list {
  min-height: 0;
  margin-top: 1rem;
  overflow-y: auto;
}

.conversation-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.8rem;
  padding: 1rem 0.8rem;
  border: 0;
  border-top: 1px solid var(--line);
  text-align: left;
  background: transparent;
}

.conversation-item:hover,
.conversation-item.active {
  border-radius: 0.9rem;
  background: var(--accent-soft);
}

.avatar {
  display: grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border-radius: 50%;
  color: var(--accent-dark);
  background: var(--warm);
  font-weight: 900;
}

.conversation-copy {
  min-width: 0;
  display: grid;
  gap: 0.25rem;
}

.conversation-copy strong,
.conversation-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-copy span {
  color: var(--muted);
  font-size: 0.8rem;
}

.conversation-item time {
  color: var(--muted);
  font-size: 0.7rem;
}

.conversation-panel {
  min-width: 0;
  overflow: hidden;
  background:
    linear-gradient(rgba(244, 246, 241, 0.9), rgba(244, 246, 241, 0.9)),
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 18px,
      rgba(25, 107, 75, 0.035) 18px,
      rgba(25, 107, 75, 0.035) 19px
    );
}

.empty-state {
  height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-state h2 {
  margin: 1rem 0 0.3rem;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2rem;
  font-weight: 500;
}

.empty-state p { margin: 0; }

.empty-icon {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border-radius: 1.3rem;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 1.8rem;
  letter-spacing: 0.1em;
}

#conversation-view {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.reply-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.reply-composer textarea {
  min-height: 3rem;
  max-height: 9rem;
  resize: vertical;
}

.reply-composer button,
.stack-form button {
  align-self: stretch;
  padding: 0.8rem 1.25rem;
  border: 0;
  border-radius: 0.8rem;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.reply-composer button:hover,
.stack-form button:hover { background: var(--accent-dark); }
.reply-composer button:disabled { opacity: 0.6; cursor: wait; }
.reply-composer .form-error {
  grid-column: 1 / -1;
}

.admin-workspace {
  min-height: calc(100vh - 72px);
  padding: 2rem;
  overflow-y: auto;
}

.admin-heading {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
}

.admin-heading h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.5rem;
  font-weight: 500;
  letter-spacing: -0.04em;
}

.admin-heading p:last-child {
  margin: 0.5rem 0 0;
  color: var(--muted);
}

.admin-grid {
  max-width: 1200px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 0 auto;
}

.admin-card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 10px 30px rgba(30, 48, 38, 0.04);
}

.admin-card h2 {
  margin: 0 0 1.1rem;
  font-size: 1.15rem;
}

.feature-entry-card {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: linear-gradient(135deg, var(--surface), var(--accent-soft));
}
.feature-entry-card h2 { margin-bottom: .35rem; font-size: 1.45rem; }
.feature-entry-card p:last-child { margin: 0; color: var(--muted); }
.marketing-workspace { max-width: 1200px; margin: 0 auto; }
.marketing-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.marketing-toolbar label { display: grid; gap: .35rem; font-size: .8rem; font-weight: 750; }
.marketing-heading { margin-bottom: 1.25rem; }
.marketing-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.marketing-grid .admin-card > p { color: var(--muted); line-height: 1.5; }
.marketing-grid textarea { resize: vertical; }
.marketing-grid small { color: var(--muted); font-weight: 500; }
.contact-preview { display: grid; gap: .35rem; margin-top: .75rem; }
.contact-preview span {
  padding: .5rem .65rem;
  border-radius: .55rem;
  background: var(--background);
  color: var(--muted);
  font-size: .78rem;
}
.marketing-send-box { margin-top: 1.2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.marketing-send-box p { color: var(--muted); font-size: .82rem; }
.marketing-consent-box { margin-top: 1.2rem; padding: 1rem 1.1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.marketing-consent-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.marketing-consent-copy h3 { margin: 0 0 .25rem; font-size: .95rem; }
#marketing-consent-hint { margin: 0; color: var(--muted); font-size: .82rem; }
#marketing-consent-status { margin: .6rem 0 0; color: var(--muted); font-size: .8rem; }
.toggle-switch { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; user-select: none; }
.toggle-switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { position: relative; width: 44px; height: 24px; border-radius: 999px; background: var(--line); transition: background .15s ease; flex: 0 0 auto; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s ease; }
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(20px); }
.toggle-switch input:focus-visible + .toggle-track { outline: 2px solid var(--accent-dark); outline-offset: 2px; }
.toggle-switch input:disabled + .toggle-track { opacity: .5; cursor: default; }
.toggle-state { font-size: .82rem; font-weight: 600; color: var(--ink); min-width: 3.2em; }
.marketing-composer {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--surface);
}
.marketing-composer textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.marketing-composer textarea + textarea { border-top: 1px solid var(--line); }
.marketing-composer .standard-copy {
  color: var(--muted);
  background: #f5f6f3;
}
.marketing-composer .standard-copy.editable {
  color: var(--text);
  background: var(--surface);
}
.standard-message-settings {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .8rem 1rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
}
.standard-message-settings label { display: flex; flex-direction: row; align-items: center; }
.marketing-disclaimer {
  margin-top: 1.5rem;
  padding: 1rem;
  border-radius: .75rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: .8rem;
  line-height: 1.5;
}
.marketing-disclaimer p { margin: .35rem 0 0; }
.database-table tbody tr[data-contact-id] { cursor: pointer; }
.database-table tbody tr[data-contact-id]:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.customer-profile-dialog { width: min(960px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); border: 0; border-radius: 18px; padding: 1.5rem; box-shadow: 0 24px 80px rgba(0,0,0,.24); }
.customer-profile-dialog::backdrop { background: rgba(17,24,39,.55); }
.customer-profile-consent { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; margin: 1rem 0; border: 1px solid var(--line); border-radius: 12px; }
.customer-profile-consent p { margin: .3rem 0 0; color: var(--muted); }
.customer-profile-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.customer-profile-grid section { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; }
.customer-profile-grid h3 { margin-top: 0; }
.customer-profile-list { margin: 0; padding-left: 1.15rem; }
.customer-profile-list li + li { margin-top: .55rem; }

.operators-card {
  max-width: 1200px;
  margin: 1.25rem auto 0;
}

.stack-form {
  display: grid;
  gap: 0.9rem;
  margin-bottom: 1.3rem;
}

.stack-form label {
  display: grid;
  gap: 0.4rem;
  color: #38443c;
  font-size: 0.8rem;
  font-weight: 750;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.8rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.8rem;
}

th {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.section-title select { max-width: 260px; }

.identity-cell {
  display: grid;
  gap: 0.2rem;
}

.identity-cell small { color: var(--muted); }

.status-badge {
  display: inline-block;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
}

.status-badge.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.status-badge.inactive {
  color: var(--danger);
  background: #f6dddd;
}

.table-action {
  padding: 0.45rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 0.55rem;
  background: var(--surface);
  font-size: 0.74rem;
  font-weight: 700;
}

.table-action:disabled { opacity: 0.45; cursor: not-allowed; }

.conversation-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.45rem 2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.conversation-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-message-label {
  display: block;
  margin-top: 0.35rem;
  font-weight: 700;
  opacity: 0.75;
}

.message-sources {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.45rem;
}

.message-sources a {
  color: inherit;
  text-decoration: underline;
}

.conversation-header h2 { margin: 0.4rem 0 0; font-size: 1.25rem; }
.conversation-header time { color: var(--muted); font-size: 0.78rem; }

.channel-pill {
  display: inline-block;
  margin: 0;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.message-list {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 2rem;
  overflow-y: auto;
}

.message {
  max-width: min(72%, 680px);
  padding: 0.85rem 1rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 1rem 1rem 1rem 0.25rem;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(30, 48, 38, 0.05);
}

.message.outgoing {
  align-self: flex-end;
  border-color: #bddbc9;
  border-radius: 1rem 1rem 0.25rem 1rem;
  background: var(--accent-soft);
}

.message p { margin: 0; line-height: 1.5; }
.message time {
  display: block;
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
}

.empty-list {
  padding: 2rem 0.8rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.85rem;
}

.message-template-card { margin-bottom: 1.5rem; }
.message-template-card .section-title { align-items: flex-end; }
.message-template-card .section-title p { margin: 0.35rem 0 0; color: var(--muted); }
.message-template-card .section-title label { min-width: 240px; }
.template-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}
.template-form label { display: flex; flex-direction: column; gap: 0.4rem; }
.template-form textarea { min-height: 5rem; resize: vertical; }
.template-form small { color: var(--muted); font-weight: 500; }
.template-category-navigation {
  grid-column: 1 / -1;
  margin: 0;
}
.stack-form .template-category-navigation .template-category-option {
  width: 100%;
  min-height: 150px;
  border: 1px solid #cbc8bf;
  color: #000;
  background: linear-gradient(145deg, #fff, var(--sole-offwhite));
  box-shadow: 0 14px 36px rgba(0, 0, 0, .09);
}
.stack-form .template-category-navigation .template-category-option:hover {
  border-color: #000;
  color: #000;
  background: #fff;
  box-shadow: 0 20px 44px rgba(0, 0, 0, .14);
}
.template-category-navigation .template-category-option > span {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 50%;
  color: #000;
  background: var(--sole-yellow);
}
.template-category-navigation .template-category-option strong { color: #000; }
.template-category-navigation .template-category-option small { color: #4e4c46; }
.template-category-navigation .template-category-option:focus-visible {
  outline: 4px solid var(--sole-yellow);
  outline-offset: 3px;
}
.template-category-card {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 1.5rem;
  border: 1px solid #cbc8bf;
  border-radius: 1.35rem;
  background: linear-gradient(145deg, #fff, var(--sole-offwhite));
  box-shadow: 0 14px 36px rgba(0, 0, 0, .09);
}
.template-category-heading {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .8rem;
  margin-bottom: 1.25rem;
}
.template-category-heading h3 { margin: 0; font-size: 1.2rem; }
.template-category-number {
  display: grid;
  width: 2.8rem;
  height: 2.8rem;
  place-items: center;
  border-radius: 50%;
  color: #000;
  background: var(--sole-yellow);
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: .04em;
}
.template-category-back { white-space: nowrap; }
.template-category-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 1.25rem;
}
.template-category-fields > .order-confirmation-template-card { grid-column: 1 / -1; }
.routine-template-card {
  min-width: 0;
  margin: 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface, #fff);
}
.routine-template-card legend { padding: 0 .4rem; font-size: 1.15rem; font-weight: 700; }
.routine-template-card label + label { margin-top: 1.25rem; }
.routine-template-card textarea { min-height: 6rem; resize: vertical; }

.template-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.template-actions span { color: var(--accent-dark); font-weight: 700; }
.template-form .form-error { grid-column: 1 / -1; }
.promotion-form + .promotion-form {
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
  margin-top: 1.5rem;
}

.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;
}

@media (max-width: 760px) {
  .login-page { padding: 1rem; }
  .login-shell { grid-template-columns: 1fr; }
  .brand-panel { min-height: auto; padding: 2.3rem; }
  .brand-panel h1 { font-size: 2.8rem; }
  .login-card { padding: 2.3rem; }
  .workspace { grid-template-columns: 1fr; }
  .conversation-sidebar { border-right: 0; }
  .conversation-panel { display: none; }
  .operator span { display: none; }
  .topnav { margin-left: auto; }
  .admin-grid { grid-template-columns: 1fr; }
  .marketing-grid { grid-template-columns: 1fr; }
  .customer-profile-grid { grid-template-columns: 1fr; }
  .feature-entry-card { align-items: stretch; flex-direction: column; }
  .admin-workspace { padding: 1rem; }
  .template-form, .template-category-fields { grid-template-columns: 1fr; }
  .template-category-navigation { grid-template-columns: 1fr; }
  .template-category-heading { grid-template-columns: auto 1fr; }
  .template-category-back { grid-column: 1 / -1; width: 100%; }
}
.visibility-list {
  display: grid;
  gap: .65rem;
  margin: 1rem 0;
}
.visibility-list label {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  min-width: 0;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  border-radius: .7rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
  background: #fbfcfa;
}
.visibility-list input[type="checkbox"] {
  flex: 0 0 1.05rem;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
}
.product-visibility-list {
  max-height: 32rem;
  overflow: auto;
  padding: .75rem;
  border: 1px solid #d7e2d9;
  border-radius: .75rem;
}

.recommendation-settings-hint {
  margin: 0.4rem 0 0;
  color: var(--muted, #6b7280);
  font-size: 0.9rem;
}

.recommendation-settings-count {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 0.8rem;
  max-width: 22rem;
  font-weight: 600;
}

.recommendation-settings-count input {
  width: 6rem;
  padding: 0.4rem 0.5rem;
}

.recommendation-settings-count small {
  font-weight: 400;
  color: var(--muted, #6b7280);
}

.recommendation-settings-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.9rem;
}

.approved-source-list {
  display: grid;
  gap: .7rem;
  margin-top: 1rem;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  align-items: start;
}

.integration-grid form {
  padding: 1.25rem;
  border: 1px solid var(--line, #dbe4dc);
  border-radius: 1rem;
  background: var(--surface-soft, #f8faf8);
}

.ai-preview-form {
  margin-top: 1.5rem;
  padding: 1.25rem;
  border: 1px solid var(--line, #dbe4dc);
  border-radius: 1rem;
  background: var(--surface-soft, #f8faf8);
}

.ai-preview-result {
  padding: 1rem;
  border-left: .3rem solid var(--accent, #196b4b);
  border-radius: .5rem;
  background: #fff;
}

.ai-preview-result p { white-space: pre-wrap; }
.ai-preview-result ul { margin: .5rem 0 0; padding-left: 1.25rem; }
.preview-grounded { color: var(--accent-dark, #12543b); font-weight: 700; }
.preview-out-of-scope { color: #9a3412; font-weight: 700; }

@media (max-width: 900px) {
  .integration-grid { grid-template-columns: 1fr; }
}

.approved-source-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .85rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: #fbfcfa;
}

.approved-source-row > div:first-child,
.approved-source-actions {
  display: flex;
  flex-direction: column;
  gap: .35rem;
  min-width: 0;
}

.approved-source-row a {
  overflow-wrap: anywhere;
}

.approved-source-actions {
  flex: 0 0 auto;
  align-items: flex-end;
}

.tenant-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0 2.5rem;
}

.tenant-card,
.action-card,
.company-feature-card {
  border: 1px solid rgba(0, 0, 0, .14);
  color: var(--ink);
  background: linear-gradient(145deg, #fff, var(--sole-offwhite));
  box-shadow: 0 14px 36px rgba(0, 0, 0, .09);
  text-align: left;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.tenant-card:hover,
.action-card:hover,
.company-feature-card:hover {
  transform: translateY(-3px);
  border-color: #000;
  box-shadow: 0 20px 44px rgba(0, 0, 0, .14);
}

.tenant-card {
  min-height: 130px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.15rem;
  padding: 1.2rem;
  border-radius: 1.35rem;
}

.tenant-card-mark {
  display: grid;
  width: 4rem;
  height: 4rem;
  place-items: center;
  border-radius: 1.15rem;
  color: white;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  font-weight: 900;
  letter-spacing: .04em;
}

.tenant-card > span:nth-child(2) { display: grid; gap: .35rem; }
.tenant-card strong { font-size: 1.25rem; }
.tenant-card small { color: var(--muted); }
.tenant-card-arrow { color: var(--accent); font-size: 1.6rem; }

.button-danger {
  border: 1px solid #a43838;
  color: #8b2525;
  background: #fff7f7;
}

.button-danger:hover {
  color: white;
  background: #a43838;
}

.platform-action-grid,
.company-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.action-card,
.company-feature-card {
  display: grid;
  align-content: start;
  gap: .55rem;
  min-width: 0;
  min-height: 150px;
  padding: 1.1rem;
  overflow-wrap: anywhere;
  border-radius: 1.15rem;
}

.action-card-icon,
.company-feature-card > span {
  color: var(--accent);
  font-size: 1.35rem;
  font-weight: 900;
}

.action-card strong,
.company-feature-card strong { font-size: 1.08rem; }
.action-card small,
.company-feature-card small { color: var(--muted); line-height: 1.5; }
.company-feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 1.5rem; }

/* Navigation cards use the available width; content workspaces keep their layout. */
@media (min-width: 1280px) {
  .company-feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.conversation-content { display: grid; grid-template-columns: minmax(0, 1fr) 19rem; min-height: 0; }
.customer-card { background: #fff; border-left: 1px solid var(--line); padding: 1.5rem; overflow:auto; }
.customer-card h3 { margin:.35rem 0 1.25rem; font-size:1.35rem; }
.customer-card dl { margin:0; display:grid; gap:1rem; }
.customer-card dl div { border-bottom:1px solid var(--line); padding-bottom:.8rem; }
.customer-card dt { color:var(--muted); font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; }
.customer-card dd { margin:.25rem 0 0; font-weight:600; overflow-wrap:anywhere; }
.contact-database-workspace { margin:2rem; }
.budget-workspace { margin:2rem; }
.budget-workspace > header { display:flex; justify-content:space-between; align-items:center; }
.budget-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; margin:1.4rem 0; }
.budget-summary article { padding:1.15rem 1.25rem; border:1px solid var(--line); border-radius:1rem; background:#f7faf7; }
.budget-summary span { display:block; color:var(--muted); font-size:.82rem; margin-bottom:.45rem; }
.budget-summary strong { font-size:1.55rem; }
.budget-summary .budget-grand-total { background:var(--accent); color:#fff; border-color:var(--accent); }
.budget-summary .budget-grand-total span { color:rgba(255,255,255,.8); }
.budget-rates-form { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:1rem; margin:0 0 1.4rem; }
.budget-rate-group { padding:1rem 1.1rem; border:1px solid var(--line); border-radius:1rem; background:#fff; }
.budget-rate-group h2 { margin:0 0 .8rem; font-size:1rem; }
.budget-rate-group label { display:block; margin-top:.7rem; color:var(--muted); font-size:.8rem; }
.budget-rate-group input,.budget-rate-group select { margin-top:.35rem; }
.budget-rate-actions { grid-column:1 / -1; display:flex; gap:1rem; align-items:center; }
.budget-rate-actions p { margin:0; }
.budget-toolbar { display:flex; gap:1rem; align-items:end; margin-bottom:1rem; }
.budget-toolbar label { flex:1; }
.budget-table { min-width:900px; }
@media (max-width: 760px) { .budget-summary,.budget-rates-form { grid-template-columns:1fr; } .budget-toolbar { align-items:stretch; flex-direction:column; } }
.contact-database-workspace > header { display:flex; justify-content:space-between; align-items:center; }
.database-import-form { display:flex; gap:1rem; align-items:end; margin:1.25rem 0; }
.database-import-form label { flex:1; }
.database-import-form label:nth-child(2) { flex: 0 1 18rem; }
.database-import-help {
  margin: -.45rem 0 1rem;
  padding: .75rem .9rem;
  border-radius: .75rem;
  color: var(--muted);
  background: #eef6f1;
}
.database-import-help.destructive-warning {
  color: #8b2f24;
  background: #fff0ed;
  border: 1px solid #efb6ae;
}
.database-table-wrap { overflow:auto; max-height:60vh; border:1px solid var(--line); border-radius:1rem; }
.database-table { width:100%; border-collapse:collapse; min-width:1100px; }
.database-table th,.database-table td { text-align:left; padding:.8rem; border-bottom:1px solid var(--line); vertical-align:top; }
.database-table th { position:sticky; top:0; background:#f7faf7; z-index:1; }
.company-heading {
  width: 100%;
  max-width: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 1rem;
  margin-top: 1.25rem;
}
.company-hub-recommendations {
  margin: 0;
  min-height: 0;
  padding: 1rem 1.15rem;
  border-radius: 1.15rem;
  box-shadow: 0 14px 36px rgba(28, 54, 40, .09);
}
.company-hub-recommendations h2 { margin: 0 0 .35rem; }
.company-hub-recommendations .section-title { margin-bottom: .55rem; }
.company-hub-recommendations .section-title p { margin: 0; font-size: .82rem; line-height: 1.35; }
.company-hub-recommendations .recommendation-settings-hint { font-size: .76rem; }
.company-hub-recommendations .recommendation-settings-count {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  max-width: none;
  margin-top: .5rem;
  font-size: .82rem;
}
.company-hub-recommendations .recommendation-settings-count small { grid-column: 1 / -1; font-size: .72rem; }
.company-control-column { display: grid; gap: .75rem; }
.company-notice-card { padding: 1rem 1.15rem; box-shadow: 0 14px 36px rgba(28, 54, 40, .09); }
.company-notice-card label { display: block; margin-bottom: .45rem; font-size: .92rem; }
.company-notice-card textarea { min-height: 5rem; padding: .65rem .75rem; font-size: .82rem; line-height: 1.4; resize: vertical; }
.initial-notice-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .55rem; }
.initial-notice-actions small { color: var(--muted); font-size: .72rem; }
.initial-notice-actions button { padding: .55rem .85rem; border: 0; border-radius: .65rem; color: #fff; background: var(--accent); font-weight: 800; }
#initial-notice-status { min-height: 1em; margin: .35rem 0 0; color: var(--accent); font-size: .72rem; }
.company-feature-card.conversations {
  color: white;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
}
.company-feature-card.conversations > span,
.company-feature-card.conversations small { color: var(--sole-offwhite); }
.section-back-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-back { width: fit-content; }
.read-only-mode #reply-form,
.read-only-mode #automation-toggle { display: none; }
.topnav { display: none !important; }

@media (max-width: 760px) {
  .tenant-card-grid,
  .platform-action-grid,
  .company-feature-grid { grid-template-columns: 1fr; }
  .company-heading { grid-template-columns: 1fr; align-items: stretch; }
  .tenant-card { min-height: 125px; }
}

/* Operational health card */
.op-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr));
  gap: .75rem;
  margin-top: .5rem;
}
.op-tile {
  border: 1px solid var(--border, #e0e4ea);
  border-radius: 10px;
  padding: .85rem 1rem;
  background: var(--surface, #fff);
}
.op-tile.bad {
  border-color: #e0b4ab;
  background: #fbeeea;
}
.op-n {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.op-tile.bad .op-n { color: #b5321f; }
.op-l {
  font-size: .78rem;
  color: var(--muted, #6b7280);
  margin-top: .35rem;
}
.op-help {
  font-size: .82rem;
  line-height: 1.5;
  margin: .65rem 0 0;
  color: var(--muted, #6b7280);
}
.op-explanation {
  font-size: .9rem;
  line-height: 1.5;
}
.op-empty { color: var(--muted, #6b7280); font-size: .9rem; }

/* Failed messages (dead-letter) */
.failed-list { display: flex; flex-direction: column; gap: .75rem; margin-top: .5rem; }
.failed-item {
  border: 1px solid var(--border, #e0e4ea);
  border-left: 3px solid #b5321f;
  border-radius: 10px;
  padding: .85rem 1rem;
  background: var(--surface, #fff);
}
.order-issue-item:not(.is-resolved) {
  border-color: #e0b4ab;
  border-left-color: #b5321f;
  background: #fff4f1;
}
.failed-item.is-resolved {
  border-color: #a8d5b9;
  border-left-color: #217a4b;
  background: #eff9f3;
}
.failed-item.is-resolved .failed-error { color: #276442; }
.op-resolved-note { margin: .45rem 0 0; color: #217a4b; font-weight: 700; }
.op-badge { color: var(--muted, #6b7280); font-size: .82rem; font-weight: 700; }
.operator-phone-cell { display: flex; gap: .4rem; align-items: center; }
.operator-phone-cell input { min-width: 9rem; width: 11rem; }
.order-issues-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: .75rem;
  margin: 1.25rem 0;
}
.order-issue-stat {
  display: grid;
  gap: .35rem;
  padding: 1rem;
  border: 1px solid var(--border, #e0e4ea);
  border-radius: 10px;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.order-issue-stat:hover { border-color: #6baa83; transform: translateY(-1px); }
.order-issue-stat:focus-visible { outline: 3px solid rgba(33, 122, 75, .25); outline-offset: 2px; }
.order-issue-stat strong { font-size: 1.5rem; font-variant-numeric: tabular-nums; }
.order-issue-stat span { color: var(--muted, #6b7280); font-size: .8rem; }
.order-issue-stat.good { border-color: #a8d5b9; background: #eff9f3; }
.order-issue-stat.good strong { color: #217a4b; }
.order-issue-stat.bad { border-color: #e0b4ab; background: #fbeeea; }
.order-issue-stat.bad strong { color: #b5321f; }
.order-issue-stat.is-selected {
  border-color: #217a4b;
  box-shadow: 0 0 0 2px rgba(33, 122, 75, .18);
}
.failed-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.failed-head time { font-size: .78rem; color: var(--muted, #6b7280); }
.failed-text { margin: .5rem 0 .35rem; }
.failed-error {
  margin: 0 0 .6rem;
  font-size: .82rem;
  color: #b5321f;
  font-family: ui-monospace, monospace;
  word-break: break-word;
}

/* AURA response journal */
.aura-journal-workspace header { display: flex; justify-content: space-between; gap: 1rem; }
.aura-journal-filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(2, minmax(150px, 1fr)) auto; gap: .75rem; align-items: end; margin: 1.25rem 0; }
.aura-journal-filters label { display: grid; gap: .35rem; font-size: .82rem; color: var(--muted); }
.aura-journal-filters input, .aura-journal-filters select { width: 100%; }
.aura-journal-list { display: grid; gap: .65rem; }
.aura-journal-row { display: grid; gap: .35rem; width: 100%; padding: .9rem 1rem; text-align: left; color: inherit; background: #fff; border: 1px solid var(--border); border-radius: 12px; }
.aura-journal-row:hover { border-color: var(--accent); box-shadow: 0 8px 24px rgba(28, 54, 40, .08); }
.aura-journal-row-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.aura-journal-question { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aura-journal-row small { color: var(--muted); }
.aura-outcome { padding: .2rem .55rem; border-radius: 999px; background: #e8f4ed; color: var(--accent); font-size: .72rem; text-transform: capitalize; }
.aura-outcome.refuzat, .aura-outcome.escaladat { background: #fbeeea; color: #a63320; }
.aura-journal-dialog { width: min(920px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 1.5rem; border: 0; border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.25); }
.aura-journal-dialog::backdrop { background: rgba(20, 30, 25, .55); }
.aura-dialog-close { float: right; width: 2.25rem; height: 2.25rem; padding: 0; border-radius: 50%; font-size: 1.5rem; }
.aura-dialog-exchange { padding: 1rem; background: #f5f8f5; border-radius: 12px; }
.aura-dialog-exchange p { white-space: pre-wrap; }
.aura-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: 1rem; }
.aura-detail-grid section { padding: 1rem; border: 1px solid var(--border); border-radius: 12px; }
.aura-detail-grid h3 { margin-top: 0; font-size: 1rem; }
.aura-detail-grid ul { margin: 0; padding-left: 1.2rem; }
@media (max-width: 760px) {
  .aura-journal-filters, .aura-detail-grid { grid-template-columns: 1fr; }
}

.routines-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 18px 0; }
.routines-toolbar button { padding: .65rem .9rem; border: 1px solid var(--accent); border-radius: .65rem; background: var(--accent); color: #fff; font-weight: 700; }
.routines-toolbar button:disabled { opacity: .5; cursor: default; }
.routines-toolbar button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 3px; }
#routines-review-label { display: flex; align-items: center; gap: .5rem; }
#routines-review { width: auto; margin: 0; }
.routines-toolbar [aria-pressed="false"] { background: var(--surface, #fff); color: var(--ink, #24332d); border: 1px solid #cbd5ce; }
.routines-table th, .routines-table td { min-width: 130px; max-width: 340px; white-space: normal; overflow-wrap: anywhere; vertical-align: top; }
.routines-table th:first-child, .routines-table td:first-child { position: sticky; left: 0; background: var(--surface, #fff); min-width: 180px; }

/* Protection: platform administration, observation only. */
.protection-grid { display: grid; grid-template-columns: minmax(280px, .85fr) minmax(340px, 1.15fr); gap: 24px; align-items: start; }
.protection-grid .admin-card { min-width: 0; }
.protection-grid fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.protection-inputs { display: grid; gap: 16px; margin: 20px 0; }
.protection-check { display: flex; align-items: center; gap: 10px; }
.protection-check input { width: auto; }
.protection-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.protection-summary article { padding: 14px; background: #f3f6f9; border-radius: 12px; overflow-wrap: anywhere; }
.protection-summary span, .protection-summary strong { display: block; }
.protection-summary span { font-size: 12px; color: #526172; margin-bottom: 8px; }
#protection-recommendations { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
#protection-recommendations dd { margin: 0; font-weight: 600; }
@media (max-width: 960px) { .protection-grid { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .protection-summary { grid-template-columns: 1fr; } }

/* Instrucțiunile și erorile importului rămân lângă formular. */
.marketing-import-column { display: grid; align-content: start; gap: 1.25rem; min-width: 0; }
.csv-guide p, .csv-guide li { line-height: 1.5; }
.csv-guide li + li { margin-top: .5rem; }
.csv-example-scroll { overflow-x: auto; }
.csv-guide table { width: 100%; border-collapse: collapse; }
.csv-guide caption { text-align: left; color: var(--muted); margin-bottom: .5rem; }
.csv-guide th, .csv-guide td { padding: .75rem; text-align: left; border: 1px solid #dce4dd; }
.csv-guide th { background: #f4f7f3; }
.csv-import-error { padding: 1rem; border: 1px solid #b42318; border-radius: 12px; background: #fff4f2; color: #8f1d14; white-space: pre-line; line-height: 1.5; }

#display-options { border: 0; padding: 0; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
#display-options .company-feature-card { cursor: pointer; min-height: 180px; }
#display-options .company-feature-card:has(input:checked) { outline: 3px solid #207353; background: #eef7f0; }
#display-options input { width: 22px; height: 22px; accent-color: #207353; }
#display-options legend { margin-bottom: 16px; }

/* Tenant exclusions: independent brand and product cards. */
#exclusions-workspace .integration-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; margin: 24px 0; }
#exclusions-workspace .exclusion-card { padding: 24px; border: 1px solid #dce5dc; border-radius: 18px; min-width: 0; }
#exclusions-workspace .exclusion-card h2 { margin: 0 0 18px; }
#exclusions-workspace .exclusion-add-card { display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: 14px; background: #f6f8f5; border: 1px solid #e3e8df; }
#exclusions-workspace .exclusion-add-card h3 { margin: 0; }
#exclusions-workspace label { display: flex; flex-direction: column; gap: 8px; font-weight: 600; }
#exclusions-workspace input { width: 100%; min-width: 0; padding: 12px; border: 1px solid #dce5dc; border-radius: 10px; font: inherit; background: white; }
#exclusions-workspace button { padding: 11px 16px; border: 1px solid #dce5dc; border-radius: 10px; cursor: pointer; font: inherit; }
#exclusions-workspace button[type="submit"] { background: #1c6b4f; color: white; align-self: start; border-color: #1c6b4f; }
#exclusions-workspace button:disabled { opacity: .55; cursor: default; }
#exclusions-workspace .exclusion-entry { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid #e3e8df; overflow-wrap: anywhere; }
@media (max-width: 720px) { #exclusions-workspace .integration-grid { grid-template-columns: 1fr; } }

#exclusions-workspace .exclusion-suggestions { list-style: none; padding: 0; margin: 0; border: 1px solid #bdccc0; border-radius: 10px; background: white; max-height: 402px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
#exclusions-workspace .exclusion-option { box-sizing: border-box; height: 80px; padding: 9px 12px; cursor: pointer; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid #e3e8df; }
#exclusions-workspace .exclusion-option:hover, #exclusions-workspace .exclusion-option[aria-selected="true"] { background: #e8f3eb; }
#exclusions-workspace .exclusion-option span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; line-height: 20px; font-size: 14px; }
#exclusions-workspace .exclusion-option small { color: #536258; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; line-height: 15px; }
#exclusions-workspace [data-suggestion-status] { margin: 0; font-size: 13px; color: #536258; }

/* Tenant learning review */
.learning-counts,.learning-toolbar { display:flex; flex-wrap:wrap; gap:12px; align-items:center; margin:16px 0; }
.learning-count { background:#eef3f8; color:#26364a; border-radius:20px; padding:7px 12px; font-size:13px; }
.learning-layout { display:grid; grid-template-columns:minmax(220px, 1fr) minmax(0, 2.5fr); gap:24px; }
.learning-case-button { display:flex; flex-direction:column; align-items:flex-start; gap:8px; width:100%; text-align:left; padding:16px; margin-bottom:10px; background:#fff; color:#26364a; border:1px solid #d5dfe9; border-radius:12px; }
.learning-case-button[aria-pressed="true"] { border-color:#4b61d1; background:#f1f3ff; }
.learning-form { display:grid; gap:12px; padding:18px; border:1px solid #d5dfe9; border-radius:12px; margin:18px 0; }
.learning-form label { display:grid; gap:6px; }
.learning-form input[type="checkbox"] { width:20px; height:20px; }
.learning-form textarea,.learning-form select { width:100%; box-sizing:border-box; }
.learning-turn { border-left:3px solid #d5dfe9; padding:8px 16px; margin:12px 0; }
#learning-workspace article p { white-space:pre-wrap; overflow-wrap:anywhere; }
#learning-workspace code { display:block; overflow-wrap:anywhere; }
#learning-workspace summary { cursor:pointer; padding:12px 0; }
@media(max-width:800px) { .learning-layout { grid-template-columns:1fr; } }

.aura-journal-navigation { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 1.5rem; }
.aura-journal-navigation [aria-expanded="true"] { border-color: var(--accent); background: #edf7f0; }
.aura-suggestion-question { margin: 0; padding: 1rem; border: 1px solid var(--border); border-radius: 12px; background: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 760px) { .aura-journal-navigation { grid-template-columns: 1fr; } }

#aura-suggestions-panel > header { align-items: flex-start; }

.marketing-campaign-report { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid #dedbd4; }
.marketing-report-counts { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.marketing-report-counts > div { border: 1px solid #dedbd4; border-radius: 12px; padding: 1rem; background: #fafaf8; }
.marketing-report-counts dt { font-size: .9rem; }
.marketing-report-counts dd { margin: .4rem 0 0; font-size: 1.8rem; font-weight: 700; }

/* Diagnostic results remain readable without relying on color alone. */
.diagnostic-check { border: 1px solid #d5d5d5; border-left: 6px solid #747474; border-radius: 12px; padding: 18px; margin: 14px 0; background: #fff; }
.diagnostic-check h3 { margin-top: 0; }
.diagnostic-ok { border-left-color: #18723b; }
.diagnostic-ok h3 { color: #18723b; }
.diagnostic-error { border-left-color: #b42318; }
.diagnostic-error h3 { color: #b42318; }
.diagnostic-warning { border-left-color: #9a5900; }
.diagnostic-warning h3 { color: #9a5900; }
.diagnostic-unknown h3 { color: #5b5b5b; }
.diagnostic-check pre, #diagnostics-test-result { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.diagnostics-legend { line-height: 1.8; }
#diagnostics-test-form { display: grid; gap: 12px; margin: 18px 0; }
#diagnostics-workspace summary { cursor: pointer; font-weight: 700; margin: 20px 0; }

.read-only-notice { margin: 0; padding: 12px 24px; background: #fff8cf; color: #403800; border-bottom: 1px solid #dfd49a; font-size: 14px; }

.response-timing { display: block; color: var(--muted); font-size: 0.75rem; margin-top: 0.25rem; }

.routines-editor-table textarea { min-width: 220px; width: 100%; resize: vertical; }
.routines-editor-table select { min-width: 150px; }
#routines-editor { border: 1px solid #ccd5cf; padding: 16px; border-radius: 12px; margin: 16px 0; }


.app-page button.button-save {
  min-height: 40px;
  padding: .65rem 1rem;
  border: 1px solid #b8aa00;
  border-radius: .65rem;
  background: var(--sole-yellow);
  color: #000;
  font-weight: 750;
}

.app-page button.button-save:hover:not(:disabled) {
  background: var(--sole-yellow);
  border-color: #000;
  box-shadow: 0 2px 0 #000;
}

.app-page button.button-save:focus-visible {
  outline: 3px solid #000;
  outline-offset: 3px;
}

.app-page button.button-save:disabled {
  opacity: .6;
  cursor: not-allowed;
}

#brand-origins-workspace .table-scroll { overflow-x: auto; margin-top: 1rem; }
#brand-origins-workspace table { width: 100%; border-collapse: collapse; }
#brand-origins-workspace th, #brand-origins-workspace td { padding: .7rem; text-align: left; vertical-align: top; }
#brand-origins-workspace td select { min-width: 12rem; }
#brand-origins-workspace td input { min-width: 14rem; width: 100%; }
#brand-origins-workspace form { display: grid; gap: .75rem; margin: 1.5rem 0; }

.message-history { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.message-history > .message-list { flex: 1; }

.medical-table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  margin-top: .25rem;
}

#display-settings-card .display-toggle { display:flex; flex-direction:row; align-items:flex-start; gap:14px; min-height:0; padding:18px; margin:16px 0; border:1px solid #d7e4dc; border-radius:14px; cursor:pointer; }
#display-settings-card .display-toggle > input { width:20px; height:20px; flex-shrink:0; margin-top:3px; }
#display-settings-card .display-toggle > span { display:flex; flex-direction:column; gap:8px; color:inherit; font-size:.875rem; font-weight:400; }
#display-settings-card .display-toggle:has(input:checked) { outline:3px solid #207353; background:#eef7f0; }

.aura-journal-workspace .workspace { height: min(78vh, 960px); min-height: 560px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.aura-journal-workspace #aura-journal-daily { overflow-x: auto; }

.learning-section-cards { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,280px),1fr)); gap:20px; margin-bottom:20px; }
#learning-sections-back { margin-bottom:20px; }
.learning-delete { margin:16px 0; border-color:#b42318; color:#b42318; }
