:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #627084;
  --line: #d9e0ea;
  --panel: #ffffff;
  --canvas: #f5f7fa;
  --soft: #eef4f1;
  --teal: #1f8a70;
  --teal-dark: #12624f;
  --coral: #d95f43;
  --amber: #b7791f;
  --green: #2f855a;
  --blue: #2c6fb7;
  --red: #c2413d;
  --status-row-active: #e7f6cb;
  --status-row-expiring: #fff1cf;
  --status-row-expired: #f6d6da;
  --status-row-hardware: #eef2f6;
  --shadow: 0 18px 44px rgba(25, 35, 50, 0.12);
  --chat-wallpaper:
    radial-gradient(circle at 12px 18px, rgba(14, 92, 76, 0.055) 0 1.5px, transparent 1.7px),
    radial-gradient(circle at 42px 36px, rgba(217, 95, 67, 0.045) 0 1.4px, transparent 1.6px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), rgba(31, 138, 112, 0.08)),
    #efe7dd;
  --chat-wallpaper-size: 38px 38px, 54px 54px, auto, auto;
  --field-bg: rgba(255, 250, 242, 0.96);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(135deg, rgba(31, 138, 112, 0.95), rgba(217, 95, 67, 0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='620' viewBox='0 0 900 620'%3E%3Crect width='900' height='620' fill='%23f5f7fa'/%3E%3Cg fill='none' stroke='%2318212f' stroke-opacity='.18' stroke-width='2'%3E%3Cpath d='M70 140h270v150H70zM118 186h174M118 228h118M420 100h340v210H420zM470 158h230M470 204h140M470 250h198M170 380h560v120H170zM220 430h130M390 430h110M540 430h140'/%3E%3C/g%3E%3Cg fill='%231f8a70' fill-opacity='.18'%3E%3Crect x='92' y='164' width='54' height='20' rx='4'/%3E%3Crect x='446' y='128' width='74' height='24' rx='4'/%3E%3Crect x='202' y='406' width='90' height='22' rx='4'/%3E%3C/g%3E%3Cg fill='%23d95f43' fill-opacity='.22'%3E%3Crect x='600' y='128' width='92' height='24' rx='4'/%3E%3Crect x='398' y='406' width='64' height='22' rx='4'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  background-size: cover;
  color: var(--ink);
}

.agent-session .content,
.agent-session .sidebar {
  -webkit-user-select: none;
  user-select: none;
}

.agent-session input,
.agent-session textarea,
.agent-session select,
.agent-session [data-copy-paste-zone] {
  -webkit-user-select: text;
  user-select: text;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.login-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1fr);
  background:
    linear-gradient(135deg, rgba(31, 138, 112, 0.95), rgba(217, 95, 67, 0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='620' viewBox='0 0 900 620'%3E%3Crect width='900' height='620' fill='%23f5f7fa'/%3E%3Cg fill='none' stroke='%2318212f' stroke-opacity='.18' stroke-width='2'%3E%3Cpath d='M70 140h270v150H70zM118 186h174M118 228h118M420 100h340v210H420zM470 158h230M470 204h140M470 250h198M170 380h560v120H170zM220 430h130M390 430h110M540 430h140'/%3E%3C/g%3E%3Cg fill='%231f8a70' fill-opacity='.18'%3E%3Crect x='92' y='164' width='54' height='20' rx='4'/%3E%3Crect x='446' y='128' width='74' height='24' rx='4'/%3E%3Crect x='202' y='406' width='90' height='22' rx='4'/%3E%3C/g%3E%3Cg fill='%23d95f43' fill-opacity='.22'%3E%3Crect x='600' y='128' width='92' height='24' rx='4'/%3E%3Crect x='398' y='406' width='64' height='22' rx='4'/%3E%3C/g%3E%3C/svg%3E");
  background-size: cover;
}

.login-copy {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: 56px;
  color: #ffffff;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  font-weight: 900;
}

.brand-logo {
  display: block;
  width: 54px;
  height: 54px;
  flex: 0 0 54px;
  border: 2px solid rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  background: var(--field-bg);
  object-fit: contain;
  padding: 4px;
}

.login-copy h1 {
  max-width: 560px;
  margin: 0 0 14px;
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: 0;
}

.login-copy p {
  max-width: 520px;
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  line-height: 1.55;
}

.login-card-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card,
.modal-panel {
  width: min(100%, 460px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  box-shadow: var(--shadow);
}

.login-card {
  padding: 30px;
}

.login-card h2,
.modal-title h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

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

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

.form-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field {
  display: grid;
  gap: 7px;
}

.field[data-wide-field] {
  grid-column: 1 / -1;
}

.field label {
  color: #415168;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  border: 1px solid #cbd5df;
  border-radius: 7px;
  background: var(--field-bg);
  color: var(--ink);
  outline: none;
}

.field input,
.field select,
.search-input {
  min-height: 42px;
  padding: 9px 11px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  padding: 10px 11px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.16);
}

.compact-select {
  width: auto;
  min-width: 92px;
}

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

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 9px 13px;
  font-weight: 800;
  line-height: 1.1;
  text-decoration: none;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
}

.icon svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--teal-dark);
}

.btn-secondary {
  border-color: rgba(255, 255, 255, 0.72);
  background: var(--field-bg);
  color: var(--ink);
}

.btn-soft {
  border-color: #b9d9ce;
  background: #e8f5ef;
  color: var(--teal-dark);
}

.btn-danger {
  border-color: #f1c5be;
  background: #fff0ed;
  color: var(--red);
}

.btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-color: var(--line);
  background: var(--field-bg);
  color: var(--ink);
}

.btn-whatsapp-call {
  border-color: #b9eadf;
  background: #e8f8f0;
  color: #128c7e;
}

.error-box,
.notice-box {
  border-radius: 7px;
  padding: 10px 12px;
  font-size: 14px;
}

