:root {
  --black: #000;
  --surface-lowest: #050505;
  --surface: #0a0a0a;
  --surface-high: #111;
  --surface-higher: #1a1a1a;
  --surface-highest: #222;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.24);
  --text: #f4f4f4;
  --muted: #96999a;
  --green: #b7e4c7;
  --amber: #fde293;
  --red: #f9b4ab;
  --blue: #a2d2ff;
  --purple: #d1bbff;
  --sidebar-width: 220px;
  --topbar-height: 72px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  border-radius: 0 !important;
}

html,
body {
  width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--black);
  color: var(--text);
  font-family: Inter, Arial, sans-serif;
}

body {
  min-height: 100vh;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 2px;
}

::selection {
  color: var(--black);
  background: var(--blue);
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: var(--black);
}

::-webkit-scrollbar-thumb {
  background: #303030;
}

.is-hidden {
  display: none !important;
}

.material-symbols-outlined {
  font-size: 21px;
  font-variation-settings: "FILL" 0, "wght" 300, "GRAD" 0, "opsz" 22;
}

.eyebrow,
.mono,
.status-chip,
.ticket-id,
.metric-trend,
.table-kicker,
kbd {
  font-family: "JetBrains Mono", Consolas, monospace;
}

.eyebrow {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.5;
}

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

h1,
h2,
h3 {
  font-family: "Hanken Grotesk", Inter, sans-serif;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(440px, 0.8fr);
  background:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    #000;
  background-size: 64px 64px;
}

.login-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 48px 64px;
  border-right: 1px solid var(--line);
}

.login-brand::after {
  position: absolute;
  top: 0;
  right: 22%;
  width: 1px;
  height: 100%;
  background: linear-gradient(transparent, rgba(162, 210, 255, 0.55), transparent);
  content: "";
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--text);
  color: var(--black);
  background: var(--text);
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.brand-mark--large {
  width: 52px;
  height: 52px;
  font-size: 17px;
}

.login-brand-copy {
  position: relative;
  z-index: 1;
  max-width: 690px;
}

.login-brand-copy h1 {
  margin: 14px 0 18px;
  font-size: clamp(50px, 7vw, 104px);
  font-weight: 600;
  letter-spacing: -0.055em;
  line-height: 0.88;
}

.login-brand-copy p {
  max-width: 470px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.system-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
}

.status-led {
  width: 7px;
  height: 7px;
  display: inline-block;
  background: var(--muted);
}

.status-led--green {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(183, 228, 199, 0.08);
}

.status-led--red {
  background: var(--red);
}

.status-led--amber {
  background: var(--amber);
}

.status-led--blue {
  background: var(--blue);
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 48px;
  background: rgba(0, 0, 0, 0.94);
}

.login-form {
  width: min(100%, 420px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.login-form h2 {
  margin: 8px 0 6px;
  font-size: 36px;
  letter-spacing: -0.035em;
}

.login-form p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field > span,
.form-label {
  color: #c8c8c8;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.035em;
}

.field input,
.field select,
.field textarea,
.table-filter,
.global-search input {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: var(--black);
  padding: 12px 13px;
  font-size: 13px;
}

.field textarea {
  min-height: 100px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #fff;
  outline: 0;
}

.password-field {
  display: flex;
  border: 1px solid var(--line-strong);
}

.password-field:focus-within {
  border-color: #fff;
}

.password-field input {
  border: 0;
}

.password-field .icon-button {
  border: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.check-row input {
  width: 15px;
  height: 15px;
  margin: 0;
  border: 1px solid var(--line-strong);
  accent-color: white;
}

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  padding: 9px 14px;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.045em;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.button:hover {
  border-color: #fff;
  background: var(--surface-highest);
}

.button--primary {
  border-color: white;
  color: black;
  background: white;
}

.button--primary:hover {
  color: black;
  background: var(--blue);
  border-color: var(--blue);
}

.button--danger {
  border-color: rgba(249, 180, 171, 0.6);
  color: var(--red);
}

.button--success {
  border-color: rgba(183, 228, 199, 0.6);
  color: var(--green);
}

.button--wide {
  width: 100%;
  justify-content: space-between;
  min-height: 48px;
}

.button:disabled {
  cursor: wait;
  opacity: 0.5;
}

.form-error {
  min-height: 18px;
  color: var(--red) !important;
}

.login-legal-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  font-size: 11px;
  letter-spacing: 0;
}

.login-legal-links a {
  color: #a8a8a8;
  text-decoration: none;
}

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

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.sidebar-brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.sidebar-brand-name {
  overflow: hidden;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.main-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 22px 12px;
  gap: 6px;
}

.nav-item {
  position: relative;
  width: 100%;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  padding: 0 12px;
  text-align: left;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface-high);
}

.nav-item.is-active {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface-higher);
}

