:root {
  --bg: #f5f4ff;
  --bg-2: #efeeff;
  --ink: #15153a;
  --muted: #5f6385;
  --line: #dcdcf3;
  --accent: #605DBA;
  --accent-2: #7b78d7;
  --danger: #b91c1c;
  --ok: #0f766e;
  --glass: rgba(255, 255, 255, 0.82);
  --shadow: 0 20px 45px rgba(39, 33, 88, 0.14);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Manrope, "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: radial-gradient(1200px 800px at 5% 10%, #e9e8ff, transparent),
              radial-gradient(900px 600px at 95% 0%, #dddafe, transparent),
              linear-gradient(180deg, var(--bg), var(--bg-2));
  min-height: 100vh;
}
h1, h2, h3 { font-family: Sora, Manrope, sans-serif; margin: 0 0 10px; }
a { color: inherit; text-decoration: none; }

.background-blur {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(500px 350px at 25% 82%, rgba(96, 93, 186, 0.24), transparent),
              radial-gradient(520px 360px at 80% 18%, rgba(123, 120, 215, 0.20), transparent);
  filter: blur(14px);
}

.glass {
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.68);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  border-radius: 20px;
}

.shell { display: grid; grid-template-columns: 228px 1fr; gap: 14px; padding: 14px; }
.sidebar { padding: 16px; min-height: calc(100vh - 28px); display: flex; flex-direction: column; }
.content { padding: 12px; display: grid; gap: 14px; align-content: start; }

