@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;700;800&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg-main: #f3f6f4;
  --bg-card: #ffffff;
  --bg-accent: #e8f3ee;
  --text-main: #1b1f24;
  --text-muted: #66707a;
  --line: rgba(17, 24, 39, 0.12);
  --green: #008f5a;
  --green-soft: #dcf8eb;
  --amber: #cc7a00;
  --amber-soft: #fff3dd;
  --red: #c32631;
  --red-soft: #ffe8ea;
  --shadow: 0 24px 60px rgba(16, 24, 40, 0.08);
  --radius-xl: 22px;
  --radius-lg: 16px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  background: radial-gradient(circle at 15% 20%, #d7f2e5 0, transparent 40%),
    radial-gradient(circle at 90% 0%, #dbefff 0, transparent 35%), var(--bg-main);
  color: var(--text-main);
}

body.app-modal-open {
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  padding: 24px 18px;
  overflow-y: auto;
}

.brand {
  font-family: "Space Grotesk", sans-serif;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
}

.brand span {
  color: var(--green);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-decoration: none;
  color: #25303b;
  font-weight: 600;
  border-radius: 11px;
  padding: 11px 12px;
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

.nav-link:hover {
  background: #eef4f1;
  transform: translateX(2px);
}

.nav-link.active {
  background: #dff4e9;
  color: #035c3e;
}

.nav-group {
  margin: 6px 0 10px;
}

.nav-group-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px 6px;
}

.nav-group-summary::-webkit-details-marker {
  display: none;
}

.nav-group-summary::after {
  content: "▾";
  font-size: 12px;
  color: #7b8794;
  transition: transform 0.2s ease;
}

.nav-group:not([open]) .nav-group-summary::after {
  transform: rotate(-90deg);
}

.nav-group.active .nav-group-summary {
  color: #035c3e;
}

.nav-group-links {
  display: grid;
  gap: 6px;
}

.nav-link-sub {
  margin-bottom: 0;
  margin-left: 8px;
  width: calc(100% - 8px);
  padding-left: 16px;
  font-size: 14px;
  background: rgba(244, 248, 246, 0.72);
}

.nav-link-sub:hover {
  background: #e8f1ed;
}

.main {
  padding: 26px;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 14px;
  animation: fade-up 0.35s ease;
}

.page-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
  font-size: 30px;
}

.page-subtitle {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 13px;
  background: #fff;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  animation: fade-up 0.45s ease;
}

.card h3 {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
}

.metric {
  margin-top: 10px;
  font-size: 29px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
  animation: fade-up 0.5s ease;
}

.panel h2 {
  margin-top: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.01em;
}

.panel-note {
  margin-top: -4px;
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

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

.promo-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

.promo-filter-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.promo-filter-form input[type="text"],
.promo-filter-form input:not([type]) {
  flex: 1 1 320px;
  min-width: 220px;
}

.analytics-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 14px;
  align-items: end;
}

.analytics-range-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.analytics-range-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  background: #fff;
  color: #22313d;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease,
    background 0.2s ease,
    color 0.2s ease;
}

.analytics-range-button:hover {
  border-color: rgba(4, 145, 91, 0.24);
  box-shadow: 0 10px 28px rgba(18, 47, 36, 0.08);
  transform: translateY(-1px);
}

.analytics-range-button.active {
  border-color: transparent;
  background: linear-gradient(105deg, #04915b, #12a565);
  box-shadow: 0 12px 30px rgba(4, 145, 91, 0.18);
  color: #fff;
}

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

.analytics-chart-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.analytics-chart-toolbar > div {
  min-width: 220px;
}

.analytics-period-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.analytics-period-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #22313d;
  font-size: 13px;
  font-weight: 600;
}

.analytics-card-subtitle {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.analytics-footnote {
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.analytics-chart-surface {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 18px;
  background:
    radial-gradient(circle at top left, rgba(4, 145, 91, 0.08), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 246, 0.92));
  overflow-x: auto;
}

.analytics-chart-svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.analytics-chart-grid {
  stroke: rgba(17, 24, 39, 0.08);
  stroke-dasharray: 4 6;
}

.analytics-chart-guide,
.analytics-chart-label {
  fill: #6a7782;
  font-size: 12px;
  font-weight: 600;
}

.analytics-chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
  color: #22313d;
  font-size: 14px;
  font-weight: 600;
}

.checkbox-inline input {
  width: auto;
}

