:root {
  --bg: #0c0f12;
  --rail: #090b0e;
  --surface: #111820;
  --surface-2: #151d26;
  --line: rgba(255, 255, 255, 0.1);
  --text: #f3efe8;
  --muted: #99a2ad;
  --accent: #ffbd4a;
  --accent-soft: rgba(255, 189, 74, 0.14);
  --ok: #55c38a;
  --danger: #ff6b6b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr;
  transition: grid-template-columns 180ms ease;
}

.app-shell.rail-collapsed {
  grid-template-columns: 88px 1fr;
}

.side-rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px;
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 34px;
}

.rail-brand {
  min-height: 94px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.nav-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 800;
}

.nav-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.brand-copy p,
.eyebrow,
.label {
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 800;
}

.brand-copy h1,
.page-head h2,
.section-head h3 {
  margin: 0;
  letter-spacing: 0;
}

.brand-copy h1 {
  max-width: 190px;
  font-size: 2.05rem;
  line-height: 0.98;
  margin-top: 8px;
}

.icon-button,
.secondary-button,
.text-button,
.accent-button,
.danger-button,
.nav-link,
.status-pill {
  border: 0;
}

.icon-button {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.1rem;
}

.rail-nav {
  display: grid;
  align-content: start;
  gap: 12px;
}

.nav-link {
  min-height: 58px;
  padding: 8px;
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-weight: 700;
}

.nav-link.active {
  background: linear-gradient(90deg, var(--accent-soft), rgba(255, 189, 74, 0.05));
  color: var(--accent);
}

.nav-link.active .nav-icon {
  background: var(--accent);
  color: #17110a;
}

.rail-health {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
}

.status-dot.ok {
  background: var(--ok);
}

.app-shell.rail-collapsed .side-rail {
  padding: 28px 18px;
}

.app-shell.rail-collapsed .rail-brand {
  min-height: 82px;
  justify-content: center;
}

.app-shell.rail-collapsed .icon-button {
  margin: 0 auto;
}

.app-shell.rail-collapsed .brand-copy,
.app-shell.rail-collapsed .rail-health span:last-child,
.app-shell.rail-collapsed .nav-text {
  display: none;
}

.app-shell.rail-collapsed .nav-link {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 8px 0;
}

.workspace {
  padding: 30px;
  max-width: 1320px;
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
  animation: rise 180ms ease both;
}

.page-head,
.section-head,
.summary-line,
.pager,
.message-row,
.customer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.page-head {
  margin-bottom: 28px;
}

.page-head h2 {
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: 1.02;
  margin-top: 6px;
}

.secondary-button,
.text-button,
.accent-button,
.danger-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 800;
}

.secondary-button {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
}

.secondary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.text-button {
  background: var(--accent);
  color: #17110a;
}

.accent-button {
  background: var(--accent);
  color: #17110a;
  margin-top: 14px;
}

.danger-button {
  background: rgba(255, 107, 107, 0.12);
  color: #ff9b9b;
  border: 1px solid rgba(255, 107, 107, 0.22);
  margin-top: 10px;
}

.summary-line {
  justify-content: flex-start;
  margin-bottom: 24px;
  color: var(--muted);
}

.summary-line strong {
  color: var(--text);
  font-size: 1.35rem;
}

.list-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.section-head {
  margin-bottom: 12px;
}

.section-head h3 {
  font-size: 1rem;
}

.customer-list,
.message-list {
  display: grid;
  gap: 8px;
}

.customer-row,
.message-row,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
}

.customer-row {
  min-height: 78px;
  padding: 14px 16px;
  border-radius: 8px;
}

.customer-row:hover {
  border-color: rgba(255, 189, 74, 0.42);
}

.customer-main {
  min-width: 220px;
}

.customer-main strong,
.customer-main span {
  display: block;
}

.customer-main strong {
  font-size: 1.05rem;
}

.customer-main span,
.customer-date,
.feedback {
  color: var(--muted);
}

.appointment-pill {
  min-width: 184px;
  text-align: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}

.appointment-pill.active {
  background: rgba(85, 195, 138, 0.14);
  color: var(--ok);
}

.toolbar {
  margin-bottom: 16px;
}

input {
  width: 100%;
  min-height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
}

.pager {
  margin-top: 18px;
  justify-content: center;
}

.detail-layout {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-bottom: 22px;
}

.detail-panel {
  border-radius: 8px;
  padding: 18px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.detail-meta span {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.detail-summary {
  color: var(--muted);
  line-height: 1.6;
}

.status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.status-pill {
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.status-pill.active {
  background: var(--accent);
  color: #17110a;
}

.status-pill.active:disabled {
  opacity: 1;
}

.flow-arrow {
  align-self: center;
  color: var(--muted);
  font-weight: 800;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 18px 0;
}

.flow-steps {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.flow-step {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.flow-step span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
}

.flow-step.done {
  color: var(--text);
}

.flow-step.done span {
  background: rgba(85, 195, 138, 0.16);
  border-color: rgba(85, 195, 138, 0.32);
  color: var(--ok);
}

.message-row {
  align-items: flex-start;
  border-radius: 8px;
  padding: 14px 16px;
}

.message-row p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.message-row span {
  white-space: nowrap;
  color: var(--muted);
}

.message-list {
  gap: 12px;
  padding: 14px;
  border-radius: 8px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    #0a0e12;
  background-size: 22px 22px;
}

.chat-row {
  display: flex;
  width: 100%;
}

.chat-row.inbound {
  justify-content: flex-start;
}

.chat-row.outbound {
  justify-content: flex-end;
}

.chat-bubble {
  position: relative;
  max-width: min(680px, 82%);
  padding: 10px 12px 7px;
  border-radius: 14px;
  line-height: 1.5;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.chat-row.inbound .chat-bubble {
  background: #18212b;
  color: var(--text);
  border-top-left-radius: 4px;
}

.chat-row.outbound .chat-bubble {
  background: #1f3f2d;
  color: #f5fff8;
  border-top-right-radius: 4px;
}

.chat-row.inbound .chat-bubble::before,
.chat-row.outbound .chat-bubble::before {
  content: "";
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
}

.chat-row.inbound .chat-bubble::before {
  left: -8px;
  border-width: 0 10px 10px 0;
  border-color: transparent #18212b transparent transparent;
}

.chat-row.outbound .chat-bubble::before {
  right: -8px;
  border-width: 10px 10px 0 0;
  border-color: #1f3f2d transparent transparent transparent;
}

.chat-text {
  white-space: normal;
}

.chat-text code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.22);
}

.chat-time {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.76rem;
  text-align: right;
}

.empty-state {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

.empty-state.compact {
  padding: 12px;
}

.skeleton-row {
  pointer-events: none;
}

.skeleton-stack {
  display: grid;
  gap: 9px;
  min-width: 220px;
}

.skeleton-line,
.skeleton-pill {
  display: block;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.skeleton-line {
  height: 14px;
  border-radius: 999px;
}

.skeleton-line.wide {
  width: 210px;
}

.skeleton-line.short {
  width: 126px;
}

.skeleton-line.date {
  width: 118px;
}

.skeleton-pill {
  width: 184px;
  height: 34px;
  border-radius: 999px;
}

.skeleton-line::after,
.skeleton-pill::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.14),
    transparent
  );
  animation: shimmer 1.05s infinite;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

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

  .side-rail {
    position: relative;
    height: auto;
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 18px;
  }

  .page-head,
  .customer-row,
  .message-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .appointment-pill {
    min-width: 0;
  }
}
