:root {
  --bg: #f3f1eb;
  --surface: #fffdf8;
  --ink: #1a1f2a;
  --muted: #5c6575;
  --line: #ddd6c8;
  --brand: #0f5c4c;
  --brand-ink: #08362d;
  --warn: #9a3412;
  --ok: #166534;
  --shadow: 0 18px 50px rgba(26, 31, 42, 0.08);
  font-family: "Segoe UI", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(15, 92, 76, 0.12), transparent 34%),
    linear-gradient(180deg, #efe9dc 0%, var(--bg) 45%, #ebe6dc 100%);
}

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

h1 { margin: 0; font-size: 1.55rem; }
.lede { color: var(--muted); line-height: 1.45; }

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

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

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

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
}

button.ghost {
  background: transparent;
  color: var(--brand-ink);
  border: 1px solid var(--line);
}

button:disabled { opacity: 0.6; cursor: wait; }

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

.desk { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  padding: 20px 24px 12px;
}
.top-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stats { display: flex; gap: 8px; flex-wrap: wrap; }
.stat {
  background: rgba(255,253,248,0.85);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--muted);
}
.stat strong { color: var(--ink); }

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  padding: 0 24px 24px;
  min-height: 0;
}

.queue, .detail {
  background: rgba(255,253,248,0.92);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  min-height: 70vh;
}

.queue { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.filters { display: grid; gap: 8px; padding: 14px; border-bottom: 1px solid var(--line); }
.ticket-list { overflow: auto; }
.ticket-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
}
.ticket-item:hover, .ticket-item.is-active { background: rgba(15, 92, 76, 0.08); }
.ticket-item .protocol { font-weight: 700; font-size: 13px; }
.ticket-item .meta { color: var(--muted); font-size: 12px; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 700;
  background: #e8efe9;
  color: var(--brand-ink);
}
.badge.down, .badge.high { background: #fde8e0; color: var(--warn); }
.badge.waiting { background: #fff4d6; color: #854d0e; }
.badge.resolved, .badge.closed { background: #e5f6ea; color: var(--ok); }

.detail { padding: 20px; overflow: auto; }
.empty { color: var(--muted); }
.detail-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.fact {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}
.fact span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.thread { display: grid; gap: 12px; margin: 18px 0; }
.message {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: #fff;
}
.message.staff { border-color: rgba(15, 92, 76, 0.35); background: #f3faf7; }
.message header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.message pre {
  margin: 0;
  white-space: pre-wrap;
  font: inherit;
  line-height: 1.45;
}
.composer, .staff-tools {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 8px;
}
.staff-tools { grid-template-columns: 1fr 1fr auto; align-items: end; }
.attachments { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.attachments a { color: var(--brand); font-size: 13px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .queue { min-height: 40vh; }
  .staff-tools { grid-template-columns: 1fr; }
}