.subscription-block {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  padding: 16px;
  margin-bottom: 14px;
}

.subscription-block-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.subscription-block h3,
.subscription-price-card h4 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.01em;
}

.subscription-currency {
  min-width: 120px;
}

.subscription-price-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.subscription-price-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(244, 248, 246, 0.95);
  padding: 14px;
}

.subscription-price-card h4 {
  margin-bottom: 12px;
}

.subscription-price-toggle {
  margin-top: 10px;
}

.subscription-period-list {
  display: grid;
  gap: 14px;
}

.subscription-period-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(244, 248, 246, 0.95);
  padding: 16px;
}

.subscription-period-head,
.subscription-period-trial-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.subscription-period-head h4,
.subscription-period-trial-head h5 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.subscription-period-trial {
  border-top: 1px solid var(--line);
  margin-top: 12px;
  padding-top: 12px;
}

.subscription-period-prices {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
}

.subscription-period-prices-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.subscription-period-prices-head h5 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.period-prices-list {
  display: grid;
  gap: 10px;
}

.subscription-period-price-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(232, 243, 238, 0.72), rgba(255, 255, 255, 0.96));
}

.token-pack-price-row {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) auto;
}

.subscription-period-price-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.subscription-period-price-actions .icon-button {
  flex-shrink: 0;
}

.subscription-feature-list {
  display: grid;
  gap: 12px;
}

