:root {
  --ink: #182230;
  --muted: #667085;
  --line: #d9e2ef;
  --primary: #1f5eff;
  --primary-strong: #1747bd;
  --success: #087443;
  --warning: #b54708;
  --danger: #b42318;
  --surface: #ffffff;
  --soft: #f6f8fb;
  --wash: #eef4ff;
  --shadow: 0 14px 34px rgba(24, 34, 48, .10);
}

html {
  background: var(--soft);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(31, 94, 255, .10), transparent 26rem),
    linear-gradient(180deg, #ffffff 0%, var(--soft) 48%, #eef2f7 100%);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", Arial, sans-serif;
}

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

.app-shell {
  min-height: 100vh;
  padding-bottom: 84px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(19, 31, 49, .96);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  backdrop-filter: blur(14px);
}

.brand {
  display: block;
  font-size: 21px;
  line-height: 1.1;
  letter-spacing: 0;
}

.user-badge {
  display: block;
  min-height: 16px;
  color: #c8d7ea;
  font-size: 12px;
}

.screen {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.auth-panel {
  min-height: calc(100vh - 104px);
  display: grid;
  place-items: center;
}

.auth-card,
.task-card,
.panel-card,
.settings-list {
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(430px, 100%);
  padding: 20px;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  margin-bottom: 16px;
  background: #e8eff8;
  border-radius: 8px;
}

.segmented button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 9px 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.segmented button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: 0 1px 4px rgba(24, 34, 48, .13);
}

.form-control {
  min-height: 46px;
  margin-bottom: 12px;
  border-color: #c7d3e2;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(11, 99, 206, .14);
}

.hint {
  margin: -4px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.balance-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 17px;
  color: #fff;
  background: linear-gradient(135deg, #1f5eff, #087443);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(31, 94, 255, .18);
}

.balance-strip span {
  display: block;
  font-size: 13px;
  opacity: .9;
}

.balance-strip strong {
  display: block;
  font-size: 34px;
  line-height: 1.05;
}

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

.task-card,
.panel-card {
  padding: 16px;
}

.task-card {
  display: flex;
  min-height: 190px;
  flex-direction: column;
}

.task-card h3,
.panel-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.25;
}

.task-card p,
.panel-card p {
  color: var(--muted);
}

.eyebrow {
  margin-bottom: 4px;
  color: #98a2b3;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 800;
}

.status-completed {
  background: #ecfdf3;
  color: var(--success);
}

.status-canceled {
  background: #f2f4f7;
  color: #667085;
}

.referral-level-select {
  width: min(180px, 100%);
}

.referral-search {
  display: flex;
  gap: 10px;
}

.referral-search .form-control {
  margin: 0;
}

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

.commission-guide span {
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-card .d-flex {
  margin-top: auto;
}

.task-record-muted {
  background: #f5f6f8;
  border-color: #e5e7eb;
  box-shadow: none;
  opacity: .86;
}

.task-record-muted h3,
.task-record-muted p,
.task-record-muted small,
.task-record-muted .small {
  color: #667085;
}

.amount {
  color: var(--success);
  font-weight: 800;
}

.settings-list {
  overflow: hidden;
}

.settings-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 58px;
  padding: 0 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  font-weight: 700;
}

.settings-list button:last-child {
  border-bottom: 0;
}

.settings-list i {
  font-style: normal;
  color: #98a2b3;
  font-size: 24px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.bottom-nav button.active {
  background: var(--wash);
  color: var(--primary);
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

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

.table {
  --bs-table-bg: transparent;
  font-size: 14px;
}

.modal-content {
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.toast-message {
  position: fixed;
  left: 50%;
  bottom: 94px;
  z-index: 99999;
  max-width: min(460px, calc(100% - 32px));
  transform: translateX(-50%) translateY(16px);
  padding: 11px 15px;
  border-radius: 8px;
  background: #101828;
  color: #fff;
  box-shadow: 0 12px 30px rgba(16, 24, 40, .25);
  opacity: 0;
  pointer-events: none;
  transition: .18s ease;
}

.toast-message.show {
  opacity: 1;
  transform: translateX(-50%);
}

@media (max-width: 420px) {
  .screen {
    padding: 12px;
  }

  .balance-strip {
    align-items: flex-start;
    flex-direction: column;
  }

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

@media (min-width: 760px) {
  .bottom-nav {
    left: 50%;
    width: min(720px, calc(100% - 32px));
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 8px 8px 0 0;
  }
}
