@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

html {
  scrollbar-gutter: stable;
}

:root {
  --brand: #0f6a60; /* dark green for nav */
  --brandText: #e6f7f7;
  --pageBg: #f3f7f8;
  --cardBg: #ffffff;
  --cardBorder: #d7e1e6;
  --cardShadow: 0 8px 22px rgba(13, 44, 45, 0.06);
  --sectionHeaderBg: #d9e8e9;
  --sectionHeaderText: #0f2f33;
  --mutedText: #5b6b73;
  --teal-900: #0b3b3c;
  --teal-800: #0f4f50;
  --teal-700: #146f70;
  --content-width: 1580px;
  --bg: var(--pageBg);
  --panel: var(--cardBg);
  --border: var(--cardBorder);
  --text: #0f172a;
  --muted: var(--mutedText);
  --accent: #0f6a60;
  --accent-strong: #0c5a52;
}

* {
  box-sizing: border-box;
}

body.admin-body {
  font-family: "IBM Plex Sans", "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  margin: 0;
  background: var(--pageBg);
  color: var(--text);
}

.admin-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 0;
  padding-left: max(20px, calc((100% - var(--content-width)) / 2 + 20px));
  padding-right: max(20px, calc((100% - var(--content-width)) / 2 + 20px));
  background: var(--brand);
  color: var(--brandText);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.08);
  position: sticky;
  top: 0;
  z-index: 1000;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: 48px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 12px;
}

.brand-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  display: block;
}

.brand-name {
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.clients-table td,
.clients-table th {
  white-space: nowrap;
}

.clients-table .col-name,
.clients-table .col-surname,
.clients-table .col-company {
  min-width: 140px;
}

.clients-table .col-email {
  min-width: 220px;
}

.clients-table .col-code {
  min-width: 110px;
}

.customer-actions {
  text-align: right;
}

.customer-actions-group {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.pagination {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--primary);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.page-link.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.clients-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.credit-form {
  margin-bottom: 16px;
}

.ledger-table td,
.ledger-table th {
  white-space: nowrap;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  flex: 1;
  align-items: center;
}

.admin-nav a,
.nav-trigger {
  color: rgba(230, 247, 247, 0.82);
  text-decoration: none;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 4px 2px;
}

.nav-trigger {
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-nav a:hover,
.nav-trigger:hover {
  color: #ffffff;
}

.nav-link.active,
.nav-group.active > .nav-trigger,
.nav-item.active {
  color: #ffffff;
}

.nav-group {
  position: relative;
}

.nav-caret {
  font-size: 10px;
  line-height: 1;
}

.client-email-primary-col,
.client-email-primary-cell {
  text-align: center;
  width: 90px;
}

.client-email-primary-cell input[type="radio"] {
  display: block;
  margin: 0 auto;
}

.nav-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 180px;
  padding: 6px;
  background: var(--brand);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  box-shadow: 0 12px 24px rgba(3, 21, 23, 0.35);
  display: none;
  z-index: 30;
}

.nav-group:hover .nav-menu,
.nav-group:focus-within .nav-menu {
  display: block;
}

.admin-topbar:hover .nav-group:hover .nav-menu,
.admin-topbar:hover .nav-group:focus-within .nav-menu {
  display: block;
}

.nav-menu::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  right: 0;
  height: 8px;
}

.nav-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.user-badge {
  margin-left: auto;
  color: #bfe9e9;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.user-badge strong {
  color: #ffffff;
}

.user-badge .muted {
  color: #f6a623;
}

.user-profile-link {
  color: #ffffff;
  text-decoration: none;
}

.user-profile-link:hover {
  text-decoration: underline;
}

.logout-link {
  color: #bfe9e9;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid rgba(191, 233, 233, 0.3);
  padding: 4px 8px;
  border-radius: 999px;
}

.logout-link:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.6);
}

.admin-content {
  max-width: var(--content-width);
  margin: 20px auto 32px;
  padding: 0 20px;
  width: 100%;
}

.page-title-bar {
  background: var(--sectionHeaderBg);
  border: 1px solid var(--cardBorder);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-span-3 {
  grid-column: 1 / -1;
}

.page-title-bar h1 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.02em;
}

.panel {
  background: var(--cardBg);
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--cardShadow);
  overflow-x: auto;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.overview-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}