.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 26px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
}
.brand-title { font-weight: 700; font-size: 14px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.nav { display: grid; gap: 8px; }
.nav-link {
  padding: 9px 10px;
  border-radius: 10px;
  color: #343568;
  font-size: 13px;
  transition: 0.25s ease;
}
.nav-link:hover { background: #eeedff; transform: translateX(2px); }
.nav-link.active { background: linear-gradient(135deg, #e9e8ff, #dcdbff); color: #1e1f4c; font-weight: 600; }
.logout-form { margin-top: auto; }
.account-actions { margin-top: auto; display: grid; gap: 8px; }
.btn-block { width: 100%; }
.mini-alert {
  padding: 8px 9px;
  border-radius: 9px;
  font-size: 12px;
  border: 1px solid transparent;
}
.mini-alert-ok { background: #dcfce7; color: #0f766e; border-color: #86efac; }
.mini-alert-error { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-card { width: min(430px, 95vw); padding: 22px; }
.pill {
  display: inline-block;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #e8e7ff;
  color: #3f3f95;
  margin-bottom: 10px;
}

.hero { padding: 18px; animation: rise .45s ease both; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; animation: rise .45s ease both; }
.grid { display: grid; gap: 12px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.form-grid { display: grid; gap: 9px; }
label { font-size: 13px; color: #242560; display: grid; gap: 5px; }
input, select {
  width: 100%;
  border: 1px solid #cecff1;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  font: inherit;
}
select[multiple] { min-height: 100px; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-ghost { background: #efefff; color: #2a2b63; }
.btn-sm { background: #e5e6fb; color: #25265a; font-size: 11px; padding: 6px 8px; }
.btn-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }

.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid #cfcdfa;
  background: #f2f1ff;
  color: #3a3c87;
  font-size: 12px;
  padding: 3px 9px;
}

.alert { padding: 11px 12px; border-radius: 12px; margin: 12px 0; }
.alert { font-size: 13px; }
.alert-ok { background: #dcfce7; color: var(--ok); border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: var(--danger); border: 1px solid #fecaca; }
.muted { color: var(--muted); }
.clean-list { margin: 0; padding-left: 18px; }

.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 800px; }
th, td { text-align: left; border-bottom: 1px solid #e8e8f8; padding: 8px 6px; vertical-align: top; }
th { font-size: 11px; letter-spacing: .02em; text-transform: uppercase; color: #52558a; }
.text-right { text-align: right; }

.inline-forms { display: grid; gap: 10px; min-width: 240px; }
.inline-form { display: grid; gap: 6px; }
.title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.inline-check { display: flex; align-items: center; gap: 8px; }
.compact-table td { font-size: 12px; padding-top: 6px; padding-bottom: 6px; }
.btn-group-compact { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.security-row { margin-top: 12px; display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; }
.field-hint { font-size: 11px; color: #5f6385; margin-top: -2px; line-height: 1.25; }
.card-preview { border: 1px solid #d7d8f5; border-radius: 10px; padding: 10px; background: #fafaff; }
.hidden { display: none !important; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(16, 24, 40, 0.42);
  display: grid;
  place-items: center;
  padding: 18px;
}
.modal-card {
  width: min(460px, 96vw);
  border-radius: 16px;
  border: 1px solid #dcdef8;
  background: linear-gradient(180deg, #ffffff, #f7f7ff);
  box-shadow: 0 28px 52px rgba(31, 37, 84, 0.26);
  padding: 16px;
}
.modal-form {
  margin-top: 10px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.mb-2 { margin-bottom: 8px; }
.priority-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border: 1px solid transparent;
}
.priority-critical { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.priority-high { background: #ffedd5; color: #9a3412; border-color: #fed7aa; }
.priority-medium { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.priority-low { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.priority-neutral { background: #eef0ff; color: #3a3c87; border-color: #d9ddff; }
.support-pagination {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
}
.support-pagination > :first-child { justify-self: start; }
.support-pagination > :nth-child(2) { justify-self: center; }
.support-pagination > :last-child { justify-self: end; }
.support-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.support-kpi {
  border: 1px solid #e2e4fb;
  background: linear-gradient(180deg, #ffffff, #f8f8ff);
  border-radius: 12px;
  padding: 10px;
}
.support-kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #595d88;
}
.support-kpi-value {
  font-family: Sora, Manrope, sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: #23265a;
  line-height: 1.2;
}
.support-data-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.support-data-block {
  border: 1px solid #e8e9fb;
  border-radius: 12px;
  padding: 10px;
  background: #fcfcff;
}
.support-data-block h3 {
  font-size: 12px;
  margin-bottom: 8px;
}
.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.ticket-description {
  border: 1px solid #e5e6fb;
  background: #fafaff;
  border-radius: 10px;
  padding: 12px;
  line-height: 1.45;
  white-space: normal;
}
.ticket-thread {
  display: grid;
  gap: 10px;
}
.thread-item {
  border: 1px solid #e5e6fb;
  background: #fafaff;
  border-radius: 10px;
  padding: 10px;
}
.thread-item-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 6px;
}
.thread-item-body {
  line-height: 1.45;
  white-space: normal;
}
.conversation-thread {
  display: grid;
  gap: 12px;
}
.message-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
}
.message-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  color: #fff;
  box-shadow: 0 8px 18px rgba(44, 44, 96, 0.24);
}
.msg-client .message-avatar {
  background: linear-gradient(135deg, #3f5fb1, #5b78ca);
}
.msg-apollo .message-avatar {
  background: linear-gradient(135deg, #605DBA, #7b78d7);
}
.glass-lite {
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(248,248,255,0.92));
  border: 1px solid #e2e4fb;
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(47, 50, 101, 0.10);
}
.message-card {
  padding: 11px 12px;
  position: relative;
  overflow: hidden;
}
.message-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #605DBA, #9f9de7);
  opacity: .75;
}
.msg-client .message-card::before {
  background: linear-gradient(180deg, #3f5fb1, #82a0f1);
}
.message-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
}
.message-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.message-source {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border: 1px solid #d8daf8;
  border-radius: 999px;
  padding: 2px 7px;
  background: #f2f3ff;
  color: #44488f;
}
.message-time {
  color: #626695;
  font-size: 12px;
}
.message-body {
  line-height: 1.48;
  white-space: normal;
}
.message-body p {
  margin: 0 0 8px;
}
.message-body p:last-child {
  margin-bottom: 0;
}
.msg-link {
  color: #3f4fb8;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.msg-link:hover {
  color: #2f3ea0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(18, 20, 44, 0.36);
  display: none;
  z-index: 1000;
  padding: 20px;
  overflow: auto;
}
.modal.open { display: block; }
.modal-card {
  width: min(980px, 94vw);
  margin: 40px auto;
  background: #fff;
  border: 1px solid #d7d8f5;
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px;
}
.modal-card-sm { width: min(520px, 94vw); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.modal-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; }
  .cols-2 { grid-template-columns: 1fr; }
  .support-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .support-data-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .ticket-meta-grid { grid-template-columns: 1fr; }
}
