* { box-sizing: border-box; }

:root {
  --sidebar: #6b2395;
  --sidebar-dark: #561a79;
  --sidebar-soft: rgba(255, 255, 255, .16);
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dce3ef;
  --soft: #eef2f8;
  --primary: #6b2395;
  --primary-dark: #531873;
  --danger: #c51f1a;
  --success: #12803b;
  --warning: #d97706;
}

html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 236px;
  padding: 26px 14px;
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar-dark));
  color: #fff;
}

.brand {
  padding: 0 5px 24px;
  font-size: 25px;
  font-weight: 800;
  line-height: 1.1;
}

.account-summary {
  padding: 0 14px 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .18);
}

.account-summary strong,
.account-summary small {
  display: block;
  color: #fff;
}

.account-summary strong {
  margin-bottom: 4px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.account-summary small {
  color: rgba(255, 255, 255, .72);
}

.sidebar a {
  display: block;
  padding: 13px 14px;
  margin: 4px 0;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
}

.sidebar a:hover,
.sidebar a.active {
  background: var(--sidebar-soft);
}

.main {
  min-height: 100vh;
  margin-left: 236px;
  padding: 28px 26px 48px;
}

.impersonation-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 14px;
  margin: -8px 0 20px;
  border: 1px solid #f5d08a;
  border-radius: 8px;
  background: #fff7df;
}

.impersonation-bar form {
  margin: 0;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

h1, h2 {
  margin: 0;
  color: var(--text);
  line-height: 1.2;
}

h1 { font-size: 28px; }
h2 { margin-bottom: 22px; font-size: 24px; }

.domain {
  color: #475569;
  font-size: 15px;
  white-space: nowrap;
}

.notice {
  padding: 13px 16px;
  margin-bottom: 18px;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #e0f2fe;
  color: #0f172a;
}

.notice.error {
  border-color: #fecaca;
  background: #fee2e2;
}

.license-created {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.license-created span {
  width: 100%;
}

.license-created strong {
  padding: 5px 8px;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-family: Consolas, Monaco, monospace;
}

.license-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.license-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.license-summary small {
  display: block;
  margin-bottom: 5px;
}

.license-summary strong {
  display: block;
  overflow-wrap: anywhere;
}

.public-separator {
  height: 1px;
  margin: 24px 0;
  border: 0;
  background: var(--line);
}

.public-help {
  margin-top: -10px;
  color: var(--muted);
  line-height: 1.45;
}

.renewal-page {
  max-width: 760px;
}

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

.renewal-summary div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.renewal-summary small,
.renewal-summary strong {
  display: block;
}

.renewal-summary strong {
  margin-top: 5px;
  font-size: 17px;
}

.pix-area {
  margin: 18px 0;
  text-align: center;
}

.pix-area img {
  display: block;
  width: min(280px, 100%);
  margin: 0 auto 16px;
}

.pix-area label,
.pix-area textarea {
  text-align: left;
}

.pix-area textarea {
  min-height: 100px;
  font-family: Consolas, Monaco, monospace;
}

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

.reseller-metrics {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.money-metric {
  font-size: 22px !important;
}

.date-metric {
  font-size: 17px !important;
  line-height: 1.25 !important;
}

.metric-card,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  box-shadow: 0 12px 34px rgba(15, 23, 42, .04);
}

.metric-card {
  min-height: 98px;
  padding: 19px 20px;
}

.metric-card span {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  font-size: 30px;
  line-height: 1;
}

.card {
  padding: 22px;
  margin-bottom: 18px;
}

.split {
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(520px, 1.1fr);
  gap: 18px;
}

.access-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 1px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
  overflow: hidden;
}

.access-strip div {
  padding: 16px 18px;
  background: #fff;
}

.access-strip small,
.access-strip strong {
  display: block;
}

.access-strip strong {
  margin-top: 5px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr));
  gap: 12px;
}