.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.range-label {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

@media (max-width: 1100px) {
  .overview-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 640px) {
  .overview-grid {
    grid-template-columns: 1fr;
  }

  .report-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.muted {
  color: var(--muted);
}

.report-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(13, 44, 45, 0.06);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.report-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.report-value {
  font-size: 28px;
  font-weight: 700;
  color: #0f172a;
}

.report-caption {
  font-size: 12px;
  color: var(--muted);
}

.report-split {
  display: flex;
  gap: 16px;
  align-items: flex-end;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.report-kpi {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fbfc;
  padding: 8px;
}

.report-kpi-value {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  color: #0f172a;
}

.report-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.report-chart {
  min-height: 200px;
}

.bar-chart {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 40px;
  gap: 8px;
  align-items: center;
}

.bar-row-wide {
  grid-template-columns: minmax(110px, 40%) 1fr 44px;
}

.bar-label {
  font-size: 12px;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 8px;
  border-radius: 999px;
  background: #e8f2f2;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--accent);
}

.bar-value {
  font-size: 12px;
  text-align: right;
  color: #0f172a;
}

.empty-note {
  font-size: 12px;
  color: var(--muted);
}

.response-mix {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.mix-track {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
}

.mix-segment {
  display: block;
  height: 100%;
}

.mix-segment.outbound {
  background: #0f6a60;
}

.mix-segment.inbound {
  background: #0ea5e9;
}

.mix-segment.internal {
  background: #94a3b8;
}

.mix-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 11px;
  color: #334155;
}

.mix-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mix-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.mix-dot.outbound {
  background: #0f6a60;
}

.mix-dot.inbound {
  background: #0ea5e9;
}

.mix-dot.internal {
  background: #94a3b8;
}

.trend-chart {
  display: grid;
  gap: 10px;
}

.trend-bars {
  height: 148px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16px, 1fr));
  gap: 4px;
  align-items: end;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fbfc;
  padding: 10px 8px 8px;
}

.trend-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}

.trend-col-fill {
  width: 100%;
  max-width: 13px;
  min-height: 8px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #0f6a60 0%, #0c5a52 100%);
}

.trend-col-label {
  min-height: 12px;
  font-size: 10px;
  line-height: 1;
  color: #64748b;
}

.trend-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 11px;
  color: #334155;
}

.stat {
  flex: 1 1 180px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff;
}

.client-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.stat .label {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat .value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
  color: #0f172a;
}

