:root {
  color-scheme: dark;
  --bg: #050505;
  --panel: #0d0d0f;
  --panel-2: #141417;
  --panel-3: #1b1b20;
  --ink: #f4f4f5;
  --muted: #9ca3af;
  --soft: #d1d5db;
  --line: #26272d;
  --line-strong: #383a42;
  --accent: #22c55e;
  --accent-dark: #16a34a;
  --urgent: #fb7185;
  --high: #f59e0b;
  --medium: #60a5fa;
  --low: #a1a1aa;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 256px 1fr;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
}

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

button {
  border: 0;
  cursor: pointer;
}

.sidebar {
  min-height: 100vh;
  padding: 18px;
  background: #080809;
  border-right: 1px solid var(--line);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.brand.compact {
  margin-bottom: 18px;
}

.brand-mark {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--accent);
  color: #04130a;
  font-weight: 900;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 15px;
}

.brand p {
  margin-top: 1px;
  color: var(--muted);
  font-size: 11px;
}

.channel-list {
  display: grid;
  gap: 6px;
}

.channel,
.logout-button,
.detail-actions button,
.login-form button {
  border-radius: 7px;
  font-weight: 700;
}

.channel {
  padding: 9px 10px;
  text-align: left;
  background: transparent;
  color: var(--soft);
}

.channel:hover,
.channel.active {
  background: var(--panel-3);
  color: #ffffff;
}

.logout-button {
  margin-top: auto;
  padding: 9px 10px;
  background: #17171a;
  color: var(--soft);
  border: 1px solid var(--line);
}

.logout-button:hover {
  color: #ffffff;
  border-color: var(--line-strong);
}

label {
  display: grid;
  gap: 6px;
  color: var(--soft);
  font-size: 11px;
  font-weight: 700;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.13);
}

.workspace {
  min-width: 0;
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 13px;
}

.eyebrow {
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 3px;
  font-size: 22px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(230px, 360px) 132px;
  gap: 8px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  gap: 10px;
}

.stat {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.stat strong {
  display: block;
  margin-bottom: 2px;
  font-size: 20px;
}

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

.content {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(320px, 42%) 1fr;
  gap: 13px;
}

.ticket-list,
.ticket-detail {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.ticket-list {
  display: grid;
  align-content: start;
}

.ticket {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 13px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.ticket:hover,
.ticket.active {
  background: #111815;
}

.ticket-top,
.meta-row,
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ticket h3 {
  margin: 0;
  font-size: 14px;
}

.source-line {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.ticket p {
  margin: 7px 0 8px;
  color: var(--soft);
  line-height: 1.45;
}

.meta-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--panel-3);
  color: var(--soft);
  font-size: 10px;
  font-weight: 800;
}

.pill.line {
  background: rgba(34, 197, 94, 0.14);
  color: #86efac;
}

.pill.facebook {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
}

.pill.website {
  background: rgba(245, 158, 11, 0.16);
  color: #fcd34d;
}

.priority-urgent {
  color: var(--urgent);
}

.priority-high {
  color: var(--high);
}

.priority-medium {
  color: var(--medium);
}

.priority-low {
  color: var(--low);
}

.ticket-detail {
  padding: 18px;
}

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

.detail-head {
  align-items: flex-start;
  margin-bottom: 16px;
}

.detail-head h2 {
  margin: 0 0 5px;
  font-size: 20px;
}

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

.field {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0a0a0b;
  overflow-wrap: anywhere;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.message-box {
  padding: 12px;
  border-left: 3px solid var(--accent);
  background: #0b1510;
  line-height: 1.65;
}

.detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.detail-actions button,
.login-form button {
  padding: 8px 11px;
  background: var(--accent);
  color: #04130a;
}

.detail-actions button:hover,
.login-form button:hover {
  background: var(--accent-dark);
}

.login-body {
  display: grid;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 20px;
}

.login-shell {
  width: min(360px, 100%);
}

.login-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-form {
  display: grid;
  gap: 12px;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--urgent);
  font-size: 12px;
}

@media (max-width: 920px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .topbar,
  .content {
    grid-template-columns: 1fr;
    display: grid;
  }

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