.nav-item.is-active::before {
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: -1px;
  width: 2px;
  background: var(--blue);
  content: "";
}

.nav-icon {
  flex: 0 0 22px;
}

.nav-label {
  font-size: 12px;
  font-weight: 500;
}

.nav-badge {
  min-width: 18px;
  margin-left: auto;
  border: 1px solid rgba(249, 180, 171, 0.5);
  color: var(--red);
  background: rgba(249, 180, 171, 0.09);
  padding: 2px 5px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--line);
}

.new-ticket-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  border: 1px solid white;
  color: black;
  background: white;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.new-ticket-button:hover {
  border-color: var(--blue);
  background: var(--blue);
}

.nav-item--logout {
  margin-top: 4px;
}

.workspace {
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  flex: 0 0 var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.96);
}

.topbar-context {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-context h2 {
  overflow: hidden;
  margin-top: 3px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.global-search {
  width: min(28vw, 360px);
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--surface-lowest);
  padding: 0 10px;
}

.global-search:focus-within {
  border-color: var(--line-strong);
}

.global-search .material-symbols-outlined {
  color: var(--muted);
  font-size: 18px;
}

.global-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 0;
  outline: 0;
}

kbd {
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 2px 5px;
  font-size: 8px;
}

.icon-button {
  position: relative;
  min-width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  padding: 0;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-higher);
}

.icon-button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.icon-button--call {
  border-color: rgba(72, 211, 127, 0.28);
  color: var(--green);
  background: rgba(72, 211, 127, 0.07);
}

.icon-button--call:hover {
  color: var(--black);
  background: var(--green);
}

.icon-button--call.is-active {
  border-color: rgba(249, 180, 171, 0.55);
  color: var(--red);
  background: rgba(249, 180, 171, 0.12);
}

.icon-button--call.is-active:hover {
  color: var(--black);
  background: var(--red);
}

.icon-button--bordered {
  border-color: var(--line);
}

.notification-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  background: var(--red);
}

.operator {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: 6px;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.operator-avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface-high);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
}

.operator-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.operator-copy strong {
  font-size: 11px;
  font-weight: 600;
}

.operator-copy span {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.05em;
}

.red-protocol-alert {
  position: relative;
  z-index: 40;
  min-height: 218px;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(250px, 0.9fr) minmax(300px, 0.85fr) minmax(330px, 1.15fr);
  overflow: hidden;
  border-bottom: 2px solid #ff5a6f;
  color: #fff;
  background: #a60018;
  box-shadow: inset 6px 0 0 #fff;
}

.red-protocol-alert[data-level="2"] {
  background: #910014;
}

.red-protocol-alert[data-level="3"] {
  border-bottom-color: #fff;
  background: #760010;
}

.red-protocol-alert__identity,
.red-protocol-alert__response {
  min-width: 0;
  padding: 20px 22px;
}

.red-protocol-alert__identity {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.red-protocol-alert__icon {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.72);
  font-size: 29px;
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 28;
}

.red-protocol-alert__eyebrow,
.red-protocol-alert__meta,
.red-protocol-alert__clock span {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.red-protocol-alert__identity h2 {
  margin: 7px 0 5px;
  overflow-wrap: anywhere;
  font-size: 25px;
  line-height: 1.08;
  letter-spacing: 0;
}

.red-protocol-alert__identity p,
.red-protocol-alert__response p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.red-protocol-alert__meta {
  margin-top: 15px;
  opacity: 0.76;
  overflow-wrap: anywhere;
}

.red-protocol-alert__location {
  position: relative;
  min-width: 0;
  min-height: 218px;
  overflow: hidden;
  border-right: 1px solid rgba(255, 255, 255, 0.32);
  border-left: 1px solid rgba(255, 255, 255, 0.32);
  background: #250006;
}

.red-protocol-alert__location iframe {
  width: 100%;
  height: 100%;
  min-height: 218px;
  display: block;
  border: 0;
  filter: saturate(0.7) contrast(1.08);
}

.red-protocol-alert__location-copy {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 48px;
  display: grid;
  grid-template-columns: 24px auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.86);
  font-size: 10px;
}