code {
  background: #eef3f4;
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.licenses-table td,
.licenses-table th {
  white-space: nowrap;
}

.licenses-table {
  font-size: 11px;
}

.licenses-table .col-max-inst {
  width: 70px;
  text-align: center;
}

.licenses-table .col-created,
.licenses-table .col-updated {
  width: 92px;
}

.activations-table td,
.activations-table th {
  white-space: nowrap;
}

.truncate {
  display: inline-block;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.license-key {
  display: inline-block;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}

.fingerprint-short {
  max-width: 220px;
}

.toggle-cell {
  text-align: center;
  width: 48px;
  padding: 4px 6px;
}

.toggle-cell input {
  margin: 0;
  appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #f8fafc;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
}

.toggle-cell input::after {
  content: '';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.toggle-activated:checked {
  background: #16a34a;
  border-color: #16a34a;
}

.toggle-activated:checked::after {
  content: '✓';
}

.toggle-revoked:checked,
.toggle-expired:checked {
  background: #ef4444;
  border-color: #ef4444;
}

.toggle-revoked:checked::after,
.toggle-expired:checked::after {
  content: '×';
}

.license-actions {
  text-align: right;
  width: 90px;
}

.activation-actions {
  text-align: right;
  width: 90px;
}

.users-table td,
.users-table th {
  white-space: nowrap;
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.inline-form {
  display: inline-flex;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.btn-small {
  padding: 4px 8px;
  font-size: 11px;
}

th,
 td {
  border-bottom: 1px solid var(--border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #edf4f4;
  color: #143434;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
}

.products-table th:nth-child(3),
.products-table td:nth-child(3) {
  min-width: 200px;
}

.products-table th:nth-child(9),
.products-table td:nth-child(9),
.products-table th:nth-child(11),
.products-table td:nth-child(11),
.products-table th:nth-child(12),
.products-table td:nth-child(12) {
  min-width: 96px;
}

tr:hover td {
  background: #f7fafb;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #123436;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}

.btn-loading {
  opacity: 0.85;
  cursor: wait;
}

.btn-spinner {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: btn-spin 0.7s linear infinite;
}

@keyframes btn-spin {
  to {
    transform: rotate(360deg);
  }
}

.btn-primary {
  background: #e2f3f0;
  border-color: #c3e5de;
  color: #0f3b36;
}

.btn-primary:hover {
  background: #d3ebe6;
}

.btn-outline {
  background: transparent;
  border-color: #9fb1b8;
  color: #0f172a;
}

.btn-outline:hover {
  background: #eef3f4;
}

.btn-danger {
  background: #fdecef;
  border-color: #f8d7da;
  color: #842029;
}

.btn-danger:hover {
  background: #f9d8dd;
  border-color: #f1b7bf;
  color: #7a1f1f;
}

.btn-merge {
  background: #fcd79c;
  border-color: #f5c27a;
  color: #7a2f0d;
  box-shadow: none;
}

.btn-merge:hover {
  background: #fbc175;
  border-color: #f2ad52;
  color: #6b250c;
}

input,
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c5d0d5;
  border-radius: 6px;
  font-size: 13px;
  background: #ffffff;
}

label {
  font-weight: 600;
  color: #213134;
  display: block;
  margin-bottom: 6px;
}

form.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert {
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 12px;
}

.alert-error {
  background: #fdecec;
  border: 1px solid #f5c2c2;
  color: #7a1f1f;
}

.alert-warning {
  background: #fff4e5;
  border: 1px solid #f4d2a6;
  color: #7a4b10;
}

.alert-success {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.auth-panel {
  max-width: 420px;
  margin: 0 auto;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  text-align: center;
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.login-name {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--teal-900);
}

.client-auth-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field-checkbox {
  justify-content: center;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.permissions-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #ffffff;
}

.role-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.role-select-row select {
  flex: 1 1 auto;
}

.role-rules-open {
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
}

.permission-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid #c5d1d6;
  border-radius: 999px;
  background: #f8fbfc;
  color: #14363c;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
}

.section-card {
  border: 1px solid var(--cardBorder);
  border-radius: 14px;
  padding: 16px;
  background: var(--cardBg);
  margin-bottom: 16px;
  box-shadow: var(--cardShadow);
  overflow: hidden;
}

.section-header {
  background: var(--sectionHeaderBg);
  color: var(--sectionHeaderText);
  border-bottom: 1px solid var(--cardBorder);
  padding: 12px 16px;
  margin: -16px -16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.section-title {
  font-weight: 700;
  font-size: 14px;
  margin: 0;
}

.section-desc {
  color: var(--mutedText);
  margin: 0;
}

.section-card + .section-card {
  margin-top: 8px;
}

.section-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.field-help {
  color: var(--muted);
  font-size: 12px;
  margin: 6px 0 0 0;
}

.settings-form .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.integration-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
}

@media (max-width: 980px) {
  .integration-config-grid {
    grid-template-columns: 1fr;
  }
}

.integration-config-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: #f8fbfc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.integration-endpoints-wrap {
  overflow-x: auto;
}

.integration-endpoints-table {
  width: 100%;
  border-collapse: collapse;
}

.integration-endpoints-table code {
  white-space: nowrap;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 10px 12px;
}

@media (max-width: 1080px) {
  .readiness-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
}

.integration-auth-endpoints {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 16px;
  align-items: start;
}

@media (max-width: 1080px) {
  .integration-auth-endpoints {
    grid-template-columns: 1fr;
  }
}

.auth-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.endpoints-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.endpoints-grid-fixed {
  grid-template-columns: repeat(2, minmax(240px, 1fr));
}

@media (max-width: 920px) {
  .endpoints-grid-fixed {
    grid-template-columns: 1fr;
  }
}

.integration-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}

@media (max-width: 1180px) {
  .integration-actions-grid {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
  }
}

@media (max-width: 820px) {
  .integration-actions-grid {
    grid-template-columns: 1fr;
  }
}

.readiness-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
}

.readiness-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.readiness-label {
  font-weight: 600;
  color: #0f172a;
}

.readiness-detail {
  font-size: 12px;
  color: #475569;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  line-height: 1.2;
  text-align: center;
  color: #ffffff;
  box-sizing: border-box;
}

.status-pill .status-pill-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  line-height: 1.2;
}

.status-open,
.status-new {
  background: #fdecec;
  border-color: #f5c2c7;
  color: #842029;
}

.status-pending {
  background: #e8edff;
  border-color: #cdd6ff;
  color: #4338ca;
}

.status-waiting_customer {
  background: #fff1df;
  border-color: #fcd9a6;
  color: #92400e;
}

.status-resolved,
.status-solved {
  background: #e8f7ef;
  border-color: #cbeada;
  color: #166534;
}

.status-closed {
  background: #edf2f7;
  border-color: #d7e3ef;
  color: #334155;
}

/* Generic status variants used elsewhere (health/readiness) */
.status-info {
  color: #ffffff;
  background: #64748b;
  border-color: #475569;
}

.status-ok {
  color: #ffffff;
  background: #15803d;
  border-color: #166534;
}

.status-warn {
  color: #ffffff;
  background: #d97706;
  border-color: #b45309;
}

.status-fail {
  color: #ffffff;
  background: #dc2626;
  border-color: #991b1b;
}

/* Ticket table pill sizing to match buttons */
.tickets-table .status-pill,
.tickets-table .priority-pill,
.ticket-summary .status-pill,
.ticket-summary .priority-pill {
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  min-height: 20px;
  min-width: 78px;
  align-items: center;
  justify-content: center;
}

.ticket-alert-cell {
  width: 52px;
  padding-left: 2px;
  padding-right: 2px;
  text-align: center;
  overflow: visible;
  text-overflow: clip;
}

.ticket-alert-icons {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 2px;
  flex-wrap: nowrap;
}

.tickets-alert-icons {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
}

.ticket-alert-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 800;
  font-size: 12px;
  border: 1px solid #fecdd3;
}

.ticket-alert-triangle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: #854d0e;
  background: linear-gradient(180deg, #fef9c3 0%, #facc15 100%);
  border: 1px solid #b45309;
  border-radius: 50%;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.35);
}

