:root {
  color-scheme: light;
  /* Align with Movena Suite / Communication tokens where practical */
  --ink: #152033;
  --muted: #5b6b7c;
  --line: #e2e8f0;
  --line-strong: #c9d4e0;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --surface-3: #f1f4f8;
  --brand: #1f5fa8;
  --brand-ink: #143d6c;
  --brand-soft: #e8f0f9;
  --teal: #0f766e;
  --accent: #0f766e;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --focus: #1f5fa8;
  --shadow: 0 8px 24px rgba(21, 32, 51, 0.08);
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-2);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}

.skip-link:focus {
  left: 0.85rem;
  top: 0.85rem;
}

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

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px;
  color: #e5edf7;
  background:
    radial-gradient(800px 320px at 10% -10%, rgba(31, 95, 168, 0.35), transparent 55%),
    #0b1220;
}

.suite-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #e2e8f0;
  font-size: 0.84rem;
  font-weight: 650;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
  transition: background 160ms var(--ease), border-color 160ms var(--ease);
}

.suite-back-link::before {
  content: "";
  width: 8px;
  height: 8px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  transform: rotate(45deg);
  flex-shrink: 0;
}

.suite-back-link:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(96, 165, 250, 0.45);
  color: #fff;
  text-decoration: none;
}

.sidebar-footnote {
  margin: auto 0 0;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  line-height: 1.4;
  color: #94a3b8;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand strong,
.brand span,
.session strong,
.session span {
  display: block;
}

.brand span,
.session span {
  color: #aab7c7;
  font-size: 0.82rem;
}

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

.nav-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 12px;
  color: #dce7f4;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.09);
}

.session {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  padding-top: 18px;
}

.session strong + span {
  margin-top: 12px;
}

.session-action {
  width: 100%;
  margin-top: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 8px 10px;
  color: #e5edf7;
  background: transparent;
}

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

.workspace {
  min-width: 0;
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 1.9rem;
  line-height: 1.15;
}

h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 168px auto;
  gap: 8px;
  align-items: center;
}

.agent-filters {
  grid-template-columns: minmax(180px, 1.6fr) repeat(5, minmax(116px, 0.8fr));
  max-width: 980px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

textarea {
  resize: vertical;
}

button {
  border: 1px solid var(--brand);
  border-radius: 8px;
  padding: 9px 12px;
  color: #fff;
  background: var(--brand);
  font-weight: 650;
}

button.secondary {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
}

.ticket-tools {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1.2fr);
  gap: 10px;
  margin-bottom: 16px;
}

.call-intake {
  display: grid;
  grid-template-columns: minmax(240px, 0.8fr) minmax(320px, 1.1fr) minmax(240px, 0.9fr);
  gap: 10px;
  align-items: start;
  margin-bottom: 16px;
}

.compact-form {
  min-height: 100%;
  box-shadow: none;
}

.tool-group {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.tool-count {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.split,
.portal-grid,
.status-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-provisioning-grid {
  margin-top: 16px;
}

.ticket-list,
.ticket-detail,
.compose,
.kb-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.ticket-list,
.ticket-detail {
  min-height: 520px;
}

.ticket-list {
  padding: 12px;
}

.list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.list-heading span {
  min-width: 32px;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--brand-ink);
  background: #d9f4ef;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
}

.pagination {
  display: grid;
  grid-template-columns: auto minmax(128px, 1fr) 86px auto;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
}

.pagination span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: center;
}

.ticket-row {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 11px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.ticket-row.selectable {
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
}

.ticket-select {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
}

.ticket-row.active,
.ticket-row:hover {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.ticket-subject {
  overflow-wrap: anywhere;
  font-weight: 700;
}

.ticket-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.ticket-detail {
  padding: 18px;
}

.empty {
  display: grid;
  min-height: 480px;
  place-items: center;
  color: var(--muted);
}

.hidden {
  display: none;
}

.honeypot {
  position: absolute;
  left: -100vw;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.detail-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}

.pill {
  border-radius: 999px;
  padding: 4px 9px;
  color: #0f172a;
  background: #e2e8f0;
  font-size: 0.78rem;
  font-weight: 700;
}

.pill.high {
  color: #7c2d12;
  background: #ffedd5;
}

.pill.sla {
  color: #164e63;
  background: #cffafe;
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.ticket-meta-grid div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fff;
}

.ticket-meta-grid span,
.ticket-meta-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.ticket-meta-grid span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.ticket-meta-grid strong {
  margin-top: 3px;
  font-size: 0.88rem;
}

.timeline {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.event {
  border-left: 4px solid var(--brand);
  padding: 9px 10px;
  background: #f8fafc;
}

.event.internal {
  border-left-color: var(--accent);
  background: #fff7ed;
}

.event strong,
.event span {
  display: block;
}

.event span {
  color: var(--muted);
  font-size: 0.78rem;
}

.compose {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.compose-wide {
  margin-top: 16px;
}

.compose label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
}

.compose .check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compose .check-row input {
  width: auto;
}

.reply-attachments {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.reply-attachments legend {
  padding: 0 8px 0 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.reply-attachment-option {
  min-width: 0;
}

.reply-attachment-option span {
  overflow-wrap: anywhere;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kb-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.compact-list {
  margin: 14px 0;
  box-shadow: none;
}

.kb-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.compact-item {
  padding: 9px 10px;
}

.kb-item span {
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.kb-item h3 {
  margin: 4px 0 6px;
  font-size: 1rem;
}

.status-item.operational {
  border-left: 4px solid var(--brand);
}

.status-item.degraded,
.status-item.unknown,
.status-item.pending_integration,
.status-item.not_configured {
  border-left: 4px solid var(--accent);
}

.status-item.outage {
  border-left: 4px solid var(--danger);
}

.customer-context {
  margin-top: 14px;
}

.source-card.ok {
  border-left: 4px solid var(--brand);
}

.source-card.partial,
.source-card.unavailable {
  border-left: 4px solid var(--accent);
}

.source-card.failed {
  border-left: 4px solid var(--danger);
}

.source-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 12px;
  margin: 10px 0;
}

.source-details div {
  min-width: 0;
}

.source-details dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.source-details dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 0.88rem;
}

.source-items {
  display: grid;
  gap: 6px;
}

.source-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.source-item strong,
.source-item span {
  overflow-wrap: anywhere;
}

.source-item span {
  color: var(--muted);
  font-size: 0.78rem;
}

.small-empty {
  min-height: 120px;
}

.error {
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 10px;
  color: var(--danger);
  background: #fff1f2;
}

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

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .nav {
    grid-column: 1 / -1;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  }

  .session {
    margin-top: 0;
    border-top: 0;
    padding-top: 0;
  }

  .split,
  .portal-grid,
  .status-grid,
  .call-intake,
  .ticket-tools {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 680px) {
  .workspace {
    padding: 16px;
  }

  .topbar,
  .filters,
  .actions,
  .ticket-meta-grid,
  .form-grid,
  .tool-group,
  .source-details,
  .source-item {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }
}
