:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687386;
  --line: #e4e9f0;
  --canvas: #f4f6f8;
  --surface: #ffffff;
  --nav: #101828;
  --nav-muted: #98a2b3;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --green: #15803d;
  --amber: #b45309;
  --red: #c24141;
  --violet: #7c3aed;
  --cyan: #0e7490;
  --slate: #475467;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  letter-spacing: -0.035em;
}

h2 {
  font-size: 23px;
  letter-spacing: -0.025em;
}

h3 {
  font-size: 16px;
}

.hidden {
  display: none !important;
}

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

.eyebrow {
  margin-bottom: 5px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: linear-gradient(145deg, #2563eb, #153fa5);
  font-size: 24px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
}

.brand-mark.small {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  font-size: 18px;
  box-shadow: none;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: #eef2f7;
}

.login-card {
  width: min(430px, 100%);
  padding: 38px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.12);
}

.login-card .brand-mark {
  margin-bottom: 24px;
}

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

.login-copy {
  margin: 10px 0 26px;
  font-size: 14px;
  line-height: 1.6;
}

.api-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #f59e0b;
}

.status-dot.ok {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.1);
}

.status-dot.error {
  background: #ef4444;
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  color: white;
  background: var(--nav);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 6px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand strong {
  display: block;
  font-size: 15px;
}

.sidebar-brand .eyebrow {
  color: #7da7ff;
}

.nav-list {
  display: grid;
  gap: 5px;
  margin-top: 22px;
}

.nav-item {
  width: 100%;
  height: 45px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #c5cedb;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.nav-item span {
  color: #637086;
  font-size: 10px;
  font-weight: 900;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.055);
}

.nav-item.active {
  color: white;
  background: #1d4ed8;
  box-shadow: 0 8px 22px rgba(29, 78, 216, 0.3);
}

