/* ============================================================================
   TaskFlow — screen-level layout (§9). Depends on glass.css tokens.
   ============================================================================ */

#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
}

/* App header (avatar, balance pill, notifications) */
.app-header {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: calc(var(--sat) + var(--sp-3)) var(--sp-4) var(--sp-3);
}
.app-header .avatar {
  width: 40px; height: 40px; border-radius: var(--r-full);
  background: var(--accent-grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; color: #fff; flex: none;
  overflow: hidden;
}
.app-header .avatar img { width: 100%; height: 100%; object-fit: cover; }

.balance-pill { cursor: pointer; }
.notif-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: var(--r-full);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex: none; cursor: pointer;
}
.notif-btn .badge {
  position: absolute; top: 4px; right: 4px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--r-full); background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}

/* Scrollable screen area (leaves room for tabbar) */
.screen {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 0 var(--sp-4) calc(var(--sab) + 96px);
}
.screen.no-tabbar { padding-bottom: calc(var(--sab) + var(--sp-5)); }

.section-title { font-size: 20px; font-weight: 600; margin: var(--sp-4) 0 var(--sp-3); }

/* ---- §9.2 Tasks feed ---- */
.chips-scroll {
  display: flex; gap: var(--sp-2); overflow-x: auto;
  padding: 4px 0 var(--sp-3); scrollbar-width: none;
}
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex: none; cursor: pointer; color: var(--text-2);
  border: 1px solid var(--glass-stroke);
  transition: color var(--t-fast), background var(--t-fast), border-color var(--t-fast);
}
.chip.active { color: #fff; background: var(--glass-fill-hi); border-color: var(--glass-stroke-hi); }

.search-row { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.filter-btn {
  width: 48px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md); cursor: pointer; font-size: 18px;
}

.task-card { margin-bottom: var(--sp-3); cursor: pointer; }
.task-card .cat-ic {
  width: 46px; height: 46px; border-radius: var(--r-md); flex: none;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.task-card .title { font-size: 15px; font-weight: 600; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.task-card .price { font-size: 22px; font-weight: 700; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
}
.badge.hold { background: rgba(255,184,77,0.14); color: var(--warning); }
.badge.instant { background: rgba(52,231,197,0.14); color: var(--success); }
.badge.info { background: rgba(87,183,255,0.14); color: var(--info); }
.badge.neutral { background: var(--glass-fill-hi); color: var(--text-2); }
.stars { color: var(--warning); font-size: 12px; }

.empty-state {
  text-align: center; padding: var(--sp-6) var(--sp-4);
  color: var(--text-2);
}
.empty-state .emoji { font-size: 44px; margin-bottom: var(--sp-3); }

/* skeleton card layout */
.sk-card { display: flex; gap: var(--sp-3); padding: var(--sp-4); margin-bottom: var(--sp-3); border-radius: var(--r-lg); }
.sk-line { height: 12px; border-radius: 6px; }

/* ---- §9.3 Task detail sheet ---- */
.offer-hero {
  position: relative; height: 150px; border-radius: var(--r-lg);
  overflow: hidden; margin-bottom: var(--sp-4);
  display: flex; align-items: flex-end; padding: var(--sp-4);
}
.offer-hero .backdrop {
  position: absolute; inset: -10%; background-size: cover; background-position: center;
  filter: blur(2px) brightness(0.6); transform: scale(1.1);
}
.offer-hero .glass-veil {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(6,7,12,0.85), rgba(6,7,12,0.1));
}
.offer-hero > * { position: relative; z-index: 1; }

.detail-tabs { display: flex; gap: var(--sp-2); margin: var(--sp-4) 0; }
.detail-tabs .tab {
  flex: 1; text-align: center; padding: 9px; cursor: pointer;
  border-radius: var(--r-md); color: var(--text-2); font-size: 13px; font-weight: 600;
  background: var(--glass-fill); transition: color var(--t-fast), background var(--t-fast);
}
.detail-tabs .tab.active { color: #fff; background: var(--glass-fill-hi); }

.step-block { display: flex; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-md); margin-bottom: var(--sp-2); }
.step-num {
  width: 26px; height: 26px; border-radius: var(--r-full); flex: none;
  background: var(--accent-grad); color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.step-block img { max-width: 100%; border-radius: var(--r-sm); margin-top: var(--sp-2); cursor: zoom-in; }

.warn-block {
  border-left: 3px solid var(--danger);
  background: rgba(255,92,122,0.08);
  padding: var(--sp-3); border-radius: var(--r-sm); margin-top: var(--sp-3);
}
.warn-block li { color: var(--text-1); margin: 3px 0; }

.reserve-timer {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--r-full);
  background: rgba(255,184,77,0.12); color: var(--warning);
  font-weight: 600; font-size: 13px;
}

/* Sticky action inside sheet */
.sheet-action {
  padding: var(--sp-3) var(--sp-5) 0; flex: none;
  border-top: 1px solid var(--glass-stroke);
  margin-top: var(--sp-3);
}

/* ---- §9.4 Proof submit ---- */
.upload-zone {
  border: 1.5px dashed var(--glass-stroke-hi);
  border-radius: var(--r-md); padding: var(--sp-5);
  text-align: center; color: var(--text-2); cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.upload-zone:active { background: var(--glass-fill-hi); border-color: var(--accent-1); }
.thumb-grid { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-2); }
.thumb {
  position: relative; width: 76px; height: 76px; border-radius: var(--r-sm);
  overflow: hidden; background: var(--glass-fill);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .rm {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: var(--r-full); background: rgba(0,0,0,0.6); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; cursor: pointer;
}
.thumb .up-progress {
  position: absolute; left: 0; bottom: 0; height: 3px;
  background: var(--success); transition: width var(--t-fast);
}

/* ---- §9.5 Мои ---- */
.my-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: var(--sp-3); scrollbar-width: none; }
.my-tabs::-webkit-scrollbar { display: none; }
.status-badge { padding: 3px 10px; border-radius: var(--r-full); font-size: 11px; font-weight: 600; }
.st-reserved { background: rgba(87,183,255,0.14); color: var(--info); }
.st-pending  { background: rgba(255,184,77,0.14); color: var(--warning); }
.st-approved { background: rgba(52,231,197,0.14); color: var(--success); }
.st-rejected { background: rgba(255,92,122,0.14); color: var(--danger); }
.st-revision { background: rgba(177,92,255,0.14); color: var(--accent-2); }
.reject-reason {
  margin-top: var(--sp-2); padding: var(--sp-3); border-radius: var(--r-sm);
  background: rgba(255,92,122,0.06); border-left: 3px solid var(--danger);
  overflow: hidden; max-height: 0; padding-top: 0; padding-bottom: 0;
  transition: max-height var(--t-base) var(--ease-out), padding var(--t-base) var(--ease-out);
}
.reject-reason.open { max-height: 200px; padding-top: var(--sp-3); padding-bottom: var(--sp-3); }

/* ---- §9.6 Wallet ---- */
.balance-hero { padding: var(--sp-5); border-radius: var(--r-lg); margin-bottom: var(--sp-4); }
.balance-hero .main { font-size: 40px; font-weight: 700; letter-spacing: -0.03em; }
.balance-sub { display: flex; gap: var(--sp-4); margin-top: var(--sp-4); }
.balance-sub .item { flex: 1; }
.balance-sub .lbl { font-size: 12px; color: var(--text-3); }
.balance-sub .val { font-size: 17px; font-weight: 600; }

.chart-wrap { padding: var(--sp-4); border-radius: var(--r-lg); margin-bottom: var(--sp-4); }
.chart-wrap svg { width: 100%; height: 120px; display: block; }

.tx-group-date { font-size: 12px; color: var(--text-3); margin: var(--sp-4) 0 var(--sp-2); text-transform: uppercase; letter-spacing: 0.04em; }
.tx-row { display: flex; align-items: center; gap: var(--sp-3); padding: 10px var(--sp-3); border-radius: var(--r-md); }
.tx-ic { width: 38px; height: 38px; border-radius: var(--r-full); flex: none; display: flex; align-items: center; justify-content: center; font-size: 16px; background: var(--glass-fill-hi); }
.tx-amt { font-weight: 600; font-variant-numeric: tabular-nums; }

.method-card { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); margin-bottom: var(--sp-2); cursor: pointer; border: 1px solid transparent; }
.method-card.selected { border-color: var(--accent-1); background: var(--glass-fill-hi); }
.calc-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.calc-row.total { font-weight: 700; font-size: 17px; border-top: 1px solid var(--glass-stroke); margin-top: 6px; padding-top: 10px; }

/* ---- §9.7 Profile ---- */
.profile-head { display: flex; flex-direction: column; align-items: center; text-align: center; padding: var(--sp-5) 0; gap: var(--sp-2); }
.profile-head .avatar-lg { width: 84px; height: 84px; border-radius: var(--r-full); background: var(--accent-grad); display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; overflow: hidden; }
.profile-head .avatar-lg img { width: 100%; height: 100%; object-fit: cover; }

.trust-ring-wrap { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4); border-radius: var(--r-lg); margin-bottom: var(--sp-4); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.stat-cell { padding: var(--sp-4) var(--sp-2); border-radius: var(--r-md); text-align: center; }
.stat-cell .v { font-size: 20px; font-weight: 700; }
.stat-cell .k { font-size: 11px; color: var(--text-3); }

.ref-box { padding: var(--sp-4); border-radius: var(--r-lg); margin-bottom: var(--sp-4); }
.ref-code {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px var(--sp-4); border-radius: var(--r-md);
  background: var(--glass-fill-hi); margin: var(--sp-3) 0; font-family: monospace; font-size: 15px;
}
.list-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 14px var(--sp-4); border-radius: var(--r-md); margin-bottom: 6px; cursor: pointer;
}
.list-row .ic { font-size: 18px; width: 22px; text-align: center; }
.list-row .chev { margin-left: auto; color: var(--text-3); }