.ticket-alert-triangle-clock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  transform: translateY(-0.5px);
}

.ticket-alert-triangle.is-flashing {
  animation: ticketAlertFlash 1s linear infinite;
}

@keyframes ticketAlertFlash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.2;
  }
}

.btn-compact {
  min-width: 10ch;
  min-height: 44px;
  padding: 10px 14px;
  white-space: normal;
  line-height: 1.2;
  justify-content: center;
  text-align: center;
}

.integration-auth-endpoints .btn-small,
.integration-actions-grid .btn-small {
  min-width: 10ch;
  min-height: 40px;
  padding: 8px 12px;
  justify-content: center;
  text-align: center;
}

.secret-actions .btn-small {
  margin: 0;
}

.placeholder-card {
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
}

.mail-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}

.mail-settings-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(13, 44, 45, 0.05);
}

.mail-settings-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.mail-settings-actions {
  justify-content: flex-start;
  margin-top: 8px;
}

.mail-test-group {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.mail-test-block {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
}

.mail-test-label {
  font-weight: 600;
  font-size: 12px;
  margin-bottom: 8px;
  color: #0f172a;
}

.mail-test-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mail-test-row input[type="email"] {
  flex: 1 1 220px;
}

.mail-test-status {
  margin-top: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.mail-test-status .status-icon {
  font-weight: 700;
  line-height: 1;
  margin-top: 1px;
}

.mail-test-status.success {
  background: #ecfdf3;
  border-color: #bbf7d0;
  color: #166534;
}

.mail-test-status.error {
  background: #fdecec;
  border-color: #f5c2c2;
  color: #7a1f1f;
}

.info-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f6f9fa;
}

.info-card .label {
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

.info-card .value {
  font-size: 12px;
  word-break: break-all;
}

.info-card .hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  margin-top: 6px;
}

.secret-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.secret-input-wrap {
  position: relative;
}

.secret-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #c5d1d6;
  border-radius: 6px;
  background: #ffffff;
  color: #0f172a;
  font-size: 12px;
}

.secret-input[readonly] {
  background: #f8fafc;
}

.secret-input-with-icon {
  padding-right: 36px;
}

.secret-icon-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.secret-icon-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.secret-icon-btn[aria-pressed="true"] {
  background: #dbeafe;
  color: #1d4ed8;
}

.secret-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.permissions-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 13px;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(120px, 1fr));
  gap: 10px 12px;
}

.permission-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}

.permission-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.permission-option {
  font-weight: 500;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.license-modal {
  position: fixed;
  inset: 0;
  background: rgba(10, 25, 30, 0.55);
  padding: 20px;
  z-index: 1100;
}

.license-modal-card {
  max-width: 640px;
  margin: 40px auto;
  background: #ffffff;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.2);
}

.profile-modal-card {
  max-width: 780px;
}

.profile-password-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.profile-form-actions {
  gap: 8px;
}

.role-rules-card {
  max-width: 980px;
}

.role-rules-actions {
  gap: 8px;
}

.license-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 12px;
}

