:root {
  --ink: #0f2742;
  --muted: #66758a;
  --line: #dfe6ee;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --blue: #1d6fd6;
  --green: #00a66c;
  --soft-green: #dff7ef;
  --red: #ce2b37;
  --orange: #f59e0b;
  --soft-orange: #fff4d6;
  --soft-red: #ffe1e4;
  --shadow: 0 8px 24px rgba(15, 39, 66, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: #eef3f6;
  font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}
.brand img {
  width: auto;
  max-width: min(260px, 44vw);
  max-height: 58px;
  object-fit: contain;
  display: block;
}
.brand-empty {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}
.userbar { display: flex; align-items: center; gap: 16px; color: var(--muted); }
.logout-button {
  min-height: 38px;
  padding: 8px 14px;
}
.push-button {
  min-height: 36px;
  padding: 8px 12px;
  white-space: nowrap;
}
.push-status {
  max-width: 190px;
  color: #087f5b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
}
.push-status:empty { display: none; }
.push-status[data-state="error"] { color: #b42318; }
.push-status[data-state="loading"] { color: #145b91; }
.nav {
  display: flex;
  gap: 42px;
  padding: 14px 40px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.nav a { color: #52657a; font-weight: 500; }
.nav a.active { color: var(--blue); }
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 0;
  max-width: 1400px;
  min-height: calc(100vh - 122px);
  margin: 0 auto;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.main { padding: 32px 44px; }
.aside { padding: 28px; border-left: 1px solid var(--line); background: #fbfcfd; }
h1 { margin: 0 0 28px; font-size: 22px; }
h2 { margin: 0 0 18px; font-size: 18px; }
.form-grid { display: grid; grid-template-columns: 150px minmax(260px, 560px); gap: 18px 22px; align-items: start; }
label { padding-top: 10px; font-weight: 500; }
.required { color: var(--red); }
input, select, textarea {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
}
textarea { min-height: 150px; resize: vertical; }
.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  width: 100%;
  border: 1px solid #cbd5df;
  border-bottom: 0;
  background: #f7f8fa;
}
.editor textarea { border-top-left-radius: 0; border-top-right-radius: 0; }
.icon { width: 28px; height: 28px; border: 0; background: transparent; color: #516276; font-weight: 700; }
.actions { display: flex; gap: 8px; padding-top: 16px; border-top: 1px solid var(--line); grid-column: 2; }
button {
  border: 1px solid #c7d3df;
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 10px 15px;
  font-weight: 700;
  cursor: pointer;
}
button.primary { background: var(--green); border-color: #008c5d; color: #fff; }
button.blue { background: var(--blue); border-color: var(--blue); color: #fff; }
button.ghost { background: #f7fafc; }
button.danger, button.ghost.danger { color: var(--red); border-color: #f0bac0; background: #fff5f6; }
button:disabled {
  cursor: wait;
  opacity: .72;
}
button[aria-busy="true"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.button-spinner,
.loading-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.hint { color: var(--muted); font-size: 13px; }
.logo-admin { display: grid; gap: 8px; }
.logo-preview {
  display: flex;
  align-items: center;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}
.logo-preview img { max-width: 260px; max-height: 82px; object-fit: contain; }
.flat-actions { grid-column: auto; }
.custom-fields { margin-top: 18px; }
.custom-fields:empty { display: none; }
.checkbox-field {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 20px;
}
.checkbox-field input { width: auto; }
.field-builder {
  display: grid;
  grid-template-columns: 220px minmax(420px, 1fr) minmax(320px, 420px);
  gap: 16px;
  align-items: start;
}
.field-palette {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}
.field-palette strong {
  margin-bottom: 4px;
  color: var(--muted);
}
.field-palette button {
  text-align: left;
  background: #fff;
  color: #52657a;
}
.field-workspace {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.inline-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.field-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}
.builder-field {
  border: 1px solid #cbd5df;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}
.builder-field-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  background: #f2f6fa;
  border-bottom: 1px solid var(--line);
}
.drag-handle {
  color: #94a3b8;
  font-weight: 900;
}
.builder-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}
.builder-grid .wide { grid-column: 1 / -1; }
.toggle-line {
  display: flex;
  gap: 8px;
  align-items: center;
}
.toggle-line input { width: auto; }
.options-row.is-hidden { display: none; }
.field-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: #fbfcfd;
}
.field-preview-panel {
  position: sticky;
  top: 14px;
}
.preview-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}
.preview-card h2 { margin-bottom: 8px; }
.preview-form {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}
.preview-section-title {
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-weight: 900;
}
.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.preview-grid .wide { grid-column: 1 / -1; }
.preview-grid input,
.preview-grid select,
.preview-grid textarea {
  background: #fff;
}
.preview-grid textarea { min-height: 90px; }
.custom-ticket-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
}
.custom-ticket-fields div { display: grid; gap: 3px; }
.custom-ticket-fields span { color: var(--muted); }
.contacts-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}
.contacts-toolbar input { min-height: 40px; }
.settings-shortcut {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fafc;
}
.settings-shortcut p { margin: 4px 0 0; }
.import-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 15px;
  border: 1px solid #c7d3df;
  border-radius: 5px;
  background: #f7fafc;
  cursor: pointer;
  font-weight: 700;
}
.import-button input { display: none; }
.contacts-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.contacts-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
}
.contacts-table th,
.contacts-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}
.contacts-table th {
  background: #f2f6fa;
  color: var(--ink);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.contacts-table td:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
}
.contact-avatar {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e7f1ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 39, 66, .35);
}
.modal-backdrop[hidden] { display: none; }
.modal-card {
  width: min(780px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(15, 39, 66, .22);
}
.compact-head { margin: 0; border-radius: 10px 10px 0 0; }
.modal-card form { padding: 22px; }
.file-list { margin: 8px 0 0; color: var(--muted); }
.sla-reminder {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 16px;
  align-items: center;
  min-height: 56px;
  padding: 10px 32px;
  border-bottom: 1px solid #f3b0b7;
  background: #fff1f2;
  color: #8f1822;
}
.sla-reminder[hidden] { display: none; }
.sla-reminder-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}
.sla-reminder-copy strong {
  font-size: 14px;
}
.sla-reminder-copy span {
  color: #9f1f2a;
  font-size: 13px;
}
.sla-reminder-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.sla-reminder-ticket {
  min-height: 32px;
  padding: 6px 10px;
  border-color: #f29aa4;
  background: #fff;
  color: #8f1822;
  font-size: 12px;
  box-shadow: none;
}
.sla-reminder-ticket span {
  color: #bf2532;
  font-weight: 700;
}
.sla-reminder-ticket:hover,
.sla-reminder-ticket.active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.sla-reminder-ticket:hover span,
.sla-reminder-ticket.active span {
  color: #fff;
}
.sla-reminder-more {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 5px;
  background: #ffd7dc;
  color: #8f1822;
  font-size: 12px;
  font-weight: 800;
}
.ticket-shell { display: grid; grid-template-columns: 360px minmax(0, 1fr) 330px; min-height: calc(100vh - 122px); }
.ticket-list-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  border-right: 1px solid var(--line);
  background: var(--panel);
}
.ticket-list {
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
}
.ticket-search-panel {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdff;
}
.ticket-search-panel label {
  padding: 0;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
}
.ticket-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.ticket-search-row input {
  min-height: 38px;
}
.ticket-search-row button {
  min-height: 38px;
  padding: 8px 10px;
}
.ticket-filter-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.ticket-filter-row label {
  color: var(--muted);
}
.ticket-filter-row select {
  min-height: 36px;
  padding: 8px 10px;
}
.ticket-search-meta {
  min-height: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.ticket-search-people {
  display: grid;
  gap: 6px;
}
.requester-match {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #b8d7ff;
  background: #f4f9ff;
  text-align: left;
  box-shadow: none;
}
.requester-match strong {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--blue);
  font-size: 12px;
}
.requester-match span {
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.ticket-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(76px, auto);
  gap: 12px;
  padding: 16px 20px 16px 22px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  transition: background .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.ticket-row:hover, .ticket-row.active { background: #eef6ff; }
.ticket-row.empty-row {
  cursor: default;
}
.ticket-row.empty-row:hover {
  background: transparent;
}
.ticket-row-main {
  min-width: 0;
  display: grid;
  gap: 5px;
}
.ticket-row-main strong {
  line-height: 1.35;
}
.ticket-row-meta,
.ticket-row-submeta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.ticket-row-aside {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 8px;
}
.ticket-row.sla-warning {
  background: var(--soft-orange);
  box-shadow: inset 6px 0 0 var(--orange);
}
.ticket-row.sla-warning:hover,
.ticket-row.sla-warning.active {
  background: #ffedbd;
}
.ticket-row.sla-critical {
  background: var(--soft-red);
  border-bottom-color: #f4b4bb;
  box-shadow: inset 6px 0 0 var(--red);
  animation: slaCriticalPulse 1.15s ease-in-out infinite;
}
.ticket-row.sla-critical:hover,
.ticket-row.sla-critical.active {
  background: #ffd0d5;
}
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  min-width: 70px;
  padding: 3px 9px;
  border-radius: 4px;
  background: var(--soft-green);
  color: #04724d;
  font-size: 12px;
  font-weight: 700;
}
.ticket-row.sla-warning .pill {
  background: #ffe7ad;
  color: #8a4b00;
}
.ticket-row.sla-critical .pill {
  background: #ffd0d5;
  color: #9f1f2a;
}
.ticket-age {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max-content;
  max-width: 160px;
  min-height: 20px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf2f7;
  color: #52657a;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}
.ticket-age.sla-warning {
  background: #ffd77a;
  color: #6f3d00;
}
.ticket-age.sla-critical {
  background: var(--red);
  color: #fff;
}
@keyframes slaCriticalPulse {
  0%, 100% {
    background: var(--soft-red);
    box-shadow: inset 6px 0 0 var(--red), 0 0 0 rgba(206, 43, 55, 0);
  }
  50% {
    background: #ffc8cf;
    box-shadow: inset 6px 0 0 var(--red), 0 0 18px rgba(206, 43, 55, .34);
  }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.ticket-view { padding: 28px 34px; background: #fff; }
.message {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  margin: 20px 0;
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: #336fb0; color: #fff; font-weight: 800;
}
.bubble { border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.message-link {
  color: var(--blue);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}
.requester-link {
  display: inline;
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}
.requester-link:hover {
  text-decoration: underline;
}
.attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.attachment {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfdff;
}
.reply-box {
  margin-top: 24px;
  border: 1px solid #b8d7ff;
  border-radius: 6px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.customer-reply {
  margin-top: 8px;
  box-shadow: none;
}
.customer-reply textarea {
  min-height: 92px;
}
.pasted-files {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 0;
}
.pasted-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #b8d7ff;
  border-radius: 5px;
  background: #f4f9ff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.pasted-file small {
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.reply-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.properties {
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 8px;
  overflow-y: auto;
}
.properties h2 {
  margin: 6px 0 12px;
  font-size: 18px;
}
.properties h2:not(:first-child) {
  margin-top: 22px;
}
.properties label {
  padding: 0;
  margin-top: 10px;
  font-size: 13px;
  font-weight: 800;
}
.properties select {
  height: 42px;
  min-height: 42px;
  padding: 8px 10px;
}
.properties button {
  min-height: 42px;
  margin-top: 10px;
}
.properties > div {
  line-height: 1.5;
}
.requester-modal-card {
  width: min(860px, 100%);
}
.requester-ticket-list {
  display: grid;
  gap: 8px;
  padding: 16px;
}
.requester-ticket-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}
.requester-ticket-item:hover {
  border-color: #9fc5ff;
  background: #f4f9ff;
}
.requester-ticket-main,
.requester-ticket-side {
  display: grid;
  gap: 5px;
}
.requester-ticket-main {
  min-width: 0;
}
.requester-ticket-main strong {
  overflow-wrap: anywhere;
}
.requester-ticket-main span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.requester-ticket-side {
  justify-items: end;
  align-content: start;
}
.report-root {
  min-height: calc(100vh - 122px);
  background: #eef3f6;
}
.report-page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 40px;
}
.report-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}
.report-head h1 {
  margin: 4px 0 6px;
  font-size: 28px;
  letter-spacing: 0;
}
.report-head-actions {
  display: grid;
  gap: 10px;
  justify-items: end;
}
.segmented-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #b9c8dc;
  border-radius: 6px;
  background: #fff;
}
.segmented-control button {
  min-height: 34px;
  padding: 7px 14px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #52657a;
}
.segmented-control button.active {
  background: #244f95;
  color: #fff;
}
.report-period-tools {
  display: grid;
  gap: 8px;
  justify-items: end;
}
.report-nav-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.report-nav-buttons button {
  min-height: 34px;
  padding: 7px 10px;
}
.report-period-tools label {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.report-period-tools select {
  min-height: 36px;
  padding: 8px 10px;
}
.report-kpis {
  display: grid;
  grid-template-columns: repeat(5, minmax(118px, 1fr));
  gap: 10px;
}
.report-kpis div {
  min-width: 118px;
  padding: 12px 16px;
  border: 1px solid #b9c8dc;
  background: #fff;
  text-align: center;
}
.report-kpis strong {
  display: block;
  padding: 5px 8px;
  margin: -12px -16px 10px;
  background: #244f95;
  color: #fff;
  font-size: 12px;
  text-transform: uppercase;
}
.report-kpis span {
  color: #0b1f3a;
  font-size: 36px;
  line-height: 1;
  font-weight: 500;
}
.report-grid {
  display: grid;
  grid-template-columns: minmax(270px, .9fr) minmax(250px, .75fr) minmax(420px, 1.55fr);
  gap: 20px;
  align-items: start;
}
.report-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}
.report-table-block,
.report-panel {
  background: #fff;
  border: 1px solid #d7e0eb;
  box-shadow: 0 8px 18px rgba(15, 39, 66, .06);
}
.report-table-block h2,
.report-panel h2 {
  margin: 0;
  padding: 10px 12px;
  color: #0f2742;
  font-size: 15px;
  text-align: center;
  text-transform: uppercase;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.report-table th {
  padding: 6px 8px;
  background: #244f95;
  color: #fff;
  text-align: left;
}
.report-table th:last-child,
.report-table td:last-child {
  width: 82px;
  text-align: right;
}
.report-table td {
  padding: 6px 8px;
  border: 1px solid #d8e1ef;
  background: #fff;
}
.report-table .total-row td {
  border-top: 2px solid #0f2742;
  font-weight: 800;
}
.report-chart-svg {
  display: block;
  width: 100%;
  height: auto;
  padding: 8px 12px 14px;
}
.report-chart-svg line {
  stroke: #8ba2bd;
  stroke-width: 1;
}
.report-chart-svg .grid {
  stroke: #d7e0eb;
}
.report-chart-svg polyline {
  fill: none;
  stroke: #3f73ca;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.report-chart-svg circle {
  fill: #3f73ca;
}
.report-chart-svg text {
  fill: #39495f;
  font-size: 12px;
  font-weight: 700;
}
.report-chart-svg .axis-label {
  fill: #59677a;
  font-weight: 500;
}
.report-pie {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(160px, 1fr);
  gap: 16px;
  align-items: center;
  padding: 12px 16px 18px;
}
.report-pie-svg {
  width: 100%;
  max-width: 240px;
  filter: drop-shadow(0 10px 6px rgba(15, 39, 66, .15));
}
.report-legend {
  display: grid;
  gap: 8px;
  font-size: 12px;
}
.report-legend div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}
.report-legend span {
  width: 10px;
  height: 10px;
}
.report-legend strong {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 500;
}
.report-legend em {
  color: var(--muted);
  font-style: normal;
  font-weight: 800;
}
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 24px; }
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.stack { display: grid; gap: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.check-row input { width: auto; }
.smtp-disabled {
  opacity: .58;
  pointer-events: none;
}
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 6px;
  color: #fff;
  background: #17395c;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }

.portal-app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 40px;
}
.portal-main { min-width: 0; }
.support-card {
  background: #fff;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  box-shadow: 0 16px 42px rgba(15, 39, 66, .12);
  overflow: hidden;
}
.form-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 26px 30px;
  background: linear-gradient(135deg, #f8fbff 0%, #eef8f1 100%);
  border-bottom: 1px solid var(--line);
}
.form-head h1 { margin: 4px 0 0; font-size: 30px; letter-spacing: 0; }
.eyebrow {
  color: #087a56;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e7f6ff;
  color: #145b91;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.ticket-form { padding: 0 30px 30px; }
.form-section {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.form-section h2 {
  margin: 0 0 14px;
  font-size: 16px;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.field-grid label,
.stack-label {
  display: grid;
  gap: 7px;
  padding: 0;
  font-weight: 700;
}
.contact-lookup-status {
  grid-column: 1 / -1;
  min-height: 18px;
  margin-top: -8px;
}
.contact-lookup-status[data-state="found"] { color: #087f5b; }
.contact-lookup-status[data-state="missing"] { color: #8a5a00; }
.contact-lookup-status[data-state="error"] { color: #b42318; }
.wide { grid-column: 1 / -1; }
.ticket-form input,
.ticket-form select,
.ticket-form textarea {
  border-radius: 6px;
  border-color: #cfdbe6;
  min-height: 42px;
}
.ticket-form textarea {
  min-height: 170px;
  line-height: 1.45;
}
.ticket-form .editor { display: grid; gap: 10px; margin-top: 8px; }
.upload-zone {
  display: grid;
  gap: 2px;
  padding: 14px;
  border: 1px dashed #9eb3c7;
  border-radius: 6px;
  background: #f8fbfd;
  cursor: pointer;
}
.upload-zone input { display: none; }
.upload-zone span { font-weight: 800; color: var(--blue); }
.upload-zone small { color: var(--muted); }
.captcha-section {
  display: grid;
  grid-template-columns: minmax(190px, .8fr) minmax(260px, 1fr);
  gap: 20px;
  align-items: center;
}
.captcha-box {
  display: grid;
  gap: 8px;
  justify-items: start;
}
.captcha-box img {
  width: 220px;
  height: 70px;
  border: 1px solid #cbd5df;
  border-radius: 6px;
  background: #fff;
}
.captcha-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 8px;
  width: min(320px, 100%);
}
.portal-actions {
  grid-column: auto;
  justify-content: flex-end;
  padding-top: 22px;
  border-top: 0;
}
.submit-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 24px;
  margin-top: 8px;
  color: #145b91;
  font-size: 13px;
  font-weight: 700;
}
.submit-status[hidden] { display: none; }
.submit-status[data-state="error"] {
  color: #b42318;
}
.ticket-form.is-submitting {
  cursor: wait;
}
.portal-aside {
  display: grid;
  gap: 14px;
  align-content: start;
}
.info-block {
  background: #fff;
  border: 1px solid #dce6ee;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 24px rgba(15, 39, 66, .08);
}
.info-number {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: #e9f7ef;
  color: #087a56;
  font-weight: 900;
}
.info-block strong { display: block; font-size: 15px; margin-bottom: 6px; }
.info-block p { margin: 0; color: var(--muted); line-height: 1.45; }
.lookup-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}
.lookup-form input { min-height: 40px; border-radius: 6px; }
.customer-page {
  width: min(980px, calc(100% - 28px));
  margin: 28px auto;
}
.customer-head {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 24px;
  margin-bottom: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.customer-head h1 { margin: 4px 0 4px; font-size: 28px; }
.customer-list { display: grid; gap: 14px; }
.customer-ticket {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.customer-ticket h2 { margin: 10px 0 8px; font-size: 18px; }
.customer-ticket p { margin: 0; color: var(--muted); }
.ticket-timeline { display: grid; gap: 12px; }
.timeline-item {
  padding-left: 14px;
  border-left: 3px solid #d8e9f7;
}
.timeline-item strong { display: block; }
.timeline-item span { display: block; margin: 3px 0 8px; color: var(--muted); font-size: 12px; }
.timeline-item p { color: var(--ink); line-height: 1.45; }
.empty-state {
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  box-shadow: var(--shadow);
}
.success-page {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: calc(100vh - 170px);
  padding: 20px;
}
.success-card {
  width: min(720px, 100%);
  padding: 34px;
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(15, 39, 66, .14);
}
.success-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: #e7f8ef;
  color: #03875d;
  font-size: 34px;
  font-weight: 900;
}
.success-card h1 {
  margin: 8px 0 10px;
  font-size: 28px;
}
.success-card p {
  margin: 0 auto 20px;
  max-width: 560px;
  color: var(--muted);
  line-height: 1.5;
}
.success-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0;
}
.success-summary div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfd;
  text-align: left;
}
.success-summary strong { font-size: 12px; color: var(--muted); text-transform: uppercase; }
.success-summary span { font-weight: 800; overflow-wrap: anywhere; }
.success-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 800;
  border: 1px solid #cbd5df;
}
.button-link.teams { background: #6264a7; border-color: #6264a7; color: #fff; }
.button-link.secondary { background: #fff; color: var(--ink); }
.success-actions .teams { min-width: 190px; }
@media (max-width: 900px) {
  .topbar { height: auto; align-items: flex-start; gap: 16px; padding: 18px; flex-direction: column; }
  .nav { gap: 18px; overflow-x: auto; padding: 12px 18px; }
  .sla-reminder { grid-template-columns: 1fr; padding: 10px 18px; }
  .sla-reminder-actions { justify-content: flex-start; }
  .layout, .ticket-shell, .admin-grid { grid-template-columns: 1fr; }
  .ticket-list-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .ticket-list { max-height: 420px; }
  .report-page { padding: 22px 14px 32px; }
  .report-head { flex-direction: column; }
  .report-head-actions { justify-items: stretch; width: 100%; }
  .segmented-control { width: 100%; }
  .segmented-control button { flex: 1; }
  .report-period-tools { justify-items: stretch; }
  .report-nav-buttons { justify-content: stretch; }
  .report-nav-buttons button { flex: 1; }
  .report-period-tools label { grid-template-columns: 1fr; }
  .report-kpis { grid-template-columns: 1fr; width: 100%; }
  .report-grid { grid-template-columns: 1fr; }
  .report-pie { grid-template-columns: 1fr; }
  .requester-ticket-item { grid-template-columns: 1fr; }
  .requester-ticket-side { justify-items: start; }
  .field-builder { grid-template-columns: 1fr; }
  .field-preview-panel { position: static; }
  .aside { border-left: 0; border-top: 1px solid var(--line); }
  .main { padding: 24px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  label { padding: 0; }
  .actions { grid-column: 1; }
  .portal-app { grid-template-columns: 1fr; width: min(100% - 20px, 720px); margin-top: 12px; }
  .portal-aside { grid-template-columns: 1fr; }
  .form-head { padding: 22px 18px; flex-direction: column; }
  .ticket-form { padding: 0 18px 22px; }
  .field-grid, .captcha-section { grid-template-columns: 1fr; }
  .portal-actions { justify-content: stretch; }
  .portal-actions button { width: 100%; }
  .submit-status { justify-content: flex-start; }
  .contacts-toolbar { grid-template-columns: 1fr; }
  .captcha-controls { width: 100%; }
  .customer-head { align-items: flex-start; flex-direction: column; }
  .customer-ticket { grid-template-columns: 1fr; }
  .success-card { padding: 24px 18px; }
  .success-summary { grid-template-columns: 1fr; }
  .success-actions { display: grid; }
}