.subscription-feature-item {
  display: grid;
  gap: 10px;
  max-width: 560px;
  padding: 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.subscription-feature-item > label {
  margin-bottom: 0;
  color: #22313d;
  font-size: 14px;
  font-weight: 700;
}

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

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #1f2a35;
  cursor: pointer;
  font-size: 16px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.icon-button:hover {
  background: #f4f8f6;
  border-color: rgba(4, 145, 91, 0.24);
}

.icon-button-danger {
  background: #fff4f5;
  color: #9a1824;
}

.icon-button-danger:hover {
  background: #ffecee;
  border-color: rgba(154, 24, 36, 0.24);
}

.plan-edit-button {
  transform: rotate(-45deg);
}

.token-pack-edit-button {
  transform: rotate(-45deg);
}

.toggle-switch {
  position: relative;
  display: inline-flex;
  width: 50px;
  height: 30px;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.toggle-switch span {
  width: 100%;
  height: 100%;
  border-radius: 999px;
  background: #d7dee4;
  transition: background 0.2s ease;
}

.toggle-switch span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(20, 32, 28, 0.14);
  transition: transform 0.2s ease;
}

.toggle-switch input:checked + span {
  background: linear-gradient(105deg, #04915b, #12a565);
}

.toggle-switch input:checked + span::after {
  transform: translateX(20px);
}

.page-back-link {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.page-back-link:hover {
  color: var(--text);
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(105deg, #04915b, #12a565);
  color: #fff;
}

.btn-secondary {
  background: #eef2f4;
  color: #1f2a35;
}

.btn-danger {
  background: #fae4e6;
  color: #9a1824;
}

.btn-compact {
  padding: 8px 10px;
  font-size: 12px;
}

.toggle-switch-field {
  display: grid;
  gap: 8px;
}

.toggle-switch-row,
.period-activity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  background: rgba(244, 248, 246, 0.95);
  padding: 10px 12px;
}

.toggle-switch-row span,
.period-activity-row span {
  color: #22313d;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.toggle-switch-inline {
  margin-bottom: 0;
}

.subscription-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.subscription-form-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.input-help {
  margin: -2px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.placement-switch-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 14px;
  background: rgba(244, 248, 246, 0.95);
  cursor: pointer;
  margin-bottom: 0;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.placement-switch-card:hover {
  border-color: rgba(4, 145, 91, 0.24);
  box-shadow: 0 10px 28px rgba(18, 47, 36, 0.08);
  transform: translateY(-1px);
}

.placement-switch-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.placement-switch-title {
  font-size: 14px;
  font-weight: 700;
  color: #22313d;
  line-height: 1.35;
}

.placement-switch-description {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted);
}

.placement-switch-card .toggle-switch {
  flex: 0 0 auto;
  margin-bottom: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 10px 11px;
  font-family: inherit;
  font-size: 14px;
}

input:disabled,
select:disabled,
textarea:disabled {
  background: #f1f5f4;
  color: #7b8794;
  cursor: not-allowed;
}

label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 10px;
}

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

.promo-code-field,
.promo-status-field,
.promo-description-field {
  min-width: 0;
}

.promo-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.promo-status-field {
  padding: 12px 14px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 14px;
  background: rgba(244, 248, 246, 0.9);
}

.promo-form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.promo-detail-block {
  margin-top: 18px;
}

.promo-link-card {
  grid-column: span 2;
}

.promo-link-anchor {
  display: block;
  color: #035c3e;
  font-weight: 700;
  line-height: 1.5;
  word-break: break-all;
  text-decoration: none;
}

.promo-link-anchor:hover {
  text-decoration: underline;
}

.promo-link-anchor-inline {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

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

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

thead th {
  text-align: left;
  border-bottom: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 12px;
  padding: 10px;
  white-space: nowrap;
}

tbody td {
  border-bottom: 1px solid #ecf0f2;
  padding: 10px;
  font-size: 13px;
}

tbody tr:hover {
  background: #f6faf8;
}

.table-row-selected {
  background: #ecf8f1;
}

.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
}

.tag-green {
  color: var(--green);
  background: var(--green-soft);
}

.tag-red {
  color: var(--red);
  background: var(--red-soft);
}

.tag-amber {
  color: var(--amber);
  background: var(--amber-soft);
}

.tag-slate {
  color: #5f6b76;
  background: #eef2f4;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

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

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

.detail-card,
.detail-action-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.detail-action-card h4 {
  margin-top: 0;
  margin-bottom: 12px;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.01em;
}

.detail-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.detail-action-head h4 {
  margin: 0;
}

.detail-label {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.detail-value {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  letter-spacing: -0.02em;
}

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

.table-info-cell {
  display: grid;
  gap: 4px;
  min-width: 170px;
}

.table-info-cell strong {
  line-height: 1.45;
}

.payment-status-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.payment-status-positive {
  color: #046b44;
  background: rgba(220, 248, 235, 0.72);
  border-color: rgba(4, 107, 68, 0.24);
}

.payment-status-waiting {
  color: #8a5b00;
  background: rgba(255, 243, 221, 0.9);
  border-color: rgba(138, 91, 0, 0.22);
}

.payment-status-danger {
  color: #a11f2a;
  background: rgba(255, 232, 234, 0.94);
  border-color: rgba(161, 31, 42, 0.2);
}

.ledger-amount {
  display: inline-flex;
  align-items: center;
  font-weight: 800;
  white-space: nowrap;
}

.ledger-amount-positive {
  color: var(--green);
}

.ledger-amount-negative {
  color: var(--red);
}

.history-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 24px;
}

.history-modal[hidden] {
  display: none;
}

.history-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 18, 24, 0.44);
  backdrop-filter: blur(5px);
}

.history-modal-dialog {
  position: relative;
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 32px 90px rgba(15, 23, 42, 0.28);
  padding: 18px;
}

.history-modal-head {
  margin-bottom: 12px;
}

.history-table-wrap {
  max-height: calc(100vh - 220px);
  overflow: auto;
}

.history-modal-empty {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  background: #182028;
  color: #fff;
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 430px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: fade-up 0.5s ease;
}

.login-title {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 31px;
}

.login-sub {
  margin: 8px 0 18px;
  color: var(--text-muted);
}

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

.panel-spotlight {
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 143, 90, 0.14), transparent 42%),
    radial-gradient(circle at 100% 100%, rgba(28, 106, 216, 0.12), transparent 38%),
    var(--bg-card);
}

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

.feature-item {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.feature-item strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 17px;
}

.feature-item span {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.provider-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 286px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: fade-up 0.45s ease;
  overflow: hidden;
}

.provider-card-link {
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.provider-card-link:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 143, 90, 0.24);
  box-shadow: 0 28px 68px rgba(16, 24, 40, 0.13);
}

.provider-card-link:focus-visible {
  outline: 3px solid rgba(0, 143, 90, 0.25);
  outline-offset: 2px;
}

.provider-card-apiboost {
  background:
    radial-gradient(circle at 0% 0%, rgba(0, 143, 90, 0.16), transparent 40%),
    rgba(255, 255, 255, 0.95);
}

.provider-card-kling {
  background:
    radial-gradient(circle at 100% 0%, rgba(204, 122, 0, 0.13), transparent 42%),
    rgba(255, 255, 255, 0.95);
}