.license-modal-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
  font-size: 12px;
}

.license-detail .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 4px;
}

.license-detail .value {
  font-weight: 600;
  color: #0f172a;
  word-break: break-all;
}

.license-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
}

.tickets-table th,
.tickets-table td {
  padding: 6px 8px;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tickets-sort-head {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.tickets-sort-label {
  display: inline-block;
}

.tickets-sort-arrows {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.tickets-sort-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  text-decoration: none;
  color: #64748b;
  border-radius: 3px;
  font-size: 9px;
  line-height: 1;
}

.tickets-sort-link:hover {
  background: #dbe5ea;
  color: #0f172a;
}

.tickets-sort-link.active {
  background: #c7d7df;
  color: #0f172a;
}

.tickets-table th:nth-child(1),
.tickets-table td:nth-child(1) {
  width: 94px;
  padding-right: 2px;
}

.tickets-table th:nth-child(2),
.tickets-table td:nth-child(2) {
  width: 44px;
  padding-left: 0;
  padding-right: 4px;
  overflow: visible;
  text-overflow: clip;
}

.tickets-table th:nth-child(3),
.tickets-table td:nth-child(3) {
  width: 110px;
}

.tickets-table th:last-child,
.tickets-table td:last-child {
  width: 90px;
  text-align: right;
}

.client-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.client-dashboard-table {
  table-layout: auto;
}

.client-dashboard-table th,
.client-dashboard-table td {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: break-word;
}

.client-dashboard-table th:nth-child(1),
.client-dashboard-table td:nth-child(1),
.client-dashboard-table th:nth-child(2),
.client-dashboard-table td:nth-child(2),
.client-dashboard-table th:nth-child(3),
.client-dashboard-table td:nth-child(3),
.client-dashboard-table th:last-child,
.client-dashboard-table td:last-child {
  width: auto;
  padding-left: 8px;
  padding-right: 8px;
  text-align: left;
}

.client-profile-table th:first-child {
  width: 150px;
  white-space: nowrap;
}

.client-profile-table td input[type="text"] {
  min-width: 220px;
}

.client-licenses-table {
  min-width: 880px;
}

.client-licenses-table th:nth-child(1),
.client-licenses-table td:nth-child(1),
.client-licenses-table th:nth-child(3),
.client-licenses-table td:nth-child(3),
.client-licenses-table th:nth-child(4),
.client-licenses-table td:nth-child(4),
.client-licenses-table th:nth-child(5),
.client-licenses-table td:nth-child(5),
.client-licenses-table th:nth-child(6),
.client-licenses-table td:nth-child(6),
.client-licenses-table th:nth-child(7),
.client-licenses-table td:nth-child(7) {
  white-space: nowrap;
}

.client-license-key-cell {
  min-width: 300px;
}

.client-license-key {
  display: block;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}

.client-tickets-table {
  min-width: 680px;
}

.client-tickets-table th:last-child,
.client-tickets-table td:last-child {
  width: 86px;
  text-align: right;
  white-space: nowrap;
}

.client-emails-table {
  min-width: 620px;
}

.client-emails-table td:first-child {
  min-width: 240px;
}

.client-emails-table .truncate {
  max-width: 100%;
}

.client-emails-table th.client-email-primary-col,
.client-emails-table td.client-email-primary-cell {
  width: 72px;
  text-align: center !important;
  white-space: nowrap;
}

.tickets-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.customer-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
}

.customer-filters .tickets-filter {
  min-width: 0;
}

.customer-filters .filter-search {
  flex: 1 1 260px;
}

.customer-filters .filter-status {
  flex: 0 0 160px;
}

.customer-filters .filter-inactive {
  flex: 0 0 auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding-bottom: 0;
}

.customer-filters .filter-actions {
  margin-left: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-filters .checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.customer-filters label {
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}

.customer-filters input,
.customer-filters select {
  width: 100%;
}

.mailing-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.tickets-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tickets-filter.actions {
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  grid-column: 1 / -1;
  flex-direction: row;
  width: 100%;
  margin-left: auto;
}

.mailing-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mail-client {
  display: grid;
  grid-template-columns: 15% 45% 40%;
  gap: 14px;
  align-items: stretch;
}

.mail-sidebar {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  padding: 10px;
  min-height: 520px;
}

.mail-sidebar-header {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 10px;
}

.mail-folder-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mail-folder-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  text-decoration: none;
  padding: 8px 10px;
  border: 1px solid #d6e1e6;
  border-radius: 9px;
  background: #f8fbfc;
  color: #0f172a;
}

.mail-folder-link:hover {
  background: #eef5f8;
  border-color: #c7d8df;
}

.mail-folder-link.active {
  background: #eaf4f7;
  border-color: #bdd4dd;
}

.mail-folder-label {
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
}

.mail-folder-count {
  margin-left: auto;
  min-width: 24px;
  text-align: right;
  font-size: 11px;
  color: #475569;
}

.mail-list-panel,
.mail-preview-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
  min-height: 520px;
}