.nav-item.active span {
  color: #bfdbfe;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 14px;
  padding: 16px 4px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-identity > div:last-child {
  min-width: 0;
}

.admin-identity strong,
.admin-identity span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-identity strong {
  font-size: 12px;
}

.admin-identity span {
  margin-top: 2px;
  color: var(--nav-muted);
  font-size: 11px;
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 13px;
  font-weight: 900;
}

.workspace {
  min-width: 0;
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-card {
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

.status-card strong,
.status-card span {
  display: block;
}

.status-card strong {
  font-size: 11px;
}

.status-card span:last-child {
  max-width: 210px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.view {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.section-heading p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.period-control {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  background: #fff;
}

.period-option {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  padding: 0 10px;
  color: #475467;
  background: transparent;
  font-size: 11px;
  font-weight: 850;
}

.period-option:hover {
  background: #f2f4f7;
}

.period-option.active {
  color: #fff;
  background: var(--primary);
}

.dashboard-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  background: #fff;
}

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

.dashboard-summary span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.dashboard-summary strong {
  margin-top: 4px;
  font-size: 16px;
}

.dashboard-summary small {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.metric-card {
  position: relative;
  overflow: hidden;
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.035);
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
}

.metric-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-card strong {
  margin-top: 15px;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.metric-card small {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.metric-card.accent-green::before {
  background: var(--green);
}

.metric-card.accent-amber::before {
  background: var(--amber);
}

.metric-card.accent-violet::before {
  background: var(--violet);
}

.metric-card.accent-red::before {
  background: var(--red);
}

.metric-card.accent-cyan::before {
  background: var(--cyan);
}

.metric-card.accent-slate::before {
  background: var(--slate);
}

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

.panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.03);
}

.panel-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.panel-header.split {
  justify-content: space-between;
  gap: 16px;
}

.panel-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.admin-account-list {
  display: grid;
}

.admin-account {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.admin-account:last-child {
  border-bottom: 0;
}

.admin-account > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.admin-account strong,
.admin-account span,
.admin-account small {
  display: block;
}

.admin-account strong {
  font-size: 13px;
}

.admin-account > div span,
.admin-account small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.activity-list {
  display: grid;
}

.activity-item {
  display: flex;
  gap: 11px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child {
  border-bottom: 0;
}

.activity-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 4px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 4px #eff6ff;
}

.activity-item strong,
.activity-item small {
  display: block;
}

.activity-item strong {
  font-size: 11px;
  line-height: 1.4;
}

.activity-item small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

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

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

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

.stack-form {
  display: grid;
  gap: 15px;
}

.panel-form {
  padding: 18px;
}

.field {
  min-width: 0;
  display: grid;
  gap: 6px;
}

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

.span-two {
  grid-column: span 2;
}

.divider,
.form-actions {
  grid-column: 1 / -1;
}

.divider {
  height: 1px;
  margin: 1px 0;
  background: var(--line);
}

label {
  color: #344054;
  font-size: 11px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  padding: 0 11px;
  outline: none;
  color: var(--ink);
  background: white;
  font-size: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea {
  padding: 10px 11px;
  resize: vertical;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #7aa2f7;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:disabled {
  color: #344054;
  background: #f2f4f7;
  cursor: not-allowed;
}

.field-help {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.4;
}

.check-card {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 10px;
  align-self: end;
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  padding: 9px 11px;
  background: #f8fbff;
  cursor: pointer;
}

.check-card input {
  width: 16px;
  min-height: 16px;
  height: 16px;
  flex: 0 0 auto;
  accent-color: var(--primary);
}

.check-card strong,
.check-card small {
  display: block;
}

.check-card strong {
  font-size: 11px;
}

.check-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

.form-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.button {
  min-height: 39px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: #344054;
  background: white;
  font-size: 11px;
  font-weight: 850;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.primary {
  color: white;
  background: var(--primary);
}

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

.button.ghost {
  border-color: #d8dee8;
}

.button.ghost:hover:not(:disabled) {
  background: #f8fafc;
}

.button.ghost.dark {
  color: #d0d5dd;
  border-color: rgba(255, 255, 255, 0.13);
  background: rgba(255, 255, 255, 0.045);
}

.button.danger,
.button.danger-outline {
  color: var(--red);
  border-color: #fecaca;
  background: #fff;
}

.button.danger {
  color: white;
  border-color: var(--red);
  background: var(--red);
}

.button.success-outline {
  color: var(--green);
  border-color: #bbf7d0;
}

.button.wide {
  width: 100%;
}

.button.mini {
  min-height: 29px;
  padding: 0 9px;
  border-radius: 6px;
  font-size: 9px;
}

.small-button {
  min-height: 31px;
}

.inline-filters {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-filters .search {
  width: 240px;
}

.inline-filters select {
  width: auto;
}

.table-wrap {
  overflow-x: auto;
}

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

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

th {
  color: #667085;
  background: #f8fafc;
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:hover {
  background: #fbfcfe;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-title {
  font-size: 11px;
  font-weight: 800;
}

.table-subtitle {
  max-width: 290px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-actions {
  display: flex;
  gap: 5px;
  white-space: nowrap;
}

.table-link {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.lead-update-fields {
  min-width: 230px;
  display: grid;
  gap: 7px;
}

.lead-update-fields textarea {
  min-height: 58px;
  font-size: 11px;
}

.role-pill,
.status-pill,
.action-pill,
.payment-kind {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  border-radius: 999px;
  padding: 0 8px;
  color: #3730a3;
  background: #eef2ff;
  font-size: 9px;
  font-weight: 850;
  white-space: nowrap;
}

.status-pill.active,
.payment-kind.paid {
  color: #166534;
  background: #dcfce7;
}

.status-pill.blocked {
  color: #991b1b;
  background: #fee2e2;
}

.status-pill.scheduled,
.payment-kind.free {
  color: #92400e;
  background: #fef3c7;
}

.status-pill.past {
  color: #475467;
  background: #f2f4f7;
}

.action-pill {
  color: #1d4ed8;
  background: #eff6ff;
}

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

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

.mono {
  color: #475467;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 9px;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.settings-columns {
  align-items: start;
}

.current-price-block {
  margin: 18px 18px 0;
  padding: 17px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff6ff, #f5f3ff);
}

.current-price-block span,
.current-price-block strong,
.current-price-block small {
  display: block;
}

.current-price-block span {
  color: #475467;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.current-price-block strong {
  margin-top: 7px;
  color: #1d4ed8;
  font-size: 25px;
}

.current-price-block small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.price-history {
  display: grid;
  max-height: 500px;
  overflow-y: auto;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.price-row:last-child {
  border-bottom: 0;
}

.price-row strong,
.price-row span,
.price-row small {
  display: block;
}

.price-row strong {
  font-size: 12px;
}

.price-row > div:first-child span,
.price-row > div:first-child small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.price-meta {
  text-align: right;
}

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

.price-meta small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 8px;
}

.dialog {
  width: min(720px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: white;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
}

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

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.dialog-body {
  padding: 20px;
}

.dialog-actions {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafc;
}

.icon-button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 8px;
  color: #667085;
  background: #f2f4f7;
  font-size: 20px;
}

.confirm-dialog {
  width: min(500px, calc(100vw - 30px));
}

.confirm-message {
  padding: 22px;
  color: #475467;
  font-size: 13px;
  line-height: 1.65;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(430px, calc(100vw - 40px));
  border-radius: 8px;
  padding: 13px 15px;
  color: white;
  background: #172033;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.45;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
}

.toast.success {
  background: var(--green);
}

.toast.error {
  background: var(--red);
}

.toast.neutral {
  background: #344054;
}

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

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

@media (max-width: 900px) {
  .app-layout {
    display: block;
  }

  .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

  .sidebar-brand {
    display: none;
  }

  .sidebar-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
  }

  .sidebar-footer .button {
    width: auto;
    margin-left: auto;
  }

  .nav-list {
    display: flex;
    margin: 0;
    overflow-x: auto;
  }

  .nav-item {
    width: auto;
    flex: 0 0 auto;
  }

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

  .status-card {
    min-width: 0;
  }

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

@media (max-width: 680px) {
  .content,
  .topbar {
    padding: 18px 14px;
  }

  .login-card {
    padding: 26px;
  }

  .metric-grid,
  .form-grid,
  .form-grid.three,
  .form-grid.two,
  .field-row {
    grid-template-columns: 1fr;
  }

  .span-two {
    grid-column: auto;
  }

  .panel-header.split,
  .inline-filters,
  .section-heading,
  .dashboard-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .period-control {
    overflow-x: auto;
  }

  .dashboard-summary small {
    text-align: left;
  }

  .inline-filters .search,
  .inline-filters select {
    width: 100%;
  }

  .table-actions {
    flex-direction: column;
  }
}