.error-box {
  border: 1px solid #f1c5be;
  background: #fff0ed;
  color: var(--red);
}

.notice-box {
  border: 1px solid #cfe4d8;
  background: #eff9f3;
  color: var(--green);
}

.workspace {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 248px minmax(0, 1fr);
  background:
    linear-gradient(135deg, rgba(31, 138, 112, 0.95), rgba(217, 95, 67, 0.88)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='620' viewBox='0 0 900 620'%3E%3Crect width='900' height='620' fill='%23f5f7fa'/%3E%3Cg fill='none' stroke='%2318212f' stroke-opacity='.18' stroke-width='2'%3E%3Cpath d='M70 140h270v150H70zM118 186h174M118 228h118M420 100h340v210H420zM470 158h230M470 204h140M470 250h198M170 380h560v120H170zM220 430h130M390 430h110M540 430h140'/%3E%3C/g%3E%3Cg fill='%231f8a70' fill-opacity='.18'%3E%3Crect x='92' y='164' width='54' height='20' rx='4'/%3E%3Crect x='446' y='128' width='74' height='24' rx='4'/%3E%3Crect x='202' y='406' width='90' height='22' rx='4'/%3E%3C/g%3E%3Cg fill='%23d95f43' fill-opacity='.22'%3E%3Crect x='600' y='128' width='92' height='24' rx='4'/%3E%3Crect x='398' y='406' width='64' height='22' rx='4'/%3E%3C/g%3E%3C/svg%3E");
  background-attachment: fixed;
  background-size: cover;
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.34);
  background:
    linear-gradient(160deg, rgba(31, 138, 112, 0.96), rgba(217, 95, 67, 0.9)),
    rgba(31, 138, 112, 0.94);
  box-shadow: 12px 0 34px rgba(24, 33, 47, 0.18);
  color: #ffffff;
  padding: 22px 18px;
}

.side-top {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 26px;
}

.side-top .brand-mark {
  border-color: rgba(255, 255, 255, 0.64);
  background: var(--field-bg);
  color: var(--teal-dark);
}

.side-top .brand-logo {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  border-color: rgba(255, 255, 255, 0.64);
  padding: 3px;
}

.side-title {
  display: grid;
  gap: 2px;
}

.side-title strong {
  line-height: 1;
}

.side-title span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-button {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.86);
  padding: 10px;
  text-align: left;
  font-weight: 800;
}

.nav-badge {
  display: inline-flex;
  min-width: 22px;
  height: 22px;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  border: 2px solid rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  padding: 0 6px;
}

.nav-button.active,
.nav-button:hover {
  border-color: rgba(255, 255, 255, 0.7);
  background: var(--field-bg);
  color: var(--teal-dark);
}

.side-footer {
  position: sticky;
  top: 22px;
  margin-top: 32px;
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.34);
  padding-top: 18px;
}

.side-footer .btn {
  justify-content: flex-start;
  min-width: 0;
  border-color: rgba(255, 255, 255, 0.72);
  background: var(--field-bg);
  color: var(--ink);
}

.side-footer .btn:hover {
  background: var(--field-bg);
  color: var(--teal-dark);
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0 0 5px;
  color: #ffffff;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: 0;
  text-shadow: 0 2px 14px rgba(24, 33, 47, 0.22);
}