.mail-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 12px;
}

.mail-list-head strong {
  font-size: 13px;
}

.mail-message-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mail-message-table th,
.mail-message-table td {
  border-bottom: 1px solid #e6eef2;
  padding: 8px 8px;
  text-align: left;
  vertical-align: top;
}

.mail-message-table th {
  background: #eef5f8;
  color: #0f172a;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.mail-message-table tbody tr.active {
  background: #f2f8fb;
}

.mail-message-table tbody tr[data-url] {
  cursor: pointer;
}

.mail-message-table tbody tr[data-url]:hover {
  background: #f8fbfd;
}

.mail-message-table tbody tr.active:hover {
  background: #f2f8fb;
}

.mail-col-from {
  max-width: 180px;
  word-break: break-word;
}

.mail-row-link {
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
}

.mail-row-link:hover {
  text-decoration: underline;
}

.mail-row-snippet {
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
  line-height: 1.35;
}

.mail-empty-row {
  color: #64748b;
  font-style: italic;
}

.mail-pagination {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.mail-preview-panel {
  overflow: hidden;
}

.mail-preview-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mail-preview-empty {
  color: #64748b;
  font-size: 12px;
}

.mail-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.mail-preview-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.mail-preview-subject {
  border: 1px solid #d9e5eb;
  border-radius: 10px;
  background: #f8fbfd;
  padding: 10px;
}

.mail-preview-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mail-preview-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  padding: 10px;
  border: 1px solid #d9e5eb;
  border-radius: 10px;
  background: #f8fbfd;
}

.mail-meta-label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}

.mail-meta-value {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #0f172a;
  word-break: break-word;
}

.mail-preview-body {
  border: 1px solid #d9e5eb;
  border-radius: 10px;
  background: #ffffff;
  padding: 12px;
  min-height: 240px;
  max-height: 420px;
  overflow: auto;
  line-height: 1.45;
  white-space: pre-wrap;
}

.mail-readonly-tip {
  font-size: 11px;
  color: #64748b;
  border-top: 1px dashed #d9e5eb;
  padding-top: 8px;
}

.mail-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

.mail-toolbar-poll {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.mail-toolbar-left {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.mail-poll-meta {
  font-size: 11px;
  color: #475569;
}

.mail-filter-form {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.mail-filter-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: #334155;
}

.mail-search-field {
  min-width: 260px;
}

.mail-search-input {
  width: 30ch;
  min-width: 260px;
}

.mail-date-field input {
  min-width: 140px;
}

.mail-filter-button {
  margin-bottom: 0;
}

.mail-filter-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-top: 18px;
}

.mail-inline-form {
  display: inline-flex;
}

.mailing-table select {
  width: 100%;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
}

.mailing-actions {
  text-align: right;
  width: 170px;
  white-space: nowrap;
}

.mailing-actions .btn + .btn {
  margin-left: 6px;
}

.mailing-subscription-col {
  font-size: 11px;
  color: #334155;
}

.mailing-edit-modal-card {
  max-width: 760px;
}

.mailing-edit-modal-card input,
.mailing-edit-modal-card select,
.mailing-edit-modal-card textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
}

.mailing-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
  border: 1px solid #d7e1e6;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.mailing-product-choice {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #0f172a;
}

.mailing-product-choice input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
}

.mailing-subscription-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mailing-subscription-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  font-size: 11px;
  font-weight: 600;
}

.mailing-subscription-pill.is-unsubscribed {
  border-color: #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.purchased-cell {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.purchase-source {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 3px 6px;
  border-radius: 6px;
  border: 1px solid #d7e1e6;
  background: #f1f5f9;
  min-width: 42px;
  text-align: center;
}

.purchased-cell input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  vertical-align: middle;
}

.mailing-row-form {
  display: none;
}

