:root {
  --ink: #14212b;
  --muted: #667684;
  --line: #dce5ea;
  --soft: #f4f7f8;
  --panel: #ffffff;
  --brand: #11845f;
  --brand-dark: #0d312b;
  --brand-mid: #174d43;
  --brand-soft: #e6f6ee;
  --chat: #edf3ef;
  --bubble-in: #ffffff;
  --bubble-out: #d8f5df;
  --danger: #b42318;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-columns: 72px 390px minmax(520px, 1fr) 330px;
  overflow: hidden;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #eef3f5;
}

.sidebar {
  background: var(--brand-dark);
  padding: 18px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  box-shadow: inset -1px 0 0 rgba(255,255,255,.06);
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #22bf7a, #11935f);
  color: #fff;
  font-weight: 900;
  font-size: 22px;
  margin-bottom: 16px;
}

.side-btn {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b8cac5;
  font-weight: 900;
  cursor: pointer;
}

.side-btn.active,
.side-btn:hover {
  background: var(--brand-mid);
  color: #fff;
}

.tickets,
.contact {
  min-width: 0;
  background: var(--panel);
}

.tickets {
  border-right: 1px solid var(--line);
}

.contact {
  border-left: 1px solid var(--line);
  background: #fbfcfd;
}

.panel-head {
  height: 86px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.panel-head.compact {
  height: 86px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 900;
  color: var(--brand);
  letter-spacing: 0;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
}

select,
input {
  border: 1px solid #cbd8df;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
}

select {
  min-width: 132px;
  height: 44px;
}

input:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(17, 132, 95, .14);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 8px;
  padding: 14px 18px 8px;
  background: #fff;
}

.tab {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafb;
  color: #536575;
  font-weight: 800;
  cursor: pointer;
}

.tab.active {
  background: var(--brand-soft);
  color: #08744e;
  border-color: #afe3cb;
}

.search-wrap {
  padding: 8px 18px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

#search {
  width: 100%;
  height: 44px;
  background: #f9fbfc;
}

.ticket-list {
  height: calc(100vh - 199px);
  overflow: auto;
  background: #fbfcfd;
}

.ticket {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e8eef2;
  background: #fff;
  padding: 15px 18px;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.ticket::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}

.ticket:hover {
  background: #f5faf8;
}

.ticket.active {
  background: #eefaf4;
}

.ticket.active::before {
  background: var(--brand);
}

.ticket strong {
  display: block;
  max-width: 260px;
  margin-bottom: 6px;
  font-size: 15px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  display: inline-flex;
  margin-top: 10px;
  padding: 4px 8px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: #08744e;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.chat {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat);
}

.chat-header {
  height: 86px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 900;
}

.chat-header h2 {
  font-size: 19px;
  line-height: 1.25;
}

.chat-header span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.messages {
  flex: 1;
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(rgba(237,243,239,.92), rgba(237,243,239,.92)),
    repeating-linear-gradient(45deg, transparent 0 12px, rgba(17,132,95,.035) 12px 13px);
}

.messages.empty {
  display: grid;
  place-items: center;
}

.empty-state {
  width: min(420px, 90%);
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 20px;
}

.empty-state span {
  font-size: 15px;
}

.msg {
  max-width: 64%;
  margin: 0 0 10px;
  padding: 10px 12px 7px;
  border-radius: 8px;
  background: var(--bubble-in);
  box-shadow: 0 1px 2px rgba(16, 33, 43, .12);
  line-height: 1.38;
  font-size: 14px;
}

.msg.out {
  margin-left: auto;
  background: var(--bubble-out);
}

.msg time {
  display: block;
  margin-top: 5px;
  text-align: right;
  color: #70808c;
  font-size: 11px;
}

.composer {
  min-height: 78px;
  padding: 14px 18px;
  display: flex;
  gap: 10px;
  background: #fff;
  border-top: 1px solid var(--line);
}

.composer input {
  flex: 1;
  height: 48px;
  background: #f9fbfc;
}

.composer button {
  min-width: 112px;
  height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.composer button:hover {
  background: #0d7655;
}

.contact-card,
.quick-card {
  margin: 16px 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.contact-card p {
  margin: 8px 0;
  color: #4d6070;
  line-height: 1.35;
}

.quick-card strong {
  display: block;
  margin-bottom: 12px;
  font-size: 15px;
}

.quick-card button {
  width: 100%;
  height: 40px;
  margin-top: 8px;
  border: 1px solid #d5e0e6;
  border-radius: 8px;
  background: #f7fafb;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.quick-card button:hover {
  background: var(--brand-soft);
  border-color: #afe3cb;
  color: #08744e;
}

@media (max-width: 1280px) {
  body {
    grid-template-columns: 72px 360px minmax(440px, 1fr);
  }

  .contact {
    display: none;
  }
}

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

  .chat {
    display: none;
  }

  .tickets {
    border-right: 0;
  }
}

.label-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.mini-label {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 7px;
  background: #eef3f7;
  color: #526371;
  font-size: 11px;
  font-weight: 800;
}

.msg.internal {
  max-width: 72%;
  margin-left: auto;
  margin-right: auto;
  background: #fff3cd;
  border: 1px solid #f4d06f;
  color: #5f4600;
}

.mode-btn {
  min-width: 92px;
  border: 1px solid #cbd8df;
  border-radius: 8px;
  background: #f7fafb;
  color: #17212b;
  font-weight: 900;
  cursor: pointer;
}

.mode-btn.internal-on {
  background: #fff3cd;
  border-color: #f4d06f;
  color: #5f4600;
}

.quick-card select,
.quick-card input {
  width: 100%;
  height: 40px;
  margin-top: 10px;
}

.sidebar a {
  text-decoration: none;
}

.settings-page {
  grid-template-columns: 72px 1fr;
}

.settings-shell {
  overflow: auto;
  background: #f4f7f8;
}

.settings-header {
  padding: 28px 32px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(320px, 1fr));
  gap: 18px;
  padding: 24px 32px;
}

.settings-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
}

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

.settings-card form {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.settings-card button {
  height: 44px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.settings-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.settings-item {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
}

.settings-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
