:root {
  --navy: #14213d;
  --navy2: #0d172d;
  --red: #c8102e;
  --ink: #172033;
  --muted: #667085;
  --line: #e3e7ed;
  --bg: #f5f6f8;
  --white: #fff;
  --green: #16865c;
  --amber: #b7791f;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font:
    14px "Segoe UI",
    Inter,
    Arial,
    sans-serif;
  background: var(--bg);
  color: var(--ink);
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
textarea,
select {
  font: inherit;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 224px;
  background: var(--navy2);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 30;
}
.brand {
  height: 92px;
  padding: 15px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #253047;
}
.brand img {
  width: 92px;
  background: #fff;
  border-radius: 5px;
  padding: 5px;
}
.brand span {
  font-size: 11px;
  letter-spacing: 1.2px;
  font-weight: 700;
  color: #cbd3e1;
}
.sidebar nav {
  padding: 18px 12px;
  flex: 1;
}
.sidebar nav a {
  display: flex;
  gap: 13px;
  align-items: center;
  height: 44px;
  padding: 0 13px;
  margin: 3px 0;
  border-radius: 8px;
  color: #c8d0df;
  font-weight: 600;
}
.sidebar nav a.active,
.sidebar nav a:hover {
  background: #25334d;
  color: #fff;
}
.profile {
  border-top: 1px solid #253047;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.profile > div:last-child {
  display: flex;
  flex-direction: column;
}
.profile small {
  color: #9aa5b8;
  margin-top: 2px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  flex: 0 0 auto;
}
main {
  margin-left: 224px;
  min-height: 100vh;
}
.topbar {
  height: 70px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.global-search {
  flex: 1;
  max-width: 520px;
}
.global-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
}
.logout {
  margin-left: auto;
  color: var(--muted);
  font-weight: 600;
}
.menu {
  display: none;
  border: 0;
  background: none;
  font-size: 20px;
}
.staging-banner {
  background: #fff3cd;
  color: #795b00;
  border-bottom: 1px solid #f0d98a;
  text-align: center;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.content {
  padding: 28px;
}
.page-title,
.ticket-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 22px;
}
.page-title h1,
.ticket-title h1 {
  font-size: 27px;
  margin: 0 0 5px;
}
.page-title p,
.ticket-title p,
.card-head p {
  margin: 0;
  color: var(--muted);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 16px;
  font-weight: 600;
  cursor: pointer;
}
.button.primary {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.button:disabled {
  background: var(--green);
  border-color: var(--green);
  cursor: default;
}
.button.full {
  width: 100%;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}
.metrics article,
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.metrics article {
  padding: 19px;
}
.metrics small {
  font-size: 10px;
  letter-spacing: 0.7px;
  font-weight: 700;
  color: var(--muted);
}
.metrics strong {
  display: block;
  font-size: 31px;
  margin-top: 8px;
}
.card {
  overflow: hidden;
}
.card-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-head h2 {
  margin: 0 0 3px;
}
.queue-tabs {
  display: flex;
  gap: 8px;
}
.queue-tabs a {
  border: 1px solid var(--line);
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--muted);
}
.ticket-row {
  display: grid;
  grid-template-columns:
    65px minmax(210px, 1.6fr) minmax(160px, 1fr) minmax(150px, 1fr)
    minmax(110px, 0.8fr) 95px;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  padding: 10px 18px;
  border-bottom: 1px solid #edf0f4;
}
.ticket-row:hover {
  background: #f8fafc;
}
.ticket-header {
  min-height: 46px;
  background: #fafbfc;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.ticket-row > span {
  min-width: 0;
}
.ticket-row strong,
.ticket-row small {
  display: block;
}
.ticket-row small {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 3px;
}
.priority {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5c7ea6;
}
.priority.high,
.priority.critical {
  background: var(--red);
}
.priority.low {
  background: #98a2b3;
}
.pill {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
}
.pill.open {
  background: #e9f2ff;
  color: #2864a5;
}
.pill.awaiting_user {
  background: #fff6df;
  color: #9a6813;
}
.pill.awaiting_vendor {
  background: #f2ecff;
  color: #6941c6;
}
.pill.resolved {
  background: #e8f8f1;
  color: var(--green);
}
.pill.closed_no_reply {
  background: #eef1f5;
  color: #596579;
}
.priority-high,
.priority-critical {
  background: #fff0f2;
  color: var(--red);
}
.priority-normal {
  background: #eaf3ff;
  color: #2864a5;
}
.priority-low {
  background: #eef1f5;
  color: #596579;
}
.empty {
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
.alert {
  padding: 12px 15px;
  border-radius: 7px;
  margin-bottom: 15px;
}
.alert.error {
  background: #fff0f2;
  color: #9b1c1c;
}
.alert.success {
  background: #e8f8f1;
  color: #116b49;
}
.form-card {
  padding: 22px;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.form-grid label,
.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-weight: 600;
}
.form-grid .wide {
  grid-column: 1/-1;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 10px 11px;
  outline: none;
}
input:focus,
textarea:focus,
select:focus {
  border-color: #7892b3;
  box-shadow: 0 0 0 3px #eaf1f8;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 20px;
}
.ticket-title {
  align-items: center;
}
.ticket-title > a {
  font-size: 25px;
}
.ticket-title > div {
  flex: 1;
  margin: 0 16px;
}
.ticket-title small {
  color: var(--red);
  font-weight: 700;
}
.ticket-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
}
.ticket-meta {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}
.conversation {
  overflow: visible;
}
.message {
  display: flex;
  gap: 13px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}
.message .avatar {
  background: #315a84;
}
.message.internal {
  background: #fffaf0;
  border-left: 3px solid #d98b19;
}
.message.internal .avatar {
  background: #d98b19;
}
.message.system {
  background: #f8fafc;
}
.message > div:last-child {
  flex: 1;
}
.message-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.message-head span {
  color: var(--muted);
  font-size: 11px;
}
.message p {
  line-height: 1.55;
  margin-bottom: 0;
}
.reply {
  padding: 18px;
}
.reply-tabs {
  display: flex;
  gap: 18px;
  margin-bottom: 12px;
}
.reply-tabs input {
  width: auto;
}
.reply > div:last-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.reply input[type="file"] {
  width: auto;
}
.ticket-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.side-card {
  padding: 18px;
}
.side-card h3 {
  margin-top: 0;
}
.side-card select {
  margin-bottom: 10px;
}
.side-card dl,
.environment dl {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  margin: 0;
}
.side-card dt,
.environment dt {
  color: var(--muted);
}
.side-card dd,
.environment dd {
  margin: 0;
  word-break: break-word;
}
.file {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px;
  margin-top: 8px;
}
.file small {
  color: var(--muted);
}
.environment {
  padding: 20px;
  margin-top: 18px;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}
.agent-line {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.agent-line > div:nth-child(2) {
  display: flex;
  flex-direction: column;
}
.agent-line small,
.agent-line > span {
  color: var(--muted);
  font-size: 11px;
}
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at top, #fff 0, #f3f5f8 70%);
}
.auth-wrap {
  width: min(92vw, 550px);
  text-align: center;
}
.auth-logo {
  width: 240px;
  margin-bottom: 22px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 38px;
  box-shadow: 0 14px 40px rgba(20, 33, 61, 0.09);
  text-align: left;
}
.auth-card h1 {
  text-align: center;
  font-size: 29px;
  margin: 0 0 8px;
}
.auth-card > p,
.auth-card > small {
  display: block;
  text-align: center;
  color: var(--muted);
}
.auth-card form {
  display: grid;
  gap: 17px;
  margin: 26px 0 20px;
}
@media (max-width: 1050px) {
  .ticket-row {
    grid-template-columns: 55px minmax(210px, 1.5fr) 1fr 130px;
  }
  .ticket-row > *:nth-child(5),
  .ticket-row > *:nth-child(6) {
    display: none;
  }
  .ticket-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    width: 78px;
  }
  .brand {
    padding: 12px 9px;
  }
  .brand img {
    width: 60px;
  }
  .brand span,
  .sidebar nav span,
  .profile > div:last-child {
    display: none;
  }
  .sidebar nav a {
    justify-content: center;
  }
  main {
    margin-left: 78px;
  }
}
@media (max-width: 680px) {
  .sidebar {
    transform: translateX(-100%);
    width: 235px;
    transition: 0.2s;
  }
  .sidebar.open {
    transform: none;
  }
  main {
    margin-left: 0;
  }
  .topbar {
    padding: 0 14px;
  }
  .menu {
    display: block;
  }
  .global-search {
    display: none;
  }
  .content {
    padding: 17px 13px;
  }
  .page-title > span,
  .logout {
    display: none;
  }
  .page-title h1 {
    font-size: 22px;
  }
  .metrics {
    display: flex;
    overflow: auto;
  }
  .metrics article {
    min-width: 170px;
  }
  .queue-tabs {
    display: none;
  }
  .ticket-row {
    grid-template-columns: 22px 1fr 105px;
    padding: 10px 13px;
  }
  .ticket-row > *:nth-child(3),
  .ticket-row > *:nth-child(5),
  .ticket-row > *:nth-child(6) {
    display: none;
  }
  .ticket-header {
    display: none;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .wide {
    grid-column: auto;
  }
  .ticket-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .ticket-title > form {
    width: 100%;
    margin-top: 10px;
  }
  .ticket-title > form button {
    width: 100%;
  }
  .ticket-meta {
    flex-wrap: wrap;
  }
  .message {
    padding: 15px 12px;
  }
  .message-head {
    flex-direction: column;
  }
  .auth-card {
    padding: 27px 22px;
  }
  .auth-logo {
    width: 190px;
  }
}
.attachment-dropzone{border:2px dashed #cbd5e1;border-radius:12px;background:#f8fafc;padding:14px;transition:.2s}.attachment-dropzone.dragging{border-color:#d40b2f;background:#fff1f3}.attachment-hint{text-align:center;color:#475569;padding:8px}.attachment-hint strong,.attachment-hint span{display:block}.attachment-dropzone input[type=file]{display:block;margin:8px auto}.attachment-preview{display:grid;gap:8px;margin-top:10px}.attachment-item{display:flex;align-items:center;gap:10px;background:#fff;border:1px solid #e2e8f0;border-radius:8px;padding:8px 10px}.attachment-item img{width:48px;height:48px;object-fit:cover;border-radius:6px}.attachment-item span{min-width:0;flex:1}.attachment-item strong,.attachment-item small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.attachment-item small{color:#64748b}.attachment-item button{border:0;background:#fee2e2;color:#991b1b;border-radius:50%;width:28px;height:28px;font-size:20px;cursor:pointer}