.tickets-filter input,
.tickets-filter select,
.ticket-form input,
.ticket-form select,
.ticket-form textarea,
.ticket-note-form textarea,
.ticket-status-form select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
}

.tickets-actions-inline {
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  width: 100%;
  grid-column: span 3;
}

.tickets-poll-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.tickets-per-page-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.tickets-per-page-inline label {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
}

.tickets-per-page-inline select {
  width: auto;
  min-width: 72px;
  padding: 6px 8px;
}

.tickets-poll-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tickets-poll-btn .poll-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: tickets-spin 0.8s linear infinite;
}

.tickets-poll-btn.loading .poll-spinner {
  display: inline-block;
}

.tickets-poll-btn.poll-alert {
  animation: tickets-pulse 1s ease-in-out infinite;
}

.tickets-poll-result {
  display: none;
  font-size: 12px;
  color: #166534;
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  padding: 6px 10px;
  border-radius: 8px;
  line-height: 1.4;
}

.tickets-poll-result.error {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecdd3;
}

@keyframes tickets-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes tickets-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(185, 28, 28, 0.35);
  }

  70% {
    box-shadow: 0 0 0 8px rgba(185, 28, 28, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(185, 28, 28, 0);
  }
}

.btn-amber {
  background: #fde9c3;
  color: #92400e;
  border: 1px solid #f5d3a5;
  box-shadow: none;
}

.btn-amber:hover {
  background: #fcd79c;
  color: #7a2f0d;
  border-color: #f2c67f;
}

.tickets-action-compact {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 84px;
  min-height: 30px;
  padding: 6px 5px;
  white-space: nowrap;
  text-align: center;
  line-height: 1;
}

.ticket-template-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.ticket-template-form select,
.ticket-template-form input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
}

.template-vars {
  display: grid;
  gap: 8px;
}

.ticket-template-empty {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.tickets-table .status-pill,
.tickets-table .priority-pill,
.ticket-summary .status-pill,
.ticket-summary .priority-pill {
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  min-height: 20px;
  min-width: 78px;
  align-items: center;
  justify-content: center;
}

.priority-low {
  background: #e7f5ff;
  color: #075985;
  border: 1px solid #cfe8ff;
}

.priority-normal {
  background: #edf7f1;
  color: #166534;
  border: 1px solid #d2eadd;
}

.priority-high {
  background: #fff6e5;
  color: #92400e;
  border: 1px solid #fce7c6;
}

.priority-urgent {
  background: #ffecec;
  color: #991b1b;
  border: 1px solid #f8d0d4;
}

.ticket-actions {
  text-align: right;
  width: 80px;
}

@media (max-width: 1100px) {
  .tickets-actions-inline {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .tickets-poll-inline {
    width: 100%;
    margin-right: 0;
  }
}

.ticket-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-purchased {
  background: #dcfce7;
  color: #166534;
}

.badge-interest {
  background: #e5e7eb;
  color: #374151;
}

.badge-enquiry {
  background: #dbeafe;
  color: #1e40af;
}

.ticket-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ticket-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.ticket-contact-card {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ticket-contact-title {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
}

.ticket-contact-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.ticket-contact-meta .label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2px;
}

.ticket-contact-meta .value {
  font-weight: 600;
  color: #0f172a;
}

.ticket-contact-form {
  display: grid;
  gap: 8px;
  max-width: 320px;
}

.ticket-contact-form select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
}

.ticket-summary .label,
.ticket-subject .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
}

.ticket-summary .value,
.ticket-subject .value {
  font-weight: 600;
  color: #0f172a;
}