.topbar p {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(132px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card,
.panel,
.customer-card,
.agent-card,
.reseller-card,
.template-card {
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  box-shadow: 0 12px 32px rgba(24, 33, 47, 0.1);
}

.metric-card {
  position: relative;
  display: grid;
  align-content: start;
  min-height: 106px;
  padding: 16px;
  border-top: 4px solid rgba(31, 138, 112, 0.72);
}

.metric-button {
  width: 100%;
  color: var(--ink);
  font: inherit;
  text-align: left;
  appearance: none;
}

.metric-static {
  color: var(--ink);
}

.metric-button:hover,
.metric-button:focus-visible {
  border-color: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 38px rgba(24, 33, 47, 0.16);
  transform: translateY(-1px);
}

.metric-card.revenue-card {
  padding-bottom: 38px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  letter-spacing: 0;
  line-height: 1.05;
  overflow-wrap: anywhere;
}

.metric-card small {
  color: var(--muted);
}

.metric-corner {
  position: absolute;
  right: 14px;
  bottom: 12px;
  max-width: calc(100% - 28px);
  color: var(--teal-dark) !important;
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.dashboard-grid .panel {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 330px;
}

.dashboard-grid .panel-body {
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.panel {
  min-width: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(217, 224, 234, 0.86);
  background: rgba(239, 231, 221, 0.76);
  padding: 15px 16px;
}

.panel-header h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.panel-body {
  padding: 16px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(130px, 170px));
  gap: 10px;
  margin-bottom: 14px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.import-table {
  min-width: 620px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #506077;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr.customer-row-active {
  background: var(--status-row-active);
}

tbody tr.customer-row-expiring {
  background: var(--status-row-expiring);
}

tbody tr.customer-row-expired {
  background: var(--status-row-expired);
}

tbody tr.customer-row-hardware,
tbody tr.customer-row-unknown {
  background: var(--status-row-hardware);
}

td strong {
  display: block;
  max-width: 240px;
}

.customer-code-cell {
  width: 108px;
  white-space: nowrap;
}

.customer-id {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border: 1px solid #b9d9ce;
  border-radius: 7px;
  background: #e8f5ef;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  padding: 4px 7px;
}

.customer-phone {
  color: var(--muted);
  font-size: 13px;
}

.status-chip,
.payment-chip {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-active {
  border: 1px solid #b8e2aa;
  background: #e7f6cb;
  color: #276749;
}

.status-expiring {
  border: 1px solid #f1c978;
  background: #fff1cf;
  color: #9a5b00;
}

.status-expired,
.payment-overdue {
  border: 1px solid #ebb3b8;
  background: #f6d6da;
  color: #a52a2a;
}

.status-unknown {
  background: #eef2f6;
  color: #556579;
}

.status-hardware {
  background: #eef2f6;
  color: #35445a;
}

.payment-paid {
  background: #e6f4f9;
  color: var(--blue);
}

.payment-partial {
  background: #fff1df;
  color: #a65f00;
}

.payment-due {
  background: #fff4d7;
  color: var(--amber);
}

.device-link {
  display: grid;
  width: 100%;
  gap: 3px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.device-link strong {
  color: inherit;
}

.device-link span,
.device-link small {
  color: var(--muted);
  font-size: 12px;
}

.device-link:hover strong,
.device-link:focus-visible strong {
  text-decoration: underline;
}

.shipping-box {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  border: 1px solid #d2d7de;
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px;
}

.shipping-box.shipping-shipped {
  border-color: #f1c978;
  background: #fff1cf;
}

.shipping-box.shipping-delivered {
  border-color: #9ccc84;
  background: #e7f6cb;
}

.shipping-box.shipping-delivered input,
.shipping-box.shipping-delivered select {
  border-color: #87bf73;
  background: #f5ffec;
  color: #276749;
  font-weight: 800;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

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

.mini-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 66px;
  padding: 10px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
}

.activity-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.mini-item .support-chip {
  display: inline-flex;
  color: #35445a;
  font-size: 11px;
}

.mini-item .support-reference {
  color: #315b9f;
}

.mini-item .support-renewal {
  color: var(--green);
}

.mini-item strong,
.mini-item span {
  display: block;
}

.mini-item span {
  color: var(--muted);
  font-size: 13px;
}

.empty-state {
  border: 1px dashed #b9c4d2;
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

.agent-card,
.customer-card,
.reseller-card,
.template-card {
  padding: 16px;
}

.agent-card h3,
.customer-card h3,
.reseller-card h3,
.template-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.detail-list {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
}

.detail-list b {
  color: var(--ink);
}

.template-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.template-grid {
  align-items: stretch;
}

.template-card {
  display: grid;
  gap: 12px;
}

.template-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.template-preview {
  display: -webkit-box;
  min-height: 92px;
  margin: 0;
  overflow: hidden;
  color: #35445a;
  font-size: 13px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  white-space: pre-line;
}

.template-modal {
  width: min(100%, 900px);
}

.template-modal textarea {
  min-height: 240px;
}

.template-variables {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-variables code {
  border: 1px solid #cbd5df;
  border-radius: 7px;
  background: var(--field-bg);
  color: var(--teal-dark);
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow: auto;
  background: rgba(24, 33, 47, 0.48);
  padding: 28px 16px;
}

.modal-panel {
  width: min(100%, 850px);
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.modal-body {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.form-section {
  display: grid;
  gap: 12px;
}

.form-section h3 {
  margin: 0;
  color: #35445a;
  font-size: 15px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 16px 18px;
}

.notes-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.note-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
}

.note-system {
  border-color: #cfe4d8;
  background: #f6fbf8;
}

.note-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.note-topline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.note-topline b {
  border-radius: 999px;
  background: #eef4f8;
  color: #35445a;
  padding: 4px 8px;
  font-size: 11px;
  text-transform: uppercase;
}

.note-copy {
  display: grid;
  gap: 5px;
}

.note-copy p {
  margin: 0;
  color: #35445a;
  font-size: 13px;
  line-height: 1.45;
}

.support-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.support-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  padding: 14px;
}

.support-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.support-card h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 17px;
}

.support-card-head span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.support-tag-form {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.support-table {
  min-width: 1180px;
}

.support-table .support-tag-form {
  grid-template-columns: 150px minmax(180px, 1fr) auto;
  min-width: 430px;
}

.support-table .support-history {
  margin-top: 10px;
}

.support-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.support-history {
  display: grid;
  gap: 8px;
}

.support-log-item {
  display: grid;
  gap: 5px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.support-log-item span:not(.support-chip) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.support-log-item p {
  margin: 0;
  color: #35445a;
  font-size: 13px;
}

.support-chip {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  background: #eef4f8;
  color: #35445a;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.support-issue {
  background: #fff0ed;
  color: var(--red);
}

.support-reference {
  background: #eef4ff;
  color: #315b9f;
}

.support-renewal {
  background: #e8f5ef;
  color: var(--teal-dark);
}

.support-new-subscription {
  background: #fff7dd;
  color: #8a5f00;
}

.support-feedback {
  background: #f0eaff;
  color: #5b3ba7;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.3fr) minmax(0, 1fr);
  gap: 12px;
  min-height: 560px;
}

.chat-sidebar {
  display: grid;
  align-content: start;
  gap: 9px;
  min-width: 0;
}

.chat-create {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  padding: 10px;
}

.chat-create strong {
  color: var(--ink);
  font-size: 14px;
}

.chat-create p {
  margin: 0;
  font-size: 12px;
}

.chat-create .field {
  gap: 5px;
}

.chat-create .field label {
  font-size: 12px;
}

.chat-create input,
.chat-create .btn,
.chat-compose .btn {
  min-height: 34px;
}

.chat-create .btn {
  padding: 7px 10px;
  font-size: 13px;
}

.chat-agent-list {
  display: grid;
  gap: 5px;
  max-height: 180px;
  overflow: auto;
  padding-right: 2px;
}

.chat-agent-list .check-row {
  justify-content: flex-start;
  min-height: 30px;
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.chat-agent-list .check-row input {
  width: 15px;
  height: 15px;
}

.chat-list {
  display: grid;
  gap: 6px;
}

.chat-list-button {
  display: grid;
  width: 100%;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  padding: 8px 9px;
  color: var(--ink);
  text-align: left;
}

.chat-list-button.active,
.chat-list-button:hover {
  border-color: rgba(31, 138, 112, 0.54);
  background: var(--field-bg);
}

.chat-list-button strong,
.chat-list-button small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-list-button strong {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.chat-unread {
  display: inline-flex;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #25d366;
  color: #ffffff;
  font-size: 10px;
  font-style: normal;
  line-height: 1;
  padding: 0 6px;
}

.chat-list-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.chat-list-button em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.chat-thread {
  display: grid;
  min-width: 0;
  min-height: 560px;
  grid-template-rows: auto minmax(280px, 1fr) auto;
  border: 1px solid rgba(14, 92, 76, 0.26);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  overflow: hidden;
}

.chat-thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: #075e54;
  color: #ffffff;
  padding: 11px 13px;
}

.chat-thread-head h3 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: 0;
}

.chat-thread-head span:not(.support-chip) {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.chat-thread-head .support-chip {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  padding: 14px 16px;
}

.chat-message {
  max-width: min(72%, 540px);
  border: 0;
  border-radius: 8px;
  background: var(--field-bg);
  box-shadow: 0 1px 1px rgba(24, 33, 47, 0.12);
  padding: 7px 9px;
}

.chat-message.mine {
  align-self: flex-end;
  background: #dcf8c6;
}

.chat-message div {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 3px;
}

.chat-message strong {
  color: #075e54;
  font-size: 12px;
}

.chat-message span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.chat-message p {
  margin: 0;
  color: #1f2b3d;
  font-size: 13px;
  overflow-wrap: anywhere;
  line-height: 1.38;
}

.chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #f0f2f5;
  padding: 10px;
}

.chat-compose input {
  border-radius: 999px;
  background: var(--field-bg);
}

.chat-empty {
  align-self: center;
  margin: 18px;
}

.chat-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 80;
  display: grid;
  width: min(360px, calc(100vw - 32px));
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  box-shadow: 0 18px 44px rgba(24, 33, 47, 0.2);
  color: var(--ink);
  padding: 14px;
  text-align: left;
}

.chat-toast strong {
  font-size: 14px;
}

.chat-toast span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.drawer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.payment-settings,
.email-settings,
.security-settings {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
}

.qr-settings {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 170px;
  gap: 14px;
  align-items: stretch;
}

.qr-preview {
  display: grid;
  min-height: 140px;
  place-items: center;
  border: 1px dashed #b9c4d2;
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.qr-preview img {
  display: block;
  width: 126px;
  height: 126px;
  object-fit: contain;
}

.qr-image {
  display: block;
  width: 220px;
  height: 220px;
  object-fit: contain;
}

.check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.check-row {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--field-bg);
  padding: 9px 11px;
  color: #35445a;
  font-weight: 800;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.invoice-modal {
  width: min(100%, 940px);
}

.invoice-document {
  display: grid;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  padding: 24px;
}

.invoice-heading,
.invoice-parties,
.payment-option,
.invoice-total {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.invoice-heading h2 {
  margin: 0 0 7px;
  font-size: 28px;
  letter-spacing: 0;
}

.invoice-heading span,
.invoice-parties span,
.payment-option span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.invoice-brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 14px;
}

.invoice-logo {
  display: block;
  width: 96px;
  height: 72px;
  flex: 0 0 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field-bg);
  object-fit: contain;
  padding: 4px;
}

.invoice-meta {
  display: grid;
  gap: 4px;
  min-width: 210px;
  text-align: right;
}

.invoice-meta strong {
  font-size: 22px;
}

.invoice-parties {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.label-text {
  margin-bottom: 5px;
  color: #506077;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.invoice-lines {
  min-width: 0;
}

.invoice-total {
  width: min(100%, 340px);
  margin-left: auto;
  border-top: 2px solid var(--ink);
  padding-top: 12px;
}

.invoice-total span {
  color: var(--muted);
  font-weight: 800;
}

.invoice-total strong {
  font-size: 28px;
}

.invoice-payment-editor {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.zelle-preview-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  padding: 14px;
  text-align: center;
}

.zelle-preview-card strong {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.empty-state.compact {
  width: 100%;
  padding: 18px;
}

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

.invoice-payments.zelle-only {
  grid-template-columns: 1fr;
}

.payment-option {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--chat-wallpaper);
  background-size: var(--chat-wallpaper-size);
  padding: 14px;
}

.payment-option strong {
  display: block;
  margin-bottom: 4px;
}

.zelle-details small {
  display: block;
  margin-top: 8px;
  color: #506077;
}

.zelle-email {
  color: var(--ink) !important;
  font-size: 16px !important;
  font-weight: 900;
}

.invoice-note {
  margin: 0;
  border-left: 4px solid var(--teal);
  background: #eff8f3;
  padding: 12px;
  color: #35445a;
}

.invoice-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-right: auto;
}

@media (max-width: 1120px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(132px, 1fr));
  }

  .dashboard-grid,
  .drawer-grid {
    grid-template-columns: 1fr;
  }

  .cards-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 860px) {
  .login-layout,
  .workspace {
    grid-template-columns: 1fr;
  }

  .login-copy {
    min-height: 360px;
    padding: 32px;
  }

  .login-copy h1 {
    font-size: 36px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.34);
    padding: 14px;
  }

  .side-top {
    margin-bottom: 12px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-button {
    justify-content: center;
    padding: 9px;
  }

  .nav-button span:last-child {
    display: none;
  }

  .nav-button .nav-badge {
    display: inline-flex;
    position: absolute;
    top: 3px;
    right: 8px;
    margin-left: 0;
  }

  .side-footer {
    position: static;
    top: auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
    padding-top: 12px;
  }

  .side-footer .btn {
    justify-content: center;
    padding: 9px 8px;
  }

  .content {
    padding: 16px;
  }

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

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .invoice-payment-editor,
  .invoice-payments,
  .chat-layout,
  .support-tag-form,
  .qr-settings {
    grid-template-columns: 1fr;
  }

  .chat-layout,
  .chat-thread {
    min-height: 460px;
  }
}

@media (max-width: 640px) {
  .login-card-wrap {
    padding: 16px;
  }

  .login-copy {
    padding: 24px 18px;
  }

  .login-copy h1 {
    font-size: 30px;
  }

  .metrics-grid,
  .cards-grid,
  .support-grid,
  .chat-compose,
  .form-grid.two,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .support-card-head {
    flex-direction: column;
  }

  .panel-header,
  .modal-header,
  .modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .button-row,
  .row-actions {
    width: 100%;
  }

  .btn {
    width: 100%;
  }

  .btn-icon {
    width: 38px;
  }

  .chat-message {
    max-width: 100%;
  }

  .invoice-heading,
  .invoice-parties,
  .payment-option,
  .invoice-total {
    align-items: flex-start;
    flex-direction: column;
  }

  .invoice-meta {
    min-width: 0;
    text-align: left;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .workspace {
    display: block;
    background: #ffffff;
  }

  .sidebar,
  .content,
  .modal-header,
  .modal-footer {
    display: none;
  }

  .modal-backdrop {
    position: static;
    display: block;
    overflow: visible;
    background: #ffffff;
    padding: 0;
  }

  .modal-panel {
    width: 100%;
    border: 0;
    box-shadow: none;
  }

  .modal-body {
    padding: 0;
  }

  .invoice-document {
    border: 0;
    padding: 0;
  }

  .btn {
    display: none;
  }
}

@media screen and (max-width: 0px) {
  :root {
    --legacy-yellow: #f2c400;
    --legacy-yellow-dark: #b69300;
    --legacy-black: #050505;
    --legacy-charcoal: #3f3f3f;
    --legacy-red: #b60000;
    --legacy-red-dark: #7e0000;
    --legacy-line: #b9b9b9;
    --legacy-soft: #f3f3f3;
    --legacy-row-green: #e7f6cb;
    --legacy-row-red: #f3d2d5;
    --legacy-field: #f8f8f8;
    --shadow: none;
    font-family: Arial, Helvetica, sans-serif;
  }

  body {
    background: #202020;
    color: #202020;
    font-family: Arial, Helvetica, sans-serif;
  }

  .login-layout {
    grid-template-columns: minmax(280px, 0.8fr) minmax(320px, 1fr);
    background: #f2f2f2;
  }

  .login-copy {
    background: #050505;
    color: #ffffff;
    padding: 42px;
  }

  .login-copy h1 {
    color: #ffffff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 40px;
    font-weight: 700;
  }

  .login-copy p {
    color: #efefef;
  }

  .login-card,
  .modal-panel,
  .metric-card,
  .panel,
  .customer-card,
  .agent-card,
  .reseller-card,
  .template-card,
  .support-card,
  .mini-item,
  .note-item,
  .chat-create,
  .chat-list-button,
  .invoice-document,
  .payment-option,
  .zelle-preview-card,
  .qr-preview {
    border: 1px solid var(--legacy-line);
    border-radius: 3px;
    background: #ffffff;
    background-image: none;
    box-shadow: none;
  }

  .login-card {
    padding: 26px;
  }

  .brand-logo {
    border: 1px solid #d7d7d7;
    border-radius: 0;
    background: #ffffff;
  }

  .workspace {
    display: block;
    min-height: 100vh;
    background: #ffffff;
    color: #202020;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 25;
    display: grid;
    grid-template-columns: minmax(280px, auto) 1fr auto;
    gap: 0;
    border: 0;
    background: #050505;
    box-shadow: none;
    color: #ffffff;
    padding: 0;
  }

  .side-top {
    min-height: 108px;
    align-items: center;
    gap: 16px;
    margin: 0;
    padding: 18px 28px;
    background: #050505;
  }

  .side-top .brand-logo {
    width: 132px;
    height: 74px;
    flex-basis: 132px;
    border: 0;
    object-fit: contain;
    padding: 5px;
  }

  .side-title strong {
    color: #ffffff;
    font-size: 22px;
    line-height: 1;
  }

  .side-title span {
    color: #d6d6d6;
    font-size: 12px;
  }

  .side-footer {
    position: static;
    top: auto;
    grid-column: 3;
    grid-row: 1;
    display: flex;
    align-self: start;
    gap: 8px;
    margin: 0;
    border: 0;
    padding: 18px 18px 0 0;
  }

  .side-footer .btn {
    justify-content: center;
    min-width: 0;
    min-height: 29px;
    border: 1px solid #662018;
    background: linear-gradient(#7a2418, #4b100c);
    color: #ffffff;
    padding: 6px 10px;
    font-size: 12px;
    white-space: nowrap;
  }

  .side-footer .btn:hover {
    background: linear-gradient(#8e2a1d, #5a140e);
    color: #ffffff;
  }

  .nav-list {
    grid-column: 1 / -1;
    display: flex;
    gap: 0;
    overflow-x: auto;
    border-top: 1px solid #242424;
    border-bottom: 4px solid #d7d7d7;
    background: #3f3f3f;
    padding: 0 22px;
  }

  .nav-button {
    width: auto;
    min-height: 46px;
    justify-content: center;
    gap: 0;
    border: 0;
    border-right: 1px solid #575757;
    border-radius: 0;
    background: transparent;
    color: #f5f5f5;
    padding: 0 17px;
    font-size: 15px;
    font-weight: 500;
    white-space: nowrap;
  }

  .nav-button .icon {
    display: none;
  }

  .nav-button.active,
  .nav-button:hover {
    border-color: #575757;
    background: #353535;
    color: var(--legacy-yellow);
  }

  .nav-badge {
    position: static;
    min-width: 20px;
    height: 20px;
    margin-left: 7px;
    border: 1px solid #ffffff;
    background: var(--legacy-red);
    font-size: 10px;
  }

  .content {
    min-height: calc(100vh - 158px);
    padding: 0 0 64px;
    background: #ffffff;
  }

  .content::after {
    content: "";
    display: block;
    height: 98px;
    margin-top: 72px;
    background:
      linear-gradient(to top, #222222 0 34px, transparent 34px),
      linear-gradient(120deg, transparent 0 34%, #222222 34% 45%, transparent 45%) 0 52px / 88px 46px repeat-x,
      linear-gradient(90deg, transparent 0 18%, #222222 18% 23%, transparent 23% 45%, #222222 45% 51%, transparent 51%) 0 34px / 150px 64px repeat-x;
  }

  .topbar {
    align-items: center;
    margin: 0 0 26px;
    border-top: 1px solid #e2e2e2;
    border-bottom: 1px solid #d3d3d3;
    background: var(--legacy-yellow);
    color: #ffffff;
    padding: 22px 28px;
  }

  .topbar h1 {
    margin: 0;
    color: #ffffff;
    font-size: 32px;
    font-weight: 400;
    line-height: 1.2;
    text-shadow: none;
  }

  .topbar p {
    display: none;
  }

  .topbar .button-row {
    align-items: center;
  }

  .topbar .btn-primary {
    border: 1px solid #8c8c8c;
    background: linear-gradient(#ffffff, #d8d8d8);
    color: #222222;
  }

  .topbar .btn-primary[data-action="open-customer"] {
    display: none;
  }

  .topbar .btn-primary .icon {
    display: none;
  }

  .metrics-grid,
  .dashboard-grid,
  .panel,
  .cards-grid,
  .support-grid,
  .chat-layout,
  .settings-grid {
    margin-right: 28px;
    margin-left: 28px;
  }

  .metrics-grid {
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
  }

  .metric-card {
    min-height: 82px;
    border-top: 0;
    padding: 10px 12px;
  }

  .metric-card span {
    color: #555555;
    font-size: 11px;
  }

  .metric-card strong {
    margin-top: 6px;
    color: #111111;
    font-size: 22px;
  }

  .metric-card small,
  .metric-corner {
    color: #555555 !important;
  }

  .dashboard-grid {
    gap: 12px;
  }

  .dashboard-grid .panel {
    height: 300px;
    margin-right: 0;
    margin-left: 0;
  }

  .panel {
    overflow: hidden;
    margin-top: 24px;
  }

  .panel-header {
    min-height: 42px;
    align-items: flex-end;
    border: 1px solid #3b3b3b;
    border-bottom: 0;
    background: linear-gradient(#555555, #202020);
    padding: 0;
  }

  .panel-header h2 {
    align-self: flex-end;
    margin: 0 0 -1px 8px;
    border: 1px solid #2f2f2f;
    border-bottom-color: #ffffff;
    border-radius: 3px 3px 0 0;
    background: #ffffff;
    color: #222222;
    padding: 10px 16px;
    font-size: 15px;
    font-weight: 900;
  }

  .panel-header .button-row,
  .panel-header > .subtle {
    align-items: center;
    margin: 7px 10px 7px auto;
  }

  .panel-header .subtle {
    color: #eeeeee;
    font-size: 12px;
  }

  .panel-body {
    border: 1px solid var(--legacy-line);
    border-top: 0;
    background: #ffffff;
    padding: 14px;
  }

  .toolbar {
    grid-template-columns: minmax(160px, 1fr) repeat(3, minmax(126px, 170px));
    gap: 6px;
    margin-bottom: 0;
    border: 1px solid #bcbcbc;
    background: linear-gradient(#eeeeee, #cfcfcf);
    padding: 10px;
  }

  .field {
    gap: 5px;
  }

  .field label {
    color: #222222;
    font-size: 13px;
    font-weight: 700;
  }

  .field input,
  .field select,
  .field textarea,
  .search-input {
    border: 1px solid #9e9e9e;
    border-radius: 3px;
    background: var(--legacy-field);
    color: #222222;
    font-size: 13px;
    outline: none;
  }

  .field input,
  .field select,
  .search-input {
    min-height: 32px;
    padding: 6px 8px;
  }

  .field textarea {
    min-height: 84px;
    padding: 7px 8px;
  }

  .table-wrap {
    border: 1px solid #bcbcbc;
    border-top: 0;
    background: #ffffff;
  }

  table {
    min-width: 1040px;
    font-size: 13px;
  }

  th,
  td {
    border: 1px solid #e5e5e5;
    padding: 8px 10px;
  }

  th {
    background: linear-gradient(#fff8f8, #e3e3e3);
    color: #333333;
    font-size: 12px;
    font-weight: 900;
    text-transform: none;
  }

  tbody tr:nth-child(odd) {
    background: var(--legacy-row-green);
  }

  tbody tr:nth-child(even) {
    background: #f7f7f7;
  }

  tbody tr:first-child {
    background: var(--legacy-row-red);
  }

  tbody tr.customer-row-active,
  tbody tr.customer-row-active:nth-child(odd),
  tbody tr.customer-row-active:nth-child(even),
  tbody tr.customer-row-active:first-child {
    background: var(--status-row-active);
  }

  tbody tr.customer-row-expiring,
  tbody tr.customer-row-expiring:nth-child(odd),
  tbody tr.customer-row-expiring:nth-child(even),
  tbody tr.customer-row-expiring:first-child {
    background: var(--status-row-expiring);
  }

  tbody tr.customer-row-expired,
  tbody tr.customer-row-expired:nth-child(odd),
  tbody tr.customer-row-expired:nth-child(even),
  tbody tr.customer-row-expired:first-child {
    background: var(--status-row-expired);
  }

  tbody tr.customer-row-hardware,
  tbody tr.customer-row-unknown,
  tbody tr.customer-row-hardware:nth-child(odd),
  tbody tr.customer-row-unknown:nth-child(odd),
  tbody tr.customer-row-hardware:nth-child(even),
  tbody tr.customer-row-unknown:nth-child(even),
  tbody tr.customer-row-hardware:first-child,
  tbody tr.customer-row-unknown:first-child {
    background: var(--status-row-hardware);
  }

  td strong {
    max-width: 240px;
  }

  .customer-id {
    min-height: 22px;
    border: 1px solid #b9b9b9;
    border-radius: 0;
    background: #f2f2f2;
    color: #222222;
    padding: 4px 7px;
  }

  .customer-phone {
    color: #555555;
    font-size: 12px;
  }

  .status-chip,
  .payment-chip {
    min-height: 24px;
    border-radius: 3px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .row-actions {
    gap: 5px;
  }

  .btn,
  .btn-icon {
    min-height: 30px;
    border-radius: 3px;
    padding: 6px 10px;
    font-size: 13px;
  }

  .btn-primary {
    border-color: var(--legacy-red-dark);
    background: linear-gradient(#d50000, #930000);
    color: #ffffff;
  }

  .btn-secondary,
  .btn-icon {
    border-color: #a7a7a7;
    background: linear-gradient(#ffffff, #dddddd);
    color: #222222;
  }

  .btn-danger {
    border-color: #7e0000;
    background: linear-gradient(#bd1c1c, #7d0808);
    color: #ffffff;
  }

  .btn-icon {
    width: 30px;
    height: 30px;
    justify-content: center;
    padding: 0;
  }

  .empty-state,
  .notice-box,
  .error-box {
    border-radius: 3px;
    background: #ffffff;
    box-shadow: none;
  }

  .modal-backdrop {
    align-items: flex-start;
    background: rgba(0, 0, 0, 0.58);
    padding: 24px 12px;
  }

  .modal-panel {
    position: relative;
    width: min(96vw, 1180px);
    max-height: none;
    border: 5px solid #050505;
    border-radius: 0;
    background: #ffffff;
    overflow: auto;
  }

  .modal-header {
    align-items: flex-start;
    border-bottom: 0;
    background: #ffffff;
    padding: 14px 24px 0;
  }

  .modal-title h2 {
    color: #222222;
    font-size: 20px;
  }

  .modal-title .subtle {
    display: none;
  }

  .modal-header .btn-icon {
    position: absolute;
    top: -16px;
    right: -16px;
    z-index: 2;
    width: 30px;
    height: 30px;
    border: 2px solid #111111;
    border-radius: 999px;
    background: #050505;
    color: #ffffff;
  }

  .modal-body {
    display: grid;
    grid-template-columns: 1.05fr 1fr 1fr;
    gap: 18px 34px;
    background: #ffffff;
    padding: 18px 28px 24px;
  }

  .modal-footer {
    align-items: center;
    border-top: 1px solid #bdbdbd;
    background: #ffffff;
    padding: 12px 22px;
  }

  .form-section {
    align-content: start;
    gap: 8px;
  }

  .form-section h3 {
    border-bottom: 1px solid #333333;
    color: #222222;
    padding-bottom: 4px;
    font-size: 17px;
    font-weight: 900;
  }

  .customer-source-section {
    grid-column: 1 / -1;
  }

  .customer-details-section,
  .address-details-section {
    grid-column: 1;
  }

  .iptv-details-section {
    grid-column: 2;
    grid-row: 2 / span 2;
  }

  .payment-details-section {
    grid-column: 3;
    grid-row: 2 / span 2;
  }

  .notes-details-section {
    grid-column: 1 / -1;
  }

  .modal-body .form-grid.two {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .history-modal {
    width: min(98vw, 1260px);
  }

  .history-modal-body {
    display: grid;
    min-width: 980px;
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .history-profile {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    border: 1px solid #bcbcbc;
    background: linear-gradient(#f8f8f8, #dddddd);
    padding: 10px;
  }

  .history-profile div {
    display: grid;
    gap: 3px;
    border-right: 1px solid #c2c2c2;
    padding-right: 10px;
  }

  .history-profile div:last-child {
    border-right: 0;
  }

  .history-profile span {
    color: #555555;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .history-profile strong {
    color: #111111;
    font-size: 18px;
  }

  .history-profile small {
    color: #555555;
    font-size: 12px;
  }

  .history-section {
    grid-column: 1 / -1;
  }

  .history-table-wrap table {
    min-width: 1040px;
  }

  .history-notes-list {
    max-height: 360px;
  }

  .chat-thread {
    background: #f6f1e7;
  }

  .chat-thread-head {
    border-radius: 0;
    background: #2f2f2f;
    color: #ffffff;
  }

  .chat-message {
    border-radius: 4px;
    background: #ffffff;
  }

  .chat-message.own {
    background: #d9f7bf;
  }

  .invoice-document {
    background: #ffffff;
  }
}

@media screen and (max-width: 0px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

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

  .history-modal-body {
    grid-template-columns: 1fr;
  }

  .customer-source-section,
  .notes-details-section {
    grid-column: 1 / -1;
  }

  .customer-details-section,
  .address-details-section,
  .iptv-details-section,
  .payment-details-section {
    grid-column: auto;
    grid-row: auto;
  }
}

@media screen and (max-width: 0px) {
  .sidebar {
    grid-template-columns: 1fr;
  }

  .side-top {
    min-height: 92px;
    padding: 12px 168px 12px 14px;
  }

  .side-top .brand-logo {
    width: 108px;
    height: 58px;
    flex-basis: 108px;
  }

  .side-title strong {
    font-size: 17px;
  }

  .side-footer {
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 160px;
    padding: 10px 10px 0 0;
  }

  .side-footer .btn {
    min-height: 26px;
    padding: 5px 7px;
    font-size: 11px;
  }

  .nav-list {
    grid-template-columns: none;
    padding: 0;
  }

  .nav-button {
    min-height: 44px;
    padding: 0 14px;
  }

  .nav-button span:last-child {
    display: inline;
  }

  .content {
    padding-bottom: 44px;
  }

  .content::after {
    height: 78px;
    margin-top: 44px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 16px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .metrics-grid,
  .dashboard-grid,
  .panel,
  .cards-grid,
  .support-grid,
  .chat-layout,
  .settings-grid {
    margin-right: 12px;
    margin-left: 12px;
  }

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

  .modal-panel {
    width: min(96vw, 860px);
  }

  .modal-body {
    min-width: 920px;
    grid-template-columns: 1.05fr 1fr 1fr;
    gap: 15px;
    padding: 16px;
  }

  .history-modal-body {
    min-width: 980px;
    grid-template-columns: 1fr;
  }

  .history-profile {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
  }

  .customer-source-section,
  .notes-details-section {
    grid-column: 1 / -1;
  }

  .customer-details-section,
  .address-details-section {
    grid-column: 1;
  }

  .iptv-details-section {
    grid-column: 2;
    grid-row: 2 / span 2;
  }

  .payment-details-section {
    grid-column: 3;
    grid-row: 2 / span 2;
  }
}

@media screen and (max-width: 0px) {
  .metrics-grid,
  .cards-grid,
  .support-grid,
  .chat-compose,
  .form-grid.two,
  .toolbar {
    grid-template-columns: 1fr;
  }

  .panel-header,
  .modal-header,
  .modal-footer {
    flex-direction: row;
    align-items: center;
  }

  .button-row,
  .row-actions {
    width: auto;
  }

  .btn {
    width: auto;
  }

  .topbar .button-row {
    width: auto;
  }
}

@media screen and (max-width: 0px) {
  :root {
    --ink: #202020;
    --muted: #5c5c5c;
    --line: #c9c9c9;
    --panel: #ffffff;
    --canvas: #f4f4f4;
    --soft: #fff7d7;
    --teal: #f2c400;
    --teal-dark: #b69300;
    --coral: #b60000;
    --amber: #b69300;
    --green: #276749;
    --blue: #315b9f;
    --red: #b60000;
    --status-row-active: #e7f6cb;
    --status-row-expiring: #fff1cf;
    --status-row-expired: #f6d6da;
    --status-row-hardware: #eef2f6;
    --field-bg: rgba(255, 253, 247, 0.96);
    --chat-wallpaper:
      radial-gradient(circle at 12px 18px, rgba(5, 5, 5, 0.05) 0 1.5px, transparent 1.7px),
      radial-gradient(circle at 42px 36px, rgba(242, 196, 0, 0.09) 0 1.4px, transparent 1.6px),
      linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(242, 196, 0, 0.08)),
      #f7f4ea;
  }

  body,
  .login-layout,
  .workspace {
    background:
      linear-gradient(135deg, rgba(245, 245, 245, 0.98), rgba(255, 250, 230, 0.96)),
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='620' viewBox='0 0 900 620'%3E%3Crect width='900' height='620' fill='%23f4f4f4'/%3E%3Cg fill='none' stroke='%23050505' stroke-opacity='.15' stroke-width='2'%3E%3Cpath d='M70 140h270v150H70zM118 186h174M118 228h118M420 100h340v210H420zM470 158h230M470 204h140M470 250h198M170 380h560v120H170zM220 430h130M390 430h110M540 430h140'/%3E%3C/g%3E%3Cg fill='%23f2c400' fill-opacity='.2'%3E%3Crect x='92' y='164' width='54' height='20' rx='4'/%3E%3Crect x='446' y='128' width='74' height='24' rx='4'/%3E%3Crect x='202' y='406' width='90' height='22' rx='4'/%3E%3C/g%3E%3Cg fill='%23b60000' fill-opacity='.2'%3E%3Crect x='600' y='128' width='92' height='24' rx='4'/%3E%3Crect x='398' y='406' width='64' height='22' rx='4'/%3E%3C/g%3E%3C/svg%3E");
    background-attachment: fixed;
    background-size: cover;
  }

  .login-copy,
  .sidebar {
    background:
      linear-gradient(160deg, rgba(5, 5, 5, 0.98), rgba(63, 63, 63, 0.96)),
      #050505;
  }

  .brand-logo,
  .side-top .brand-mark,
  .side-top .brand-logo {
    border-color: rgba(242, 196, 0, 0.7);
    background: #ffffff;
    color: var(--teal-dark);
  }

  .nav-button {
    background: rgba(255, 255, 255, 0.07);
    color: rgba(255, 255, 255, 0.9);
  }

  .nav-button.active,
  .nav-button:hover {
    border-color: rgba(242, 196, 0, 0.72);
    background: rgba(242, 196, 0, 0.16);
    color: #ffe36e;
  }

  .side-title span {
    color: rgba(255, 255, 255, 0.84);
  }

  .topbar h1 {
    color: #202020;
    text-shadow: none;
  }

  .topbar p {
    color: #5c5c5c;
  }

  .side-footer .btn,
  .btn-secondary,
  .btn-icon {
    border-color: #d4c38a;
    background: linear-gradient(#ffffff, #f3ead1);
    color: #202020;
  }

  .btn-primary {
    border-color: #9f7d00;
    background: linear-gradient(135deg, #f7d51c, #b69300);
    color: #202020;
  }

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

  .btn-soft {
    border-color: #e1c862;
    background: #fff7d7;
    color: #6f5100;
  }

  .metric-card {
    border-top-color: rgba(242, 196, 0, 0.92);
  }

  .metric-corner,
  .zelle-email {
    color: #6f5100 !important;
  }

  .panel-header,
  .chat-thread-head {
    background: linear-gradient(135deg, rgba(63, 63, 63, 0.95), rgba(5, 5, 5, 0.95));
  }

  .panel-header h2,
  .chat-thread-head h3 {
    color: #ffffff;
  }

  .panel-header .subtle,
  .chat-thread-head small {
    color: rgba(255, 255, 255, 0.78);
  }

  th {
    background: linear-gradient(135deg, #f7f7f7, #d9d9d9);
    color: #202020;
  }

  .field input:focus,
  .field select:focus,
  .field textarea:focus,
  .search-input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(242, 196, 0, 0.22);
  }

  .invoice-note {
    border-left-color: var(--teal);
    background: #fff7d7;
  }
}