.red-protocol-alert__location-copy span:last-child {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.74);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.red-protocol-alert__waiting {
  height: 100%;
  min-height: 218px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 7px;
  padding: 24px;
  text-align: center;
}

.red-protocol-alert__waiting .material-symbols-outlined {
  font-size: 34px;
}

.red-protocol-alert__waiting strong {
  font-size: 12px;
}

.red-protocol-alert__waiting span:last-child {
  max-width: 240px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  line-height: 1.4;
}

.red-protocol-alert__response {
  display: flex;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}

.red-protocol-alert__clock {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.38);
}

.red-protocol-alert__clock strong {
  min-width: 118px;
  color: #fff;
  font-family: "JetBrains Mono", monospace;
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
  text-align: right;
}

.red-protocol-alert__clock strong.is-overdue {
  animation: emergency-pulse 0.8s steps(2, end) infinite;
}

.red-protocol-alert__actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.red-protocol-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(255, 255, 255, 0.65);
  color: #fff;
  background: transparent;
  padding: 7px 10px;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.15;
  text-decoration: none;
}

.red-protocol-button .material-symbols-outlined {
  font-size: 17px;
}

.red-protocol-button:hover,
.red-protocol-button--primary {
  color: #780011;
  background: #fff;
}

.red-protocol-button:disabled {
  cursor: progress;
  opacity: 0.55;
}

.red-protocol-button.is-active {
  color: #fff;
  background: #000;
}

@keyframes emergency-pulse {
  50% {
    opacity: 0.42;
  }
}

.main-content {
  min-height: 0;
  flex: 1;
  overflow: auto;
  background: var(--black);
}

.main-content:focus {
  outline: 0;
}

.view-container {
  min-height: 100%;
  padding: 28px;
}

.view-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.view-header h1 {
  margin: 5px 0;
  font-size: clamp(27px, 3vw, 40px);
  font-weight: 600;
  letter-spacing: -0.04em;
}

.view-header p {
  color: var(--muted);
  font-size: 13px;
}

.view-actions,
.filter-group,
.inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-view {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 248px minmax(360px, 1fr) 300px;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.chat-view > * {
  min-height: 0;
}

.client-panel,
.inbox-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-lowest);
}

.client-panel {
  border-right: 1px solid var(--line);
}

.inbox-panel {
  border-left: 1px solid var(--line);
}

.panel-block {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

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

.panel-heading h3 {
  font-size: 14px;
  font-weight: 600;
}

.client-identity {
  display: flex;
  align-items: center;
  gap: 11px;
}

.client-logo {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  color: var(--blue);
  background: var(--surface-high);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}

.client-identity strong {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.client-identity span {
  color: var(--green);
  font-size: 10px;
}

.info-list {
  display: grid;
  gap: 17px;
}

.info-item {
  min-width: 0;
}

.info-item label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.info-item p {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
}

.associated-tickets {
  flex: 1;
  overflow: auto;
  padding: 14px;
}

.compact-ticket {
  width: 100%;
  margin-bottom: 7px;
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--black);
  padding: 11px;
  text-align: left;
}

.compact-ticket:hover {
  border-color: var(--line-strong);
  background: var(--surface-high);
}

.compact-ticket-top,
.compact-ticket-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.compact-ticket p {
  margin: 7px 0 9px;
  font-size: 11px;
  line-height: 1.45;
}

.compact-ticket-bottom {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.conversation-panel {
  position: relative;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--black);
  background-size: 100% 48px;
}

.conversation-header {
  height: 68px;
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.92);
}

.conversation-person {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
}

.conversation-person h3 {
  overflow: hidden;
  margin-bottom: 3px;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-person p {
  color: var(--green);
  font-size: 9px;
}

.channel-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(162, 210, 255, 0.4);
  color: var(--blue);
  background: rgba(162, 210, 255, 0.05);
}

.mobile-chat-tools {
  display: none;
}

.message-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 24px clamp(18px, 3vw, 44px);
}

.message {
  width: fit-content;
  max-width: min(78%, 660px);
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: 18px;
}

