:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #697586;
  --border: #dde3ea;
  --accent: #d61f69;
  --accent-2: #155bce;
  --success: #12805c;
  --warning: #a86400;
  --shadow: 0 12px 34px rgba(20, 32, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--text);
  color: white;
  cursor: pointer;
}

button.secondary {
  background: #edf2f7;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  background: white;
  color: var(--text);
}

pre {
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  white-space: pre-wrap;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  padding: 28px 20px;
  background: #101828;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.sidebar h1 {
  margin: 4px 0 0;
  font-size: 30px;
}

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

.sidebar .eyebrow {
  color: #98a2b3;
}

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

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #d0d5dd;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

.agent-box {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.agent-box label {
  color: #d0d5dd;
  font-size: 13px;
}

.main-panel {
  padding: 28px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}

.topbar h2 {
  margin: 4px 0 0;
  font-size: 28px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.ticket-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 18px;
  min-height: calc(100vh - 130px);
}

.ticket-list-panel,
.conversation-panel,
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ticket-list-panel {
  padding: 14px;
}

.filters {
  margin-bottom: 12px;
  display: grid;
  gap: 8px;
}

.ticket-list {
  display: grid;
  gap: 8px;
}

.ticket-card {
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  background: white;
  color: var(--text);
}

.ticket-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(214, 31, 105, 0.12);
}

.ticket-card strong {
  display: block;
  margin-bottom: 6px;
}

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

.conversation-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.empty-state {
  margin: auto;
  color: var(--muted);
}

.ticket-detail {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.hidden {
  display: none !important;
}

.ticket-header {
  padding: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.ticket-header h3 {
  margin: 0 0 6px;
}

.ticket-header p {
  margin: 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 8px;
}

.messages {
  flex: 1;
  padding: 18px;
  display: grid;
  gap: 12px;
  align-content: start;
}

.message {
  max-width: 78%;
  padding: 12px;
  border-radius: 8px;
  background: #f2f4f7;
}

.message.customer {
  margin-left: auto;
  background: #eaf2ff;
}

.message.ai {
  border-left: 4px solid var(--accent-2);
}

.message.ai-agent {
  border-left: 4px solid var(--accent-2);
}

.message.agent {
  border-left: 4px solid var(--success);
}

.message small {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
}

.reply-form {
  padding: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

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

.panel {
  padding: 18px;
}

.panel h3 {
  margin-top: 0;
}

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

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

.metric-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

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

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.help-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0;
}

.help-header {
  display: grid;
  gap: 14px;
  margin-bottom: 20px;
}

.help-header h1 {
  margin: 0;
  font-size: 34px;
}

.help-content {
  display: grid;
  gap: 12px;
}

.help-card,
.help-article {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.help-card h2,
.help-article h2 {
  margin: 0 0 10px;
  font-size: 22px;
}

.help-card p {
  color: var(--muted);
}

.help-article {
  line-height: 1.55;
}

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

  .sidebar {
    position: static;
  }

  .ticket-layout,
  .grid.two {
    grid-template-columns: 1fr;
  }

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