.summary-grid div {
  min-height: 74px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.summary-grid small,
.summary-grid strong {
  display: block;
}

.summary-grid small {
  margin-bottom: 6px;
  color: var(--muted);
}

.report-filters {
  flex-wrap: wrap;
}

.report-filters input,
.report-filters select {
  max-width: 220px;
}

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

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.toolbar input {
  max-width: 440px;
  margin: 0;
}

.toolbar button,
.toolbar .button {
  flex: 0 0 auto;
}

.wide { grid-column: 1 / -1; }

label {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  margin-top: 7px;
  padding: 10px 12px;
  border: 1px solid #c7d2e4;
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  outline: none;
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.field-hint {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
}

.integration-copy {
  margin-bottom: 18px;
}

.integration-form .message-template {
  min-height: 240px;
  font-family: Consolas, Monaco, monospace;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 35, 149, .12);
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0;
}

.check input {
  width: auto;
  min-height: 0;
  margin: 0;
}

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 10px 14px;
  border: 0;
  border-radius: 7px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

button:hover,
.button:hover { background: var(--primary-dark); }

.button.secondary,
button.secondary {
  background: #e9edf5;
  color: var(--text);
}

.button.secondary:hover,
button.secondary:hover { background: #dce3ef; }

.button.ghost,
button.ghost {
  border: 1px solid #c7d2e4;
  background: #fff;
  color: var(--text);
}

.button.ghost:hover,
button.ghost:hover { background: #f8fafc; }

.button.tiny,
button.tiny {
  min-height: 30px;
  padding: 7px 10px;
  font-size: 12px;
}

button.danger,
.button.danger { background: var(--danger); }

button.danger:hover,
.button.danger:hover { background: #9f1713; }

button.ok,
.button.ok { background: var(--success); }

button.ok:hover,
.button.ok:hover { background: #0f6931; }

button.warning,
.button.warning { background: var(--warning); }

button.warning:hover,
.button.warning:hover { background: #b45309; }

.copy-line {
  display: grid;
  grid-template-columns: 180px minmax(260px, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.copy-line:last-child { border-bottom: 0; }

.copy-line span { font-weight: 800; }

.setting-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.setting-line strong,
.setting-line small {
  display: block;
}

.setting-line small {
  margin-top: 4px;
}

code {
  display: inline-block;
  max-width: 100%;
  padding: 4px 7px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #0f172a;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  overflow-wrap: anywhere;
}

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

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

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

th {
  background: #f0f3f9;
  color: #0f172a;
  font-size: 13px;
}

td { font-size: 14px; }

small {
  color: var(--muted);
  font-size: 12px;
}

.license-code {
  margin-bottom: 8px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

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

.actions form {
  display: inline;
  margin: 0;
}

.pill {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.pill.active,
.pill.approved {
  background: #dcfce7;
  color: #08752f;
}

.pill.blocked,
.pill.blocked_by_admin,
.pill.blocked_by_reseller,
.pill.blocked_parent,
.pill.expired,
.pill.suspended,
.pill.canceled,
.pill.rejected {
  background: #fee2e2;
  color: #b91c1c;
}

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

.report-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.report-head h2 {
  margin: 4px 0 6px;
}

.report-head p {
  margin: 0;
  color: var(--muted);
}

.resellers-table {
  min-width: 1680px;
}

.pill.pending {
  background: #fef3c7;
  color: #92400e;
}

.bars {
  display: flex;
  align-items: end;
  gap: 12px;
  min-height: 220px;
  padding: 18px 8px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(#fff 0 24%, #f8fafc 24% 25%, #fff 25% 49%, #f8fafc 49% 50%, #fff 50% 74%, #f8fafc 74% 75%, #fff 75%);
}

.bar-item {
  display: flex;
  flex: 1;
  min-width: 42px;
  height: 180px;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.bar-track {
  display: flex;
  width: 100%;
  height: 130px;
  align-items: end;
  border-radius: 7px;
  background: #edf2f7;
  overflow: hidden;
}

.bar-track span {
  display: block;
  width: 100%;
  border-radius: 7px 7px 0 0;
  background: var(--primary);
}

.bar-item b {
  font-size: 12px;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--sidebar), #24122f);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, .28);
}

.login-card h1 {
  margin-bottom: 6px;
}

.login-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.public {
  max-width: 720px;
  margin: 36px auto;
  padding: 0 18px;
}

@media (max-width: 1000px) {
  .sidebar {
    position: static;
    width: auto;
    min-height: 0;
    padding: 18px;
  }

  .brand { padding-bottom: 12px; }

  .sidebar a {
    display: inline-block;
    margin-right: 5px;
  }

  .main {
    margin-left: 0;
    padding: 22px 16px 38px;
  }

  .metrics,
  .reseller-metrics,
  .split,
  .form-grid,
  .summary-grid,
  .access-strip {
    grid-template-columns: 1fr;
  }

  .copy-line {
    grid-template-columns: 1fr;
  }

  .setting-line {
    display: block;
  }

  .setting-line form {
    margin-top: 12px;
  }

  .license-summary {
    grid-template-columns: 1fr;
  }

  .renewal-summary {
    grid-template-columns: 1fr;
  }

  .page-head {
    display: block;
  }

  .toolbar,
  .impersonation-bar,
  .report-head {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar input {
    max-width: none;
  }

  .domain {
    margin-top: 8px;
    white-space: normal;
  }
}
