:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #182226;
  --muted: #66757c;
  --line: #d9e2e4;
  --mint: #00b8a6;
  --coral: #e55a5a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
}

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

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  display: grid;
  width: min(420px, 100%);
  gap: 14px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(20, 35, 40, 0.12);
}

.brand {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0;
}

.brand.small {
  font-size: 22px;
  padding: 18px 18px 12px;
}

.muted {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

textarea {
  min-height: 96px;
  padding: 12px;
  resize: vertical;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--mint);
  color: #fff;
  cursor: pointer;
  font-weight: 650;
}

.ghost {
  min-width: 96px;
  background: #edf4f5;
  color: var(--ink);
}

.error {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff0f0;
  color: #9d2d2d;
  font-size: 14px;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  background: #0f1b1f;
  color: #fff;
}

.nav {
  display: block;
  width: calc(100% - 20px);
  margin: 6px 10px;
  padding: 0 14px;
  text-align: left;
  background: transparent;
  color: #d8e2e3;
}

.nav.active {
  background: rgba(0, 184, 166, 0.18);
  color: #fff;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 20px;
  padding: 24px;
}

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

.panel {
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.panel h2,
.panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.panel-head,
.detail-head,
.row-title,
.row-meta,
.inline-form {
  display: flex;
  gap: 10px;
  align-items: center;
}

.panel-head,
.detail-head {
  justify-content: space-between;
}

.tickets-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.9fr) minmax(440px, 1.1fr);
  gap: 20px;
}

.tickets-main,
.ticket-detail {
  align-self: start;
}

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

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 22px;
}

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

.ticket-list,
.detail-stack {
  display: grid;
  gap: 12px;
}

.ticket-row {
  display: grid;
  width: 100%;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.ticket-row.active {
  border-color: var(--mint);
  box-shadow: inset 3px 0 0 var(--mint);
}

.ticket-row p {
  margin: 0;
  color: var(--ink);
  font-weight: 400;
}

.row-title,
.row-meta {
  justify-content: space-between;
}

.row-meta {
  color: var(--muted);
  font-size: 13px;
}

.badge {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf4f5;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.strong {
  background: var(--mint);
  color: #fff;
}

.label-row,
.chips,
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.label-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--label-color);
  color: var(--ink);
  font-size: 12px;
}

.detail-block {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 32px;
}

.check input {
  width: auto;
  min-height: 0;
}

.manager {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.chip-button {
  min-height: 30px;
  padding: 0 10px;
  background: #edf4f5;
  color: var(--ink);
  font-size: 12px;
}

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

.turn {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.turn.assistant {
  background: #f3fbfa;
}

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

.turn p,
.events {
  margin: 0;
}

.empty {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.kv {
  display: grid;
  grid-template-columns: 90px 1fr;
  margin-top: 24px;
  gap: 8px 16px;
}

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

.kv dd {
  margin: 0;
}

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

  .sidebar {
    border-right: 0;
  }

  .tickets-layout,
  .filters,
  .stats {
    grid-template-columns: 1fr;
  }
}