.provider-card-openai {
  background:
    radial-gradient(circle at 100% 100%, rgba(28, 106, 216, 0.12), transparent 40%),
    rgba(255, 255, 255, 0.95);
}

.provider-card-main {
  display: grid;
  gap: 16px;
  height: 100%;
}

.provider-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

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

.provider-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  overflow: hidden;
  flex: 0 0 auto;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.provider-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.provider-avatar-fallback {
  display: grid;
  place-items: center;
  color: #103a2f;
  background: linear-gradient(145deg, #e4f6ee, #f6fbf8);
}

.provider-avatar-fallback span {
  font-family: "Space Grotesk", sans-serif;
  font-size: 24px;
  font-weight: 700;
}

.provider-card-eyebrow {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.provider-card-title {
  margin: 6px 0 0;
  font-family: "Space Grotesk", sans-serif;
  font-size: 30px;
  line-height: 1.02;
}

.provider-connection {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
}

.provider-connection svg {
  width: 20px;
  height: 20px;
}

.provider-connection-ready {
  color: var(--green);
  background: var(--green-soft);
}

.provider-connection-pending {
  color: #7c8793;
  background: #eef2f4;
  border-color: rgba(17, 24, 39, 0.08);
}

.provider-connection-failed {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(195, 38, 49, 0.18);
}

.provider-card-description {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
  min-height: 0;
  margin: 0;
}

.provider-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.provider-meta div {
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 14px;
  padding: 12px;
  background: rgba(244, 248, 246, 0.95);
}

.provider-meta span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.provider-meta strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.provider-pricing-root {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.provider-pricing-controls {
  display: grid;
  gap: 16px;
}

.provider-pricing-controls-head,
.provider-pricing-controls-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
}

.provider-pricing-search-field,
.provider-pricing-modality-field {
  display: grid;
  gap: 8px;
}

.provider-pricing-search-field {
  flex: 1;
  min-width: 280px;
}

.provider-pricing-modality-field {
  min-width: 220px;
  width: min(260px, 100%);
}

.provider-pricing-filter-actions {
  display: grid;
  gap: 8px;
  min-width: 220px;
  justify-items: end;
}

.provider-pricing-filter-summary {
  font-size: 12px;
  text-align: right;
}

.provider-pricing-panel {
  padding: 18px;
  min-width: 0;
  max-width: 100%;
}

.provider-pricing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

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

.provider-pricing-brand h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: -0.02em;
}

.provider-pricing-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.provider-pricing-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  min-width: 0;
}

.provider-pricing-catalog {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.provider-pricing-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 246, 0.94));
}

.provider-pricing-table {
  min-width: 1220px;
}

.provider-pricing-table tbody td {
  vertical-align: top;
}

.provider-pricing-toggle-cell {
  width: 88px;
}

.provider-pricing-actions-cell {
  width: 132px;
}

.provider-pricing-model-row-unavailable {
  background: rgba(255, 247, 236, 0.74);
}

.provider-model-name {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.provider-model-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.provider-mini-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  color: #41505e;
  background: #eef2f4;
}

.provider-inline-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.compact-select,
.compact-input {
  min-width: 0;
  padding: 8px 9px;
  font-size: 13px;
}

.compact-label {
  margin-bottom: 0;
  font-size: 11px;
  font-weight: 700;
  color: #5d6771;
}

.cell-stack {
  display: grid;
  gap: 8px;
  min-width: 220px;
}

