:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #687782;
  --line: #d7e0e6;
  --accent: #0f6f5c;
  --accent-2: #315b7c;
  --sidebar: #132421;
  --sidebar-soft: #203c37;
  --danger: #b42318;
  --warning: #9a5b00;
  --shadow: 0 12px 30px rgba(23, 32, 38, 0.07);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
}

a { color: inherit; text-decoration: none; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  background: var(--sidebar);
  color: #fff;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 800;
}

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #d9fff4;
  color: var(--sidebar);
}

.nav { display: grid; gap: 8px; }

.nav a {
  padding: 10px 12px;
  border-radius: 8px;
  color: #d8eee8;
}

.nav a:hover { background: rgba(255, 255, 255, 0.1); }
.nav a:focus-visible, .btn-primary:focus-visible, .btn-secondary:focus-visible, .link-button:focus-visible {
  outline: 3px solid #8ed7ff;
  outline-offset: 2px;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  font-size: 13px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #a9c6bd;
  font-weight: 800;
}

.live-indicator::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6b807a;
}

.live-indicator.online::before {
  background: #3bf0a8;
  box-shadow: 0 0 0 4px rgba(59, 240, 168, 0.12);
}

.main {
  margin-left: 244px;
  padding: 32px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

h1, h2, p { margin-top: 0; }
h1 { font-size: 32px; margin-bottom: 0; }
h2 { font-size: 18px; }
.page-subtitle {
  color: var(--muted);
  margin: 6px 0 0;
}

.title-with-help {
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-trigger {
  position: relative;
  width: 34px;
  height: 34px;
  min-height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 2px solid #a8d8cd;
  background: #d9fff4;
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(15, 111, 92, 0.18);
  font-weight: 900;
  font-size: 17px;
  line-height: 1;
  transition: transform 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.info-trigger:hover,
.info-trigger:focus-visible {
  background: var(--accent);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 111, 92, 0.28);
}

.info-popover {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%) translateY(-4px);
  width: min(340px, calc(100vw - 48px));
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  display: grid;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  padding: 14px;
  text-align: left;
  transition: opacity 120ms ease, transform 120ms ease;
  z-index: 10;
}

.info-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  left: calc(50% - 6px);
  width: 12px;
  height: 12px;
  background: #ffffff;
  border-left: 1px solid var(--line);
  border-top: 1px solid var(--line);
  transform: rotate(45deg);
}

.info-popover span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
}

.info-trigger:hover .info-popover,
.info-trigger:focus-visible .info-popover {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

.hero-strip {
  background: linear-gradient(135deg, #ffffff 0%, #f3faf8 58%, #eef4fb 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.btn-primary, .btn-secondary, .btn-danger, button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  font-weight: 700;
  font-size: 14px;
}

.btn-primary, button.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #0b5f4e; }

.btn-secondary {
  background: #e8eef3;
  color: var(--accent-2);
}
.btn-secondary:hover { background: #dce7ee; }

.btn-danger {
  width: 100%;
  background: #ffe8e5;
  color: var(--danger);
  border: 1px solid #f1b9b4;
  margin-bottom: 14px;
}
.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

.link-button {
  background: transparent;
  color: #d8eee8;
  padding: 0;
  min-height: auto;
  justify-content: flex-start;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 26px;
}

.metrics article, .panel, .table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
  display: grid;
  gap: 6px;
  border-left: 4px solid var(--accent);
}

.metrics span {
  font-size: 30px;
  font-weight: 800;
}

.metrics strong {
  color: var(--muted);
  font-size: 13px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.55fr);
  gap: 18px;
}

.list { display: grid; gap: 8px; }

.ticket-row {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ticket-row:hover { border-color: var(--accent); }
.ticket-row:focus-visible { outline: 3px solid #8ed7ff; outline-offset: 2px; }
.ticket-row.danger { border-color: #f1b9b4; }
.ticket-id { color: var(--muted); font-weight: 700; }
.grow { flex: 1; min-width: 0; }

.badge, .pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #31465a;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.muted-pill { background: rgba(255, 255, 255, 0.1); color: #d8eee8; }

.priority-high, .priority-critical { background: #ffe8e5; color: var(--danger); }
.priority-medium { background: #fff2d8; color: var(--warning); }
.priority-low { background: #e7f5ef; color: var(--accent); }
.badge.danger { background: #ffe8e5; color: var(--danger); }

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 180px)) auto;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
  font: inherit;
}

textarea { resize: vertical; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }
td a { color: var(--accent-2); font-weight: 800; }
tr:hover td { background: #f7fafb; }
.strong-cell { font-weight: 700; }

.pagination {
  margin-top: 14px;
  display: flex;
  gap: 14px;
  align-items: center;
}

.form {
  display: grid;
  gap: 14px;
}

.form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.wide-form { padding: 18px; }
.compact p { margin: 0 0 12px; }
.actions { display: flex; gap: 10px; }
.quick-close-form { margin-bottom: 14px; }

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 720px) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

.single-form {
  grid-template-columns: minmax(0, 760px);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin-bottom: 18px;
}

.panel { padding: 18px; }
.panel-gap { margin-top: 18px; }
.ticket-meta { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.description { line-height: 1.55; }

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

.facts dt { color: var(--muted); font-size: 12px; font-weight: 800; }
.facts dd { margin: 4px 0 0; }

.timeline { margin-top: 16px; display: grid; gap: 10px; }
.timeline-item { border-top: 1px solid var(--line); padding-top: 12px; }
.timeline-item time { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }

.radio-row ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 12px;
}

.radio-row label { display: flex; align-items: center; gap: 6px; }
.radio-row input { width: auto; min-height: auto; }

.empty, .muted { color: var(--muted); }
.full { width: 100%; margin-top: 14px; }
.help-panel { align-self: start; }
.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
  display: grid;
  gap: 10px;
}
.staff-list, .queue-list {
  display: grid;
  gap: 10px;
}
.staff-row, .queue-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfd;
}
.queue-row {
  justify-content: space-between;
  flex-wrap: wrap;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #dcecf7;
  color: var(--accent-2);
  font-weight: 800;
}
.danger-text { color: var(--danger); font-weight: 800; }
.messages { margin-bottom: 18px; }
.message { background: #e7f5ef; border: 1px solid #b9dfcf; border-radius: 8px; padding: 10px 12px; }
.live-toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  background: #132421;
  color: #ffffff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  z-index: 50;
}

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #10231f;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  background: #fff;
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-brand { color: var(--ink); margin-bottom: 22px; }

.btn-sso {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 8px;
  background: #2f2f2f;
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  margin-bottom: 16px;
}
.btn-sso:hover { background: #1f1f1f; }

.login-sep {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted, #6b7a86);
  font-size: 13px;
  margin: 4px 0 16px;
}
.login-sep::before,
.login-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #dce4ea;
}
.login-sep span { padding: 0 10px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; min-height: auto; }
  .main { margin-left: 0; padding: 18px; }
  .metrics, .split, .detail-grid, .filters, .form-layout { grid-template-columns: 1fr; }
  .page-header { align-items: flex-start; flex-direction: column; }
}