.ticket-subject {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.ticket-status-form {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.ticket-thread {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.ticket-message {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #ffffff;
}

.ticket-message-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.ticket-message-body {
  font-size: 12px;
  color: #0f172a;
  line-height: 1.5;
}

.ticket-message--client {
  align-self: flex-end;
  background: var(--cardBg);
  border-left: 4px solid var(--border);
  border-color: var(--border);
  max-width: 86%;
}

.ticket-message--agent {
  align-self: flex-start;
  background: var(--sectionHeaderBg);
  border-left: 4px solid var(--accent);
  border-color: var(--border);
  max-width: 86%;
}

.ticket-thread--client .ticket-message {
  max-width: none;
}

.ticket-thread--client .ticket-message--agent {
  align-self: stretch;
  margin-right: 26px;
  background: #fff4e5;
  border-color: #f1c27d;
}

.ticket-thread--client .ticket-message--client {
  align-self: stretch;
  margin-left: 26px;
  background: #e8f6ed;
  border-color: #b7e4c7;
}

.ticket-thread--admin .ticket-message.inbound,
.ticket-thread--admin .ticket-message.in {
  background: #e8f6ed;
  border-color: #b7e4c7;
}

.ticket-thread--admin .ticket-message.outbound,
.ticket-thread--admin .ticket-message.out {
  background: #fff4e5;
  border-color: #f1c27d;
}

@media (max-width: 900px) {
  .ticket-thread--client .ticket-message--agent {
    margin-right: 12px;
  }

  .ticket-thread--client .ticket-message--client {
    margin-left: 12px;
  }
}

.ticket-message--client .ticket-message-meta {
  justify-content: flex-end;
}

.ticket-message--agent .ticket-message-meta {
  justify-content: flex-start;
}

.ticket-status-cell {
  text-align: center;
}

.ticket-alert-unreplied {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(0,0,0,0.18);
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  line-height: 1;
}

.ticket-message-agent {
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.ticket-note-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ticket-assign-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ticket-assign-form button {
  align-self: flex-start;
}

.ticket-reply-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.ticket-message.outbound {
  border-left: 4px solid #1b6e6f;
}

.ticket-message.out {
  border-left: 4px solid #1b6e6f;
}

.ticket-message.internal_note {
  border-left: 4px solid #f59e0b;
  background: #e0f2fe;
}

.ticket-message.inbound {
  border-left: 4px solid #3b82f6;
}

.ticket-message.in {
  border-left: 4px solid #3b82f6;
}

.customer-manage-modal .license-modal-card {
  width: min(98vw, 1500px);
  max-width: min(98vw, 1500px);
}

.client-merge-modal .license-modal-card {
  width: min(96vw, 860px);
  max-width: min(96vw, 860px);
}

.client-merge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  align-items: start;
}

.client-merge-mode {
  grid-column: 1 / -1;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbfc;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-merge-mode-list {
  display: grid;
  gap: 6px;
}

.client-merge-mode-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  font-weight: 600;
  color: #1f2937;
}

.client-merge-mode-row input {
  margin: 0;
}

.client-merge-confirm {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

#client-merge-confirm-input {
  width: 100%;
}

.client-merge-verify {
  margin-top: 10px;
  border: 1px solid #fecaca;
  background: #fff1f2;
  border-radius: 10px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.client-merge-verify-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f97316;
  color: #ffffff;
  font-weight: 700;
  display: grid;
  place-items: center;
}

.client-merge-verify-body {
  display: grid;
  gap: 4px;
}

.client-merge-verify-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.client-merge-toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1200;
  min-width: 260px;
  max-width: min(90vw, 560px);
  border-radius: 10px;
  border: 1px solid #bbf7d0;
  background: #ecfdf3;
  color: #166534;
  padding: 10px 12px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  font-size: 12px;
  font-weight: 600;
}

.client-merge-toast.error {
  border-color: #f5c2c2;
  background: #fdecec;
  color: #7a1f1f;
}

.customer-manage-modal .customer-modal-content {
  max-height: calc(100vh - 150px);
  overflow: auto;
  padding-right: 4px;
}

.customer-modal-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.customer-group-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbfc;
  padding: 10px;
}

.customer-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.customer-modal-grid-account {
  grid-template-columns: 1fr;
}

.customer-account-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

.customer-modal-actions {
  justify-content: flex-start;
  gap: 8px;
  margin-top: 10px;
}

.customer-inline-table th,
.customer-inline-table td {
  white-space: nowrap;
}

@media (max-width: 1080px) {
  .customer-modal-layout {
    grid-template-columns: 1fr;
  }

  .client-merge-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .customer-modal-grid {
    grid-template-columns: 1fr;
  }
}

.debug-note {
  margin-top: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .admin-topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .brand {
    margin-right: 0;
  }

  .admin-nav {
    width: 100%;
  }

  .page-title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .mail-client {
    grid-template-columns: 1fr;
  }

  .mail-preview-meta-grid {
    grid-template-columns: 1fr;
  }

  .mail-filter-form {
    align-items: stretch;
  }

  .mail-filter-actions {
    padding-top: 0;
  }

  .mail-search-input,
  .mail-date-field input {
    width: 100%;
    min-width: 0;
  }

  .user-actions {
    justify-content: flex-start;
  }

  .profile-password-grid {
    grid-template-columns: 1fr;
  }
}