.message--operator {
  align-items: flex-end;
  margin-left: auto;
}

.message--arriving {
  animation: message-arrive 220ms ease-out both;
}

@keyframes message-arrive {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-bubble {
  width: fit-content;
  max-width: 100%;
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: normal;
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
}

.message--operator .message-bubble {
  border-color: rgba(162, 210, 255, 0.25);
  background: #101416;
}

.message--bot .message-bubble {
  border-style: dashed;
  border-color: rgba(209, 187, 255, 0.35);
  color: #cac5d1;
  background: transparent;
}

.message-author {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
  color: var(--purple);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.message-author--operator {
  color: var(--blue);
}

.message-meta {
  margin-top: 5px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
}

.message--operator .message-meta {
  color: var(--blue);
}

.message-composer {
  flex: 0 0 auto;
  padding: 14px 18px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-lowest);
}

.new-message-indicator {
  position: absolute;
  z-index: 8;
  bottom: 104px;
  left: 50%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--blue);
  color: var(--blue);
  background: rgba(0, 0, 0, 0.94);
  padding: 7px 11px;
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  transform: translateX(-50%);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.new-message-indicator:hover {
  color: var(--black);
  background: var(--blue);
}

.new-message-indicator .material-symbols-outlined {
  font-size: 16px;
}

.quick-replies {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin-bottom: 10px;
}

.quick-reply {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  color: var(--muted);
  background: transparent;
  padding: 6px 9px;
  font-size: 9px;
}

.quick-reply:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.composer-row {
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--line-strong);
  background: var(--black);
  padding: 6px;
}

.composer-row:focus-within {
  border-color: var(--blue);
}

.composer-row textarea {
  min-height: 34px;
  max-height: 116px;
  flex: 1;
  border: 0;
  background: transparent;
  padding: 8px;
  font-size: 12px;
  line-height: 18px;
  outline: 0;
  resize: none;
}

.send-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid white;
  color: black;
  background: white;
}

.send-button:hover {
  border-color: var(--blue);
  background: var(--blue);
}

.inbox-header {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.inbox-header h3 {
  font-size: 17px;
}

.inbox-tabs {
  display: flex;
  margin-top: 18px;
  border-bottom: 1px solid var(--line);
}

.inbox-tab {
  flex: 1;
  border: 0;
  border-bottom: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  padding: 9px 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.inbox-tab.is-active {
  border-color: var(--blue);
  color: var(--blue);
}

.inbox-list {
  flex: 1;
  overflow-y: auto;
}

.inbox-item {
  position: relative;
  width: 100%;
  display: block;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: inherit;
  background: transparent;
  padding: 16px 18px;
  text-align: left;
}

.inbox-item:hover {
  background: var(--surface-high);
}

.inbox-item.is-active {
  background: var(--surface-higher);
}

.inbox-item.is-active::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--blue);
  content: "";
}

.inbox-item--updated {
  animation: inbox-item-update 520ms ease-out;
}

@keyframes inbox-item-update {
  0% {
    background: rgba(162, 210, 255, 0.14);
  }
  100% {
    background: transparent;
  }
}

.inbox-item-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.inbox-item-top strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inbox-item-top time {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
}

.inbox-item p {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.inbox-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}