.provider-row-status-text {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.provider-pricing-collapsed-note {
  padding: 14px 16px;
  border: 1px dashed rgba(17, 24, 39, 0.12);
  border-radius: 14px;
  background: rgba(244, 248, 246, 0.72);
}

.pricing-filters-dialog {
  width: min(440px, calc(100vw - 24px));
  border: 0;
  border-radius: 24px;
  padding: 0;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 90px rgba(17, 24, 39, 0.2);
}

.pricing-filters-dialog::backdrop {
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(3px);
}

.pricing-filters-form {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.pricing-filters-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.pricing-filters-head h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

.pricing-filters-list {
  display: grid;
  gap: 12px;
}

.pricing-filter-option {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 14px;
  background: rgba(244, 248, 246, 0.92);
  color: #22313d;
  font-size: 14px;
  font-weight: 600;
}

.pricing-filter-option input {
  width: auto;
  margin: 0;
}

.pricing-filters-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.provider-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.provider-card-status-copy {
  display: inline-flex;
}

.provider-card-open {
  color: #0d6e49;
  font-size: 13px;
  font-weight: 700;
}

.provider-hero-main {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.provider-avatar-large {
  width: 72px;
  height: 72px;
  border-radius: 22px;
}

.provider-avatar-large span {
  font-size: 28px;
}

.provider-hero-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.provider-hero-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  background: rgba(255, 255, 255, 0.86);
}

.provider-hero-status-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.provider-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.mini-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.mini-card span {
  color: var(--text-muted);
  font-size: 12px;
}

.mini-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  line-height: 1.1;
  word-break: break-word;
}

.provider-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.provider-lead {
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.provider-hero-title {
  margin: 8px 0 10px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 40px;
  line-height: 1;
}

.provider-hero-text {
  margin: 0;
  max-width: 760px;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
}

.provider-secret-stack {
  display: grid;
  gap: 12px;
}

.provider-secret-form {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.8);
  padding: 16px;
}

.provider-secret-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.provider-secret-head h3 {
  margin: 0 0 6px;
  font-family: "Space Grotesk", sans-serif;
}

.provider-secret-status {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.provider-secret-input {
  flex: 1;
  min-width: 240px;
}

.provider-result {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(244, 248, 246, 0.95);
  padding: 14px;
  line-height: 1.55;
}

.provider-result-success {
  border-color: rgba(0, 143, 90, 0.16);
  background: rgba(233, 247, 239, 0.96);
}

.provider-result-pending {
  border-color: rgba(17, 24, 39, 0.08);
  background: rgba(244, 248, 246, 0.95);
}

.provider-result-error {
  border-color: rgba(195, 38, 49, 0.2);
  background: var(--red-soft);
  color: var(--red);
}

.provider-result-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 8px;
}

.provider-info-sections {
  display: grid;
  gap: 12px;
}

.provider-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  padding: 16px;
}

.provider-section h3 {
  margin-top: 0;
  margin-bottom: 10px;
  font-family: "Space Grotesk", sans-serif;
}

.provider-json {
  margin: 0;
  padding: 14px;
  background: #182028;
  color: #f4f7fa;
  border-radius: 14px;
  overflow: auto;
  font-size: 12px;
  line-height: 1.5;
}

.provider-bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-main);
}

.provider-bullet-list li + li {
  margin-top: 6px;
}

.input-help {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

.checkbox-cell {
  display: flex;
  align-items: flex-end;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 0;
}

.checkbox-inline input {
  width: auto;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1140px) {
  .card-grid,
  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subscription-price-grid,
  .feature-list,
  .provider-grid,
  .provider-summary-grid,
  .provider-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .promo-toolbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .analytics-chart-toolbar {
    width: 100%;
  }

  .analytics-chart-toolbar > div {
    width: 100%;
  }

  .subscription-period-price-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .token-pack-price-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .subscription-period-price-actions {
    grid-column: 1 / -1;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .main {
    padding: 14px;
  }

  .provider-hero,
  .provider-secret-head,
  .provider-pricing-controls-head,
  .provider-pricing-controls-bar,
  .provider-pricing-head,
  .provider-pricing-toolbar {
    flex-direction: column;
  }

  .promo-code-row {
    grid-template-columns: 1fr;
  }

  .provider-pricing-stats {
    justify-content: flex-start;
  }

  .provider-pricing-filter-actions {
    width: 100%;
    justify-items: stretch;
  }

  .provider-pricing-filter-summary {
    text-align: left;
  }

  .subscription-period-prices-head {
    flex-direction: column;
  }

  .analytics-period-summary {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .card-grid,
  .kpi-row,
  .subscription-price-grid,
  .feature-list,
  .provider-grid,
  .provider-summary-grid,
  .provider-meta,
  .placement-checkbox-grid,
  .detail-grid,
  .form-grid,
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }

  .subscription-period-price-row {
    grid-template-columns: 1fr;
  }

  .subscription-period-price-actions {
    justify-content: flex-start;
  }

  .page-title {
    font-size: 24px;
  }

  .login-card {
    padding: 20px;
  }

  .provider-hero-title {
    font-size: 30px;
  }

  .promo-link-card {
    grid-column: auto;
  }

  .analytics-range-button {
    flex: 1 1 calc(50% - 10px);
  }

  .analytics-period-summary {
    flex-direction: column;
    align-items: stretch;
  }
}