.switch { position: relative; width: 44px; height: 26px; border-radius: var(--r-full); background: var(--glass-fill-hi); cursor: pointer; transition: background var(--t-fast); flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--t-fast) var(--ease-spring); }
.switch.on { background: var(--accent-1); }
.switch.on::after { transform: translateX(18px); }

/* ---- §9.8 Advertiser ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-4); }
.kpi-cell { padding: var(--sp-4); border-radius: var(--r-md); }
.kpi-cell .v { font-size: 24px; font-weight: 700; }
.kpi-cell .k { font-size: 12px; color: var(--text-3); }

/* Tinder-style proof review */
.review-stage { position: relative; height: calc(100vh - 320px); min-height: 340px; margin: var(--sp-3) 0; }
.review-card {
  position: absolute; inset: 0;
  border-radius: var(--r-lg); padding: var(--sp-4);
  display: flex; flex-direction: column; gap: var(--sp-3);
  will-change: transform;
  touch-action: pan-y;
}
.review-card .proof-img { width: 100%; height: 190px; object-fit: cover; border-radius: var(--r-md); background: var(--glass-fill); }
.review-decision {
  position: absolute; top: 18px; padding: 6px 14px; border-radius: var(--r-md);
  font-weight: 800; font-size: 22px; letter-spacing: 0.05em;
  border: 3px solid; opacity: 0; transform: rotate(-8deg);
}
.review-decision.approve { left: 18px; color: var(--success); border-color: var(--success); }
.review-decision.reject  { right: 18px; color: var(--danger); border-color: var(--danger); transform: rotate(8deg); }
.review-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-3); }
.review-big-btn { flex: 1; height: 56px; font-size: 24px; }