.channel-label {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.unread-count {
  min-width: 17px;
  border: 1px solid rgba(162, 210, 255, 0.45);
  color: var(--blue);
  background: rgba(162, 210, 255, 0.08);
  padding: 2px 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-align: center;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line-strong);
  padding: 3px 6px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-chip--critical,
.status-chip--high {
  border-color: rgba(249, 180, 171, 0.45);
  color: var(--red);
  background: rgba(249, 180, 171, 0.08);
}

.status-chip--medium,
.status-chip--new {
  border-color: rgba(162, 210, 255, 0.45);
  color: var(--blue);
  background: rgba(162, 210, 255, 0.08);
}

.status-chip--progress,
.status-chip--waiting {
  border-color: rgba(253, 226, 147, 0.45);
  color: var(--amber);
  background: rgba(253, 226, 147, 0.08);
}

.status-chip--low,
.status-chip--solved,
.status-chip--active {
  border-color: rgba(183, 228, 199, 0.45);
  color: var(--green);
  background: rgba(183, 228, 199, 0.08);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.metric-card {
  position: relative;
  min-height: 122px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 16px;
}

.metric-card:hover {
  border-color: var(--line-strong);
  background: var(--surface-high);
}

.metric-card--critical {
  border-color: rgba(249, 180, 171, 0.45);
}

.metric-card::after {
  position: absolute;
  right: -10px;
  bottom: -22px;
  color: rgba(255, 255, 255, 0.035);
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 88px;
  font-weight: 700;
  content: attr(data-index);
}

.metric-label {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  position: relative;
  z-index: 1;
  margin: 7px 0;
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.metric-trend {
  color: var(--muted);
  font-size: 8px;
}

.metric-trend--up {
  color: var(--green);
}

.metric-trend--alert {
  color: var(--red);
}

.data-card {
  border: 1px solid var(--line);
  background: var(--surface);
}

.data-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

.table-filter {
  width: auto;
  min-width: 142px;
  height: 34px;
  padding: 7px 28px 7px 10px;
  border-color: var(--line);
  color: #c6c6c6;
  background: var(--black);
  font-size: 10px;
}

.data-count {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
}

.table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: var(--black);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.data-table td {
  color: #d7d7d7;
  font-size: 11px;
}

.data-table tbody tr {
  transition: background 130ms ease;
}

.data-table tbody tr:hover {
  background: var(--surface-high);
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.odoo-frame {
  display: block;
  width: 100%;
  min-height: 620px;
  border: 0;
  background: var(--black);
}

.location-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.location-sidebar {
  min-height: 620px;
}

.location-list {
  max-height: 620px;
  overflow: auto;
}

.location-item {
  width: 100%;
  display: grid;
  grid-template-columns: 8px 1fr;
  gap: 12px;
  padding: 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.location-item:hover,
.location-item.is-active {
  background: var(--surface-high);
}

.location-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.location-item p {
  margin: 0 0 6px;
  color: #d8d8d8;
  font-size: 11px;
}

.location-item span:last-child {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
}

.location-map-card {
  min-width: 0;
}

.live-map-frame {
  display: block;
  width: 100%;
  min-height: 540px;
  border: 0;
  background: var(--black);
}

.location-detail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.location-detail > div {
  padding: 14px;
  background: var(--surface);
}

.location-detail label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.location-detail p {
  margin: 0;
  color: var(--text);
  font-size: 12px;
}

.location-detail span {
  color: var(--muted);
}

.message-location {
  min-width: min(280px, 100%);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}

.message-location .material-symbols-outlined {
  color: var(--green);
}

.message-location strong {
  display: block;
  font-size: 12px;
}

.message-location p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 10px;
}

.location-jump,
.location-link {
  padding: 7px 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-decoration: none;
  cursor: pointer;
}

.ticket-id {
  color: var(--text);
  font-size: 10px;
}

.cell-main {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 600;
}

.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

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

.mini-avatar {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-higher);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
}

.row-action {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
}

.row-action:hover {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface-higher);
}

.row-action--danger:hover {
  border-color: rgba(249, 180, 171, 0.45);
  color: var(--red);
  background: rgba(249, 180, 171, 0.08);
}

.row-action .material-symbols-outlined {
  font-size: 17px;
}

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

.metrics-grid .metric-card {
  grid-column: span 3;
}

.chart-card {
  grid-column: span 6;
  min-height: 320px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 18px;
}

.chart-card--wide {
  grid-column: span 8;
}

.chart-card--narrow {
  grid-column: span 4;
}

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

.chart-header h3 {
  font-size: 15px;
}

.chart-header span {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
}

.bar-chart {
  height: 205px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 12px;
  border-bottom: 1px solid var(--line);
  background: repeating-linear-gradient(to top, transparent 0 50px, var(--line) 51px);
}

.bar-column {
  position: relative;
  flex: 1;
  min-width: 12px;
  border: 1px solid rgba(162, 210, 255, 0.45);
  border-bottom: 0;
  background: rgba(162, 210, 255, 0.22);
  transition: background 140ms ease;
}

.bar-column:hover {
  background: var(--blue);
}

.bar-column::after {
  position: absolute;
  top: -21px;
  left: 50%;
  display: none;
  color: var(--blue);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  content: attr(data-value);
  transform: translateX(-50%);
}

.bar-column:hover::after {
  display: block;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 9px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
}

.donut-layout {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 1fr;
  align-items: center;
  gap: 24px;
  min-height: 215px;
}

.donut {
  position: relative;
  width: 170px;
  height: 170px;
  display: grid;
  place-items: center;
  margin: auto;
  background: conic-gradient(var(--green) 0 58%, var(--amber) 58% 77%, var(--red) 77% 84%, #242424 84% 100%);
  border-radius: 50% !important;
}

.donut::before {
  position: absolute;
  width: 116px;
  height: 116px;
  background: var(--surface);
  border-radius: 50% !important;
  content: "";
}

.donut-center {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut-center strong {
  display: block;
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 27px;
}

.donut-center span {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
}

.legend {
  display: grid;
  gap: 12px;
}

.legend-item {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.legend-swatch {
  width: 8px;
  height: 8px;
}

.legend-item strong {
  color: var(--text);
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
}

.agent-list {
  display: grid;
}

.agent-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.agent-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 10px;
}

.agent-stat {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  text-align: right;
}

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

.client-stat {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 15px;
}

.client-stat strong {
  display: block;
  margin: 5px 0 2px;
  font-family: "Hanken Grotesk", sans-serif;
  font-size: 25px;
}

.client-stat span {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.7fr);
  gap: 14px;
}

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

.settings-card {
  border: 1px solid var(--line);
  background: var(--surface);
}

.settings-card-header {
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.settings-card-header h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

.settings-card-header p {
  color: var(--muted);
  font-size: 10px;
}

.settings-card-body {
  padding: 18px;
}

.setting-row {
  min-height: 57px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

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

.setting-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
}

.setting-row p {
  color: var(--muted);
  font-size: 9px;
}

.switch {
  position: relative;
  width: 38px;
  height: 20px;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  background: var(--black);
  cursor: pointer;
}

.switch::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: var(--muted);
  content: "";
  transition: left 140ms ease, background 140ms ease;
}

.switch.is-on {
  border-color: rgba(183, 228, 199, 0.55);
  background: rgba(183, 228, 199, 0.08);
}

.switch.is-on::after {
  left: 21px;
  background: var(--green);
}

.quick-create {
  display: grid;
  gap: 12px;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}

.check-field input,
.shift-day input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--green);
}

.shift-editor {
  min-width: 0;
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  padding: 11px;
}

.form-grid .shift-editor {
  grid-column: 1 / -1;
}

.shift-editor legend {
  padding: 0 6px;
  color: #c8c8c8;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.shift-editor__head,
.shift-editor__row {
  display: grid;
  grid-template-columns: minmax(74px, 0.65fr) repeat(2, minmax(92px, 1fr));
  align-items: center;
  gap: 7px;
}

.shift-editor__head {
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.shift-editor__row input[type="time"] {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  background: var(--black);
  padding: 8px;
  font-size: 11px;
}

.shift-day {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  cursor: pointer;
}

.shift-editor.is-disabled {
  opacity: 0.42;
}

.protocol-window {
  min-height: 42px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(255, 204, 128, 0.35);
  color: var(--amber);
  padding: 9px 11px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
}

.protocol-window .material-symbols-outlined {
  font-size: 18px;
}

.schedule-cell {
  max-width: 320px;
  white-space: normal;
  line-height: 1.55;
}

.secret-display {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.secret-display__client {
  color: var(--muted);
  font-size: 11px;
}

.secret-display__code {
  width: 100%;
  overflow-wrap: anywhere;
  border: 1px solid var(--green);
  color: var(--green);
  background: rgba(183, 228, 199, 0.06);
  padding: 20px;
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(20px, 4vw, 32px);
  letter-spacing: 0;
}

.secret-display p {
  color: var(--muted);
  font-size: 10px;
}

.toast-region {
  position: fixed;
  z-index: 1000;
  top: 20px;
  right: 20px;
  width: min(390px, calc(100vw - 40px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.voice-call-dock {
  position: fixed;
  z-index: 950;
  right: 20px;
  bottom: 20px;
  width: min(470px, calc(100vw - 40px));
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--green);
  background: #0c0c0c;
  padding: 10px 12px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.6);
}

.voice-call-dock[data-status="reconnecting"],
.voice-call-dock[data-status="ringing"] {
  border-left-color: var(--amber);
}

.voice-call-dock[data-status="error"] {
  border-left-color: var(--red);
}

.voice-call-summary,
.voice-call-actions {
  min-width: 0;
  display: flex;
  align-items: center;
}

.voice-call-summary {
  gap: 10px;
}

.voice-call-actions {
  gap: 7px;
}

.voice-call-channel {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(183, 228, 199, 0.42);
  color: var(--green);
  background: rgba(183, 228, 199, 0.08);
}

.voice-call-copy {
  min-width: 0;
}

.voice-call-copy strong,
.voice-call-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-call-copy strong {
  margin-bottom: 3px;
  font-size: 11px;
}

.voice-call-copy span {
  color: var(--muted);
  font-size: 9px;
}

.voice-call-duration {
  min-width: 42px;
  color: var(--text);
  font-size: 10px;
  text-align: right;
}

.voice-hangup-button {
  border-color: rgba(249, 180, 171, 0.55);
  color: var(--black);
  background: var(--red);
}

.voice-hangup-button:hover {
  border-color: #fff;
  color: #fff;
  background: #a82e25;
}

.toast {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  align-items: center;
  gap: 11px;
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--blue);
  background: #0c0c0c;
  padding: 12px;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  animation: toast-in 180ms ease-out both;
}

.toast--error {
  border-left-color: var(--red);
}

.toast-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--blue);
}

.toast strong {
  display: block;
  margin-bottom: 3px;
  font-size: 10px;
}

.toast p {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.toast-action {
  border: 0;
  color: var(--blue);
  background: transparent;
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
}

.modal-backdrop {
  position: fixed;
  z-index: 900;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.78);
  padding: 24px;
}

.modal {
  width: min(620px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border: 1px solid var(--line-strong);
  background: #090909;
  box-shadow: 14px 14px 0 #000;
}

.modal--wide {
  width: min(840px, 100%);
}

.modal-header {
  min-height: 65px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin-top: 4px;
  font-size: 19px;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

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

.form-grid .field--wide {
  grid-column: 1 / -1;
}

.ticket-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.detail-cell {
  min-height: 77px;
  background: var(--surface);
  padding: 13px;
}

.detail-cell--wide {
  grid-column: span 3;
}

.detail-cell label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: "JetBrains Mono", monospace;
  font-size: 8px;
  text-transform: uppercase;
}

.detail-cell p {
  font-size: 11px;
  line-height: 1.55;
}

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

.empty-state .material-symbols-outlined {
  display: block;
  margin: 0 auto 10px;
  font-size: 32px;
}

.mobile-only {
  display: none;
}

@media (max-width: 1200px) {
  :root {
    --sidebar-width: 78px;
  }

  .sidebar-brand {
    justify-content: center;
    padding: 0;
  }

  .sidebar-brand-name,
  .nav-label,
  .new-ticket-button span:last-child {
    display: none;
  }

  .main-nav,
  .sidebar-footer {
    padding-right: 10px;
    padding-left: 10px;
  }

  .nav-item {
    justify-content: center;
    padding: 0;
  }

  .new-ticket-button {
    padding: 0;
  }

  .nav-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    margin: 0;
  }

  .chat-view {
    grid-template-columns: 220px minmax(340px, 1fr) 260px;
  }

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

@media (max-width: 980px) {
  .operator-copy,
  .global-search kbd {
    display: none;
  }

  .global-search {
    width: 240px;
  }

  .red-protocol-alert {
    max-height: 350px;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 0.95fr);
  }

  .red-protocol-alert__identity {
    padding-bottom: 12px;
  }

  .red-protocol-alert__response {
    padding-top: 12px;
  }

  .red-protocol-alert__location {
    min-height: 350px;
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .red-protocol-alert__location iframe,
  .red-protocol-alert__waiting {
    min-height: 350px;
  }

  .client-panel {
    display: none;
  }

  .chat-view {
    grid-template-columns: minmax(340px, 1fr) 280px;
  }

  .metrics-grid .metric-card {
    grid-column: span 6;
  }

  .chart-card,
  .chart-card--wide,
  .chart-card--narrow {
    grid-column: 1 / -1;
  }

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

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

@media (max-width: 760px) {
  :root {
    --topbar-height: 62px;
  }

  body {
    overflow: auto;
  }

  .login-screen {
    grid-template-columns: 1fr;
  }

  .login-brand {
    display: none;
  }

  .login-panel {
    min-height: 100vh;
    padding: 28px 20px;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    display: block;
    padding-bottom: 62px;
  }

  .sidebar {
    position: fixed;
    z-index: 800;
    right: 0;
    bottom: 0;
    left: 0;
    width: auto;
    height: 62px;
    display: block;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .sidebar-brand,
  .sidebar-footer {
    display: none;
  }

  .main-nav {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0;
    padding: 0;
  }

  .nav-item {
    height: 100%;
    min-height: 0;
    border: 0;
  }

  .nav-item.is-active {
    border-top: 1px solid var(--blue);
  }

  .nav-item.is-active::before {
    display: none;
  }

  .workspace {
    height: calc(100vh - 62px);
  }

  .red-protocol-alert {
    max-height: 56vh;
    display: block;
    overflow-y: auto;
    box-shadow: inset 4px 0 0 #fff;
  }

  .red-protocol-alert__identity,
  .red-protocol-alert__response {
    padding: 15px 16px;
  }

  .red-protocol-alert__identity h2 {
    font-size: 21px;
  }

  .red-protocol-alert__meta {
    display: none;
  }

  .red-protocol-alert__location,
  .red-protocol-alert__location iframe,
  .red-protocol-alert__waiting {
    min-height: 160px;
  }

  .red-protocol-alert__location {
    border-right: 0;
    border-left: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.32);
    border-bottom: 1px solid rgba(255, 255, 255, 0.32);
  }

  .red-protocol-alert__clock strong {
    min-width: 100px;
    font-size: 32px;
  }

  .red-protocol-button {
    min-height: 40px;
  }

  .red-protocol-button[href],
  .red-protocol-button[data-emergency-copy],
  .red-protocol-button[data-emergency-resolve] {
    width: 40px;
    padding: 7px;
  }

  .red-protocol-button[href] span:last-child,
  .red-protocol-button[data-emergency-resolve] span:last-child {
    display: none;
  }

  .topbar {
    padding: 0 14px;
  }

  .topbar-context h2 {
    font-size: 17px;
  }

  .topbar-context .eyebrow,
  .global-search,
  .operator {
    display: none;
  }

  .mobile-only {
    display: inline-grid;
  }

  .chat-view {
    grid-template-columns: 1fr;
  }

  .inbox-panel {
    position: absolute;
    z-index: 30;
    top: var(--topbar-height);
    right: 0;
    bottom: 62px;
    width: min(88vw, 330px);
    display: none;
    border-left: 1px solid var(--line-strong);
    box-shadow: -18px 0 0 rgba(0, 0, 0, 0.55);
  }

  .chat-view.show-inbox .inbox-panel {
    display: flex;
  }

  .mobile-chat-tools {
    display: flex;
  }

  .conversation-header > .inline-actions {
    display: none;
  }

  .message {
    max-width: 90%;
  }

  .view-container {
    padding: 18px 14px;
  }

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

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

  .metrics-grid .metric-card {
    grid-column: 1 / -1;
  }

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

  .filter-group {
    width: 100%;
    overflow-x: auto;
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }

  .location-layout,
  .location-detail {
    grid-template-columns: 1fr;
  }

  .location-sidebar,
  .live-map-frame {
    min-height: 360px;
  }

  .message-location {
    grid-template-columns: 22px minmax(0, 1fr);
  }

  .location-jump,
  .location-link {
    width: 100%;
    grid-column: 1 / -1;
    text-align: center;
    white-space: nowrap;
  }

  .form-grid,
  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .field--wide,
  .detail-cell--wide {
    grid-column: auto;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-height: 92vh;
    box-shadow: none;
  }

  .modal-footer {
    flex-wrap: wrap;
  }

  .modal-footer .button {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    white-space: normal;
  }

  .voice-call-dock {
    right: 10px;
    bottom: 74px;
    width: calc(100vw - 20px);
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .voice-call-duration {
    display: none;
  }
}

@media (max-width: 480px) {
  .summary-grid,
  .client-summary {
    grid-template-columns: 1fr;
  }

  .view-actions {
    width: 100%;
  }

  .view-actions .button {
    flex: 1;
  }

  .toast-region {
    top: 10px;
    right: 10px;
    width: calc(100vw - 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .message--arriving,
  .inbox-item--updated {
    animation: none;
  }

  .message-list {
    scroll-behavior: auto;
  }
}