/* 5-step wizard stepper */
.stepper { display: flex; gap: 6px; margin: var(--sp-3) 0 var(--sp-4); }
.stepper .dot { flex: 1; height: 5px; border-radius: var(--r-full); background: var(--glass-fill-hi); transition: background var(--t-base); }
.stepper .dot.done { background: var(--accent-grad); }
.stepper .dot.active { background: var(--accent-1); box-shadow: var(--glow-accent); }

.radio-list .radio-item { display: flex; align-items: center; gap: var(--sp-3); padding: 14px var(--sp-4); border-radius: var(--r-md); margin-bottom: 8px; cursor: pointer; border: 1px solid transparent; }
.radio-list .radio-item.selected { border-color: var(--accent-1); background: var(--glass-fill-hi); }
.radio-dot { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--glass-stroke-hi); flex: none; position: relative; }
.radio-item.selected .radio-dot { border-color: var(--accent-1); }
.radio-item.selected .radio-dot::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent-1); }

.check-item { display: flex; align-items: center; gap: var(--sp-3); padding: 12px var(--sp-3); border-radius: var(--r-md); margin-bottom: 6px; cursor: pointer; }
.checkbox { width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--glass-stroke-hi); flex: none; display: flex; align-items: center; justify-content: center; }
.checkbox.on { background: var(--accent-grad); border-color: transparent; }

/* Onboarding */
.onb { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; padding: calc(var(--sat) + var(--sp-5)) var(--sp-5) calc(var(--sab) + var(--sp-5)); }
.onb-slides { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.onb-slides::-webkit-scrollbar { display: none; }
.onb-slide { flex: none; width: 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: var(--sp-4); padding: var(--sp-5); }
.onb-slide .emoji { font-size: 72px; }
.onb-dots { display: flex; gap: 8px; justify-content: center; margin: var(--sp-4) 0; }
.onb-dots .d { width: 8px; height: 8px; border-radius: 50%; background: var(--glass-stroke-hi); transition: width var(--t-base), background var(--t-base); }
.onb-dots .d.active { width: 22px; background: var(--accent-1); }

/* Pull-to-refresh drop */
.ptr-drop { position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none; }

/* Loading spinner used in buttons/full-screen */
.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.2); border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
.full-loader { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 80; }
